Make generic EventHandler methods
authorstephan.szabo@sony.com <stephan.szabo@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Nov 2018 18:24:06 +0000 (18:24 +0000)
committerstephan.szabo@sony.com <stephan.szabo@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Nov 2018 18:24:06 +0000 (18:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=192032

Reviewed by Michael Catanzaro.

No new tests. No new behavior.

Move mostly generic for non-Apple platform implementations
of methods from EventHandlerGlib into EventHandler. Two
of these also had different Windows implementations, so
to limit behavior change from this, those are currently
overridden for Windows as well as Mac and IOS.

* page/EventHandler.cpp:
(WebCore::EventHandler::passMousePressEventToSubframe):
(WebCore::EventHandler::passMouseReleaseEventToSubframe):
(WebCore::EventHandler::widgetDidHandleWheelEvent):
(WebCore::EventHandler::tabsToAllFormControls const):
(WebCore::EventHandler::passWidgetMouseDownEventToWidget):
(WebCore::EventHandler::passMouseDownEventToWidget):
(WebCore::EventHandler::focusDocumentView):
(WebCore::EventHandler::eventActivatedView const):
(WebCore::EventHandler::passMouseMoveEventToSubframe):
* page/win/EventHandlerWin.cpp:
(WebCore::EventHandler::passMouseMoveEventToSubframe):
(WebCore::EventHandler::passMousePressEventToSubframe): Deleted.
(WebCore::EventHandler::passMouseReleaseEventToSubframe): Deleted.
(WebCore::EventHandler::widgetDidHandleWheelEvent): Deleted.
(WebCore::EventHandler::tabsToAllFormControls const): Deleted.
(WebCore::EventHandler::focusDocumentView): Deleted.
(WebCore::EventHandler::passWidgetMouseDownEventToWidget): Deleted.
(WebCore::EventHandler::accessKeyModifiers): Deleted.
* platform/glib/EventHandlerGLib.cpp:
(WebCore::EventHandler::tabsToAllFormControls const): Deleted.
(WebCore::EventHandler::focusDocumentView): Deleted.
(WebCore::EventHandler::passWidgetMouseDownEventToWidget): Deleted.
(WebCore::EventHandler::passMouseDownEventToWidget): Deleted.
(WebCore::EventHandler::eventActivatedView const): Deleted.
(WebCore::EventHandler::widgetDidHandleWheelEvent): Deleted.
(WebCore::EventHandler::passMousePressEventToSubframe): Deleted.
(WebCore::EventHandler::passMouseMoveEventToSubframe): Deleted.
(WebCore::EventHandler::passMouseReleaseEventToSubframe): Deleted.
(WebCore::EventHandler::accessKeyModifiers): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238622 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/win/EventHandlerWin.cpp
Source/WebCore/platform/glib/EventHandlerGLib.cpp

index 1f37acd..4a00dec 100644 (file)
@@ -1,3 +1,49 @@
+2018-11-28  Stephan Szabo  <stephan.szabo@sony.com>
+
+        Make generic EventHandler methods
+        https://bugs.webkit.org/show_bug.cgi?id=192032
+
+        Reviewed by Michael Catanzaro.
+
+        No new tests. No new behavior.
+
+        Move mostly generic for non-Apple platform implementations
+        of methods from EventHandlerGlib into EventHandler. Two
+        of these also had different Windows implementations, so
+        to limit behavior change from this, those are currently
+        overridden for Windows as well as Mac and IOS.
+
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::passMousePressEventToSubframe):
+        (WebCore::EventHandler::passMouseReleaseEventToSubframe):
+        (WebCore::EventHandler::widgetDidHandleWheelEvent):
+        (WebCore::EventHandler::tabsToAllFormControls const):
+        (WebCore::EventHandler::passWidgetMouseDownEventToWidget):
+        (WebCore::EventHandler::passMouseDownEventToWidget):
+        (WebCore::EventHandler::focusDocumentView):
+        (WebCore::EventHandler::eventActivatedView const):
+        (WebCore::EventHandler::passMouseMoveEventToSubframe):
+        * page/win/EventHandlerWin.cpp:
+        (WebCore::EventHandler::passMouseMoveEventToSubframe):
+        (WebCore::EventHandler::passMousePressEventToSubframe): Deleted.
+        (WebCore::EventHandler::passMouseReleaseEventToSubframe): Deleted.
+        (WebCore::EventHandler::widgetDidHandleWheelEvent): Deleted.
+        (WebCore::EventHandler::tabsToAllFormControls const): Deleted.
+        (WebCore::EventHandler::focusDocumentView): Deleted.
+        (WebCore::EventHandler::passWidgetMouseDownEventToWidget): Deleted.
+        (WebCore::EventHandler::accessKeyModifiers): Deleted.
+        * platform/glib/EventHandlerGLib.cpp:
+        (WebCore::EventHandler::tabsToAllFormControls const): Deleted.
+        (WebCore::EventHandler::focusDocumentView): Deleted.
+        (WebCore::EventHandler::passWidgetMouseDownEventToWidget): Deleted.
+        (WebCore::EventHandler::passMouseDownEventToWidget): Deleted.
+        (WebCore::EventHandler::eventActivatedView const): Deleted.
+        (WebCore::EventHandler::widgetDidHandleWheelEvent): Deleted.
+        (WebCore::EventHandler::passMousePressEventToSubframe): Deleted.
+        (WebCore::EventHandler::passMouseMoveEventToSubframe): Deleted.
+        (WebCore::EventHandler::passMouseReleaseEventToSubframe): Deleted.
+        (WebCore::EventHandler::accessKeyModifiers): Deleted.
+
 2018-11-28  Zalan Bujtas  <zalan@apple.com>
 
         [LFC][Quirk] Use non-collapsed vertical margin values when the container is stretched to the size of the ICB.
