diff options
Diffstat (limited to 'src/core/render_widget_host_view_qt.cpp')
-rw-r--r-- | src/core/render_widget_host_view_qt.cpp | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 3d4e5bbc2..888043fda 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -12,7 +12,6 @@ #include "web_contents_adapter_client.h" #include "web_event_factory.h" -#include "base/threading/thread_task_runner_handle.h" #include "components/viz/common/features.h" #include "components/viz/common/frame_sinks/begin_frame_source.h" #include "components/viz/common/surfaces/frame_sink_id_allocator.h" @@ -47,7 +46,7 @@ #endif #if defined(USE_AURA) -#include "ui/wm/core/cursors_aura.h" +#include "ui/wm/core/cursor_util.h" #include "ui/base/cursor/cursor_size.h" #endif @@ -145,7 +144,7 @@ public: RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost *widget) : content::RenderWidgetHostViewBase::RenderWidgetHostViewBase(widget) - , m_taskRunner(base::ThreadTaskRunnerHandle::Get()) + , m_taskRunner(base::SingleThreadTaskRunner::GetCurrentDefault()) , m_gestureProvider(QtGestureProviderConfig(), this) , m_frameSinkId(host()->GetFrameSinkId()) , m_delegateClient(new RenderWidgetHostViewQtDelegateClient(this)) @@ -368,6 +367,9 @@ gfx::Rect RenderWidgetHostViewQt::GetViewBounds() void RenderWidgetHostViewQt::UpdateBackgroundColor() { + if (!m_delegate) + return; + DCHECK(GetBackgroundColor()); SkColor color = *GetBackgroundColor(); @@ -478,14 +480,13 @@ bool RenderWidgetHostViewQt::updateCursorFromResource(ui::mojom::CursorType type return true; } -void RenderWidgetHostViewQt::UpdateCursor(const content::WebCursor &webCursor) +void RenderWidgetHostViewQt::UpdateCursor(const ui::Cursor &webCursor) { DisplayCursor(webCursor); } -void RenderWidgetHostViewQt::DisplayCursor(const content::WebCursor &webCursor) +void RenderWidgetHostViewQt::DisplayCursor(const ui::Cursor &cursorInfo) { - const ui::Cursor &cursorInfo = webCursor.cursor(); Qt::CursorShape shape = Qt::ArrowCursor; switch (cursorInfo.type()) { case ui::mojom::CursorType::kNull: @@ -614,7 +615,9 @@ void RenderWidgetHostViewQt::ImeCancelComposition() qApp->inputMethod()->reset(); } -void RenderWidgetHostViewQt::ImeCompositionRangeChanged(const gfx::Range&, const std::vector<gfx::Rect>&) +void RenderWidgetHostViewQt::ImeCompositionRangeChanged(const gfx::Range &, + const absl::optional<std::vector<gfx::Rect>> &, + const absl::optional<std::vector<gfx::Rect>> &) { // FIXME: not implemented? QT_NOT_YET_IMPLEMENTED @@ -682,9 +685,11 @@ void RenderWidgetHostViewQt::OnUpdateTextInputStateCalled(content::TextInputMana // In case of text selection, the update is expected in RenderWidgetHostViewQt::selectionChanged(). if (GetSelectedText().empty()) { - // At this point it is unknown whether the text input state has been updated due to a text selection. - // Keep the cursor position updated for cursor movements too. - delegateClient()->setCursorPosition(state->selection.start()); + if (state->composition.has_value()) { + delegateClient()->setCursorPosition(state->composition->start()); + } else { + delegateClient()->setCursorPosition(state->selection.start()); + } m_delegate->inputMethodStateChanged(type != ui::TEXT_INPUT_TYPE_NONE, type == ui::TEXT_INPUT_TYPE_PASSWORD); } @@ -831,11 +836,11 @@ void RenderWidgetHostViewQt::notifyHidden() m_delegatedFrameHost->DetachFromCompositor(); } -void RenderWidgetHostViewQt::ProcessAckedTouchEvent(const content::TouchEventWithLatencyInfo &touch, blink::mojom::InputEventResultState ack_result) { - Q_UNUSED(touch); - const bool eventConsumed = ack_result == blink::mojom::InputEventResultState::kConsumed; - const bool isSetNonBlocking = content::InputEventResultStateIsSetNonBlocking(ack_result); - m_gestureProvider.OnTouchEventAck(touch.event.unique_touch_event_id, eventConsumed, isSetNonBlocking); +void RenderWidgetHostViewQt::ProcessAckedTouchEvent(const content::TouchEventWithLatencyInfo &touch, blink::mojom::InputEventResultState ack_result) +{ + const bool eventConsumed = (ack_result == blink::mojom::InputEventResultState::kConsumed); + const bool isSetBlocking = content::InputEventResultStateIsSetBlocking(ack_result); + m_gestureProvider.OnTouchEventAck(touch.event.unique_touch_event_id, eventConsumed, isSetBlocking); } void RenderWidgetHostViewQt::processMotionEvent(const ui::MotionEvent &motionEvent) @@ -979,7 +984,6 @@ void RenderWidgetHostViewQt::TakeFallbackContentFrom(content::RenderWidgetHostVi CopyBackgroundColorIfPresentFrom(*viewQt); m_delegatedFrameHost->TakeFallbackContentFrom(viewQt->m_delegatedFrameHost.get()); - host()->GetContentRenderingTimeoutFrom(viewQt->host()); } void RenderWidgetHostViewQt::EnsureSurfaceSynchronizedForWebTest() |