Clean up some EventHandler coordinate-related naming and fix ScrollableArea::lastKnow...
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 May 2020 03:48:29 +0000 (03:48 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 May 2020 03:48:29 +0000 (03:48 +0000)
https://bugs.webkit.org/show_bug.cgi?id=211259

Reviewed by Zalan Bujtas.

Source/WebCore:

On EventHandler, rename m_lastKnownMousePosition, m_mouseDownPos and m_mouseDown for clarity.

Rename ScrollableArea::lastKnownMousePosition() to be lastKnownMousePositionInView().
Previously, lastKnownMousePosition() would fetch it from EventHandler, which simply stashed
event.position() (which is in a coordinate system that differs between WK1 and Wk2) which
was not relative to the EventHandler's frame. This cause mouseLocationInScrollerForScrollerImp:
to give wrong answers.

Instead, lastKnownMousePositionInView() now specifically returns coordinates relative to the Frame.
This behavior change will be tested in future overlay scrollbar tests.

Document::showPlaybackTargetPicker() was using FrameView::lastKnownMousePosition(), so to avoid
changing its (probably broken) behavior, have it call frame()->eventHandler().lastKnownMousePosition().

* dom/Document.cpp:
(WebCore::Document::showPlaybackTargetPicker):
* page/EventHandler.cpp:
(WebCore::EventHandler::clear):
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::handleMouseDraggedEvent):
(WebCore::EventHandler::updateDragSourceActionsAllowed const):
(WebCore::EventHandler::dispatchDragStartEventOnSourceElement):
(WebCore::EventHandler::handleDrag):
(WebCore::EventHandler::mouseMovementExceedsThreshold const):
* page/EventHandler.h:
* page/FrameView.cpp:
(WebCore::FrameView::lastKnownMousePositionInView const):
(WebCore::FrameView::lastKnownMousePosition const): Deleted.
* page/FrameView.h:
* platform/PlatformMouseEvent.h:
* platform/ScrollableArea.h:
(WebCore::ScrollableArea::lastKnownMousePositionInView const):
(WebCore::ScrollableArea::lastKnownMousePosition const): Deleted.
* platform/mac/ScrollAnimatorMac.mm:
(-[WebScrollerImpPairDelegate mouseLocationInContentAreaForScrollerImpPair:]):
(-[WebScrollerImpPairDelegate scrollerImpPair:convertContentPoint:toScrollerImp:]):
(-[WebScrollerImpDelegate mouseLocationInScrollerForScrollerImp:]):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::lastKnownMousePositionInView const):
(WebCore::RenderLayer::lastKnownMousePosition const): Deleted.
* rendering/RenderLayer.h:
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::lastKnownMousePositionInView const):
(WebCore::RenderListBox::lastKnownMousePosition const): Deleted.
* rendering/RenderListBox.h:

Source/WebKit:

* Shared/WebEvent.h:
(WebKit::WebMouseEvent::position const):
* Shared/WebMouseEvent.cpp:
(WebKit::WebMouseEvent::WebMouseEvent):
* WebProcess/Plugins/PDF/PDFPlugin.h:

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

17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/EventHandler.h
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/platform/PlatformMouseEvent.h
Source/WebCore/platform/ScrollableArea.h
Source/WebCore/platform/mac/ScrollAnimatorMac.mm
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayer.h
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderListBox.h
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebEvent.h
Source/WebKit/Shared/WebMouseEvent.cpp
Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.h