index d6e01be..6d141ea 100644 (file)
@@ -65,6 +65,7 @@
 #include "Logging.h"
 #include "MouseEvent.h"
 #include "MouseEventWithHitTestResults.h"
+#include "NotImplemented.h"
 #include "Page.h"
 #include "PageOverlayController.h"
 #include "Pasteboard.h"
@@ -139,6 +140,8 @@ const int ColorDragHystersis = 3;
 const int GeneralDragHysteresis = 3;
 #if PLATFORM(COCOA)
 const Seconds EventHandler::TextDragDelay { 150_ms };
+#else
+const Seconds EventHandler::TextDragDelay { 0_s };
 #endif
 #endif // ENABLE(DRAG_SUPPORT)
 
@@ -4274,4 +4277,77 @@ void EventHandler::setImmediateActionStage(ImmediateActionStage stage)
     m_immediateActionStage = stage;
 }
 
+#if !PLATFORM(COCOA)
+OptionSet<PlatformEvent::Modifier> EventHandler::accessKeyModifiers()
+{
+    return PlatformEvent::Modifier::AltKey;
+}
+
+bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
+{
+    subframe->eventHandler().handleMousePressEvent(mev.event());
+    return true;
+}
+
+bool EventHandler::passMouseReleaseEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
+{
+    subframe->eventHandler().handleMouseReleaseEvent(mev.event());
+    return true;
+}
+
+bool EventHandler::widgetDidHandleWheelEvent(const PlatformWheelEvent& event, Widget& widget)
+{
+    if (!is<FrameView>(widget))
+        return false;
+
+    return downcast<FrameView>(widget).frame().eventHandler().handleWheelEvent(event);
+}
+
+bool EventHandler::tabsToAllFormControls(KeyboardEvent*) const
+{
+    // We always allow tabs to all controls
+    return true;
+}
+
+bool EventHandler::passWidgetMouseDownEventToWidget(RenderWidget* renderWidget)
+{
+    return passMouseDownEventToWidget(renderWidget->widget());
+}
+
+bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults& event)
+{
+    // Figure out which view to send the event to.
+    RenderObject* target = event.targetNode() ? event.targetNode()->renderer() : nullptr;
+    if (!is<RenderWidget>(target))
+        return false;
+    return passMouseDownEventToWidget(downcast<RenderWidget>(*target).widget());
+}
+
+bool EventHandler::passMouseDownEventToWidget(Widget*)
+{
+    notImplemented();
+    return false;
+}
+
+void EventHandler::focusDocumentView()
+{
+    if (Page* page = m_frame.page())
+        page->focusController().setFocusedFrame(&m_frame);
+}
+#endif // !PLATFORM(COCOA)
+
+#if !PLATFORM(COCOA) && !PLATFORM(WIN)
+bool EventHandler::eventActivatedView(const PlatformMouseEvent&) const
+{
+    notImplemented();
+    return false;
+}
+
+bool EventHandler::passMouseMoveEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe, HitTestResult* hoveredNode)
+{
+    subframe->eventHandler().handleMouseMoveEvent(mev.event(), hoveredNode);
+    return true;
+}
+#endif // !PLATFORM(COCOA) && !PLATFORM(WIN)
+
 } // namespace WebCore
index bb1dc39..0909710 100644 (file)
 #include "config.h"
 #include "EventHandler.h"
 
-#include "COMPtr.h"
-#include "Cursor.h"
-#include "DataTransfer.h"
-#include "FloatPoint.h"
-#include "FocusController.h"
-#include "FrameView.h"
-#include "Frame.h"
-#include "FrameSelection.h"
-#include "HitTestRequest.h"
-#include "HitTestResult.h"
 #include "MouseEventWithHitTestResults.h"
