<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[286712] branches/safari-612.4.2.1-branch/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/286712">286712</a></dd>
<dt>Author</dt> <dd>alancoon@apple.com</dd>
<dt>Date</dt> <dd>2021-12-08 13:25:12 -0800 (Wed, 08 Dec 2021)</dd>
</dl>
<h3>Log Message</h3>
<pre>Cherry-pick <a href="http://trac.webkit.org/projects/webkit/changeset/285790">r285790</a>. rdar://problem/85928816
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</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari612421branchSourceWebCoreChangeLog">branches/safari-612.4.2.1-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari612421branchSourceWebCorePALChangeLog">branches/safari-612.4.2.1-branch/Source/WebCore/PAL/ChangeLog</a></li>
<li><a href="#branchessafari612421branchSourceWebCorePALpalspicgCoreGraphicsSPIh">branches/safari-612.4.2.1-branch/Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h</a></li>
<li><a href="#branchessafari612421branchSourceWebCorePALpalspimacIOKitSPIMach">branches/safari-612.4.2.1-branch/Source/WebCore/PAL/pal/spi/mac/IOKitSPIMac.h</a></li>
<li><a href="#branchessafari612421branchSourceWebCoreplatformPlatformWheelEventcpp">branches/safari-612.4.2.1-branch/Source/WebCore/platform/PlatformWheelEvent.cpp</a></li>
<li><a href="#branchessafari612421branchSourceWebCoreplatformPlatformWheelEventh">branches/safari-612.4.2.1-branch/Source/WebCore/platform/PlatformWheelEvent.h</a></li>
<li><a href="#branchessafari612421branchSourceWebCoreplatformmacPlatformEventFactoryMach">branches/safari-612.4.2.1-branch/Source/WebCore/platform/mac/PlatformEventFactoryMac.h</a></li>
<li><a href="#branchessafari612421branchSourceWebCoreplatformmacPlatformEventFactoryMacmm">branches/safari-612.4.2.1-branch/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm</a></li>
<li><a href="#branchessafari612421branchSourceWebKitChangeLog">branches/safari-612.4.2.1-branch/Source/WebKit/ChangeLog</a></li>
<li><a href="#branchessafari612421branchSourceWebKitSharedWebEventConversioncpp">branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebEventConversion.cpp</a></li>
<li><a href="#branchessafari612421branchSourceWebKitSharedWebWheelEventcpp">branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEvent.cpp</a></li>
<li><a href="#branchessafari612421branchSourceWebKitSharedWebWheelEventh">branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEvent.h</a></li>
<li><a href="#branchessafari612421branchSourceWebKitSharedWebWheelEventCoalescercpp">branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEventCoalescer.cpp</a></li>
<li><a href="#branchessafari612421branchSourceWebKitSharediosWebIOSEventFactorymm">branches/safari-612.4.2.1-branch/Source/WebKit/Shared/ios/WebIOSEventFactory.mm</a></li>
<li><a href="#branchessafari612421branchSourceWebKitSharedmacNativeWebGestureEventMacmm">branches/safari-612.4.2.1-branch/Source/WebKit/Shared/mac/NativeWebGestureEventMac.mm</a></li>
<li><a href="#branchessafari612421branchSourceWebKitSharedmacWebEventFactorymm">branches/safari-612.4.2.1-branch/Source/WebKit/Shared/mac/WebEventFactory.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari612421branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-612.4.2.1-branch/Source/WebCore/ChangeLog (286711 => 286712)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.4.2.1-branch/Source/WebCore/ChangeLog 2021-12-08 21:25:05 UTC (rev 286711)
+++ branches/safari-612.4.2.1-branch/Source/WebCore/ChangeLog 2021-12-08 21:25:12 UTC (rev 286712)
</span><span class="lines">@@ -1,5 +1,89 @@
</span><span class="cx"> 2021-12-01 Alan Coon <alancoon@apple.com>
</span><span class="cx">
</span><ins>+ Cherry-pick r285790. rdar://problem/85928816
+
+ 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
+
+ 2021-11-14 Simon Fraser <simon.fraser@apple.com>
+
+ Attach IOHIDEvent timestamps to wheel events
+ https://bugs.webkit.org/show_bug.cgi?id=233051
+
+ Reviewed by Wenson Hsieh.
+
+ 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):
+
+2021-12-01 Alan Coon <alancoon@apple.com>
+
</ins><span class="cx"> Cherry-pick r285786. rdar://problem/85928816
</span><span class="cx">
</span><span class="cx"> Clean up IOKit SPI headers
</span></span></pre></div>
<a id="branchessafari612421branchSourceWebCorePALChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-612.4.2.1-branch/Source/WebCore/PAL/ChangeLog (286711 => 286712)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.4.2.1-branch/Source/WebCore/PAL/ChangeLog 2021-12-08 21:25:05 UTC (rev 286711)
+++ branches/safari-612.4.2.1-branch/Source/WebCore/PAL/ChangeLog 2021-12-08 21:25:12 UTC (rev 286712)
</span><span class="lines">@@ -1,5 +1,78 @@
</span><span class="cx"> 2021-12-01 Alan Coon <alancoon@apple.com>
</span><span class="cx">
</span><ins>+ Cherry-pick r285790. rdar://problem/85928816
+
+ 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
+
+ 2021-11-14 Simon Fraser <simon.fraser@apple.com>
+
+ Attach IOHIDEvent timestamps to wheel events
+ https://bugs.webkit.org/show_bug.cgi?id=233051
+
+ Reviewed by Wenson Hsieh.
+
+ Expose a few bits of SPI needed.
+
+ * pal/spi/cg/CoreGraphicsSPI.h:
+ * pal/spi/cocoa/IOKitSPI.h:
+
+2021-12-01 Alan Coon <alancoon@apple.com>
+
</ins><span class="cx"> Cherry-pick r285786. rdar://problem/85928816
</span><span class="cx">
</span><span class="cx"> Clean up IOKit SPI headers
</span></span></pre></div>
<a id="branchessafari612421branchSourceWebCorePALpalspicgCoreGraphicsSPIh"></a>
<div class="modfile"><h4>Modified: branches/safari-612.4.2.1-branch/Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h (286711 => 286712)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.4.2.1-branch/Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h 2021-12-08 21:25:05 UTC (rev 286711)
+++ branches/safari-612.4.2.1-branch/Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h 2021-12-08 21:25:12 UTC (rev 286712)
</span><span class="lines">@@ -32,6 +32,10 @@
</span><span class="cx"> #include <pal/spi/cocoa/IOSurfaceSPI.h>
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+#if PLATFORM(MAC)
+#include <pal/spi/cocoa/IOKitSPI.h>
+#endif
+
</ins><span class="cx"> #if USE(APPLE_INTERNAL_SDK)
</span><span class="cx">
</span><span class="cx"> #include <CoreGraphics/CGContextDelegatePrivate.h>
</span><span class="lines">@@ -42,6 +46,7 @@
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> #include <CoreGraphics/CGAccessibility.h>
</span><ins>+#include <CoreGraphics/CGEventPrivate.h>
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #else
</span><span class="lines">@@ -350,6 +355,7 @@
</span><span class="cx"> typedef int32_t CGSDisplayID;
</span><span class="cx"> CGSDisplayID CGSMainDisplayID(void);
</span><span class="cx">
</span><ins>+IOHIDEventRef CGEventCopyIOHIDEvent(CGEventRef);
</ins><span class="cx"> #endif // PLATFORM(MAC)
</span><span class="cx">
</span><span class="cx"> #if ENABLE(PDFKIT_PLUGIN) && !USE(APPLE_INTERNAL_SDK)
</span></span></pre></div>
<a id="branchessafari612421branchSourceWebCorePALpalspimacIOKitSPIMach"></a>
<div class="modfile"><h4>Modified: branches/safari-612.4.2.1-branch/Source/WebCore/PAL/pal/spi/mac/IOKitSPIMac.h (286711 => 286712)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.4.2.1-branch/Source/WebCore/PAL/pal/spi/mac/IOKitSPIMac.h 2021-12-08 21:25:05 UTC (rev 286711)
+++ branches/safari-612.4.2.1-branch/Source/WebCore/PAL/pal/spi/mac/IOKitSPIMac.h 2021-12-08 21:25:12 UTC (rev 286712)
</span><span class="lines">@@ -43,6 +43,8 @@
</span><span class="cx"> #define kIOHIDProductIDKey "ProductID"
</span><span class="cx">
</span><span class="cx"> WTF_EXTERN_C_BEGIN
</span><ins>+
+typedef struct __IOHIDEvent * IOHIDEventRef;
</ins><span class="cx"> typedef struct CF_BRIDGED_TYPE(id) __IOHIDServiceClient * IOHIDServiceClientRef;
</span><span class="cx"> typedef struct CF_BRIDGED_TYPE(id) __IOHIDEventSystemClient * IOHIDEventSystemClientRef;
</span><span class="cx"> typedef void (^IOHIDServiceClientBlock)(void *, void *, IOHIDServiceClientRef);
</span><span class="lines">@@ -81,6 +83,8 @@
</span><span class="cx"> };
</span><span class="cx"> typedef uint32_t IOHIDEventType;
</span><span class="cx">
</span><ins>+uint64_t IOHIDEventGetTimeStamp(IOHIDEventRef);
+
</ins><span class="cx"> WTF_EXTERN_C_END
</span><span class="cx">
</span><span class="cx"> #endif // USE(APPLE_INTERNAL_SDK)
</span></span></pre></div>
<a id="branchessafari612421branchSourceWebCoreplatformPlatformWheelEventcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612.4.2.1-branch/Source/WebCore/platform/PlatformWheelEvent.cpp (286711 => 286712)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.4.2.1-branch/Source/WebCore/platform/PlatformWheelEvent.cpp 2021-12-08 21:25:05 UTC (rev 286711)
+++ branches/safari-612.4.2.1-branch/Source/WebCore/platform/PlatformWheelEvent.cpp 2021-12-08 21:25:12 UTC (rev 286712)
</span><span class="lines">@@ -75,6 +75,7 @@
</span><span class="cx"> #endif // ENABLE(KINETIC_SCROLLING)
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(COCOA)
</span><ins>+ platformWheelEvent.m_ioHIDEventTimestamp = platformWheelEvent.m_timestamp;
</ins><span class="cx"> platformWheelEvent.m_unacceleratedScrollingDeltaY = deltaY;
</span><span class="cx"> #endif // PLATFORM(COCOA)
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari612421branchSourceWebCoreplatformPlatformWheelEventh"></a>
<div class="modfile"><h4>Modified: branches/safari-612.4.2.1-branch/Source/WebCore/platform/PlatformWheelEvent.h (286711 => 286712)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.4.2.1-branch/Source/WebCore/platform/PlatformWheelEvent.h 2021-12-08 21:25:05 UTC (rev 286711)
+++ branches/safari-612.4.2.1-branch/Source/WebCore/platform/PlatformWheelEvent.h 2021-12-08 21:25:12 UTC (rev 286712)
</span><span class="lines">@@ -152,6 +152,8 @@
</span><span class="cx"> unsigned scrollCount() const { return m_scrollCount; }
</span><span class="cx"> float unacceleratedScrollingDeltaX() const { return m_unacceleratedScrollingDeltaX; }
</span><span class="cx"> float unacceleratedScrollingDeltaY() const { return m_unacceleratedScrollingDeltaY; }
</span><ins>+
+ WallTime ioHIDEventTimestamp() const { return m_ioHIDEventTimestamp; }
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if ENABLE(ASYNC_SCROLLING)
</span><span class="lines">@@ -200,6 +202,7 @@
</span><span class="cx"> PlatformWheelEventPhase m_momentumPhase { PlatformWheelEventPhase::None };
</span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(COCOA)
</span><ins>+ WallTime m_ioHIDEventTimestamp;
</ins><span class="cx"> unsigned m_scrollCount { 0 };
</span><span class="cx"> float m_unacceleratedScrollingDeltaX { 0 };
</span><span class="cx"> float m_unacceleratedScrollingDeltaY { 0 };
</span></span></pre></div>
<a id="branchessafari612421branchSourceWebCoreplatformmacPlatformEventFactoryMach"></a>
<div class="modfile"><h4>Modified: branches/safari-612.4.2.1-branch/Source/WebCore/platform/mac/PlatformEventFactoryMac.h (286711 => 286712)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.4.2.1-branch/Source/WebCore/platform/mac/PlatformEventFactoryMac.h 2021-12-08 21:25:05 UTC (rev 286711)
+++ branches/safari-612.4.2.1-branch/Source/WebCore/platform/mac/PlatformEventFactoryMac.h 2021-12-08 21:25:12 UTC (rev 286712)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx"> WEBCORE_EXPORT String keyIdentifierForKeyEvent(NSEvent *);
</span><span class="cx"> WEBCORE_EXPORT String keyForKeyEvent(NSEvent *);
</span><span class="cx"> WEBCORE_EXPORT String codeForKeyEvent(NSEvent *);
</span><del>-WEBCORE_EXPORT WallTime eventTimeStampSince1970(NSEvent *);
</del><ins>+WEBCORE_EXPORT WallTime eventTimeStampSince1970(NSTimeInterval);
</ins><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT OptionSet<PlatformEvent::Modifier> modifiersForEvent(NSEvent *);
</span><span class="cx"> WEBCORE_EXPORT void getWheelEventDeltas(NSEvent *, float& deltaX, float& deltaY, BOOL& continuous);
</span></span></pre></div>
<a id="branchessafari612421branchSourceWebCoreplatformmacPlatformEventFactoryMacmm"></a>
<div class="modfile"><h4>Modified: branches/safari-612.4.2.1-branch/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm (286711 => 286712)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.4.2.1-branch/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm 2021-12-08 21:25:05 UTC (rev 286711)
+++ branches/safari-612.4.2.1-branch/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm 2021-12-08 21:25:12 UTC (rev 286712)
</span><span class="lines">@@ -607,9 +607,9 @@
</span><span class="cx"> return systemStartupTime;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-WallTime eventTimeStampSince1970(NSEvent* event)
</del><ins>+WallTime eventTimeStampSince1970(NSTimeInterval timestamp)
</ins><span class="cx"> {
</span><del>- return WallTime::fromRawSeconds(static_cast<double>(cachedStartupTimeIntervalSince1970() + [event timestamp]));
</del><ins>+ return WallTime::fromRawSeconds(static_cast<double>(cachedStartupTimeIntervalSince1970() + timestamp));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline bool isKeyUpEvent(NSEvent *event)
</span><span class="lines">@@ -720,7 +720,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> m_modifiers = modifiersForEvent(event);
</span><del>- m_timestamp = eventTimeStampSince1970(event);
</del><ins>+ m_timestamp = eventTimeStampSince1970(event.timestamp);
</ins><span class="cx">
</span><span class="cx"> // PlatformMouseEvent
</span><span class="cx"> m_position = pointForEvent(event, windowView);
</span><span class="lines">@@ -755,7 +755,7 @@
</span><span class="cx"> // PlatformEvent
</span><span class="cx"> m_type = PlatformEvent::Wheel;
</span><span class="cx"> m_modifiers = modifiersForEvent(event);
</span><del>- m_timestamp = eventTimeStampSince1970(event);
</del><ins>+ m_timestamp = eventTimeStampSince1970(event.timestamp);
</ins><span class="cx">
</span><span class="cx"> // PlatformWheelEvent
</span><span class="cx"> m_position = pointForEvent(event, windowView);
</span><span class="lines">@@ -794,7 +794,7 @@
</span><span class="cx"> // PlatformEvent
</span><span class="cx"> m_type = isKeyUpEvent(event) ? PlatformEvent::KeyUp : PlatformEvent::KeyDown;
</span><span class="cx"> m_modifiers = modifiersForEvent(event);
</span><del>- m_timestamp = eventTimeStampSince1970(event);
</del><ins>+ m_timestamp = eventTimeStampSince1970(event.timestamp);
</ins><span class="cx">
</span><span class="cx"> // PlatformKeyboardEvent
</span><span class="cx"> m_text = textFromEvent(event);
</span></span></pre></div>
<a id="branchessafari612421branchSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-612.4.2.1-branch/Source/WebKit/ChangeLog (286711 => 286712)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.4.2.1-branch/Source/WebKit/ChangeLog 2021-12-08 21:25:05 UTC (rev 286711)
+++ branches/safari-612.4.2.1-branch/Source/WebKit/ChangeLog 2021-12-08 21:25:12 UTC (rev 286712)
</span><span class="lines">@@ -1,3 +1,94 @@
</span><ins>+2021-12-01 Alan Coon <alancoon@apple.com>
+
+ Cherry-pick r285790. rdar://problem/85928816
+
+ 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
+
+ 2021-11-14 Simon Fraser <simon.fraser@apple.com>
+
+ Attach IOHIDEvent timestamps to wheel events
+ https://bugs.webkit.org/show_bug.cgi?id=233051
+
+ Reviewed by Wenson Hsieh.
+
+ 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):
+
</ins><span class="cx"> 2021-12-03 Russell Epstein <repstein@apple.com>
</span><span class="cx">
</span><span class="cx"> Cherry-pick r286505. rdar://problem/85918531
</span></span></pre></div>
<a id="branchessafari612421branchSourceWebKitSharedWebEventConversioncpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebEventConversion.cpp (286711 => 286712)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebEventConversion.cpp 2021-12-08 21:25:05 UTC (rev 286711)
+++ branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebEventConversion.cpp 2021-12-08 21:25:12 UTC (rev 286712)
</span><span class="lines">@@ -169,6 +169,7 @@
</span><span class="cx"> m_hasPreciseScrollingDeltas = webEvent.hasPreciseScrollingDeltas();
</span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(COCOA)
</span><ins>+ m_ioHIDEventTimestamp = webEvent.ioHIDEventTimestamp();
</ins><span class="cx"> m_scrollCount = webEvent.scrollCount();
</span><span class="cx"> m_unacceleratedScrollingDeltaX = webEvent.unacceleratedScrollingDelta().width();
</span><span class="cx"> m_unacceleratedScrollingDeltaY = webEvent.unacceleratedScrollingDelta().height();
</span></span></pre></div>
<a id="branchessafari612421branchSourceWebKitSharedWebWheelEventcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEvent.cpp (286711 => 286712)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEvent.cpp 2021-12-08 21:25:05 UTC (rev 286711)
+++ branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEvent.cpp 2021-12-08 21:25:12 UTC (rev 286712)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(COCOA)
</span><del>-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)
</del><ins>+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)
</ins><span class="cx"> : WebEvent(type, modifiers, timestamp)
</span><span class="cx"> , m_position(position)
</span><span class="cx"> , m_globalPosition(globalPosition)
</span><span class="lines">@@ -55,6 +55,7 @@
</span><span class="cx"> , m_momentumPhase(momentumPhase)
</span><span class="cx"> , m_directionInvertedFromDevice(directionInvertedFromDevice)
</span><span class="cx"> , m_hasPreciseScrollingDeltas(hasPreciseScrollingDeltas)
</span><ins>+ , m_ioHIDEventTimestamp(ioHIDEventTimestamp)
</ins><span class="cx"> , m_scrollCount(scrollCount)
</span><span class="cx"> , m_unacceleratedScrollingDelta(unacceleratedScrollingDelta)
</span><span class="cx"> {
</span><span class="lines">@@ -92,6 +93,7 @@
</span><span class="cx"> encoder << m_hasPreciseScrollingDeltas;
</span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(COCOA)
</span><ins>+ encoder << m_ioHIDEventTimestamp;
</ins><span class="cx"> encoder << m_scrollCount;
</span><span class="cx"> encoder << m_unacceleratedScrollingDelta;
</span><span class="cx"> #endif
</span><span class="lines">@@ -122,6 +124,8 @@
</span><span class="cx"> return false;
</span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(COCOA)
</span><ins>+ if (!decoder.decode(t.m_ioHIDEventTimestamp))
+ return false;
</ins><span class="cx"> if (!decoder.decode(t.m_scrollCount))
</span><span class="cx"> return false;
</span><span class="cx"> if (!decoder.decode(t.m_unacceleratedScrollingDelta))
</span></span></pre></div>
<a id="branchessafari612421branchSourceWebKitSharedWebWheelEventh"></a>
<div class="modfile"><h4>Modified: branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEvent.h (286711 => 286712)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEvent.h 2021-12-08 21:25:05 UTC (rev 286711)
+++ branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEvent.h 2021-12-08 21:25:12 UTC (rev 286712)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx">
</span><span class="cx"> WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, OptionSet<Modifier>, WallTime timestamp);
</span><span class="cx"> #if PLATFORM(COCOA)
</span><del>- 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);
</del><ins>+ 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);
</ins><span class="cx"> #elif PLATFORM(GTK) || USE(LIBWPE)
</span><span class="cx"> 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);
</span><span class="cx"> #endif
</span><span class="lines">@@ -70,6 +70,7 @@
</span><span class="cx"> bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas; }
</span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(COCOA)
</span><ins>+ WallTime ioHIDEventTimestamp() const { return m_ioHIDEventTimestamp; }
</ins><span class="cx"> uint32_t scrollCount() const { return m_scrollCount; }
</span><span class="cx"> const WebCore::FloatSize& unacceleratedScrollingDelta() const { return m_unacceleratedScrollingDelta; }
</span><span class="cx"> #endif
</span><span class="lines">@@ -87,11 +88,13 @@
</span><span class="cx"> uint32_t m_granularity { ScrollByPageWheelEvent };
</span><span class="cx"> uint32_t m_phase { Phase::PhaseNone };
</span><span class="cx"> uint32_t m_momentumPhase { Phase::PhaseNone };
</span><ins>+
</ins><span class="cx"> bool m_directionInvertedFromDevice { false };
</span><span class="cx"> #if PLATFORM(COCOA) || PLATFORM(GTK) || USE(LIBWPE)
</span><span class="cx"> bool m_hasPreciseScrollingDeltas { false };
</span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(COCOA)
</span><ins>+ WallTime m_ioHIDEventTimestamp;
</ins><span class="cx"> uint32_t m_scrollCount { 0 };
</span><span class="cx"> WebCore::FloatSize m_unacceleratedScrollingDelta;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="branchessafari612421branchSourceWebKitSharedWebWheelEventCoalescercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEventCoalescer.cpp (286711 => 286712)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEventCoalescer.cpp 2021-12-08 21:25:05 UTC (rev 286711)
+++ branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEventCoalescer.cpp 2021-12-08 21:25:12 UTC (rev 286712)
</span><span class="lines">@@ -78,7 +78,7 @@
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx"> auto mergedUnacceleratedScrollingDelta = a.unacceleratedScrollingDelta() + b.unacceleratedScrollingDelta();
</span><span class="cx">
</span><del>- 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());
</del><ins>+ 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());
</ins><span class="cx"> #elif PLATFORM(GTK) || USE(LIBWPE)
</span><span class="cx"> return WebWheelEvent(WebEvent::Wheel, b.position(), b.globalPosition(), mergedDelta, mergedWheelTicks, b.phase(), b.momentumPhase(), b.granularity(), b.hasPreciseScrollingDeltas(), b.modifiers(), b.timestamp());
</span><span class="cx"> #else
</span></span></pre></div>
<a id="branchessafari612421branchSourceWebKitSharediosWebIOSEventFactorymm"></a>
<div class="modfile"><h4>Modified: branches/safari-612.4.2.1-branch/Source/WebKit/Shared/ios/WebIOSEventFactory.mm (286711 => 286712)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.4.2.1-branch/Source/WebKit/Shared/ios/WebIOSEventFactory.mm 2021-12-08 21:25:05 UTC (rev 286711)
+++ branches/safari-612.4.2.1-branch/Source/WebKit/Shared/ios/WebIOSEventFactory.mm 2021-12-08 21:25:12 UTC (rev 286712)
</span><span class="lines">@@ -161,7 +161,7 @@
</span><span class="cx"> WebCore::FloatSize delta(deltaVector.dx, deltaVector.dy);
</span><span class="cx"> WebCore::FloatSize wheelTicks = delta;
</span><span class="cx"> wheelTicks.scale(1. / static_cast<float>(WebCore::Scrollbar::pixelsPerLineStep()));
</span><del>-
</del><ins>+ auto timestamp = MonotonicTime::fromRawSeconds(event.timestamp).approximateWallTime();
</ins><span class="cx"> return {
</span><span class="cx"> WebKit::WebEvent::Wheel,
</span><span class="cx"> scrollLocation,
</span><span class="lines">@@ -176,7 +176,8 @@
</span><span class="cx"> 1,
</span><span class="cx"> delta,
</span><span class="cx"> { },
</span><del>- MonotonicTime::fromRawSeconds(event.timestamp).approximateWallTime()
</del><ins>+ timestamp,
+ timestamp
</ins><span class="cx"> };
</span><span class="cx"> }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="branchessafari612421branchSourceWebKitSharedmacNativeWebGestureEventMacmm"></a>
<div class="modfile"><h4>Modified: branches/safari-612.4.2.1-branch/Source/WebKit/Shared/mac/NativeWebGestureEventMac.mm (286711 => 286712)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.4.2.1-branch/Source/WebKit/Shared/mac/NativeWebGestureEventMac.mm 2021-12-08 21:25:05 UTC (rev 286711)
+++ branches/safari-612.4.2.1-branch/Source/WebKit/Shared/mac/NativeWebGestureEventMac.mm 2021-12-08 21:25:12 UTC (rev 286712)
</span><span class="lines">@@ -62,7 +62,7 @@
</span><span class="cx"> : WebGestureEvent(
</span><span class="cx"> webEventTypeForNSEvent(event),
</span><span class="cx"> OptionSet<WebEvent::Modifier> { },
</span><del>- WebCore::eventTimeStampSince1970(event),
</del><ins>+ WebCore::eventTimeStampSince1970(event.timestamp),
</ins><span class="cx"> WebCore::IntPoint(pointForEvent(event, view)),
</span><span class="cx"> event.type == NSEventTypeMagnify ? event.magnification : 0,
</span><span class="cx"> event.type == NSEventTypeRotate ? event.rotation : 0)
</span></span></pre></div>
<a id="branchessafari612421branchSourceWebKitSharedmacWebEventFactorymm"></a>
<div class="modfile"><h4>Modified: branches/safari-612.4.2.1-branch/Source/WebKit/Shared/mac/WebEventFactory.mm (286711 => 286712)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612.4.2.1-branch/Source/WebKit/Shared/mac/WebEventFactory.mm 2021-12-08 21:25:05 UTC (rev 286711)
+++ branches/safari-612.4.2.1-branch/Source/WebKit/Shared/mac/WebEventFactory.mm 2021-12-08 21:25:12 UTC (rev 286712)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #import <WebCore/PlatformEventFactoryMac.h>
</span><span class="cx"> #import <WebCore/Scrollbar.h>
</span><span class="cx"> #import <WebCore/WindowsKeyboardCodes.h>
</span><ins>+#import <pal/spi/cg/CoreGraphicsSPI.h>
</ins><span class="cx"> #import <pal/spi/mac/NSMenuSPI.h>
</span><span class="cx"> #import <wtf/ASCIICType.h>
</span><span class="cx">
</span><span class="lines">@@ -353,7 +354,7 @@
</span><span class="cx"> float deltaZ = [event deltaZ];
</span><span class="cx"> int clickCount = clickCountForEvent(event);
</span><span class="cx"> auto modifiers = modifiersForEvent(event);
</span><del>- auto timestamp = WebCore::eventTimeStampSince1970(event);
</del><ins>+ auto timestamp = WebCore::eventTimeStampSince1970(event.timestamp);
</ins><span class="cx"> int eventNumber = [event eventNumber];
</span><span class="cx"> int menuTypeForEvent = typeForEvent(event);
</span><span class="cx">
</span><span class="lines">@@ -408,9 +409,26 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> auto modifiers = modifiersForEvent(event);
</span><del>- auto timestamp = WebCore::eventTimeStampSince1970(event);
</del><ins>+ auto timestamp = WebCore::eventTimeStampSince1970(event.timestamp);
</ins><span class="cx">
</span><del>- 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);
</del><ins>+ auto ioHIDEventTimestamp = [](NSEvent *event) {
+ auto cgEvent = event.CGEvent;
+ if (!cgEvent)
+ return event.timestamp;
+
+ auto iohidEvent = adoptCF(CGEventCopyIOHIDEvent(cgEvent));
+ if (!iohidEvent)
+ return event.timestamp;
+
+ auto ioHIDEventTimestamp = IOHIDEventGetTimeStamp(iohidEvent.get()); // IOEventRef timestamp is mach_absolute_time units.
+ return MonotonicTime::fromMachAbsoluteTime(ioHIDEventTimestamp).secondsSinceEpoch().seconds();
+ }(event);
+
+ auto ioHIDEventWallTime = WebCore::eventTimeStampSince1970(ioHIDEventTimestamp);
+
+ 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, ioHIDEventWallTime);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(NSEvent *event, bool handledByInputMethod, bool replacesSoftSpace, const Vector<WebCore::KeypressCommand>& commands)
</span><span class="lines">@@ -428,7 +446,7 @@
</span><span class="cx"> bool isKeypad = isKeypadEvent(event);
</span><span class="cx"> bool isSystemKey = false; // SystemKey is always false on the Mac.
</span><span class="cx"> auto modifiers = modifiersForEvent(event);
</span><del>- auto timestamp = WebCore::eventTimeStampSince1970(event);
</del><ins>+ auto timestamp = WebCore::eventTimeStampSince1970(event.timestamp);
</ins><span class="cx">
</span><span class="cx"> // Always use 13 for Enter/Return -- we don't want to use AppKit's different character for Enter.
</span><span class="cx"> if (windowsVirtualKeyCode == VK_RETURN) {
</span></span></pre>
</div>
</div>
</body>
</html>