index 3a3e956..f91b4b2 100644 (file)
@@ -1,3 +1,56 @@
+2020-04-30  Simon Fraser  <simon.fraser@apple.com>
+
+        Clean up some EventHandler coordinate-related naming and fix ScrollableArea::lastKnownMousePosition() conversions
+        https://bugs.webkit.org/show_bug.cgi?id=211259
+
+        Reviewed by Zalan Bujtas.
+
+        On EventHandler, rename m_lastKnownMousePosition, m_mouseDownPos and m_mouseDown for clarity.
+
+        Rename ScrollableArea::lastKnownMousePosition() to be lastKnownMousePositionInView().
+        Previously, lastKnownMousePosition() would fetch it from EventHandler, which simply stashed
+        event.position() (which is in a coordinate system that differs between WK1 and Wk2) which
+        was not relative to the EventHandler's frame. This cause mouseLocationInScrollerForScrollerImp:
+        to give wrong answers.
+
+        Instead, lastKnownMousePositionInView() now specifically returns coordinates relative to the Frame.
+        This behavior change will be tested in future overlay scrollbar tests.
+
+        Document::showPlaybackTargetPicker() was using FrameView::lastKnownMousePosition(), so to avoid
+        changing its (probably broken) behavior, have it call frame()->eventHandler().lastKnownMousePosition().
+
+        * dom/Document.cpp:
+        (WebCore::Document::showPlaybackTargetPicker):
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::clear):
+        (WebCore::EventHandler::handleMousePressEvent):
+        (WebCore::EventHandler::handleMouseDraggedEvent):
+        (WebCore::EventHandler::updateDragSourceActionsAllowed const):
+        (WebCore::EventHandler::dispatchDragStartEventOnSourceElement):
+        (WebCore::EventHandler::handleDrag):
+        (WebCore::EventHandler::mouseMovementExceedsThreshold const):
+        * page/EventHandler.h:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::lastKnownMousePositionInView const):
+        (WebCore::FrameView::lastKnownMousePosition const): Deleted.
+        * page/FrameView.h:
+        * platform/PlatformMouseEvent.h:
+        * platform/ScrollableArea.h:
+        (WebCore::ScrollableArea::lastKnownMousePositionInView const):
+        (WebCore::ScrollableArea::lastKnownMousePosition const): Deleted.
+        * platform/mac/ScrollAnimatorMac.mm:
+        (-[WebScrollerImpPairDelegate mouseLocationInContentAreaForScrollerImpPair:]):
+        (-[WebScrollerImpPairDelegate scrollerImpPair:convertContentPoint:toScrollerImp:]):
+        (-[WebScrollerImpDelegate mouseLocationInScrollerForScrollerImp:]):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::lastKnownMousePositionInView const):
+        (WebCore::RenderLayer::lastKnownMousePosition const): Deleted.
+        * rendering/RenderLayer.h:
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::lastKnownMousePositionInView const):
+        (WebCore::RenderListBox::lastKnownMousePosition const): Deleted.
+        * rendering/RenderListBox.h:
+
 2020-04-30  Yusuke Suzuki  <ysuzuki@apple.com>
 
         Some HTML element critical paths include AtomString materialization
index c6d958b..59e30e0 100644 (file)
@@ -7352,11 +7352,16 @@ void Document::showPlaybackTargetPicker(MediaPlaybackTargetClient& client, bool
     if (!page)
         return;
 
+    if (!frame())
+        return;
+
     auto it = m_clientToIDMap.find(&client);
     if (it == m_clientToIDMap.end())
         return;
 
-    page->showPlaybackTargetPicker(it->value, view()->lastKnownMousePosition(), isVideo, routeSharingPolicy, routingContextUID);
+    // FIXME: This is probably wrong for subframes.
+    auto position = frame()->eventHandler().lastKnownMousePosition();
+    page->showPlaybackTargetPicker(it->value, position, isVideo, routeSharingPolicy, routingContextUID);
 }
 
 void Document::playbackTargetPickerClientStateDidChange(MediaPlaybackTargetClient& client, MediaProducer::MediaStateFlags state)
index 89b6b6d..9a84397 100644 (file)
@@ -446,8 +446,8 @@ void EventHandler::clear()
     m_shouldOnlyFireDragOverEvent = false;
 #endif
     m_mousePositionIsUnknown = true;
-    m_lastKnownMousePosition = IntPoint();
-    m_lastKnownMouseGlobalPosition = IntPoint();
+    m_lastKnownMousePosition = { };
+    m_lastKnownMouseGlobalPosition = { };
     m_mousePressNode = nullptr;
     m_mousePressed = false;
     m_capturesDragging = false;
