diff options
Diffstat (limited to 'src/core/render_widget_host_view_qt.h')
-rw-r--r-- | src/core/render_widget_host_view_qt.h | 109 |
1 files changed, 45 insertions, 64 deletions
diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index 15ef4fa2a..a55e04dd8 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** 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 #ifndef RENDER_WIDGET_HOST_VIEW_QT_H #define RENDER_WIDGET_HOST_VIEW_QT_H @@ -48,18 +12,16 @@ #include "components/viz/common/resources/transferable_resource.h" #include "components/viz/common/surfaces/parent_local_surface_id_allocator.h" #include "components/viz/host/host_frame_sink_client.h" -#include "content/browser/accessibility/browser_accessibility_manager.h" #include "content/browser/accessibility/web_contents_accessibility.h" #include "content/browser/renderer_host/input/mouse_wheel_phase_handler.h" #include "content/browser/renderer_host/render_widget_host_view_base.h" #include "content/browser/renderer_host/text_input_manager.h" #include "ui/events/gesture_detection/filtered_gesture_provider.h" -QT_FORWARD_DECLARE_CLASS(QAccessibleInterface) - namespace content { class RenderFrameHost; class RenderWidgetHostImpl; +class WebContents; } namespace ui { @@ -69,7 +31,7 @@ class TouchSelectionController; namespace QtWebEngineCore { class RenderWidgetHostViewQtDelegateClient; -class GuestInputEventObserverQt; +class InputEventObserverQt; class TouchSelectionControllerClientQt; class WebContentsAccessibilityQt; class WebContentsAdapterClient; @@ -80,6 +42,7 @@ class RenderWidgetHostViewQt , public base::SupportsWeakPtr<RenderWidgetHostViewQt> , public content::TextInputManager::Observer , public content::RenderFrameMetadataProvider::Observer + , public content::RenderWidgetHost::InputEventObserver { public: RenderWidgetHostViewQt(content::RenderWidgetHost* widget); @@ -90,14 +53,14 @@ public: WebContentsAdapterClient *adapterClient() { return m_adapterClient; } void setAdapterClient(WebContentsAdapterClient *adapterClient); RenderWidgetHostViewQtDelegateClient *delegateClient() const { return m_delegateClient.get(); } - void setGuest(content::RenderWidgetHostImpl *); + // Overridden from RenderWidgetHostView: void InitAsChild(gfx::NativeView) override; - void InitAsPopup(content::RenderWidgetHostView*, const gfx::Rect&) override; + void InitAsPopup(content::RenderWidgetHostView*, const gfx::Rect&, const gfx::Rect&) override; void SetSize(const gfx::Size& size) override; void SetBounds(const gfx::Rect&) override; gfx::NativeView GetNativeView() override; - gfx::NativeViewAccessible GetNativeViewAccessible() override; + gfx::NativeViewAccessible GetNativeViewAccessible() override { return nullptr; } void Focus() override; bool HasFocus() override; bool IsMouseLocked() override; @@ -106,7 +69,7 @@ public: void CopyFromSurface(const gfx::Rect &src_rect, const gfx::Size &output_size, base::OnceCallback<void(const SkBitmap &)> callback) override; - void Show() override; + void ShowWithVisibility(content::PageVisibilityState page_visibility) override; void Hide() override; bool IsShowing() override; gfx::Rect GetViewBounds() override; @@ -114,29 +77,31 @@ public: blink::mojom::PointerLockResult LockMouse(bool) override; blink::mojom::PointerLockResult ChangeMouseLock(bool) override; void UnlockMouse() override; - void UpdateCursor(const content::WebCursor&) override; - void DisplayCursor(const content::WebCursor&) override; + void UpdateCursor(const ui::Cursor&) override; + void DisplayCursor(const ui::Cursor&) override; content::CursorManager *GetCursorManager() override; void SetIsLoading(bool) override; void ImeCancelComposition() override; - void ImeCompositionRangeChanged(const gfx::Range&, const std::vector<gfx::Rect>&) override; + void ImeCompositionRangeChanged(const gfx::Range &, + const absl::optional<std::vector<gfx::Rect>> &, + const absl::optional<std::vector<gfx::Rect>> &) override; void RenderProcessGone() override; bool TransformPointToCoordSpaceForView(const gfx::PointF &point, content::RenderWidgetHostViewBase *target_view, gfx::PointF *transformed_point) override; void Destroy() override; - void SetTooltipText(const base::string16 &tooltip_text) override; - void DisplayTooltipText(const base::string16& tooltip_text) override; + void UpdateTooltipUnderCursor(const std::u16string &tooltip_text) override; + void UpdateTooltip(const std::u16string& tooltip_text) override; void WheelEventAck(const blink::WebMouseWheelEvent &event, blink::mojom::InputEventResultState ack_result) override; void GestureEventAck(const blink::WebGestureEvent &event, - blink::mojom::InputEventResultState ack_result) override; + blink::mojom::InputEventResultState ack_result, + blink::mojom::ScrollResultDataPtr scroll_result_data) override; content::MouseWheelPhaseHandler *GetMouseWheelPhaseHandler() override; viz::ScopedSurfaceIdAllocator DidUpdateVisualProperties(const cc::RenderFrameMetadata &metadata) override; void OnDidUpdateVisualPropertiesComplete(const cc::RenderFrameMetadata &metadata); // Overridden from RenderWidgetHostViewBase: - void GetScreenInfo(blink::ScreenInfo *results) override; gfx::Rect GetBoundsInRootWindow() override; void ProcessAckedTouchEvent(const content::TouchEventWithLatencyInfo &touch, blink::mojom::InputEventResultState ack_result) override; @@ -153,14 +118,25 @@ public: void DidStopFlinging() override; std::unique_ptr<content::SyntheticGestureTarget> CreateSyntheticGestureTarget() override; ui::Compositor *GetCompositor() override; - base::Optional<content::DisplayFeature> GetDisplayFeature() override; + absl::optional<content::DisplayFeature> GetDisplayFeature() override; void SetDisplayFeatureForTesting(const content::DisplayFeature*) override; -#if defined(OS_MAC) + content::WebContentsAccessibility *GetWebContentsAccessibility() override; +#if BUILDFLAG(IS_MAC) + void ShowSharePicker( + const std::string &title, + const std::string &text, + const std::string &url, + const std::vector<std::string> &file_paths, + blink::mojom::ShareService::ShareCallback callback) override { QT_NOT_YET_IMPLEMENTED } void SetActive(bool active) override { QT_NOT_YET_IMPLEMENTED } void SpeakSelection() override { QT_NOT_YET_IMPLEMENTED } void ShowDefinitionForSelection() override { QT_NOT_YET_IMPLEMENTED } void SetWindowFrameInScreen(const gfx::Rect&) override { QT_NOT_YET_IMPLEMENTED } -#endif // defined(OS_MAC) +#endif // BUILDFLAG(IS_MAC) + void NotifyHostAndDelegateOnWasShown(blink::mojom::RecordContentToVisibleTimeRequestPtr) override { QT_NOT_YET_IMPLEMENTED } + void RequestSuccessfulPresentationTimeFromHostOrDelegate(blink::mojom::RecordContentToVisibleTimeRequestPtr) override {} + void CancelSuccessfulPresentationTimeRequestForHostAndDelegate() override {} + void InvalidateLocalSurfaceIdAndAllocationGroup() override {} // Overridden from ui::GestureProviderClient. void OnGestureEvent(const ui::GestureEventData& gesture) override; @@ -170,15 +146,20 @@ public: void OnSelectionBoundsChanged(content::TextInputManager *text_input_manager, RenderWidgetHostViewBase *updated_view) override; void OnTextSelectionChanged(content::TextInputManager *text_input_manager, RenderWidgetHostViewBase *updated_view) override; - // Overridden from content::BrowserAccessibilityDelegate - content::WebContentsAccessibility *GetWebContentsAccessibility() override; - // Overridden from content::RenderFrameMetadataProvider::Observer void OnRenderFrameMetadataChangedAfterActivation(base::TimeTicks activation_time) override; void OnRenderFrameMetadataChangedBeforeActivation(const cc::RenderFrameMetadata &) override {} void OnRenderFrameSubmission() override {} void OnLocalSurfaceIdChanged(const cc::RenderFrameMetadata &) override {} + // Overridden from content::RenderWidgetHost::InputEventObserver + void OnInputEvent(const blink::WebInputEvent &) override { } + void OnInputEventAck(blink::mojom::InputEventResultSource, + blink::mojom::InputEventResultState state, + const blink::WebInputEvent &event) override; + + static void registerInputEventObserver(content::WebContents *, content::RenderFrameHost *); + // Called from RenderWidgetHostViewQtDelegateClient. Compositor::Id compositorId(); void notifyShown(); @@ -190,7 +171,7 @@ public: // Called from WebContentsAdapter. gfx::SizeF lastContentsSize() const { return m_lastContentsSize; } - gfx::Vector2dF lastScrollOffset() const { return m_lastScrollOffset; } + gfx::PointF lastScrollOffset() const { return m_lastScrollOffset; } ui::TouchSelectionController *getTouchSelectionController() const { return m_touchSelectionController.get(); } TouchSelectionControllerClientQt *getTouchSelectionControllerClient() const { return m_touchSelectionControllerClient.get(); } @@ -198,7 +179,9 @@ public: ui::TextInputType getTextInputType() const; void synchronizeVisualProperties( - const base::Optional<viz::LocalSurfaceId> &childSurfaceId); + const absl::optional<viz::LocalSurfaceId> &childSurfaceId); + + void resetTouchSelectionController(); private: friend class DelegatedFrameHostClientQt; @@ -213,7 +196,6 @@ private: std::unique_ptr<content::CursorManager> m_cursorManager; ui::FilteredGestureProvider m_gestureProvider; - std::unique_ptr<GuestInputEventObserverQt> m_guestInputEventObserver; viz::FrameSinkId m_frameSinkId; std::unique_ptr<RenderWidgetHostViewQtDelegateClient> m_delegateClient; @@ -225,12 +207,11 @@ private: bool m_isMouseLocked = false; bool m_visible = false; bool m_deferredShow = false; - gfx::Vector2dF m_lastScrollOffset; + gfx::PointF m_lastScrollOffset; gfx::SizeF m_lastContentsSize; DelegatedFrameHostClientQt m_delegatedFrameHostClient { this }; // VIZ - blink::ScreenInfo m_screenInfo; std::unique_ptr<content::DelegatedFrameHost> m_delegatedFrameHost; std::unique_ptr<ui::Layer> m_rootLayer; std::unique_ptr<ui::Compositor> m_uiCompositor; |