⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 285941 in webkit


Ignore:
Timestamp:
Nov 17, 2021, 11:14:31 AM (5 years ago)
Author:
Alan Coon
Message:

Cherry-pick r285790. rdar://problem/85512520

Attach IOHIDEvent timestamps to wheel events
https://bugs.webkit.org/show_bug.cgi?id=233051

Reviewed by Wenson Hsieh.
Source/WebCore:

On some macOS devices, there can be significant deltas between NSEvent timestamps,
and the timestamps on underlying IOHIDEvents (rdar://85309639). This makes momentum
velocity computation unpredictable; we can get better results by using IOHIDEvent
timestamps.

  • platform/PlatformWheelEvent.cpp: (WebCore::PlatformWheelEvent::createFromGesture):
  • platform/PlatformWheelEvent.h: (WebCore::PlatformWheelEvent::ioHIDEventTimestamp const):
  • platform/mac/PlatformEventFactoryMac.h:
  • platform/mac/PlatformEventFactoryMac.mm: (WebCore::eventTimeStampSince1970): (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder): (WebCore::PlatformWheelEventBuilder::PlatformWheelEventBuilder): (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):

Source/WebCore/PAL:

Expose a few bits of SPI needed.

  • pal/spi/cg/CoreGraphicsSPI.h:
  • pal/spi/cocoa/IOKitSPI.h:

Source/WebKit:

On some macOS devices, there can be significant deltas between NSEvent timestamps,
and the timestamps on underlying IOHIDEvents (rdar://85309639). This makes momentum
velocity computation unpredictable; we can get better results by using IOHIDEvent
timestamps.

  • Shared/WebEventConversion.cpp: (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
  • Shared/WebWheelEvent.cpp: (WebKit::WebWheelEvent::WebWheelEvent): (WebKit::WebWheelEvent::encode const): (WebKit::WebWheelEvent::decode):
  • Shared/WebWheelEvent.h: (WebKit::WebWheelEvent::ioHIDEventTimestamp const):
  • Shared/WebWheelEventCoalescer.cpp: (WebKit::WebWheelEventCoalescer::coalesce):
  • Shared/ios/WebIOSEventFactory.mm: (WebIOSEventFactory::createWebWheelEvent):
  • Shared/mac/NativeWebGestureEventMac.mm:
  • Shared/mac/WebEventFactory.mm: (WebKit::WebEventFactory::createWebMouseEvent): (WebKit::WebEventFactory::createWebWheelEvent): (WebKit::WebEventFactory::createWebKeyboardEvent):

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

Location:
branches/safari-613.1.9.0-branch/Source
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-613.1.9.0-branch/Source/WebCore/ChangeLog

    r285840 r285941  
     12021-11-17  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r285790. rdar://problem/85512520
     4
     5    Attach IOHIDEvent timestamps to wheel events
     6    https://bugs.webkit.org/show_bug.cgi?id=233051
     7   
     8    Reviewed by Wenson Hsieh.
     9    Source/WebCore:
     10   
     11    On some macOS devices, there can be significant deltas between NSEvent timestamps,
     12    and the timestamps on underlying IOHIDEvents (rdar://85309639). This makes momentum
     13    velocity computation unpredictable; we can get better results by using IOHIDEvent
     14    timestamps.
     15   
     16    * platform/PlatformWheelEvent.cpp:
     17    (WebCore::PlatformWheelEvent::createFromGesture):
     18    * platform/PlatformWheelEvent.h:
     19    (WebCore::PlatformWheelEvent::ioHIDEventTimestamp const):
     20    * platform/mac/PlatformEventFactoryMac.h:
     21    * platform/mac/PlatformEventFactoryMac.mm:
     22    (WebCore::eventTimeStampSince1970):
     23    (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
     24    (WebCore::PlatformWheelEventBuilder::PlatformWheelEventBuilder):
     25    (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
     26   
     27    Source/WebCore/PAL:
     28   
     29    Expose a few bits of SPI needed.
     30   
     31    * pal/spi/cg/CoreGraphicsSPI.h:
     32    * pal/spi/cocoa/IOKitSPI.h:
     33   
     34    Source/WebKit:
     35   
     36    On some macOS devices, there can be significant deltas between NSEvent timestamps,
     37    and the timestamps on underlying IOHIDEvents (rdar://85309639). This makes momentum
     38    velocity computation unpredictable; we can get better results by using IOHIDEvent
     39    timestamps.
     40   
     41    * Shared/WebEventConversion.cpp:
     42    (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
     43    * Shared/WebWheelEvent.cpp:
     44    (WebKit::WebWheelEvent::WebWheelEvent):
     45    (WebKit::WebWheelEvent::encode const):
     46    (WebKit::WebWheelEvent::decode):
     47    * Shared/WebWheelEvent.h:
     48    (WebKit::WebWheelEvent::ioHIDEventTimestamp const):
     49    * Shared/WebWheelEventCoalescer.cpp:
     50    (WebKit::WebWheelEventCoalescer::coalesce):
     51    * Shared/ios/WebIOSEventFactory.mm:
     52    (WebIOSEventFactory::createWebWheelEvent):
     53    * Shared/mac/NativeWebGestureEventMac.mm:
     54    * Shared/mac/WebEventFactory.mm:
     55    (WebKit::WebEventFactory::createWebMouseEvent):
     56    (WebKit::WebEventFactory::createWebWheelEvent):
     57    (WebKit::WebEventFactory::createWebKeyboardEvent):
     58   
     59   
     60    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285790 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     61
     62    2021-11-14  Simon Fraser  <simon.fraser@apple.com>
     63
     64            Attach IOHIDEvent timestamps to wheel events
     65            https://bugs.webkit.org/show_bug.cgi?id=233051
     66
     67            Reviewed by Wenson Hsieh.
     68
     69            On some macOS devices, there can be significant deltas between NSEvent timestamps,
     70            and the timestamps on underlying IOHIDEvents (rdar://85309639). This makes momentum
     71            velocity computation unpredictable; we can get better results by using IOHIDEvent
     72            timestamps.
     73
     74            * platform/PlatformWheelEvent.cpp:
     75            (WebCore::PlatformWheelEvent::createFromGesture):
     76            * platform/PlatformWheelEvent.h:
     77            (WebCore::PlatformWheelEvent::ioHIDEventTimestamp const):
     78            * platform/mac/PlatformEventFactoryMac.h:
     79            * platform/mac/PlatformEventFactoryMac.mm:
     80            (WebCore::eventTimeStampSince1970):
     81            (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
     82            (WebCore::PlatformWheelEventBuilder::PlatformWheelEventBuilder):
     83            (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
     84
    1852021-11-15  Russell Epstein  <repstein@apple.com>
    286
  • branches/safari-613.1.9.0-branch/Source/WebCore/PAL/ChangeLog

    r285845 r285941  
     12021-11-17  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r285790. rdar://problem/85512520
     4
     5    Attach IOHIDEvent timestamps to wheel events
     6    https://bugs.webkit.org/show_bug.cgi?id=233051
     7   
     8    Reviewed by Wenson Hsieh.
     9    Source/WebCore:
     10   
     11    On some macOS devices, there can be significant deltas between NSEvent timestamps,
     12    and the timestamps on underlying IOHIDEvents (rdar://85309639). This makes momentum
     13    velocity computation unpredictable; we can get better results by using IOHIDEvent
     14    timestamps.
     15   
     16    * platform/PlatformWheelEvent.cpp:
     17    (WebCore::PlatformWheelEvent::createFromGesture):
     18    * platform/PlatformWheelEvent.h:
     19    (WebCore::PlatformWheelEvent::ioHIDEventTimestamp const):
     20    * platform/mac/PlatformEventFactoryMac.h:
     21    * platform/mac/PlatformEventFactoryMac.mm:
     22    (WebCore::eventTimeStampSince1970):
     23    (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
     24    (WebCore::PlatformWheelEventBuilder::PlatformWheelEventBuilder):
     25    (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
     26   
     27    Source/WebCore/PAL:
     28   
     29    Expose a few bits of SPI needed.
     30   
     31    * pal/spi/cg/CoreGraphicsSPI.h:
     32    * pal/spi/cocoa/IOKitSPI.h:
     33   
     34    Source/WebKit:
     35   
     36    On some macOS devices, there can be significant deltas between NSEvent timestamps,
     37    and the timestamps on underlying IOHIDEvents (rdar://85309639). This makes momentum
     38    velocity computation unpredictable; we can get better results by using IOHIDEvent
     39    timestamps.
     40   
     41    * Shared/WebEventConversion.cpp:
     42    (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
     43    * Shared/WebWheelEvent.cpp:
     44    (WebKit::WebWheelEvent::WebWheelEvent):
     45    (WebKit::WebWheelEvent::encode const):
     46    (WebKit::WebWheelEvent::decode):
     47    * Shared/WebWheelEvent.h:
     48    (WebKit::WebWheelEvent::ioHIDEventTimestamp const):
     49    * Shared/WebWheelEventCoalescer.cpp:
     50    (WebKit::WebWheelEventCoalescer::coalesce):
     51    * Shared/ios/WebIOSEventFactory.mm:
     52    (WebIOSEventFactory::createWebWheelEvent):
     53    * Shared/mac/NativeWebGestureEventMac.mm:
     54    * Shared/mac/WebEventFactory.mm:
     55    (WebKit::WebEventFactory::createWebMouseEvent):
     56    (WebKit::WebEventFactory::createWebWheelEvent):
     57    (WebKit::WebEventFactory::createWebKeyboardEvent):
     58   
     59   
     60    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285790 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     61
     62    2021-11-14  Simon Fraser  <simon.fraser@apple.com>
     63
     64            Attach IOHIDEvent timestamps to wheel events
     65            https://bugs.webkit.org/show_bug.cgi?id=233051
     66
     67            Reviewed by Wenson Hsieh.
     68
     69            Expose a few bits of SPI needed.
     70
     71            * pal/spi/cg/CoreGraphicsSPI.h:
     72            * pal/spi/cocoa/IOKitSPI.h:
     73
    1742021-11-15  Russell Epstein  <repstein@apple.com>
    275
  • branches/safari-613.1.9.0-branch/Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h

    r283863 r285941  
    3333#endif
    3434
     35#if PLATFORM(MAC)
     36#include <pal/spi/cocoa/IOKitSPI.h>
     37#endif
     38
    3539#if USE(APPLE_INTERNAL_SDK)
    3640
     
    4347#if PLATFORM(MAC)
    4448#include <CoreGraphics/CGAccessibility.h>
     49#include <CoreGraphics/CGEventPrivate.h>
    4550#endif
    4651
     
    352357CGSDisplayID CGSMainDisplayID(void);
    353358
     359IOHIDEventRef CGEventCopyIOHIDEvent(CGEventRef);
    354360#endif // PLATFORM(MAC)
    355361
  • branches/safari-613.1.9.0-branch/Source/WebCore/PAL/pal/spi/mac/IOKitSPIMac.h

    r285786 r285941  
    4444
    4545WTF_EXTERN_C_BEGIN
     46
     47typedef struct __IOHIDEvent * IOHIDEventRef;
    4648typedef struct CF_BRIDGED_TYPE(id) __IOHIDServiceClient * IOHIDServiceClientRef;
    4749typedef struct CF_BRIDGED_TYPE(id) __IOHIDEventSystemClient * IOHIDEventSystemClientRef;
     
    8284typedef uint32_t IOHIDEventType;
    8385
     86uint64_t IOHIDEventGetTimeStamp(IOHIDEventRef);
     87
    8488WTF_EXTERN_C_END
    8589
  • branches/safari-613.1.9.0-branch/Source/WebCore/platform/PlatformWheelEvent.cpp

    r285787 r285941  
    7676
    7777#if PLATFORM(COCOA)
     78    platformWheelEvent.m_ioHIDEventTimestamp = platformWheelEvent.m_timestamp;
    7879    platformWheelEvent.m_unacceleratedScrollingDeltaY = deltaY;
    7980#endif // PLATFORM(COCOA)
  • branches/safari-613.1.9.0-branch/Source/WebCore/platform/PlatformWheelEvent.h

    r285367 r285941  
    152152    unsigned scrollCount() const { return m_scrollCount; }
    153153    FloatSize unacceleratedScrollingDelta() const { return { m_unacceleratedScrollingDeltaX, m_unacceleratedScrollingDeltaY }; }
     154   
     155    WallTime ioHIDEventTimestamp() const { return m_ioHIDEventTimestamp; }
    154156#endif
    155157
     
    200202#endif
    201203#if PLATFORM(COCOA)
     204    WallTime m_ioHIDEventTimestamp;
    202205    unsigned m_scrollCount { 0 };
    203206    float m_unacceleratedScrollingDeltaX { 0 };
  • branches/safari-613.1.9.0-branch/Source/WebCore/platform/mac/PlatformEventFactoryMac.h

    r235158 r285941  
    5151WEBCORE_EXPORT String keyForKeyEvent(NSEvent *);
    5252WEBCORE_EXPORT String codeForKeyEvent(NSEvent *);
    53 WEBCORE_EXPORT WallTime eventTimeStampSince1970(NSEvent *);
     53WEBCORE_EXPORT WallTime eventTimeStampSince1970(NSTimeInterval);
    5454
    5555WEBCORE_EXPORT OptionSet<PlatformEvent::Modifier> modifiersForEvent(NSEvent *);
  • branches/safari-613.1.9.0-branch/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm

    r279059 r285941  
    608608}
    609609
    610 WallTime eventTimeStampSince1970(NSEvent* event)
    611 {
    612     return WallTime::fromRawSeconds(static_cast<double>(cachedStartupTimeIntervalSince1970() + [event timestamp]));
     610WallTime eventTimeStampSince1970(NSTimeInterval timestamp)
     611{
     612    return WallTime::fromRawSeconds(static_cast<double>(cachedStartupTimeIntervalSince1970() + timestamp));
    613613}
    614614
     
    721721
    722722        m_modifiers = modifiersForEvent(event);
    723         m_timestamp = eventTimeStampSince1970(event);
     723        m_timestamp = eventTimeStampSince1970(event.timestamp);
    724724
    725725        // PlatformMouseEvent
     
    756756        m_type = PlatformEvent::Wheel;
    757757        m_modifiers = modifiersForEvent(event);
    758         m_timestamp = eventTimeStampSince1970(event);
     758        m_timestamp = eventTimeStampSince1970(event.timestamp);
    759759
    760760        // PlatformWheelEvent
     
    795795        m_type = isKeyUpEvent(event) ? PlatformEvent::KeyUp : PlatformEvent::KeyDown;
    796796        m_modifiers = modifiersForEvent(event);
    797         m_timestamp = eventTimeStampSince1970(event);
     797        m_timestamp = eventTimeStampSince1970(event.timestamp);
    798798
    799799        // PlatformKeyboardEvent
  • branches/safari-613.1.9.0-branch/Source/WebKit/ChangeLog

    r285903 r285941  
     12021-11-17  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r285790. rdar://problem/85512520
     4
     5    Attach IOHIDEvent timestamps to wheel events
     6    https://bugs.webkit.org/show_bug.cgi?id=233051
     7   
     8    Reviewed by Wenson Hsieh.
     9    Source/WebCore:
     10   
     11    On some macOS devices, there can be significant deltas between NSEvent timestamps,
     12    and the timestamps on underlying IOHIDEvents (rdar://85309639). This makes momentum
     13    velocity computation unpredictable; we can get better results by using IOHIDEvent
     14    timestamps.
     15   
     16    * platform/PlatformWheelEvent.cpp:
     17    (WebCore::PlatformWheelEvent::createFromGesture):
     18    * platform/PlatformWheelEvent.h:
     19    (WebCore::PlatformWheelEvent::ioHIDEventTimestamp const):
     20    * platform/mac/PlatformEventFactoryMac.h:
     21    * platform/mac/PlatformEventFactoryMac.mm:
     22    (WebCore::eventTimeStampSince1970):
     23    (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
     24    (WebCore::PlatformWheelEventBuilder::PlatformWheelEventBuilder):
     25    (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
     26   
     27    Source/WebCore/PAL:
     28   
     29    Expose a few bits of SPI needed.
     30   
     31    * pal/spi/cg/CoreGraphicsSPI.h:
     32    * pal/spi/cocoa/IOKitSPI.h:
     33   
     34    Source/WebKit:
     35   
     36    On some macOS devices, there can be significant deltas between NSEvent timestamps,
     37    and the timestamps on underlying IOHIDEvents (rdar://85309639). This makes momentum
     38    velocity computation unpredictable; we can get better results by using IOHIDEvent
     39    timestamps.
     40   
     41    * Shared/WebEventConversion.cpp:
     42    (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
     43    * Shared/WebWheelEvent.cpp:
     44    (WebKit::WebWheelEvent::WebWheelEvent):
     45    (WebKit::WebWheelEvent::encode const):
     46    (WebKit::WebWheelEvent::decode):
     47    * Shared/WebWheelEvent.h:
     48    (WebKit::WebWheelEvent::ioHIDEventTimestamp const):
     49    * Shared/WebWheelEventCoalescer.cpp:
     50    (WebKit::WebWheelEventCoalescer::coalesce):
     51    * Shared/ios/WebIOSEventFactory.mm:
     52    (WebIOSEventFactory::createWebWheelEvent):
     53    * Shared/mac/NativeWebGestureEventMac.mm:
     54    * Shared/mac/WebEventFactory.mm:
     55    (WebKit::WebEventFactory::createWebMouseEvent):
     56    (WebKit::WebEventFactory::createWebWheelEvent):
     57    (WebKit::WebEventFactory::createWebKeyboardEvent):
     58   
     59   
     60    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285790 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     61
     62    2021-11-14  Simon Fraser  <simon.fraser@apple.com>
     63
     64            Attach IOHIDEvent timestamps to wheel events
     65            https://bugs.webkit.org/show_bug.cgi?id=233051
     66
     67            Reviewed by Wenson Hsieh.
     68
     69            On some macOS devices, there can be significant deltas between NSEvent timestamps,
     70            and the timestamps on underlying IOHIDEvents (rdar://85309639). This makes momentum
     71            velocity computation unpredictable; we can get better results by using IOHIDEvent
     72            timestamps.
     73
     74            * Shared/WebEventConversion.cpp:
     75            (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
     76            * Shared/WebWheelEvent.cpp:
     77            (WebKit::WebWheelEvent::WebWheelEvent):
     78            (WebKit::WebWheelEvent::encode const):
     79            (WebKit::WebWheelEvent::decode):
     80            * Shared/WebWheelEvent.h:
     81            (WebKit::WebWheelEvent::ioHIDEventTimestamp const):
     82            * Shared/WebWheelEventCoalescer.cpp:
     83            (WebKit::WebWheelEventCoalescer::coalesce):
     84            * Shared/ios/WebIOSEventFactory.mm:
     85            (WebIOSEventFactory::createWebWheelEvent):
     86            * Shared/mac/NativeWebGestureEventMac.mm:
     87            * Shared/mac/WebEventFactory.mm:
     88            (WebKit::WebEventFactory::createWebMouseEvent):
     89            (WebKit::WebEventFactory::createWebWheelEvent):
     90            (WebKit::WebEventFactory::createWebKeyboardEvent):
     91
    1922021-11-16  Russell Epstein  <repstein@apple.com>
    293
  • branches/safari-613.1.9.0-branch/Source/WebKit/Shared/WebEventConversion.cpp

    r281610 r285941  
    170170#endif
    171171#if PLATFORM(COCOA)
     172        m_ioHIDEventTimestamp = webEvent.ioHIDEventTimestamp();
    172173        m_scrollCount = webEvent.scrollCount();
    173174        m_unacceleratedScrollingDeltaX = webEvent.unacceleratedScrollingDelta().width();
  • branches/safari-613.1.9.0-branch/Source/WebKit/Shared/WebWheelEvent.cpp

    r268522 r285941  
    4545
    4646#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)
     47WebWheelEvent::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)
    4848    : WebEvent(type, modifiers, timestamp)
    4949    , m_position(position)
     
    5656    , m_directionInvertedFromDevice(directionInvertedFromDevice)
    5757    , m_hasPreciseScrollingDeltas(hasPreciseScrollingDeltas)
     58    , m_ioHIDEventTimestamp(ioHIDEventTimestamp)
    5859    , m_scrollCount(scrollCount)
    5960    , m_unacceleratedScrollingDelta(unacceleratedScrollingDelta)
     
    9394#endif
    9495#if PLATFORM(COCOA)
     96    encoder << m_ioHIDEventTimestamp;
    9597    encoder << m_scrollCount;
    9698    encoder << m_unacceleratedScrollingDelta;
     
    123125#endif
    124126#if PLATFORM(COCOA)
     127    if (!decoder.decode(t.m_ioHIDEventTimestamp))
     128        return false;
    125129    if (!decoder.decode(t.m_scrollCount))
    126130        return false;
  • branches/safari-613.1.9.0-branch/Source/WebKit/Shared/WebWheelEvent.h

    r268522 r285941  
    5454    WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, OptionSet<Modifier>, WallTime timestamp);
    5555#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);
     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);
    5757#elif PLATFORM(GTK) || USE(LIBWPE)
    5858    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);
     
    7171#endif
    7272#if PLATFORM(COCOA)
     73    WallTime ioHIDEventTimestamp() const { return m_ioHIDEventTimestamp; }
    7374    uint32_t scrollCount() const { return m_scrollCount; }
    7475    const WebCore::FloatSize& unacceleratedScrollingDelta() const { return m_unacceleratedScrollingDelta; }
     
    8889    uint32_t m_phase { Phase::PhaseNone };
    8990    uint32_t m_momentumPhase { Phase::PhaseNone };
     91
    9092    bool m_directionInvertedFromDevice { false };
    9193#if PLATFORM(COCOA) || PLATFORM(GTK) || USE(LIBWPE)
     
    9395#endif
    9496#if PLATFORM(COCOA)
     97    WallTime m_ioHIDEventTimestamp;
    9598    uint32_t m_scrollCount { 0 };
    9699    WebCore::FloatSize m_unacceleratedScrollingDelta;
  • branches/safari-613.1.9.0-branch/Source/WebKit/Shared/WebWheelEventCoalescer.cpp

    r285165 r285941  
    7979    auto mergedUnacceleratedScrollingDelta = a.unacceleratedScrollingDelta() + b.unacceleratedScrollingDelta();
    8080
    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());
     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());
    8282#elif PLATFORM(GTK) || USE(LIBWPE)
    8383    return WebWheelEvent(WebEvent::Wheel, b.position(), b.globalPosition(), mergedDelta, mergedWheelTicks, b.phase(), b.momentumPhase(), b.granularity(), b.hasPreciseScrollingDeltas(), b.modifiers(), b.timestamp());
  • branches/safari-613.1.9.0-branch/Source/WebKit/Shared/ios/WebIOSEventFactory.mm

    r278253 r285941  
    162162    WebCore::FloatSize wheelTicks = delta;
    163163    wheelTicks.scale(1. / static_cast<float>(WebCore::Scrollbar::pixelsPerLineStep()));
    164 
     164    auto timestamp = MonotonicTime::fromRawSeconds(event.timestamp).approximateWallTime();
    165165    return {
    166166        WebKit::WebEvent::Wheel,
     
    177177        delta,
    178178        { },
    179         MonotonicTime::fromRawSeconds(event.timestamp).approximateWallTime()
     179        timestamp,
     180        timestamp
    180181    };
    181182}
  • branches/safari-613.1.9.0-branch/Source/WebKit/Shared/mac/NativeWebGestureEventMac.mm

    r267916 r285941  
    6363        webEventTypeForNSEvent(event),
    6464        OptionSet<WebEvent::Modifier> { },
    65         WebCore::eventTimeStampSince1970(event),
     65        WebCore::eventTimeStampSince1970(event.timestamp),
    6666        WebCore::IntPoint(pointForEvent(event, view)),
    6767        event.type == NSEventTypeMagnify ? event.magnification : 0,
  • branches/safari-613.1.9.0-branch/Source/WebKit/Shared/mac/WebEventFactory.mm

    r242325 r285941  
    3333#import <WebCore/Scrollbar.h>
    3434#import <WebCore/WindowsKeyboardCodes.h>
     35#import <pal/spi/cg/CoreGraphicsSPI.h>
    3536#import <pal/spi/mac/NSMenuSPI.h>
    3637#import <wtf/ASCIICType.h>
     
    354355    int clickCount = clickCountForEvent(event);
    355356    auto modifiers = modifiersForEvent(event);
    356     auto timestamp = WebCore::eventTimeStampSince1970(event);
     357    auto timestamp = WebCore::eventTimeStampSince1970(event.timestamp);
    357358    int eventNumber = [event eventNumber];
    358359    int menuTypeForEvent = typeForEvent(event);
     
    409410
    410411    auto modifiers = modifiersForEvent(event);
    411     auto timestamp = WebCore::eventTimeStampSince1970(event);
    412 
    413     return WebWheelEvent(WebEvent::Wheel, WebCore::IntPoint(position), WebCore::IntPoint(globalPosition), WebCore::FloatSize(deltaX, deltaY), WebCore::FloatSize(wheelTicksX, wheelTicksY), granularity, directionInvertedFromDevice, phase, momentumPhase, hasPreciseScrollingDeltas, scrollCount, unacceleratedScrollingDelta, modifiers, timestamp);
     412    auto timestamp = WebCore::eventTimeStampSince1970(event.timestamp);
     413
     414    auto ioHIDEventTimestamp = [](NSEvent *event) {
     415        auto cgEvent = event.CGEvent;
     416        if (!cgEvent)
     417            return event.timestamp;
     418
     419        auto iohidEvent = adoptCF(CGEventCopyIOHIDEvent(cgEvent));
     420        if (!iohidEvent)
     421            return event.timestamp;
     422
     423        auto ioHIDEventTimestamp = IOHIDEventGetTimeStamp(iohidEvent.get()); // IOEventRef timestamp is mach_absolute_time units.
     424        return MonotonicTime::fromMachAbsoluteTime(ioHIDEventTimestamp).secondsSinceEpoch().seconds();
     425    }(event);
     426
     427    auto ioHIDEventWallTime = WebCore::eventTimeStampSince1970(ioHIDEventTimestamp);
     428
     429    return WebWheelEvent(WebEvent::Wheel, WebCore::IntPoint(position), WebCore::IntPoint(globalPosition), WebCore::FloatSize(deltaX, deltaY), WebCore::FloatSize(wheelTicksX, wheelTicksY),
     430        granularity, directionInvertedFromDevice, phase, momentumPhase, hasPreciseScrollingDeltas,
     431        scrollCount, unacceleratedScrollingDelta, modifiers, timestamp, ioHIDEventWallTime);
    414432}
    415433
     
    429447    bool isSystemKey                = false; // SystemKey is always false on the Mac.
    430448    auto modifiers = modifiersForEvent(event);
    431     auto timestamp                  = WebCore::eventTimeStampSince1970(event);
     449    auto timestamp                  = WebCore::eventTimeStampSince1970(event.timestamp);
    432450
    433451    // Always use 13 for Enter/Return -- we don't want to use AppKit's different character for Enter.
Note: See TracChangeset for help on using the changeset viewer.