-#include "Page.h"
-#include "PlatformKeyboardEvent.h"
-#include "PlatformWheelEvent.h"
-#include "Scrollbar.h"
-#include "WCDataObject.h"
-#include "NotImplemented.h"
 
 namespace WebCore {
 
-#if ENABLE(DRAG_SUPPORT)
-const Seconds EventHandler::TextDragDelay { 0_s };
-#endif
-
-bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
-{
-    subframe->eventHandler().handleMousePressEvent(mev.event());
-    return true;
-}
-
 bool EventHandler::passMouseMoveEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe, HitTestResult* hoveredNode)
 {
 #if ENABLE(DRAG_SUPPORT)
     if (m_mouseDownMayStartDrag && !m_mouseDownWasInSubframe)
         return false;
 #endif
-    subframe->eventHandler().handleMouseMoveEvent(mev.event(), hoveredNode);
-    return true;
-}
-
-bool EventHandler::passMouseReleaseEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
-{
-    subframe->eventHandler().handleMouseReleaseEvent(mev.event());
-    return true;
-}
-
-bool EventHandler::widgetDidHandleWheelEvent(const PlatformWheelEvent& wheelEvent, Widget& widget)
-{
-    if (!is<FrameView>(widget))
-        return false;
-
-    return downcast<FrameView>(widget).frame().eventHandler().handleWheelEvent(wheelEvent);
-}
 
-bool EventHandler::tabsToAllFormControls(KeyboardEvent*) const
-{
+    subframe->eventHandler().handleMouseMoveEvent(mev.event(), hoveredNode);
     return true;
 }
 
@@ -91,23 +47,4 @@ bool EventHandler::eventActivatedView(const PlatformMouseEvent& event) const
     return event.didActivateWebView();
 }
 
-void EventHandler::focusDocumentView()
-{
-    Page* page = m_frame.page();
-    if (!page)
-        return;
-    page->focusController().setFocusedFrame(&m_frame);
-}
-
-bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults&)
-{
-    notImplemented();
-    return false;
-}
-
-OptionSet<PlatformEvent::Modifier> EventHandler::accessKeyModifiers()
-{
-    return PlatformEvent::Modifier::AltKey;
-}
-
 }
index 1c080f7..fe3d60d 100644 (file)
 
 namespace WebCore {
 
-#if ENABLE(DRAG_SUPPORT)
-const Seconds EventHandler::TextDragDelay { 0_s };
-#endif
-
-bool EventHandler::tabsToAllFormControls(KeyboardEvent*) const
-{
-    // We always allow tabs to all controls
-    return true;
-}
-
-void EventHandler::focusDocumentView()
-{
-    if (Page* page = m_frame.page())
-        page->focusController().setFocusedFrame(&m_frame);
-}
-
-bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults& event)
-{
-    // Figure out which view to send the event to.
-    RenderObject* target = event.targetNode() ? event.targetNode()->renderer() : nullptr;
-    if (!is<RenderWidget>(target))
-        return false;
-    return passMouseDownEventToWidget(downcast<RenderWidget>(*target).widget());
-}
-
-bool EventHandler::passWidgetMouseDownEventToWidget(RenderWidget* renderWidget)
-{
-    return passMouseDownEventToWidget(renderWidget->widget());
-}
-
-bool EventHandler::passMouseDownEventToWidget(Widget*)
-{
-    notImplemented();
-    return false;
-}
-
-bool EventHandler::eventActivatedView(const PlatformMouseEvent&) const
-{
-    // GTK+ activation is not necessarily tied to mouse events, so it may
-    // not make sense to implement this
-
-    notImplemented();
-    return false;
-}
-
-bool EventHandler::widgetDidHandleWheelEvent(const PlatformWheelEvent& event, Widget& widget)
-{
-    if (!is<FrameView>(widget))
-        return false;
-
-    return downcast<FrameView>(widget).frame().eventHandler().handleWheelEvent(event);
-}
-
-bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
-{
-    subframe->eventHandler().handleMousePressEvent(mev.event());
-    return true;
-}
-
-bool EventHandler::passMouseMoveEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe, HitTestResult* hoveredNode)
-{
-    subframe->eventHandler().handleMouseMoveEvent(mev.event(), hoveredNode);
-    return true;
-}
-
-bool EventHandler::passMouseReleaseEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
-{
-    subframe->eventHandler().handleMouseReleaseEvent(mev.event());
-    return true;
-}
-
-OptionSet<PlatformEvent::Modifier> EventHandler::accessKeyModifiers()
-{
-    return PlatformEvent::Modifier::AltKey;
-}
-
 // GTK+ must scroll horizontally if the mouse pointer is on top of the
 // horizontal scrollbar while scrolling with the wheel; we need to
 // add the deltas and ticks here so that this behavior is consistent