Changeset 286713 in webkit
- Timestamp:
- Dec 8, 2021, 1:25:18 PM (5 years ago)
- Location:
- branches/safari-612.4.2.1-branch/Source
- Files:
-
- 10 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/PAL/pal/spi/mac/IOKitSPIMac.h (modified) (1 diff)
-
WebCore/platform/PlatformWheelEvent.cpp (modified) (1 diff)
-
WebCore/platform/PlatformWheelEvent.h (modified) (2 diffs)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/Shared/WebEventConversion.cpp (modified) (1 diff)
-
WebKit/Shared/WebWheelEvent.cpp (modified) (4 diffs)
-
WebKit/Shared/WebWheelEvent.h (modified) (3 diffs)
-
WebKit/Shared/WebWheelEventCoalescer.cpp (modified) (1 diff)
-
WebKit/Shared/mac/WebEventFactory.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-612.4.2.1-branch/Source/WebCore/ChangeLog
r286712 r286713 1 2021-12-01 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r286270. rdar://problem/85928816 4 5 Plumb raw platform scrolling deltas along in wheel events 6 https://bugs.webkit.org/show_bug.cgi?id=233583 7 8 Reviewed by Simon Fraser. 9 10 Source/WebCore: 11 12 * platform/PlatformWheelEvent.cpp: 13 (WebCore::PlatformWheelEvent::createFromGesture): 14 * platform/PlatformWheelEvent.h: 15 (WebCore::PlatformWheelEvent::rawPlatformDelta const): 16 * PAL/pal/spi/mac/IOKitSPIMac.h: 17 18 Source/WebKit: 19 20 * Shared/WebEventConversion.cpp: 21 (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent): 22 * Shared/WebWheelEvent.cpp: 23 (WebKit::WebWheelEvent::WebWheelEvent): 24 (WebKit::WebWheelEvent::encode const): 25 (WebKit::WebWheelEvent::decode): 26 * Shared/WebWheelEvent.h: 27 (WebKit::WebWheelEvent::rawPlatformDelta const): 28 * Shared/WebWheelEventCoalescer.cpp: 29 (WebKit::WebWheelEventCoalescer::coalesce): 30 * Shared/mac/WebEventFactory.mm: 31 (WebKit::WebEventFactory::createWebWheelEvent): 32 Extract and plumb raw unaccelerated (in the HID sense) deltas in scroll 33 events for use in a future patch. 34 35 36 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@286270 268f45cc-cd09-0410-ab3c-d52691b4dbfc 37 38 2021-11-29 Tim Horton <timothy_horton@apple.com> 39 40 Plumb raw platform scrolling deltas along in wheel events 41 https://bugs.webkit.org/show_bug.cgi?id=233583 42 43 Reviewed by Simon Fraser. 44 45 * platform/PlatformWheelEvent.cpp: 46 (WebCore::PlatformWheelEvent::createFromGesture): 47 * platform/PlatformWheelEvent.h: 48 (WebCore::PlatformWheelEvent::rawPlatformDelta const): 49 * PAL/pal/spi/mac/IOKitSPIMac.h: 50 1 51 2021-12-01 Alan Coon <alancoon@apple.com> 2 52 -
branches/safari-612.4.2.1-branch/Source/WebCore/PAL/pal/spi/mac/IOKitSPIMac.h
r286712 r286713 84 84 typedef uint32_t IOHIDEventType; 85 85 86 typedef uint32_t IOHIDEventField; 87 88 #ifdef __LP64__ 89 typedef double IOHIDFloat; 90 #else 91 typedef float IOHIDFloat; 92 #endif 93 94 #define IOHIDEventFieldBase(type) (type << 16) 95 96 #define kIOHIDEventFieldScrollBase IOHIDEventFieldBase(kIOHIDEventTypeScroll) 97 static const IOHIDEventField kIOHIDEventFieldScrollX = (kIOHIDEventFieldScrollBase | 0); 98 static const IOHIDEventField kIOHIDEventFieldScrollY = (kIOHIDEventFieldScrollBase | 1); 99 86 100 uint64_t IOHIDEventGetTimeStamp(IOHIDEventRef); 101 IOHIDFloat IOHIDEventGetFloatValue(IOHIDEventRef, IOHIDEventField); 87 102 88 103 WTF_EXTERN_C_END -
branches/safari-612.4.2.1-branch/Source/WebCore/platform/PlatformWheelEvent.cpp
r286712 r286713 77 77 #if PLATFORM(COCOA) 78 78 platformWheelEvent.m_ioHIDEventTimestamp = platformWheelEvent.m_timestamp; 79 platformWheelEvent.m_rawPlatformDelta = platformWheelEvent.m_rawPlatformDelta; 79 80 platformWheelEvent.m_unacceleratedScrollingDeltaY = deltaY; 80 81 #endif // PLATFORM(COCOA) -
branches/safari-612.4.2.1-branch/Source/WebCore/platform/PlatformWheelEvent.h
r286712 r286713 155 155 156 156 WallTime ioHIDEventTimestamp() const { return m_ioHIDEventTimestamp; } 157 158 std::optional<FloatSize> rawPlatformDelta() const { return m_rawPlatformDelta; } 157 159 #endif 158 160 … … 204 206 #if PLATFORM(COCOA) 205 207 WallTime m_ioHIDEventTimestamp; 208 std::optional<FloatSize> m_rawPlatformDelta; 206 209 unsigned m_scrollCount { 0 }; 207 210 float m_unacceleratedScrollingDeltaX { 0 }; -
branches/safari-612.4.2.1-branch/Source/WebKit/ChangeLog
r286712 r286713 1 2021-12-01 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r286270. rdar://problem/85928816 4 5 Plumb raw platform scrolling deltas along in wheel events 6 https://bugs.webkit.org/show_bug.cgi?id=233583 7 8 Reviewed by Simon Fraser. 9 10 Source/WebCore: 11 12 * platform/PlatformWheelEvent.cpp: 13 (WebCore::PlatformWheelEvent::createFromGesture): 14 * platform/PlatformWheelEvent.h: 15 (WebCore::PlatformWheelEvent::rawPlatformDelta const): 16 * PAL/pal/spi/mac/IOKitSPIMac.h: 17 18 Source/WebKit: 19 20 * Shared/WebEventConversion.cpp: 21 (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent): 22 * Shared/WebWheelEvent.cpp: 23 (WebKit::WebWheelEvent::WebWheelEvent): 24 (WebKit::WebWheelEvent::encode const): 25 (WebKit::WebWheelEvent::decode): 26 * Shared/WebWheelEvent.h: 27 (WebKit::WebWheelEvent::rawPlatformDelta const): 28 * Shared/WebWheelEventCoalescer.cpp: 29 (WebKit::WebWheelEventCoalescer::coalesce): 30 * Shared/mac/WebEventFactory.mm: 31 (WebKit::WebEventFactory::createWebWheelEvent): 32 Extract and plumb raw unaccelerated (in the HID sense) deltas in scroll 33 events for use in a future patch. 34 35 36 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@286270 268f45cc-cd09-0410-ab3c-d52691b4dbfc 37 38 2021-11-29 Tim Horton <timothy_horton@apple.com> 39 40 Plumb raw platform scrolling deltas along in wheel events 41 https://bugs.webkit.org/show_bug.cgi?id=233583 42 43 Reviewed by Simon Fraser. 44 45 * Shared/WebEventConversion.cpp: 46 (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent): 47 * Shared/WebWheelEvent.cpp: 48 (WebKit::WebWheelEvent::WebWheelEvent): 49 (WebKit::WebWheelEvent::encode const): 50 (WebKit::WebWheelEvent::decode): 51 * Shared/WebWheelEvent.h: 52 (WebKit::WebWheelEvent::rawPlatformDelta const): 53 * Shared/WebWheelEventCoalescer.cpp: 54 (WebKit::WebWheelEventCoalescer::coalesce): 55 * Shared/mac/WebEventFactory.mm: 56 (WebKit::WebEventFactory::createWebWheelEvent): 57 Extract and plumb raw unaccelerated (in the HID sense) deltas in scroll 58 events for use in a future patch. 59 1 60 2021-12-01 Alan Coon <alancoon@apple.com> 2 61 -
branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebEventConversion.cpp
r286712 r286713 171 171 #if PLATFORM(COCOA) 172 172 m_ioHIDEventTimestamp = webEvent.ioHIDEventTimestamp(); 173 m_rawPlatformDelta = webEvent.rawPlatformDelta(); 173 174 m_scrollCount = webEvent.scrollCount(); 174 175 m_unacceleratedScrollingDeltaX = webEvent.unacceleratedScrollingDelta().width(); -
branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEvent.cpp
r286712 r286713 45 45 46 46 #if PLATFORM(COCOA) 47 WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& delta, const FloatSize& wheelTicks, Granularity granularity, bool directionInvertedFromDevice, Phase phase, Phase momentumPhase, bool hasPreciseScrollingDeltas, uint32_t scrollCount, const WebCore::FloatSize& unacceleratedScrollingDelta, OptionSet<Modifier> modifiers, WallTime timestamp, WallTime ioHIDEventTimestamp )47 WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& delta, const FloatSize& wheelTicks, Granularity granularity, bool directionInvertedFromDevice, Phase phase, Phase momentumPhase, bool hasPreciseScrollingDeltas, uint32_t scrollCount, const WebCore::FloatSize& unacceleratedScrollingDelta, OptionSet<Modifier> modifiers, WallTime timestamp, WallTime ioHIDEventTimestamp, std::optional<WebCore::FloatSize> rawPlatformDelta) 48 48 : WebEvent(type, modifiers, timestamp) 49 49 , m_position(position) … … 57 57 , m_hasPreciseScrollingDeltas(hasPreciseScrollingDeltas) 58 58 , m_ioHIDEventTimestamp(ioHIDEventTimestamp) 59 , m_rawPlatformDelta(rawPlatformDelta) 59 60 , m_scrollCount(scrollCount) 60 61 , m_unacceleratedScrollingDelta(unacceleratedScrollingDelta) … … 95 96 #if PLATFORM(COCOA) 96 97 encoder << m_ioHIDEventTimestamp; 98 encoder << m_rawPlatformDelta; 97 99 encoder << m_scrollCount; 98 100 encoder << m_unacceleratedScrollingDelta; … … 127 129 if (!decoder.decode(t.m_ioHIDEventTimestamp)) 128 130 return false; 131 if (!decoder.decode(t.m_rawPlatformDelta)) 132 return false; 129 133 if (!decoder.decode(t.m_scrollCount)) 130 134 return false; -
branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEvent.h
r286712 r286713 54 54 WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, OptionSet<Modifier>, WallTime timestamp); 55 55 #if PLATFORM(COCOA) 56 WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, bool directionInvertedFromDevice, Phase, Phase momentumPhase, bool hasPreciseScrollingDeltas, uint32_t scrollCount, const WebCore::FloatSize& unacceleratedScrollingDelta, OptionSet<Modifier>, WallTime timestamp, WallTime ioHIDEventTimestamp );56 WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, bool directionInvertedFromDevice, Phase, Phase momentumPhase, bool hasPreciseScrollingDeltas, uint32_t scrollCount, const WebCore::FloatSize& unacceleratedScrollingDelta, OptionSet<Modifier>, WallTime timestamp, WallTime ioHIDEventTimestamp, std::optional<WebCore::FloatSize> rawPlatformDelta); 57 57 #elif PLATFORM(GTK) || USE(LIBWPE) 58 58 WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Phase, Phase momentumPhase, Granularity, bool hasPreciseScrollingDeltas, OptionSet<Modifier>, WallTime timestamp); … … 72 72 #if PLATFORM(COCOA) 73 73 WallTime ioHIDEventTimestamp() const { return m_ioHIDEventTimestamp; } 74 std::optional<WebCore::FloatSize> rawPlatformDelta() const { return m_rawPlatformDelta; } 74 75 uint32_t scrollCount() const { return m_scrollCount; } 75 76 const WebCore::FloatSize& unacceleratedScrollingDelta() const { return m_unacceleratedScrollingDelta; } … … 96 97 #if PLATFORM(COCOA) 97 98 WallTime m_ioHIDEventTimestamp; 99 std::optional<WebCore::FloatSize> m_rawPlatformDelta; 98 100 uint32_t m_scrollCount { 0 }; 99 101 WebCore::FloatSize m_unacceleratedScrollingDelta; -
branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEventCoalescer.cpp
r286712 r286713 78 78 #if PLATFORM(COCOA) 79 79 auto mergedUnacceleratedScrollingDelta = a.unacceleratedScrollingDelta() + b.unacceleratedScrollingDelta(); 80 std::optional<WebCore::FloatSize> mergedRawPlatformScrollingDelta; 81 if (a.rawPlatformDelta() && b.rawPlatformDelta()) 82 mergedRawPlatformScrollingDelta = a.rawPlatformDelta().value() + b.rawPlatformDelta().value(); 80 83 81 return WebWheelEvent(WebEvent::Wheel, b.position(), b.globalPosition(), mergedDelta, mergedWheelTicks, b.granularity(), b.directionInvertedFromDevice(), b.phase(), b.momentumPhase(), b.hasPreciseScrollingDeltas(), b.scrollCount(), mergedUnacceleratedScrollingDelta, b.modifiers(), b.timestamp(), b.ioHIDEventTimestamp() );84 return WebWheelEvent(WebEvent::Wheel, b.position(), b.globalPosition(), mergedDelta, mergedWheelTicks, b.granularity(), b.directionInvertedFromDevice(), b.phase(), b.momentumPhase(), b.hasPreciseScrollingDeltas(), b.scrollCount(), mergedUnacceleratedScrollingDelta, b.modifiers(), b.timestamp(), b.ioHIDEventTimestamp(), mergedRawPlatformScrollingDelta); 82 85 #elif PLATFORM(GTK) || USE(LIBWPE) 83 86 return WebWheelEvent(WebEvent::Wheel, b.position(), b.globalPosition(), mergedDelta, mergedWheelTicks, b.phase(), b.momentumPhase(), b.granularity(), b.hasPreciseScrollingDeltas(), b.modifiers(), b.timestamp()); -
branches/safari-612.4.2.1-branch/Source/WebKit/Shared/mac/WebEventFactory.mm
r286712 r286713 412 412 auto timestamp = WebCore::eventTimeStampSince1970(event.timestamp); 413 413 414 auto ioHIDEventTimestamp = [ ](NSEvent *event) {414 auto ioHIDEventTimestamp = [&]() { 415 415 auto cgEvent = event.CGEvent; 416 416 if (!cgEvent) 417 417 return event.timestamp; 418 418 419 auto io hidEvent = adoptCF(CGEventCopyIOHIDEvent(cgEvent));420 if (!io hidEvent)419 auto ioHIDEvent = adoptCF(CGEventCopyIOHIDEvent(cgEvent)); 420 if (!ioHIDEvent) 421 421 return event.timestamp; 422 422 423 auto ioHIDEventTimestamp = IOHIDEventGetTimeStamp(io hidEvent.get()); // IOEventRef timestamp is mach_absolute_time units.423 auto ioHIDEventTimestamp = IOHIDEventGetTimeStamp(ioHIDEvent.get()); // IOEventRef timestamp is mach_absolute_time units. 424 424 return MonotonicTime::fromMachAbsoluteTime(ioHIDEventTimestamp).secondsSinceEpoch().seconds(); 425 }(event); 425 }(); 426 427 auto rawPlatformDelta = [&]() -> std::optional<WebCore::FloatSize> { 428 auto cgEvent = event.CGEvent; 429 if (!cgEvent) 430 return std::nullopt; 431 432 auto ioHIDEvent = adoptCF(CGEventCopyIOHIDEvent(cgEvent)); 433 if (!ioHIDEvent) 434 return std::nullopt; 435 436 return { WebCore::FloatSize(-IOHIDEventGetFloatValue(ioHIDEvent.get(), kIOHIDEventFieldScrollX), -IOHIDEventGetFloatValue(ioHIDEvent.get(), kIOHIDEventFieldScrollY)) }; 437 }(); 426 438 427 439 auto ioHIDEventWallTime = WebCore::eventTimeStampSince1970(ioHIDEventTimestamp); … … 429 441 return WebWheelEvent(WebEvent::Wheel, WebCore::IntPoint(position), WebCore::IntPoint(globalPosition), WebCore::FloatSize(deltaX, deltaY), WebCore::FloatSize(wheelTicksX, wheelTicksY), 430 442 granularity, directionInvertedFromDevice, phase, momentumPhase, hasPreciseScrollingDeltas, 431 scrollCount, unacceleratedScrollingDelta, modifiers, timestamp, ioHIDEventWallTime );443 scrollCount, unacceleratedScrollingDelta, modifiers, timestamp, ioHIDEventWallTime, rawPlatformDelta); 432 444 } 433 445
Note:
See TracChangeset
for help on using the changeset viewer.