Commit 4bb0db09 authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Make WebFrameWidgetBase be the PageWidgetEventHandler.

This moves a bunch of methods from WebViewImpl into WebViewFrameWidget.
This now makes the WebFrameWidgetBase is now a PageWidgetEventHandler
so that we can share common code in the base class. In follow up CLs
duplicate code in WebFrameWidgetImpl will be removed.

BUG=1097816

Change-Id: I3bf9610f6eb8ce6b5bd36c5db9b374ff5d100be3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2518127
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatardanakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824066}
parent 5db02076
...@@ -22,8 +22,8 @@ class CORE_EXPORT CurrentInputEvent { ...@@ -22,8 +22,8 @@ class CORE_EXPORT CurrentInputEvent {
static const WebInputEvent* Get() { return current_input_event_; } static const WebInputEvent* Get() { return current_input_event_; }
private: private:
friend class WebViewImpl;
friend class WebFrameWidgetImpl; friend class WebFrameWidgetImpl;
friend class WebViewFrameWidget;
friend class NavigationPolicyTest; friend class NavigationPolicyTest;
static const WebInputEvent* current_input_event_; static const WebInputEvent* current_input_event_;
......
...@@ -88,7 +88,6 @@ class BrowserControls; ...@@ -88,7 +88,6 @@ class BrowserControls;
class DevToolsEmulator; class DevToolsEmulator;
class Frame; class Frame;
class FullscreenController; class FullscreenController;
class HTMLPlugInElement;
class PageScaleConstraintsSet; class PageScaleConstraintsSet;
class WebDevToolsAgentImpl; class WebDevToolsAgentImpl;
class WebLocalFrame; class WebLocalFrame;
...@@ -109,7 +108,6 @@ using PaintHoldingCommitTrigger = cc::PaintHoldingCommitTrigger; ...@@ -109,7 +108,6 @@ using PaintHoldingCommitTrigger = cc::PaintHoldingCommitTrigger;
class CORE_EXPORT WebViewImpl final : public WebView, class CORE_EXPORT WebViewImpl final : public WebView,
public RefCounted<WebViewImpl>, public RefCounted<WebViewImpl>,
public PageWidgetEventHandler,
public mojom::blink::PageBroadcast { public mojom::blink::PageBroadcast {
public: public:
static WebViewImpl* Create( static WebViewImpl* Create(
...@@ -294,10 +292,6 @@ class CORE_EXPORT WebViewImpl final : public WebView, ...@@ -294,10 +292,6 @@ class CORE_EXPORT WebViewImpl final : public WebView,
// outside this class. // outside this class.
WebLocalFrameImpl* MainFrameImpl() const; WebLocalFrameImpl* MainFrameImpl() const;
// Event related methods:
void MouseContextMenu(const WebMouseEvent&);
void MouseDoubleClick(const WebMouseEvent&);
// Changes the zoom and scroll for zooming into an editable element // Changes the zoom and scroll for zooming into an editable element
// with bounds |element_bounds_in_document| and caret bounds // with bounds |element_bounds_in_document| and caret bounds
// |caret_bounds_in_document|. // |caret_bounds_in_document|.
...@@ -535,7 +529,6 @@ class CORE_EXPORT WebViewImpl final : public WebView, ...@@ -535,7 +529,6 @@ class CORE_EXPORT WebViewImpl final : public WebView,
void UpdateLifecycle(WebLifecycleUpdate requested_update, void UpdateLifecycle(WebLifecycleUpdate requested_update,
DocumentUpdateReason reason); DocumentUpdateReason reason);
void ThemeChanged(); void ThemeChanged();
WebInputEventResult HandleInputEvent(const WebCoalescedInputEvent&);
WebInputEventResult DispatchBufferedTouchEvents(); WebInputEventResult DispatchBufferedTouchEvents();
void ApplyViewportChanges(const ApplyViewportChangesArgs& args); void ApplyViewportChanges(const ApplyViewportChangesArgs& args);
void RecordManipulationTypeCounts(cc::ManipulationInfo info); void RecordManipulationTypeCounts(cc::ManipulationInfo info);
...@@ -604,18 +597,6 @@ class CORE_EXPORT WebViewImpl final : public WebView, ...@@ -604,18 +597,6 @@ class CORE_EXPORT WebViewImpl final : public WebView,
int target_margin, int target_margin,
int minimum_margin); int minimum_margin);
// PageWidgetEventHandler functions
void HandleMouseLeave(LocalFrame&, const WebMouseEvent&) override;
void HandleMouseDown(LocalFrame&, const WebMouseEvent&) override;
WebInputEventResult HandleMouseUp(LocalFrame&, const WebMouseEvent&) override;
WebInputEventResult HandleMouseWheel(LocalFrame&,
const WebMouseWheelEvent&) override;
WebInputEventResult HandleGestureEvent(const WebGestureEvent&) override;
WebInputEventResult HandleKeyEvent(const WebKeyboardEvent&) override;
WebInputEventResult HandleCharEvent(const WebKeyboardEvent&) override;
WebInputEventResult HandleCapturedMouseEvent(const WebCoalescedInputEvent&);
void EnablePopupMouseWheelEventListener(WebLocalFrameImpl* local_root); void EnablePopupMouseWheelEventListener(WebLocalFrameImpl* local_root);
void DisablePopupMouseWheelEventListener(); void DisablePopupMouseWheelEventListener();
...@@ -739,12 +720,6 @@ class CORE_EXPORT WebViewImpl final : public WebView, ...@@ -739,12 +720,6 @@ class CORE_EXPORT WebViewImpl final : public WebView,
float compositor_device_scale_factor_override_ = 0.f; float compositor_device_scale_factor_override_ = 0.f;
TransformationMatrix device_emulation_transform_; TransformationMatrix device_emulation_transform_;
// Webkit expects keyPress events to be suppressed if the associated keyDown
// event was handled. Safari implements this behavior by peeking out the
// associated WM_CHAR event if the keydown was handled. We emulate
// this behavior by setting this flag if the keyDown was handled.
bool suppress_next_keypress_event_ = false;
// TODO(ekaramad): Can we remove this and make sure IME events are not called // TODO(ekaramad): Can we remove this and make sure IME events are not called
// when there is no page focus? // when there is no page focus?
// Represents whether or not this object should process incoming IME events. // Represents whether or not this object should process incoming IME events.
...@@ -757,19 +732,11 @@ class CORE_EXPORT WebViewImpl final : public WebView, ...@@ -757,19 +732,11 @@ class CORE_EXPORT WebViewImpl final : public WebView,
// closed. // closed.
scoped_refptr<WebPagePopupImpl> page_popup_; scoped_refptr<WebPagePopupImpl> page_popup_;
// This stores the last hidden page popup. If a GestureTap attempts to open
// the popup that is closed by its previous GestureTapDown, the popup remains
// closed.
scoped_refptr<WebPagePopupImpl> last_hidden_page_popup_;
Persistent<DevToolsEmulator> dev_tools_emulator_; Persistent<DevToolsEmulator> dev_tools_emulator_;
// Whether the user can press tab to focus links. // Whether the user can press tab to focus links.
bool tabs_to_links_ = false; bool tabs_to_links_ = false;
// If set, the (plugin) element which has mouse capture.
Persistent<HTMLPlugInElement> mouse_capture_element_;
// WebViews, and WebWidgets, are used to host a Page. The WidgetClient() // WebViews, and WebWidgets, are used to host a Page. The WidgetClient()
// provides compositing support for the WebView. // provides compositing support for the WebView.
// In some cases, a WidgetClient() is not provided, or it informs us that // In some cases, a WidgetClient() is not provided, or it informs us that
...@@ -799,11 +766,6 @@ class CORE_EXPORT WebViewImpl final : public WebView, ...@@ -799,11 +766,6 @@ class CORE_EXPORT WebViewImpl final : public WebView,
bool should_dispatch_first_layout_after_finished_parsing_ = false; bool should_dispatch_first_layout_after_finished_parsing_ = false;
bool should_dispatch_first_layout_after_finished_loading_ = false; bool should_dispatch_first_layout_after_finished_loading_ = false;
// TODO(bokan): Temporary debugging added to diagnose
// https://crbug.com/992315. Somehow we're synchronously calling
// WebViewImpl::Close while handling an input event.
bool debug_inside_input_handling_ = false;
FloatSize elastic_overscroll_; FloatSize elastic_overscroll_;
// If true, we send IPC messages when |preferred_size_| changes. // If true, we send IPC messages when |preferred_size_| changes.
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "third_party/blink/public/web/web_meaningful_layout.h" #include "third_party/blink/public/web/web_meaningful_layout.h"
#include "third_party/blink/renderer/core/clipboard/data_object.h" #include "third_party/blink/renderer/core/clipboard/data_object.h"
#include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/page/page_widget_delegate.h"
#include "third_party/blink/renderer/platform/graphics/apply_viewport_changes.h" #include "third_party/blink/renderer/platform/graphics/apply_viewport_changes.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_image.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_image.h"
#include "third_party/blink/renderer/platform/heap/member.h" #include "third_party/blink/renderer/platform/heap/member.h"
...@@ -63,7 +64,8 @@ class CORE_EXPORT WebFrameWidgetBase ...@@ -63,7 +64,8 @@ class CORE_EXPORT WebFrameWidgetBase
public WidgetBaseClient, public WidgetBaseClient,
public mojom::blink::FrameWidget, public mojom::blink::FrameWidget,
public viz::mojom::blink::InputTargetClient, public viz::mojom::blink::InputTargetClient,
public FrameWidget { public FrameWidget,
public PageWidgetEventHandler {
public: public:
WebFrameWidgetBase( WebFrameWidgetBase(
WebWidgetClient&, WebWidgetClient&,
...@@ -643,8 +645,6 @@ class CORE_EXPORT WebFrameWidgetBase ...@@ -643,8 +645,6 @@ class CORE_EXPORT WebFrameWidgetBase
// The fullscreen granted status from the most recent VisualProperties update. // The fullscreen granted status from the most recent VisualProperties update.
bool IsFullscreenGranted(); bool IsFullscreenGranted();
virtual PageWidgetEventHandler* GetPageWidgetEventHandler() = 0;
// Return the LocalFrameView used for animation scrolling. This is overridden // Return the LocalFrameView used for animation scrolling. This is overridden
// by WebViewFrameWidget and should eventually be removed once null does not // by WebViewFrameWidget and should eventually be removed once null does not
// need to be passed for the main frame. // need to be passed for the main frame.
......
...@@ -860,10 +860,6 @@ WebInputEventResult WebFrameWidgetImpl::HandleGestureEvent( ...@@ -860,10 +860,6 @@ WebInputEventResult WebFrameWidgetImpl::HandleGestureEvent(
return event_result; return event_result;
} }
PageWidgetEventHandler* WebFrameWidgetImpl::GetPageWidgetEventHandler() {
return this;
}
LocalFrameView* WebFrameWidgetImpl::GetLocalFrameViewForAnimationScrolling() { LocalFrameView* WebFrameWidgetImpl::GetLocalFrameViewForAnimationScrolling() {
return LocalRootImpl()->GetFrame()->View(); return LocalRootImpl()->GetFrame()->View();
} }
......
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
#include "third_party/blink/public/web/web_input_method_controller.h" #include "third_party/blink/public/web/web_input_method_controller.h"
#include "third_party/blink/renderer/core/frame/web_frame_widget_base.h" #include "third_party/blink/renderer/core/frame/web_frame_widget_base.h"
#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h" #include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"
#include "third_party/blink/renderer/core/page/page_widget_delegate.h"
#include "third_party/blink/renderer/core/scroll/scroll_types.h" #include "third_party/blink/renderer/core/scroll/scroll_types.h"
#include "third_party/blink/renderer/platform/graphics/apply_viewport_changes.h" #include "third_party/blink/renderer/platform/graphics/apply_viewport_changes.h"
#include "third_party/blink/renderer/platform/graphics/graphics_layer.h" #include "third_party/blink/renderer/platform/graphics/graphics_layer.h"
...@@ -71,8 +70,7 @@ class WebFrameWidgetImpl; ...@@ -71,8 +70,7 @@ class WebFrameWidgetImpl;
// //
// For the main frame's WebFrameWidget implementation, see WebViewFrameWidget. // For the main frame's WebFrameWidget implementation, see WebViewFrameWidget.
// //
class WebFrameWidgetImpl final : public WebFrameWidgetBase, class WebFrameWidgetImpl final : public WebFrameWidgetBase {
public PageWidgetEventHandler {
public: public:
WebFrameWidgetImpl( WebFrameWidgetImpl(
util::PassKey<WebFrameWidget>, util::PassKey<WebFrameWidget>,
...@@ -187,7 +185,6 @@ class WebFrameWidgetImpl final : public WebFrameWidgetBase, ...@@ -187,7 +185,6 @@ class WebFrameWidgetImpl final : public WebFrameWidgetBase,
WebInputEventResult HandleKeyEvent(const WebKeyboardEvent&) override; WebInputEventResult HandleKeyEvent(const WebKeyboardEvent&) override;
WebInputEventResult HandleCharEvent(const WebKeyboardEvent&) override; WebInputEventResult HandleCharEvent(const WebKeyboardEvent&) override;
PageWidgetEventHandler* GetPageWidgetEventHandler() override;
LocalFrameView* GetLocalFrameViewForAnimationScrolling() override; LocalFrameView* GetLocalFrameViewForAnimationScrolling() override;
LocalFrame* FocusedLocalFrameAvailableForIme() const; LocalFrame* FocusedLocalFrameAvailableForIme() const;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/util/type_safety/pass_key.h" #include "base/util/type_safety/pass_key.h"
#include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/exported/web_page_popup_impl.h"
#include "third_party/blink/renderer/core/frame/web_frame_widget_base.h" #include "third_party/blink/renderer/core/frame/web_frame_widget_base.h"
#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h" #include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"
#include "third_party/blink/renderer/platform/graphics/apply_viewport_changes.h" #include "third_party/blink/renderer/platform/graphics/apply_viewport_changes.h"
...@@ -18,6 +19,7 @@ ...@@ -18,6 +19,7 @@
namespace blink { namespace blink {
class HTMLPlugInElement;
class WebFrameWidget; class WebFrameWidget;
class WebViewImpl; class WebViewImpl;
class WebWidgetClient; class WebWidgetClient;
...@@ -144,7 +146,20 @@ class CORE_EXPORT WebViewFrameWidget : public WebFrameWidgetBase { ...@@ -144,7 +146,20 @@ class CORE_EXPORT WebViewFrameWidget : public WebFrameWidgetBase {
gfx::Size DIPsToCeiledBlinkSpace(const gfx::Size& size); gfx::Size DIPsToCeiledBlinkSpace(const gfx::Size& size);
private: private:
PageWidgetEventHandler* GetPageWidgetEventHandler() override; // PageWidgetEventHandler overrides:
void HandleMouseLeave(LocalFrame&, const WebMouseEvent&) override;
void HandleMouseDown(LocalFrame&, const WebMouseEvent&) override;
WebInputEventResult HandleMouseUp(LocalFrame&, const WebMouseEvent&) override;
WebInputEventResult HandleMouseWheel(LocalFrame&,
const WebMouseWheelEvent&) override;
WebInputEventResult HandleGestureEvent(const WebGestureEvent&) override;
WebInputEventResult HandleKeyEvent(const WebKeyboardEvent&) override;
WebInputEventResult HandleCharEvent(const WebKeyboardEvent&) override;
WebInputEventResult HandleCapturedMouseEvent(const WebCoalescedInputEvent&);
void MouseContextMenu(const WebMouseEvent&);
void MouseDoubleClick(const WebMouseEvent&);
LocalFrameView* GetLocalFrameViewForAnimationScrolling() override; LocalFrameView* GetLocalFrameViewForAnimationScrolling() override;
void SetWindowRectSynchronously(const gfx::Rect& new_window_rect); void SetWindowRectSynchronously(const gfx::Rect& new_window_rect);
...@@ -189,6 +204,18 @@ class CORE_EXPORT WebViewFrameWidget : public WebFrameWidgetBase { ...@@ -189,6 +204,18 @@ class CORE_EXPORT WebViewFrameWidget : public WebFrameWidgetBase {
// than the WebViewImpl::size_ since isn't set in auto resize mode. // than the WebViewImpl::size_ since isn't set in auto resize mode.
gfx::Size size_; gfx::Size size_;
// keyPress events to be suppressed if the associated keyDown event was
// handled.
bool suppress_next_keypress_event_ = false;
// If set, the (plugin) element which has mouse capture.
Member<HTMLPlugInElement> mouse_capture_element_;
// This stores the last hidden page popup. If a GestureTap attempts to open
// the popup that is closed by its previous GestureTapDown, the popup remains
// closed.
scoped_refptr<WebPagePopupImpl> last_hidden_page_popup_;
SelfKeepAlive<WebViewFrameWidget> self_keep_alive_; SelfKeepAlive<WebViewFrameWidget> self_keep_alive_;
DISALLOW_COPY_AND_ASSIGN(WebViewFrameWidget); DISALLOW_COPY_AND_ASSIGN(WebViewFrameWidget);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment