summaryrefslogtreecommitdiffstats
path: root/src/core/render_widget_host_view_qt.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-09-04 11:31:59 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-12-02 09:18:42 +0100
commit5dc3a3fb5e3286a9643fece7c7f94cec7fc29f3e (patch)
tree1a7d2baf14aa414321914b7fa9ea70591c1577ea /src/core/render_widget_host_view_qt.cpp
parent4f285f7b2a1316bbad6e74258305613933f574c8 (diff)
Adaptations for Chromium 92
Change-Id: I1849c130ca75615802744275f6e4212a755c39b4 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'src/core/render_widget_host_view_qt.cpp')
-rw-r--r--src/core/render_widget_host_view_qt.cpp43
1 files changed, 27 insertions, 16 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index 4e2ab2ea9..791e9d75e 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -597,6 +597,11 @@ void RenderWidgetHostViewQt::DisplayCursor(const content::WebCursor &webCursor)
if (updateCursorFromResource(cursorInfo.type()))
return;
break;
+ case ui::mojom::CursorType::kEastWestNoResize:
+ case ui::mojom::CursorType::kNorthEastSouthWestNoResize:
+ case ui::mojom::CursorType::kNorthSouthNoResize:
+ case ui::mojom::CursorType::kNorthWestSouthEastNoResize:
+ // Use forbidden cursor matching webcursor_mac.mm and win_cursor_factory.cc
case ui::mojom::CursorType::kNoDrop:
case ui::mojom::CursorType::kNotAllowed:
shape = Qt::ForbiddenCursor;
@@ -664,12 +669,12 @@ void RenderWidgetHostViewQt::Destroy()
delete this;
}
-void RenderWidgetHostViewQt::SetTooltipText(const std::u16string &tooltip_text)
+void RenderWidgetHostViewQt::UpdateTooltipUnderCursor(const std::u16string &tooltip_text)
{
- DisplayTooltipText(tooltip_text);
+ UpdateTooltip(tooltip_text);
}
-void RenderWidgetHostViewQt::DisplayTooltipText(const std::u16string &tooltip_text)
+void RenderWidgetHostViewQt::UpdateTooltip(const std::u16string &tooltip_text)
{
if (host()->delegate() && m_adapterClient)
m_adapterClient->setToolTip(toQt(tooltip_text));
@@ -748,15 +753,22 @@ void RenderWidgetHostViewQt::OnTextSelectionChanged(content::TextInputManager *t
Q_UNUSED(text_input_manager);
Q_UNUSED(updated_view);
- const content::TextInputManager::TextSelection *selection = GetTextInputManager()->GetTextSelection(updated_view);
- if (!selection)
- return;
+ // We obtain the TextSelection from focused RWH which is obtained from the
+ // frame tree.
+ content::RenderWidgetHostViewBase *focused_view =
+ GetFocusedWidget() ? GetFocusedWidget()->GetView() : nullptr;
+
+ if (!focused_view)
+ return;
#if defined(USE_OZONE)
- if (!selection->selected_text().empty() && selection->user_initiated()) {
- // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard.
- ui::ScopedClipboardWriter clipboard_writer(ui::ClipboardBuffer::kSelection);
- clipboard_writer.WriteText(selection->selected_text());
+ if (ui::Clipboard::IsSupportedClipboardBuffer(ui::ClipboardBuffer::kSelection)) {
+ const content::TextInputManager::TextSelection *selection = GetTextInputManager()->GetTextSelection(focused_view);
+ if (selection->selected_text().length() && selection->user_initiated()) {
+ // Set the ClipboardBuffer::kSelection to the ui::Clipboard.
+ ui::ScopedClipboardWriter clipboard_writer(ui::ClipboardBuffer::kSelection);
+ clipboard_writer.WriteText(selection->selected_text());
+ }
}
#endif // defined(USE_OZONE)
@@ -988,9 +1000,8 @@ void RenderWidgetHostViewQt::TakeFallbackContentFrom(content::RenderWidgetHostVi
{
DCHECK(!static_cast<RenderWidgetHostViewBase*>(view)->IsRenderWidgetHostViewChildFrame());
RenderWidgetHostViewQt *viewQt = static_cast<RenderWidgetHostViewQt *>(view);
- base::Optional<SkColor> color = viewQt->GetBackgroundColor();
- if (color)
- SetBackgroundColor(*color);
+ CopyBackgroundColorIfPresentFrom(*viewQt);
+
m_delegatedFrameHost->TakeFallbackContentFrom(viewQt->m_delegatedFrameHost.get());
host()->GetContentRenderingTimeoutFrom(viewQt->host());
}
@@ -1029,7 +1040,7 @@ void RenderWidgetHostViewQt::OnRenderFrameMetadataChangedAfterActivation(base::T
m_adapterClient->updateContentsSize(toQt(m_lastContentsSize));
}
-void RenderWidgetHostViewQt::synchronizeVisualProperties(const base::Optional<viz::LocalSurfaceId> &childSurfaceId)
+void RenderWidgetHostViewQt::synchronizeVisualProperties(const absl::optional<viz::LocalSurfaceId> &childSurfaceId)
{
if (childSurfaceId)
m_dfhLocalSurfaceIdAllocator.UpdateFromChild(*childSurfaceId);
@@ -1062,9 +1073,9 @@ ui::Compositor *RenderWidgetHostViewQt::GetCompositor()
return m_uiCompositor.get();
}
-base::Optional<content::DisplayFeature> RenderWidgetHostViewQt::GetDisplayFeature()
+absl::optional<content::DisplayFeature> RenderWidgetHostViewQt::GetDisplayFeature()
{
- return base::nullopt;
+ return absl::nullopt;
}
void RenderWidgetHostViewQt::SetDisplayFeatureForTesting(const content::DisplayFeature *)