@@ -788,7 +788,7 @@ bool EventHandler::handleMousePressEvent(const MouseEventWithHitTestResults& eve
 
     m_mouseDownWasSingleClickInSelection = false;
 
-    m_mouseDown = event.event();
+    m_mouseDownEvent = event.event();
 
     if (m_immediateActionStage != ImmediateActionStage::PerformedHitTest)
         m_immediateActionStage = ImmediateActionStage::None;
@@ -906,7 +906,7 @@ bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& e
     }
 
     if (m_selectionInitiationState != ExtendedSelection) {
-        HitTestResult result(m_mouseDownPos);
+        HitTestResult result(m_mouseDownContentsPosition);
         m_frame.document()->hitTest(HitTestRequest(), result);
 
         updateSelectionForMouseDrag(result);
@@ -1175,7 +1175,7 @@ DragSourceAction EventHandler::updateDragSourceActionsAllowed() const
     if (!view)
         return DragSourceActionNone;
 
-    return page->dragController().delegateDragSourceAction(view->contentsToRootView(m_mouseDownPos));
+    return page->dragController().delegateDragSourceAction(view->contentsToRootView(m_mouseDownContentsPosition));
 }
 #endif // ENABLE(DRAG_SUPPORT)
 
@@ -1725,7 +1725,7 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& platformMouse
     m_mouseDownMayStartSelect = false;
     m_mouseDownMayStartAutoscroll = false;
     if (FrameView* view = m_frame.view())
