Changeset 286270 in webkit
- Timestamp:
- Nov 29, 2021, 3:58:33 PM (5 years ago)
- Location:
- trunk/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
-
trunk/Source/WebCore/ChangeLog
r286265 r286270 1 2021-11-29 Tim Horton <timothy_horton@apple.com> 2 3 Plumb raw platform scrolling deltas along in wheel events 4 https://bugs.webkit.org/show_bug.cgi?id=233583 5 6 Reviewed by Simon Fraser. 7 8 * platform/PlatformWheelEvent.cpp: 9 (WebCore::PlatformWheelEvent::createFromGesture): 10 * platform/PlatformWheelEvent.h: 11 (WebCore::PlatformWheelEvent::rawPlatformDelta const): 12 * PAL/pal/spi/mac/IOKitSPIMac.h: 13 1 14 2021-11-29 Wenson Hsieh <wenson_hsieh@apple.com> 2 15 -
trunk/Source/WebCore/PAL/pal/spi/mac/IOKitSPIMac.h
r285790 r286270 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 -
trunk/Source/WebCore/platform/PlatformWheelEvent.cpp
r285790 r286270 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) -
trunk/Source/WebCore/platform/PlatformWheelEvent.h
r285953 r286270 161 161 162 162 WallTime ioHIDEventTimestamp() const { return m_ioHIDEventTimestamp; } 163 164 std::optional<FloatSize> rawPlatformDelta() const { return m_rawPlatformDelta; } 163 165 #endif 164 166 … … 210 212 #if PLATFORM(COCOA) 211 213 WallTime m_ioHIDEventTimestamp; 214 std::optional<FloatSize> m_rawPlatformDelta; 212 215 unsigned m_scrollCount { 0 }; 213 216 float m_unacceleratedScrollingDeltaX { 0 }; -
trunk/Source/WebKit/ChangeLog
r286267 r286270 1 2021-11-29 Tim Horton <timothy_horton@apple.com> 2 3 Plumb raw platform scrolling deltas along in wheel events 4 https://bugs.webkit.org/show_bug.cgi?id=233583 5 6 Reviewed by Simon Fraser. 7 8 * Shared/WebEventConversion.cpp: 9 (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent): 10 * Shared/WebWheelEvent.cpp: 11 (WebKit::WebWheelEvent::WebWheelEvent): 12 (WebKit::WebWheelEvent::encode const): 13 (WebKit::WebWheelEvent::decode): 14 * Shared/WebWheelEvent.h: 15 (WebKit::WebWheelEvent::rawPlatformDelta const): 16 * Shared/WebWheelEventCoalescer.cpp: 17 (WebKit::WebWheelEventCoalescer::coalesce): 18 * Shared/mac/WebEventFactory.mm: 19 (WebKit::WebEventFactory::createWebWheelEvent): 20 Extract and plumb raw unaccelerated (in the HID sense) deltas in scroll 21 events for use in a future patch. 22 1 23 2021-11-29 Chris Dumez <cdumez@apple.com> 2 24 -
trunk/Source/WebKit/Shared/WebEventConversion.cpp
r285790 r286270 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(); -
trunk/Source/WebKit/Shared/WebWheelEvent.cpp
r285790 r286270 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; -
trunk/Source/WebKit/Shared/WebWheelEvent.h
r285790 r286270 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; -
trunk/Source/WebKit/Shared/WebWheelEventCoalescer.cpp
r285790 r286270 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()); -
trunk/Source/WebKit/Shared/mac/WebEventFactory.mm
r285790 r286270 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.