summaryrefslogtreecommitdiffstats
path: root/src/core/render_widget_host_view_qt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/render_widget_host_view_qt.cpp')
-rw-r--r--src/core/render_widget_host_view_qt.cpp281
1 files changed, 144 insertions, 137 deletions
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index 9d5744cbf..888043fda 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -1,46 +1,8 @@
-
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWebEngine module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "render_widget_host_view_qt.h"
-#include "browser_accessibility_manager_qt.h"
#include "qtwebenginecoreglobal_p.h"
#include "render_widget_host_view_qt_delegate.h"
#include "render_widget_host_view_qt_delegate_client.h"
@@ -50,13 +12,12 @@
#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"
#include "components/viz/host/host_frame_sink_manager.h"
#include "content/browser/compositor/image_transport_factory.h"
-#include "content/browser/renderer_host/display_util.h"
+#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/browser/renderer_host/frame_tree.h"
#include "content/browser/renderer_host/frame_tree_node.h"
#include "content/browser/renderer_host/cursor_manager.h"
@@ -68,9 +29,11 @@
#include "content/browser/renderer_host/ui_events_helper.h"
#include "content/common/content_switches_internal.h"
#include "content/common/cursors/webcursor.h"
+#include "content/public/browser/web_contents.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/display/display_util.h"
#include "ui/events/blink/blink_event_util.h"
#include "ui/events/event.h"
#include "ui/events/gesture_detection/gesture_configuration.h"
@@ -83,12 +46,12 @@
#endif
#if defined(USE_AURA)
+#include "ui/wm/core/cursor_util.h"
#include "ui/base/cursor/cursor_size.h"
-#include "ui/base/cursor/cursors_aura.h"
#endif
#if defined(Q_OS_MACOS)
-#include "content/app/resources/grit/content_resources.h"
+#include "ui/resources/grit/ui_resources.h"
#endif
#include <QGuiApplication>
@@ -129,16 +92,27 @@ static inline ui::GestureProvider::Config QtGestureProviderConfig() {
extern display::Display toDisplayDisplay(int id, const QScreen *screen);
-static blink::ScreenInfo screenInfoFromQScreen(QScreen *screen)
+static display::ScreenInfos screenInfosFromQtForUpdate(QScreen *currentScreen)
{
- blink::ScreenInfo r;
- if (!screen)
- screen = qApp->primaryScreen();
- if (screen)
- content::DisplayUtil::DisplayToScreenInfo(&r, toDisplayDisplay(0, screen));
- else
- r.device_scale_factor = qGuiApp->devicePixelRatio();
- return r;
+ display::ScreenInfo screenInfo;
+ const auto &screens = qApp->screens();
+ if (screens.isEmpty()) {
+ screenInfo.device_scale_factor = qGuiApp->devicePixelRatio();
+ return display::ScreenInfos(screenInfo);
+ }
+
+ Q_ASSERT(qApp->primaryScreen() == screens.first());
+ display::ScreenInfos result;
+ for (int i = 0; i < screens.length(); ++i) {
+ display::DisplayUtil::DisplayToScreenInfo(&screenInfo, toDisplayDisplay(i, screens.at(i)));
+ result.screen_infos.push_back(screenInfo);
+ if (currentScreen == screens.at(i))
+ result.current_display_id = i;
+ }
+
+ Q_ASSERT(result.current_display_id != display::kInvalidDisplayId);
+
+ return result;
}
// An minimal override to support progressing flings
@@ -168,33 +142,10 @@ public:
}
};
-class GuestInputEventObserverQt : public content::RenderWidgetHost::InputEventObserver
-{
-public:
- GuestInputEventObserverQt(RenderWidgetHostViewQt *rwhv)
- : m_rwhv(rwhv)
- {
- }
- ~GuestInputEventObserverQt() {}
-
- void OnInputEvent(const blink::WebInputEvent&) override {}
- void OnInputEventAck(blink::mojom::InputEventResultSource,
- blink::mojom::InputEventResultState state,
- const blink::WebInputEvent &event) override
- {
- if (event.GetType() == blink::WebInputEvent::Type::kMouseWheel)
- m_rwhv->WheelEventAck(static_cast<const blink::WebMouseWheelEvent &>(event), state);
- }
-
-private:
- RenderWidgetHostViewQt *m_rwhv;
-};
-
RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost *widget)
: content::RenderWidgetHostViewBase::RenderWidgetHostViewBase(widget)
- , m_taskRunner(base::ThreadTaskRunnerHandle::Get())
+ , m_taskRunner(base::SingleThreadTaskRunner::GetCurrentDefault())
, m_gestureProvider(QtGestureProviderConfig(), this)
- , m_guestInputEventObserver(new GuestInputEventObserverQt(this))
, m_frameSinkId(host()->GetFrameSinkId())
, m_delegateClient(new RenderWidgetHostViewQtDelegateClient(this))
{
@@ -226,11 +177,7 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost *widget
m_cursorManager.reset(new content::CursorManager(this));
m_touchSelectionControllerClient.reset(new TouchSelectionControllerClientQt(this));
- ui::TouchSelectionController::Config config;
- config.max_tap_duration = base::TimeDelta::FromMilliseconds(ui::GestureConfiguration::GetInstance()->long_press_time_in_ms());
- config.tap_slop = ui::GestureConfiguration::GetInstance()->max_touch_move_in_pixels_for_click();
- config.enable_longpress_drag_selection = false;
- m_touchSelectionController.reset(new ui::TouchSelectionController(m_touchSelectionControllerClient.get(), config));
+ resetTouchSelectionController();
host()->render_frame_metadata_provider()->AddObserver(this);
host()->render_frame_metadata_provider()->ReportAllFrameSubmissionsForTesting(true);
@@ -247,6 +194,9 @@ RenderWidgetHostViewQt::~RenderWidgetHostViewQt()
if (text_input_manager_)
text_input_manager_->RemoveObserver(this);
+ if (host()->delegate())
+ m_touchSelectionControllerClient->resetControls();
+
m_touchSelectionController.reset();
m_touchSelectionControllerClient.reset();
@@ -275,17 +225,43 @@ void RenderWidgetHostViewQt::setAdapterClient(WebContentsAdapterClient *adapterC
m_adapterClient = nullptr; });
}
-void RenderWidgetHostViewQt::setGuest(content::RenderWidgetHostImpl *rwh)
+void RenderWidgetHostViewQt::OnInputEventAck(blink::mojom::InputEventResultSource,
+ blink::mojom::InputEventResultState state,
+ const blink::WebInputEvent &event)
{
- rwh->AddInputEventObserver(m_guestInputEventObserver.get());
+ if (event.GetType() == blink::WebInputEvent::Type::kMouseWheel)
+ WheelEventAck(static_cast<const blink::WebMouseWheelEvent &>(event), state);
+}
+
+// static
+// Called when new child/guest renderframes created.
+void RenderWidgetHostViewQt::registerInputEventObserver(content::WebContents *webContents,
+ content::RenderFrameHost *rfh)
+{
+ if (static_cast<content::RenderFrameHostImpl *>(rfh)->is_local_root_subframe()) {
+ content::WebContents *parent = webContents->GetOutermostWebContents();
+ QtWebEngineCore::RenderWidgetHostViewQt *mainRwhv =
+ static_cast<QtWebEngineCore::RenderWidgetHostViewQt *>(
+ parent->GetRenderWidgetHostView());
+ // Child (originAgentCluster) or guest (pdf) frame that is embedded into the main frame
+ content::RenderWidgetHost *childFrame = rfh->GetRenderWidgetHost();
+ childFrame->AddInputEventObserver(mainRwhv);
+
+ if (webContents->IsInnerWebContentsForGuest()) {
+ // The frame which holds the actual PDF content inside the guest
+ content::RenderWidgetHost *guestFrame = webContents->GetRenderViewHost()->GetWidget();
+ guestFrame->AddInputEventObserver(mainRwhv);
+ }
+ }
}
void RenderWidgetHostViewQt::InitAsChild(gfx::NativeView)
{
}
-void RenderWidgetHostViewQt::InitAsPopup(content::RenderWidgetHostView*, const gfx::Rect& rect)
+void RenderWidgetHostViewQt::InitAsPopup(content::RenderWidgetHostView*, const gfx::Rect& rect, const gfx::Rect& anchorRect)
{
+ Q_UNUSED(anchorRect);
m_delegate->initAsPopup(toQt(rect));
}
@@ -315,11 +291,6 @@ gfx::NativeView RenderWidgetHostViewQt::GetNativeView()
return gfx::NativeView();
}
-gfx::NativeViewAccessible RenderWidgetHostViewQt::GetNativeViewAccessible()
-{
- return 0;
-}
-
content::WebContentsAccessibility *RenderWidgetHostViewQt::GetWebContentsAccessibility()
{
if (!m_webContentsAccessibility)
@@ -367,8 +338,9 @@ void RenderWidgetHostViewQt::CopyFromSurface(const gfx::Rect &src_rect,
m_delegatedFrameHost->CopyFromCompositingSurface(src_rect, output_size, std::move(callback));
}
-void RenderWidgetHostViewQt::Show()
+void RenderWidgetHostViewQt::ShowWithVisibility(content::PageVisibilityState page_visibility)
{
+ Q_ASSERT(page_visibility != content::PageVisibilityState::kHidden);
if (m_delegate)
m_delegate->show();
else
@@ -395,6 +367,9 @@ gfx::Rect RenderWidgetHostViewQt::GetViewBounds()
void RenderWidgetHostViewQt::UpdateBackgroundColor()
{
+ if (!m_delegate)
+ return;
+
DCHECK(GetBackgroundColor());
SkColor color = *GetBackgroundColor();
@@ -441,13 +416,13 @@ bool RenderWidgetHostViewQt::updateCursorFromResource(ui::mojom::CursorType type
{
int resourceId;
// GetCursorDataFor only knows hotspots for 1x and 2x cursor images, in physical pixels.
- qreal hotspotDpr = m_screenInfo.device_scale_factor <= 1.0f ? 1.0f : 2.0f;
+ qreal hotspotDpr = GetScreenInfo().device_scale_factor <= 1.0f ? 1.0f : 2.0f;
qreal hotX;
qreal hotY;
#if defined(USE_AURA)
gfx::Point hotspot;
- if (!ui::GetCursorDataFor(ui::CursorSize::kNormal, type, hotspotDpr, &resourceId, &hotspot))
+ if (!wm::GetCursorDataFor(ui::CursorSize::kNormal, type, hotspotDpr, &resourceId, &hotspot))
return false;
hotX = hotspot.x();
hotY = hotspot.y();
@@ -488,7 +463,7 @@ bool RenderWidgetHostViewQt::updateCursorFromResource(ui::mojom::CursorType type
if (!imageSkia)
return false;
- QImage imageQt = toQImage(imageSkia->GetRepresentation(m_screenInfo.device_scale_factor));
+ QImage imageQt = toQImage(imageSkia->GetRepresentation(GetScreenInfo().device_scale_factor));
// Convert hotspot coordinates into device-independent pixels.
hotX /= hotspotDpr;
@@ -505,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:
@@ -597,6 +571,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;
@@ -636,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
@@ -664,22 +645,17 @@ void RenderWidgetHostViewQt::Destroy()
delete this;
}
-void RenderWidgetHostViewQt::SetTooltipText(const base::string16 &tooltip_text)
+void RenderWidgetHostViewQt::UpdateTooltipUnderCursor(const std::u16string &tooltip_text)
{
- DisplayTooltipText(tooltip_text);
+ UpdateTooltip(tooltip_text);
}
-void RenderWidgetHostViewQt::DisplayTooltipText(const base::string16 &tooltip_text)
+void RenderWidgetHostViewQt::UpdateTooltip(const std::u16string &tooltip_text)
{
if (host()->delegate() && m_adapterClient)
m_adapterClient->setToolTip(toQt(tooltip_text));
}
-void RenderWidgetHostViewQt::GetScreenInfo(blink::ScreenInfo *results)
-{
- *results = m_screenInfo;
-}
-
gfx::Rect RenderWidgetHostViewQt::GetBoundsInRootWindow()
{
return toGfx(delegateClient()->windowRectInDips());
@@ -709,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);
}
@@ -748,15 +726,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)
@@ -851,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)
@@ -877,11 +862,17 @@ bool RenderWidgetHostViewQt::isPopup() const
bool RenderWidgetHostViewQt::updateScreenInfo()
{
- blink::ScreenInfo oldScreenInfo = m_screenInfo;
- QScreen *screen = m_delegate->window() ? m_delegate->window()->screen() : nullptr;
- m_screenInfo = screenInfoFromQScreen(screen);
- return (m_screenInfo != oldScreenInfo);
+ QWindow *window = m_delegate->Window();
+ if (!window)
+ return false;
+
+ display::ScreenInfos newScreenInfos = screenInfosFromQtForUpdate(window->screen());
+ if (screen_infos_ == newScreenInfos)
+ return false;
+
+ screen_infos_ = std::move(newScreenInfos);
+ return true;
}
void RenderWidgetHostViewQt::handleWheelEvent(QWheelEvent *event)
@@ -918,7 +909,9 @@ void RenderWidgetHostViewQt::WheelEventAck(const blink::WebMouseWheelEvent &even
}
}
-void RenderWidgetHostViewQt::GestureEventAck(const blink::WebGestureEvent &event, blink::mojom::InputEventResultState ack_result)
+void RenderWidgetHostViewQt::GestureEventAck(const blink::WebGestureEvent &event,
+ blink::mojom::InputEventResultState ack_result,
+ blink::mojom::ScrollResultDataPtr scroll_result_data)
{
// Forward unhandled scroll events back as wheel events
if (event.GetType() != blink::WebInputEvent::Type::kGestureScrollUpdate)
@@ -988,11 +981,9 @@ 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());
}
void RenderWidgetHostViewQt::EnsureSurfaceSynchronizedForWebTest()
@@ -1019,17 +1010,22 @@ void RenderWidgetHostViewQt::OnRenderFrameMetadataChangedAfterActivation(base::T
m_touchSelectionControllerClient->UpdateClientSelectionBounds(m_selectionStart, m_selectionEnd);
}
- gfx::Vector2dF scrollOffset = metadata.root_scroll_offset.value_or(gfx::Vector2dF());
- gfx::SizeF contentsSize = metadata.root_layer_size;
+ gfx::PointF scrollOffset = gfx::PointF();
+ if (metadata.root_scroll_offset.has_value())
+ scrollOffset = gfx::ScalePoint(metadata.root_scroll_offset.value(),
+ 1 / metadata.device_scale_factor);
std::swap(m_lastScrollOffset, scrollOffset);
- std::swap(m_lastContentsSize, contentsSize);
if (m_adapterClient && scrollOffset != m_lastScrollOffset)
m_adapterClient->updateScrollPosition(toQt(m_lastScrollOffset));
+
+ gfx::SizeF contentsSize =
+ gfx::ScaleSize(metadata.root_layer_size, 1 / metadata.device_scale_factor);
+ std::swap(m_lastContentsSize, contentsSize);
if (m_adapterClient && contentsSize != m_lastContentsSize)
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);
@@ -1041,7 +1037,7 @@ void RenderWidgetHostViewQt::synchronizeVisualProperties(const base::Optional<vi
m_rootLayer->SetBounds(gfx::Rect(gfx::Point(), viewSizeInPixels));
m_uiCompositorLocalSurfaceIdAllocator.GenerateId();
m_uiCompositor->SetScaleAndSize(
- m_screenInfo.device_scale_factor,
+ GetScreenInfo().device_scale_factor,
viewSizeInPixels,
m_uiCompositorLocalSurfaceIdAllocator.GetCurrentLocalSurfaceId());
m_delegatedFrameHost->EmbedSurface(
@@ -1052,6 +1048,17 @@ void RenderWidgetHostViewQt::synchronizeVisualProperties(const base::Optional<vi
host()->SynchronizeVisualProperties();
}
+void RenderWidgetHostViewQt::resetTouchSelectionController()
+{
+ Q_ASSERT(m_touchSelectionControllerClient);
+ m_touchSelectionControllerClient->resetControls();
+ ui::TouchSelectionController::Config config;
+ config.max_tap_duration = base::Milliseconds(ui::GestureConfiguration::GetInstance()->long_press_time_in_ms());
+ config.tap_slop = ui::GestureConfiguration::GetInstance()->max_touch_move_in_pixels_for_click();
+ config.enable_longpress_drag_selection = false;
+ m_touchSelectionController.reset(new ui::TouchSelectionController(m_touchSelectionControllerClient.get(), config));
+}
+
std::unique_ptr<content::SyntheticGestureTarget> RenderWidgetHostViewQt::CreateSyntheticGestureTarget()
{
return nullptr;
@@ -1062,9 +1069,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 *)