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 {
static const WebInputEvent* Get() { return current_input_event_; }
private:
friend class WebViewImpl;
friend class WebFrameWidgetImpl;
friend class WebViewFrameWidget;
friend class NavigationPolicyTest;
static const WebInputEvent* current_input_event_;
......
......@@ -88,7 +88,6 @@ class BrowserControls;
class DevToolsEmulator;
class Frame;
class FullscreenController;
class HTMLPlugInElement;
class PageScaleConstraintsSet;
class WebDevToolsAgentImpl;
class WebLocalFrame;
......@@ -109,7 +108,6 @@ using PaintHoldingCommitTrigger = cc::PaintHoldingCommitTrigger;
class CORE_EXPORT WebViewImpl final : public WebView,
public RefCounted<WebViewImpl>,
public PageWidgetEventHandler,
public mojom::blink::PageBroadcast {
public:
static WebViewImpl* Create(
......@@ -294,10 +292,6 @@ class CORE_EXPORT WebViewImpl final : public WebView,
// outside this class.
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
// with bounds |element_bounds_in_document| and caret bounds
// |caret_bounds_in_document|.
......@@ -535,7 +529,6 @@ class CORE_EXPORT WebViewImpl final : public WebView,
void UpdateLifecycle(WebLifecycleUpdate requested_update,
DocumentUpdateReason reason);
void ThemeChanged();
WebInputEventResult HandleInputEvent(const WebCoalescedInputEvent&);
WebInputEventResult DispatchBufferedTouchEvents();
void ApplyViewportChanges(const ApplyViewportChangesArgs& args);
void RecordManipulationTypeCounts(cc::ManipulationInfo info);
......@@ -604,18 +597,6 @@ class CORE_EXPORT WebViewImpl final : public WebView,
int target_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 DisablePopupMouseWheelEventListener();
......@@ -739,12 +720,6 @@ class CORE_EXPORT WebViewImpl final : public WebView,
float compositor_device_scale_factor_override_ = 0.f;
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
// when there is no page focus?
// Represents whether or not this object should process incoming IME events.
......@@ -757,19 +732,11 @@ class CORE_EXPORT WebViewImpl final : public WebView,
// closed.
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_;
// Whether the user can press tab to focus links.
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()
// provides compositing support for the WebView.
// In some cases, a WidgetClient() is not provided, or it informs us that
......@@ -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_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_;
// If true, we send IPC messages when |preferred_size_| changes.
......
......@@ -24,6 +24,7 @@
#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/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/paint/paint_image.h"
#include "third_party/blink/renderer/platform/heap/member.h"
......@@ -63,7 +64,8 @@ class CORE_EXPORT WebFrameWidgetBase
public WidgetBaseClient,
public mojom::blink::FrameWidget,
public viz::mojom::blink::InputTargetClient,
public FrameWidget {
public FrameWidget,
public PageWidgetEventHandler {
public:
WebFrameWidgetBase(
WebWidgetClient&,
......@@ -643,8 +645,6 @@ class CORE_EXPORT WebFrameWidgetBase
// The fullscreen granted status from the most recent VisualProperties update.
bool IsFullscreenGranted();
virtual PageWidgetEventHandler* GetPageWidgetEventHandler() = 0;
// Return the LocalFrameView used for animation scrolling. This is overridden
// by WebViewFrameWidget and should eventually be removed once null does not
// need to be passed for the main frame.
......
......@@ -860,10 +860,6 @@ WebInputEventResult WebFrameWidgetImpl::HandleGestureEvent(
return event_result;
}
PageWidgetEventHandler* WebFrameWidgetImpl::GetPageWidgetEventHandler() {
return this;
}
LocalFrameView* WebFrameWidgetImpl::GetLocalFrameViewForAnimationScrolling() {
return LocalRootImpl()->GetFrame()->View();
}
......
......@@ -43,7 +43,6 @@
#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_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/platform/graphics/apply_viewport_changes.h"
#include "third_party/blink/renderer/platform/graphics/graphics_layer.h"
......@@ -71,8 +70,7 @@ class WebFrameWidgetImpl;
//
// For the main frame's WebFrameWidget implementation, see WebViewFrameWidget.
//
class WebFrameWidgetImpl final : public WebFrameWidgetBase,
public PageWidgetEventHandler {
class WebFrameWidgetImpl final : public WebFrameWidgetBase {
public:
WebFrameWidgetImpl(
util::PassKey<WebFrameWidget>,
......@@ -187,7 +185,6 @@ class WebFrameWidgetImpl final : public WebFrameWidgetBase,
WebInputEventResult HandleKeyEvent(const WebKeyboardEvent&) override;
WebInputEventResult HandleCharEvent(const WebKeyboardEvent&) override;
PageWidgetEventHandler* GetPageWidgetEventHandler() override;
LocalFrameView* GetLocalFrameViewForAnimationScrolling() override;
LocalFrame* FocusedLocalFrameAvailableForIme() const;
......
......@@ -10,6 +10,7 @@
#include "base/single_thread_task_runner.h"
#include "base/util/type_safety/pass_key.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_local_frame_impl.h"
#include "third_party/blink/renderer/platform/graphics/apply_viewport_changes.h"
......@@ -18,6 +19,7 @@
namespace blink {
class HTMLPlugInElement;
class WebFrameWidget;
class WebViewImpl;
class WebWidgetClient;
......@@ -144,7 +146,20 @@ class CORE_EXPORT WebViewFrameWidget : public WebFrameWidgetBase {
gfx::Size DIPsToCeiledBlinkSpace(const gfx::Size& size);
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;
void SetWindowRectSynchronously(const gfx::Rect& new_window_rect);
......@@ -189,6 +204,18 @@ class CORE_EXPORT WebViewFrameWidget : public WebFrameWidgetBase {
// than the WebViewImpl::size_ since isn't set in auto resize mode.
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_;
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