Changeset 279059 in webkit
- Timestamp:
- Jun 20, 2021 2:31:34 PM (13 months ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/page/EventHandler.cpp (modified) (1 diff)
-
WebCore/platform/PlatformMouseEvent.h (modified) (2 diffs)
-
WebCore/platform/mac/PlatformEventFactoryMac.mm (modified) (1 diff)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/Shared/WebEventConversion.cpp (modified) (1 diff)
-
WebKit/UIProcess/ios/WKMouseGestureRecognizer.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r279057 r279059 1 2021-06-20 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [Live Text] Mouse events should only trigger text recognition if the cursor is moving 4 https://bugs.webkit.org/show_bug.cgi?id=227181 5 rdar://79469827 6 7 Reviewed by Tim Horton. 8 9 Make a slight adjustment to how we trigger the text recognition timer when hovering over images; instead of 10 allowing any non-synthetic mouse event to kick off the timer, limit it to only mouse events with horizontal or 11 vertical movement deltas. 12 13 To implement this, we remove some `ENABLE(POINTER_LOCK)` guards around PlatformMouseEvent's movement delta, and 14 check whether the movement delta is nonzero in EventHandler when determining whether to start the text 15 recognition timer. 16 17 * page/EventHandler.cpp: 18 (WebCore::EventHandler::updateMouseEventTargetNode): 19 20 Check for a nonzero movement delta in place of the synthetic click type; since all synthetic mouse events are 21 created with no horizontal or vertical delta, since new movement delta check obviates the need for checking the 22 synthetic click type. 23 24 Additionally, we invert the conditional here so that if any mouse events are detected over content that is not 25 an image, we'll immediately stop the timer; however, if the mouse event is over an image, we'll only kick off 26 the timer if the movement delta is additionally nonzero. 27 28 * platform/PlatformMouseEvent.h: 29 (WebCore::PlatformMouseEvent::globalPosition const): 30 (WebCore::PlatformMouseEvent::movementDelta const): 31 * platform/mac/PlatformEventFactoryMac.mm: 32 (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder): 33 1 34 2021-06-20 Alan Bujtas <zalan@apple.com> 2 35 -
trunk/Source/WebCore/page/EventHandler.cpp
r278964 r279059 2541 2541 2542 2542 #if ENABLE(IMAGE_ANALYSIS) 2543 if (platformMouseEvent.syntheticClickType() == NoTap) { 2544 if (m_elementUnderMouse && is<RenderImage>(m_elementUnderMouse->renderer())) 2545 m_textRecognitionHoverTimer.restart(); 2546 else 2547 m_textRecognitionHoverTimer.stop(); 2548 } 2543 if (!m_elementUnderMouse || !is<RenderImage>(m_elementUnderMouse->renderer())) 2544 m_textRecognitionHoverTimer.stop(); 2545 else if (!platformMouseEvent.movementDelta().isZero()) 2546 m_textRecognitionHoverTimer.restart(); 2549 2547 #endif // ENABLE(IMAGE_ANALYSIS) 2550 2548 -
trunk/Source/WebCore/platform/PlatformMouseEvent.h
r270582 r279059 66 66 const IntPoint& position() const { return m_position; } 67 67 const IntPoint& globalPosition() const { return m_globalPosition; } 68 #if ENABLE(POINTER_LOCK)69 68 const IntPoint& movementDelta() const { return m_movementDelta; } 70 #endif71 69 72 70 MouseButton button() const { return m_button; } … … 96 94 IntPoint m_position; 97 95 IntPoint m_globalPosition; 98 #if ENABLE(POINTER_LOCK)99 96 IntPoint m_movementDelta; 100 #endif101 97 double m_force { 0 }; 102 98 PointerID m_pointerId { mousePointerID }; -
trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm
r269659 r279059 729 729 m_buttons = currentlyPressedMouseButtons(); 730 730 m_clickCount = clickCountForEvent(event); 731 #if ENABLE(POINTER_LOCK)732 731 m_movementDelta = IntPoint(event.deltaX, event.deltaY); 733 #endif734 732 735 733 m_force = 0; -
trunk/Source/WebKit/ChangeLog
r279045 r279059 1 2021-06-20 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [Live Text] Mouse events should only trigger text recognition if the cursor is moving 4 https://bugs.webkit.org/show_bug.cgi?id=227181 5 rdar://79469827 6 7 Reviewed by Tim Horton. 8 9 Populate the `deltaX` and `deltaY` members of the platform mouse event on iOS, when using a trackpad. This 10 allows the adjusted logic in EventHandler to apply to iPadOS when using a trackpad as well (see WebCore 11 ChangeLog for more information). 12 13 * Shared/WebEventConversion.cpp: 14 (WebKit::WebKit2PlatformMouseEvent::WebKit2PlatformMouseEvent): 15 * UIProcess/ios/WKMouseGestureRecognizer.mm: 16 (-[WKMouseGestureRecognizer createMouseEventWithType:wasCancelled:]): 17 1 18 2021-06-18 Brent Fulgham <bfulgham@apple.com> 2 19 -
trunk/Source/WebKit/Shared/WebEventConversion.cpp
r270582 r279059 106 106 107 107 m_position = webEvent.position(); 108 #if ENABLE(POINTER_LOCK)109 108 m_movementDelta = WebCore::IntPoint(webEvent.deltaX(), webEvent.deltaY()); 110 #endif111 109 m_globalPosition = webEvent.globalPosition(); 112 110 m_clickCount = webEvent.clickCount(); -
trunk/Source/WebKit/UIProcess/ios/WKMouseGestureRecognizer.mm
r278727 r279059 121 121 122 122 WebCore::IntPoint point { [self locationInView:self.view] }; 123 123 auto delta = point - WebCore::IntPoint { [_currentTouch previousLocationInView:self.view] }; 124 124 // UITouch's timestamp uses mach_absolute_time as its timebase, same as MonotonicTime. 125 125 auto timestamp = MonotonicTime::fromRawSeconds([_currentTouch timestamp]).approximateWallTime(); 126 return WTF::makeUnique<WebKit::NativeWebMouseEvent>(type, button, buttons, point, point, 0, 0, 0, [_currentTouch tapCount], modifiers, timestamp, 0, cancelled ? WebKit::GestureWasCancelled::Yes : WebKit::GestureWasCancelled::No);126 return WTF::makeUnique<WebKit::NativeWebMouseEvent>(type, button, buttons, point, point, delta.width(), delta.height(), 0, [_currentTouch tapCount], modifiers, timestamp, 0, cancelled ? WebKit::GestureWasCancelled::Yes : WebKit::GestureWasCancelled::No); 127 127 } 128 128
Note: See TracChangeset
for help on using the changeset viewer.