-        m_mouseDownPos = view->windowToContents(platformMouseEvent.position());
+        m_mouseDownContentsPosition = view->windowToContents(platformMouseEvent.position());
     else {
         invalidateClick();
         return false;
@@ -3695,7 +3695,7 @@ void EventHandler::dispatchEventToDragSourceElement(const AtomString& eventType,
 
 bool EventHandler::dispatchDragStartEventOnSourceElement(DataTransfer& dataTransfer)
 {
-    return !dispatchDragEvent(eventNames().dragstartEvent, *dragState().source, m_mouseDown, dataTransfer) && !m_frame.selection().selection().isInPasswordField();
+    return !dispatchDragEvent(eventNames().dragstartEvent, *dragState().source, m_mouseDownEvent, dataTransfer) && !m_frame.selection().selection().isInPasswordField();
 }
     
 static bool ExactlyOneBitSet(DragSourceAction n)
@@ -3729,10 +3729,10 @@ bool EventHandler::handleDrag(const MouseEventWithHitTestResults& event, CheckDr
         dragState().shouldDispatchEvents = (updateDragSourceActionsAllowed() & DragSourceActionDHTML);
 
         // Try to find an element that wants to be dragged.
-        HitTestResult result(m_mouseDownPos);
+        HitTestResult result(m_mouseDownContentsPosition);
         m_frame.document()->hitTest(OptionSet<HitTestRequest::RequestType> { HitTestRequest::ReadOnly, HitTestRequest::DisallowUserAgentShadowContent }, result);
         if (m_frame.page())
-            dragState().source = m_frame.page()->dragController().draggableElement(&m_frame, result.targetElement(), m_mouseDownPos, dragState());
+            dragState().source = m_frame.page()->dragController().draggableElement(&m_frame, result.targetElement(), m_mouseDownContentsPosition, dragState());
         
         if (!dragState().source)
             m_mouseDownMayStartDrag = false; // no element is draggable
@@ -3807,7 +3807,7 @@ bool EventHandler::handleDrag(const MouseEventWithHitTestResults& event, CheckDr
             dragState().source->document().updateStyleIfNeeded();
             if (auto* renderer = dragState().source->renderer()) {
                 auto absolutePosition = renderer->localToAbsolute();
-                auto delta = m_mouseDownPos - roundedIntPoint(absolutePosition);
+                auto delta = m_mouseDownContentsPosition - roundedIntPoint(absolutePosition);
                 dragState().dataTransfer->setDragImage(dragState().source.get(), delta.width(), delta.height());
             } else {
                 dispatchEventToDragSourceElement(eventNames().dragendEvent, event.event());
@@ -3833,7 +3833,7 @@ bool EventHandler::handleDrag(const MouseEventWithHitTestResults& event, CheckDr
     
     if (m_mouseDownMayStartDrag) {
         Page* page = m_frame.page();
-        m_didStartDrag = page && page->dragController().startDrag(m_frame, dragState(), srcOp, event.event(), m_mouseDownPos, hasNonDefaultPasteboardData);
+        m_didStartDrag = page && page->dragController().startDrag(m_frame, dragState(), srcOp, event.event(), m_mouseDownContentsPosition, hasNonDefaultPasteboardData);
         // In WebKit2 we could re-enter this code and start another drag.
         // On OS X this causes problems with the ownership of the pasteboard and the promised types.
         if (m_didStartDrag) {
@@ -3864,7 +3864,7 @@ bool EventHandler::mouseMovementExceedsThreshold(const FloatPoint& viewportLocat
     if (!view)
         return false;
     IntPoint location = view->windowToContents(flooredIntPoint(viewportLocation));
-    IntSize delta = location - m_mouseDownPos;
+    IntSize delta = location - m_mouseDownContentsPosition;
     
     return abs(delta.width()) >= pointsThreshold || abs(delta.height()) >= pointsThreshold;
 }
index adb15db..bb014c6 100644 (file)
@@ -179,6 +179,7 @@ public:
 
     void resizeLayerDestroyed();
 
+    // FIXME: Each Frame has an EventHandler, and not every event goes to all frames, so this position can be stale. It should probably be stored on Page.
     IntPoint lastKnownMousePosition() const;
     IntPoint lastKnownMouseGlobalPosition() const { return m_lastKnownMouseGlobalPosition; }
     Cursor currentMouseCursor() const { return m_currentMouseCursor; }
@@ -587,11 +588,11 @@ private:
     LayoutSize m_offsetFromResizeCorner; // In the coords of m_resizeLayer.
     
     bool m_mousePositionIsUnknown { true };
-    IntPoint m_lastKnownMousePosition;
+    IntPoint m_lastKnownMousePosition; // Same coordinates as PlatformMouseEvent::position().
     IntPoint m_lastKnownMouseGlobalPosition;
-    IntPoint m_mouseDownPos; // In our view's coords.
+    IntPoint m_mouseDownContentsPosition;
     WallTime m_mouseDownTimestamp;
-    PlatformMouseEvent m_mouseDown;
+    PlatformMouseEvent m_mouseDownEvent;
     PlatformMouseEvent m_lastPlatformMouseEvent;
 
 #if PLATFORM(COCOA)
index b3fe140..51ee5bf 100644 (file)
@@ -2012,9 +2012,9 @@ bool FrameView::fixedElementsLayoutRelativeToFrame() const
     return frame().settings().fixedElementsLayoutRelativeToFrame();
 }
 
-IntPoint FrameView::lastKnownMousePosition() const
+IntPoint FrameView::lastKnownMousePositionInView() const
 {
-    return frame().eventHandler().lastKnownMousePosition();
+    return convertFromContainingWindow(frame().eventHandler().lastKnownMousePosition());
 }
 
 bool FrameView::isHandlingWheelEvent() const
index 21c2efc..2827f12 100644 (file)
@@ -520,7 +520,7 @@ public:
     enum ScrollbarModesCalculationStrategy { RulesFromWebContentOnly, AnyRule };
     void calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode, ScrollbarModesCalculationStrategy = AnyRule);
 
-    IntPoint lastKnownMousePosition() const final;
+    IntPoint lastKnownMousePositionInView() const final;
     bool isHandlingWheelEvent() const final;
     bool shouldSetCursor() const;
 
index 85b53f0..fdf268c 100644 (file)
@@ -61,6 +61,8 @@ const double ForceAtForceClick = 2;
         {
         }
 
+        // This position is relative to the enclosing NSWindow in WebKit1, and is WKWebView-relative in WebKit2.
+        // Use ScrollView::windowToContents() to convert it to into the contents of a given view.
         const IntPoint& position() const { return m_position; }
         const IntPoint& globalPosition() const { return m_globalPosition; }
 #if ENABLE(POINTER_LOCK)
index 45fac02..f004d3b 100644 (file)
@@ -277,7 +277,7 @@ public:
 
     virtual IntSize contentsSize() const = 0;
     virtual IntSize overhangAmount() const { return IntSize(); }
-    virtual IntPoint lastKnownMousePosition() const { return IntPoint(); }
+    virtual IntPoint lastKnownMousePositionInView() const { return IntPoint(); }
     virtual bool isHandlingWheelEvent() const { return false; }
 
     virtual int headerHeight() const { return 0; }
index a277efc..29196d2 100644 (file)
@@ -224,7 +224,9 @@ static NSSize abs(NSSize size)
     if (!_scrollableArea)
         return NSZeroPoint;
 
-    return _scrollableArea->lastKnownMousePosition();
+    // It's OK that this position isn't relative to this scroller (which might be an overflow scroller).
+    // AppKit just takes the result and passes it back to -scrollerImpPair:convertContentPoint:toScrollerImp:.
+    return _scrollableArea->lastKnownMousePositionInView();
 }
 
 - (NSPoint)scrollerImpPair:(NSScrollerImpPair *)scrollerImpPair convertContentPoint:(NSPoint)pointInContentArea toScrollerImp:(NSScrollerImp *)scrollerImp
@@ -250,7 +252,7 @@ static NSSize abs(NSSize size)
 
     ASSERT(scrollerImp == scrollerImpForScrollbar(*scrollbar));
 
-    return scrollbar->convertFromContainingView(WebCore::IntPoint(pointInContentArea));
+    return scrollbar->convertFromContainingView(WebCore::roundedIntPoint(pointInContentArea));
 }
 
 - (void)scrollerImpPair:(NSScrollerImpPair *)scrollerImpPair setContentAreaNeedsDisplayInRect:(NSRect)rect
@@ -513,7 +515,8 @@ enum FeatureToAnimate {
 
     ASSERT_UNUSED(scrollerImp, scrollerImp == scrollerImpForScrollbar(*_scrollbar));
 
-    return _scrollbar->convertFromContainingView(_scrollbar->scrollableArea().lastKnownMousePosition());
+    auto positionInView = _scrollbar->scrollableArea().lastKnownMousePositionInView();
+    return _scrollbar->convertFromContainingView(positionInView);
 }
 
 - (NSRect)convertRectToLayer:(NSRect)rect
index 27ac824..cb92df3 100644 (file)
@@ -3283,9 +3283,9 @@ void RenderLayer::didUpdateScroll()
 }
 #endif
 
-IntPoint RenderLayer::lastKnownMousePosition() const
+IntPoint RenderLayer::lastKnownMousePositionInView() const
 {
-    return renderer().frame().eventHandler().lastKnownMousePosition();
+    return renderer().view().frameView().lastKnownMousePositionInView();
 }
 
 bool RenderLayer::isHandlingWheelEvent() const
index 6de1fef..a428033 100644 (file)
@@ -1125,7 +1125,7 @@ private:
 
     IntRect visibleContentRectInternal(VisibleContentRectIncludesScrollbars, VisibleContentRectBehavior) const final;
     IntSize overhangAmount() const final;
-    IntPoint lastKnownMousePosition() const final;
+    IntPoint lastKnownMousePositionInView() const final;
     bool isHandlingWheelEvent() const final;
     bool shouldSuspendScrollAnimations() const final;
     IntRect scrollableAreaBoundingBox(bool* isInsideFixed = nullptr) const final;
index 341e881..0466cba 100644 (file)
@@ -856,9 +856,9 @@ IntSize RenderListBox::contentsSize() const
     return IntSize(scrollWidth(), scrollHeight());
 }
 
-IntPoint RenderListBox::lastKnownMousePosition() const
+IntPoint RenderListBox::lastKnownMousePositionInView() const
 {
-    return view().frameView().lastKnownMousePosition();
+    return view().frameView().lastKnownMousePositionInView();
 }
 
 bool RenderListBox::isHandlingWheelEvent() const
index 5f0261a..cc93409 100644 (file)
@@ -130,7 +130,7 @@ private:
     Scrollbar* verticalScrollbar() const final { return m_vBar.get(); }
     IntSize contentsSize() const final;
     IntSize visibleSize() const final { return IntSize(width(), height()); }
-    IntPoint lastKnownMousePosition() const final;
+    IntPoint lastKnownMousePositionInView() const final;
     bool isHandlingWheelEvent() const final;
     bool shouldSuspendScrollAnimations() const final;
     bool forceUpdateScrollbarsOnMainThreadForPerformanceTesting() const final;
index 920d090..2e7dda2 100644 (file)
@@ -1,3 +1,16 @@
+2020-04-30  Simon Fraser  <simon.fraser@apple.com>
+
+        Clean up some EventHandler coordinate-related naming and fix ScrollableArea::lastKnownMousePosition() conversions
+        https://bugs.webkit.org/show_bug.cgi?id=211259
+
+        Reviewed by Zalan Bujtas.
+
+        * Shared/WebEvent.h:
+        (WebKit::WebMouseEvent::position const):
+        * Shared/WebMouseEvent.cpp:
+        (WebKit::WebMouseEvent::WebMouseEvent):
+        * WebProcess/Plugins/PDF/PDFPlugin.h:
+
 2020-04-30  David Kilzer  <ddkilzer@apple.com>
 
         [iOS] Fix confusing idiom for releasing _selectionRects in -[WKTextRange dealloc]
index ba5c59e..6a08e5b 100644 (file)
@@ -140,14 +140,14 @@ public:
     WebMouseEvent();
 
 #if PLATFORM(MAC)
-    WebMouseEvent(Type, Button, unsigned short buttons, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, OptionSet<Modifier>, WallTime timestamp, double force, SyntheticClickType = NoTap, int eventNumber = -1, int menuType = 0);
+    WebMouseEvent(Type, Button, unsigned short buttons, const WebCore::IntPoint& positionInView, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, OptionSet<Modifier>, WallTime timestamp, double force, SyntheticClickType = NoTap, int eventNumber = -1, int menuType = 0);
 #else
-    WebMouseEvent(Type, Button, unsigned short buttons, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, OptionSet<Modifier>, WallTime timestamp, double force = 0, SyntheticClickType = NoTap);
+    WebMouseEvent(Type, Button, unsigned short buttons, const WebCore::IntPoint& positionInView, const WebCore::IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, OptionSet<Modifier>, WallTime timestamp, double force = 0, SyntheticClickType = NoTap);
 #endif
 
     Button button() const { return static_cast<Button>(m_button); }
     unsigned short buttons() const { return m_buttons; }
-    const WebCore::IntPoint& position() const { return m_position; }
+    const WebCore::IntPoint& position() const { return m_position; } // Relative to the view.
     const WebCore::IntPoint& globalPosition() const { return m_globalPosition; }
     float deltaX() const { return m_deltaX; }
     float deltaY() const { return m_deltaY; }
@@ -168,7 +168,7 @@ private:
 
     uint32_t m_button { static_cast<uint32_t>(NoButton) };
     unsigned short m_buttons { 0 };
-    WebCore::IntPoint m_position;
+    WebCore::IntPoint m_position; // Relative to the view.
     WebCore::IntPoint m_globalPosition;
     float m_deltaX { 0 };
     float m_deltaY { 0 };
index b9f06bd..7b270dc 100644 (file)
@@ -34,14 +34,14 @@ using namespace WebCore;
 WebMouseEvent::WebMouseEvent() = default;
 
 #if PLATFORM(MAC)
-WebMouseEvent::WebMouseEvent(Type type, Button button, unsigned short buttons, const IntPoint& position, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, OptionSet<Modifier> modifiers, WallTime timestamp, double force, SyntheticClickType syntheticClickType, int eventNumber, int menuType)
+WebMouseEvent::WebMouseEvent(Type type, Button button, unsigned short buttons, const IntPoint& positionInView, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, OptionSet<Modifier> modifiers, WallTime timestamp, double force, SyntheticClickType syntheticClickType, int eventNumber, int menuType)
 #else
-WebMouseEvent::WebMouseEvent(Type type, Button button, unsigned short buttons, const IntPoint& position, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, OptionSet<Modifier> modifiers, WallTime timestamp, double force, SyntheticClickType syntheticClickType)
+WebMouseEvent::WebMouseEvent(Type type, Button button, unsigned short buttons, const IntPoint& positionInView, const IntPoint& globalPosition, float deltaX, float deltaY, float deltaZ, int clickCount, OptionSet<Modifier> modifiers, WallTime timestamp, double force, SyntheticClickType syntheticClickType)
 #endif
     : WebEvent(type, modifiers, timestamp)
     , m_button(button)
     , m_buttons(buttons)
-    , m_position(position)
+    , m_position(positionInView)
     , m_globalPosition(globalPosition)
     , m_deltaX(deltaX)
     , m_deltaY(deltaY)
index 1c1fc86..03975ce 100644 (file)
@@ -230,7 +230,7 @@ private:
     void setScrollOffset(const WebCore::ScrollOffset&) final;
     void invalidateScrollbarRect(WebCore::Scrollbar&, const WebCore::IntRect&) final;
     void invalidateScrollCornerRect(const WebCore::IntRect&) final;
-    WebCore::IntPoint lastKnownMousePosition() const final { return m_lastMousePositionInPluginCoordinates; }
+    WebCore::IntPoint lastKnownMousePositionInView() const final { return m_lastMousePositionInPluginCoordinates; }
     bool isActive() const final;
     bool isScrollCornerVisible() const final { return false; }
     WebCore::ScrollPosition scrollPosition() const final;