Diff
Modified: branches/safari-612.4.2.1-branch/Source/WebCore/ChangeLog (286712 => 286713)
--- branches/safari-612.4.2.1-branch/Source/WebCore/ChangeLog 2021-12-08 21:25:12 UTC (rev 286712)
+++ branches/safari-612.4.2.1-branch/Source/WebCore/ChangeLog 2021-12-08 21:25:18 UTC (rev 286713)
@@ -1,5 +1,55 @@
2021-12-01 Alan Coon <alanc...@apple.com>
+ Cherry-pick r286270. rdar://problem/85928816
+
+ Plumb raw platform scrolling deltas along in wheel events
+ https://bugs.webkit.org/show_bug.cgi?id=233583
+
+ Reviewed by Simon Fraser.
+
+ Source/WebCore:
+
+ * platform/PlatformWheelEvent.cpp:
+ (WebCore::PlatformWheelEvent::createFromGesture):
+ * platform/PlatformWheelEvent.h:
+ (WebCore::PlatformWheelEvent::rawPlatformDelta const):
+ * PAL/pal/spi/mac/IOKitSPIMac.h:
+
+ Source/WebKit:
+
+ * Shared/WebEventConversion.cpp:
+ (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
+ * Shared/WebWheelEvent.cpp:
+ (WebKit::WebWheelEvent::WebWheelEvent):
+ (WebKit::WebWheelEvent::encode const):
+ (WebKit::WebWheelEvent::decode):
+ * Shared/WebWheelEvent.h:
+ (WebKit::WebWheelEvent::rawPlatformDelta const):
+ * Shared/WebWheelEventCoalescer.cpp:
+ (WebKit::WebWheelEventCoalescer::coalesce):
+ * Shared/mac/WebEventFactory.mm:
+ (WebKit::WebEventFactory::createWebWheelEvent):
+ Extract and plumb raw unaccelerated (in the HID sense) deltas in scroll
+ events for use in a future patch.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@286270 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-11-29 Tim Horton <timothy_hor...@apple.com>
+
+ Plumb raw platform scrolling deltas along in wheel events
+ https://bugs.webkit.org/show_bug.cgi?id=233583
+
+ Reviewed by Simon Fraser.
+
+ * platform/PlatformWheelEvent.cpp:
+ (WebCore::PlatformWheelEvent::createFromGesture):
+ * platform/PlatformWheelEvent.h:
+ (WebCore::PlatformWheelEvent::rawPlatformDelta const):
+ * PAL/pal/spi/mac/IOKitSPIMac.h:
+
+2021-12-01 Alan Coon <alanc...@apple.com>
+
Cherry-pick r285790. rdar://problem/85928816
Attach IOHIDEvent timestamps to wheel events
Modified: branches/safari-612.4.2.1-branch/Source/WebCore/PAL/pal/spi/mac/IOKitSPIMac.h (286712 => 286713)
--- branches/safari-612.4.2.1-branch/Source/WebCore/PAL/pal/spi/mac/IOKitSPIMac.h 2021-12-08 21:25:12 UTC (rev 286712)
+++ branches/safari-612.4.2.1-branch/Source/WebCore/PAL/pal/spi/mac/IOKitSPIMac.h 2021-12-08 21:25:18 UTC (rev 286713)
@@ -83,7 +83,22 @@
};
typedef uint32_t IOHIDEventType;
+typedef uint32_t IOHIDEventField;
+
+#ifdef __LP64__
+typedef double IOHIDFloat;
+#else
+typedef float IOHIDFloat;
+#endif
+
+#define IOHIDEventFieldBase(type) (type << 16)
+
+#define kIOHIDEventFieldScrollBase IOHIDEventFieldBase(kIOHIDEventTypeScroll)
+static const IOHIDEventField kIOHIDEventFieldScrollX = (kIOHIDEventFieldScrollBase | 0);
+static const IOHIDEventField kIOHIDEventFieldScrollY = (kIOHIDEventFieldScrollBase | 1);
+
uint64_t IOHIDEventGetTimeStamp(IOHIDEventRef);
+IOHIDFloat IOHIDEventGetFloatValue(IOHIDEventRef, IOHIDEventField);
WTF_EXTERN_C_END
Modified: branches/safari-612.4.2.1-branch/Source/WebCore/platform/PlatformWheelEvent.cpp (286712 => 286713)
--- branches/safari-612.4.2.1-branch/Source/WebCore/platform/PlatformWheelEvent.cpp 2021-12-08 21:25:12 UTC (rev 286712)
+++ branches/safari-612.4.2.1-branch/Source/WebCore/platform/PlatformWheelEvent.cpp 2021-12-08 21:25:18 UTC (rev 286713)
@@ -76,6 +76,7 @@
#if PLATFORM(COCOA)
platformWheelEvent.m_ioHIDEventTimestamp = platformWheelEvent.m_timestamp;
+ platformWheelEvent.m_rawPlatformDelta = platformWheelEvent.m_rawPlatformDelta;
platformWheelEvent.m_unacceleratedScrollingDeltaY = deltaY;
#endif // PLATFORM(COCOA)
Modified: branches/safari-612.4.2.1-branch/Source/WebCore/platform/PlatformWheelEvent.h (286712 => 286713)
--- branches/safari-612.4.2.1-branch/Source/WebCore/platform/PlatformWheelEvent.h 2021-12-08 21:25:12 UTC (rev 286712)
+++ branches/safari-612.4.2.1-branch/Source/WebCore/platform/PlatformWheelEvent.h 2021-12-08 21:25:18 UTC (rev 286713)
@@ -154,6 +154,8 @@
float unacceleratedScrollingDeltaY() const { return m_unacceleratedScrollingDeltaY; }
WallTime ioHIDEventTimestamp() const { return m_ioHIDEventTimestamp; }
+
+ std::optional<FloatSize> rawPlatformDelta() const { return m_rawPlatformDelta; }
#endif
#if ENABLE(ASYNC_SCROLLING)
@@ -203,6 +205,7 @@
#endif
#if PLATFORM(COCOA)
WallTime m_ioHIDEventTimestamp;
+ std::optional<FloatSize> m_rawPlatformDelta;
unsigned m_scrollCount { 0 };
float m_unacceleratedScrollingDeltaX { 0 };
float m_unacceleratedScrollingDeltaY { 0 };
Modified: branches/safari-612.4.2.1-branch/Source/WebKit/ChangeLog (286712 => 286713)
--- branches/safari-612.4.2.1-branch/Source/WebKit/ChangeLog 2021-12-08 21:25:12 UTC (rev 286712)
+++ branches/safari-612.4.2.1-branch/Source/WebKit/ChangeLog 2021-12-08 21:25:18 UTC (rev 286713)
@@ -1,5 +1,64 @@
2021-12-01 Alan Coon <alanc...@apple.com>
+ Cherry-pick r286270. rdar://problem/85928816
+
+ Plumb raw platform scrolling deltas along in wheel events
+ https://bugs.webkit.org/show_bug.cgi?id=233583
+
+ Reviewed by Simon Fraser.
+
+ Source/WebCore:
+
+ * platform/PlatformWheelEvent.cpp:
+ (WebCore::PlatformWheelEvent::createFromGesture):
+ * platform/PlatformWheelEvent.h:
+ (WebCore::PlatformWheelEvent::rawPlatformDelta const):
+ * PAL/pal/spi/mac/IOKitSPIMac.h:
+
+ Source/WebKit:
+
+ * Shared/WebEventConversion.cpp:
+ (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
+ * Shared/WebWheelEvent.cpp:
+ (WebKit::WebWheelEvent::WebWheelEvent):
+ (WebKit::WebWheelEvent::encode const):
+ (WebKit::WebWheelEvent::decode):
+ * Shared/WebWheelEvent.h:
+ (WebKit::WebWheelEvent::rawPlatformDelta const):
+ * Shared/WebWheelEventCoalescer.cpp:
+ (WebKit::WebWheelEventCoalescer::coalesce):
+ * Shared/mac/WebEventFactory.mm:
+ (WebKit::WebEventFactory::createWebWheelEvent):
+ Extract and plumb raw unaccelerated (in the HID sense) deltas in scroll
+ events for use in a future patch.
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@286270 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-11-29 Tim Horton <timothy_hor...@apple.com>
+
+ Plumb raw platform scrolling deltas along in wheel events
+ https://bugs.webkit.org/show_bug.cgi?id=233583
+
+ Reviewed by Simon Fraser.
+
+ * Shared/WebEventConversion.cpp:
+ (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
+ * Shared/WebWheelEvent.cpp:
+ (WebKit::WebWheelEvent::WebWheelEvent):
+ (WebKit::WebWheelEvent::encode const):
+ (WebKit::WebWheelEvent::decode):
+ * Shared/WebWheelEvent.h:
+ (WebKit::WebWheelEvent::rawPlatformDelta const):
+ * Shared/WebWheelEventCoalescer.cpp:
+ (WebKit::WebWheelEventCoalescer::coalesce):
+ * Shared/mac/WebEventFactory.mm:
+ (WebKit::WebEventFactory::createWebWheelEvent):
+ Extract and plumb raw unaccelerated (in the HID sense) deltas in scroll
+ events for use in a future patch.
+
+2021-12-01 Alan Coon <alanc...@apple.com>
+
Cherry-pick r285790. rdar://problem/85928816
Attach IOHIDEvent timestamps to wheel events
Modified: branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebEventConversion.cpp (286712 => 286713)
--- branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebEventConversion.cpp 2021-12-08 21:25:12 UTC (rev 286712)
+++ branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebEventConversion.cpp 2021-12-08 21:25:18 UTC (rev 286713)
@@ -170,6 +170,7 @@
#endif
#if PLATFORM(COCOA)
m_ioHIDEventTimestamp = webEvent.ioHIDEventTimestamp();
+ m_rawPlatformDelta = webEvent.rawPlatformDelta();
m_scrollCount = webEvent.scrollCount();
m_unacceleratedScrollingDeltaX = webEvent.unacceleratedScrollingDelta().width();
m_unacceleratedScrollingDeltaY = webEvent.unacceleratedScrollingDelta().height();
Modified: branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEvent.cpp (286712 => 286713)
--- branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEvent.cpp 2021-12-08 21:25:12 UTC (rev 286712)
+++ branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEvent.cpp 2021-12-08 21:25:18 UTC (rev 286713)
@@ -44,7 +44,7 @@
}
#if PLATFORM(COCOA)
-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)
+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)
: WebEvent(type, modifiers, timestamp)
, m_position(position)
, m_globalPosition(globalPosition)
@@ -56,6 +56,7 @@
, m_directionInvertedFromDevice(directionInvertedFromDevice)
, m_hasPreciseScrollingDeltas(hasPreciseScrollingDeltas)
, m_ioHIDEventTimestamp(ioHIDEventTimestamp)
+ , m_rawPlatformDelta(rawPlatformDelta)
, m_scrollCount(scrollCount)
, m_unacceleratedScrollingDelta(unacceleratedScrollingDelta)
{
@@ -94,6 +95,7 @@
#endif
#if PLATFORM(COCOA)
encoder << m_ioHIDEventTimestamp;
+ encoder << m_rawPlatformDelta;
encoder << m_scrollCount;
encoder << m_unacceleratedScrollingDelta;
#endif
@@ -126,6 +128,8 @@
#if PLATFORM(COCOA)
if (!decoder.decode(t.m_ioHIDEventTimestamp))
return false;
+ if (!decoder.decode(t.m_rawPlatformDelta))
+ return false;
if (!decoder.decode(t.m_scrollCount))
return false;
if (!decoder.decode(t.m_unacceleratedScrollingDelta))
Modified: branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEvent.h (286712 => 286713)
--- branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEvent.h 2021-12-08 21:25:12 UTC (rev 286712)
+++ branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEvent.h 2021-12-08 21:25:18 UTC (rev 286713)
@@ -53,7 +53,7 @@
WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, OptionSet<Modifier>, WallTime timestamp);
#if PLATFORM(COCOA)
- 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);
+ 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);
#elif PLATFORM(GTK) || USE(LIBWPE)
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);
#endif
@@ -71,6 +71,7 @@
#endif
#if PLATFORM(COCOA)
WallTime ioHIDEventTimestamp() const { return m_ioHIDEventTimestamp; }
+ std::optional<WebCore::FloatSize> rawPlatformDelta() const { return m_rawPlatformDelta; }
uint32_t scrollCount() const { return m_scrollCount; }
const WebCore::FloatSize& unacceleratedScrollingDelta() const { return m_unacceleratedScrollingDelta; }
#endif
@@ -95,6 +96,7 @@
#endif
#if PLATFORM(COCOA)
WallTime m_ioHIDEventTimestamp;
+ std::optional<WebCore::FloatSize> m_rawPlatformDelta;
uint32_t m_scrollCount { 0 };
WebCore::FloatSize m_unacceleratedScrollingDelta;
#endif
Modified: branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEventCoalescer.cpp (286712 => 286713)
--- branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEventCoalescer.cpp 2021-12-08 21:25:12 UTC (rev 286712)
+++ branches/safari-612.4.2.1-branch/Source/WebKit/Shared/WebWheelEventCoalescer.cpp 2021-12-08 21:25:18 UTC (rev 286713)
@@ -77,8 +77,11 @@
#if PLATFORM(COCOA)
auto mergedUnacceleratedScrollingDelta = a.unacceleratedScrollingDelta() + b.unacceleratedScrollingDelta();
+ std::optional<WebCore::FloatSize> mergedRawPlatformScrollingDelta;
+ if (a.rawPlatformDelta() && b.rawPlatformDelta())
+ mergedRawPlatformScrollingDelta = a.rawPlatformDelta().value() + b.rawPlatformDelta().value();
- 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());
+ 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);
#elif PLATFORM(GTK) || USE(LIBWPE)
return WebWheelEvent(WebEvent::Wheel, b.position(), b.globalPosition(), mergedDelta, mergedWheelTicks, b.phase(), b.momentumPhase(), b.granularity(), b.hasPreciseScrollingDeltas(), b.modifiers(), b.timestamp());
#else
Modified: branches/safari-612.4.2.1-branch/Source/WebKit/Shared/mac/WebEventFactory.mm (286712 => 286713)
--- branches/safari-612.4.2.1-branch/Source/WebKit/Shared/mac/WebEventFactory.mm 2021-12-08 21:25:12 UTC (rev 286712)
+++ branches/safari-612.4.2.1-branch/Source/WebKit/Shared/mac/WebEventFactory.mm 2021-12-08 21:25:18 UTC (rev 286713)
@@ -411,24 +411,36 @@
auto modifiers = modifiersForEvent(event);
auto timestamp = WebCore::eventTimeStampSince1970(event.timestamp);
- auto ioHIDEventTimestamp = [](NSEvent *event) {
+ auto ioHIDEventTimestamp = [&]() {
auto cgEvent = event.CGEvent;
if (!cgEvent)
return event.timestamp;
- auto iohidEvent = adoptCF(CGEventCopyIOHIDEvent(cgEvent));
- if (!iohidEvent)
+ auto ioHIDEvent = adoptCF(CGEventCopyIOHIDEvent(cgEvent));
+ if (!ioHIDEvent)
return event.timestamp;
- auto ioHIDEventTimestamp = IOHIDEventGetTimeStamp(iohidEvent.get()); // IOEventRef timestamp is mach_absolute_time units.
+ auto ioHIDEventTimestamp = IOHIDEventGetTimeStamp(ioHIDEvent.get()); // IOEventRef timestamp is mach_absolute_time units.
return MonotonicTime::fromMachAbsoluteTime(ioHIDEventTimestamp).secondsSinceEpoch().seconds();
- }(event);
+ }();
+ auto rawPlatformDelta = [&]() -> std::optional<WebCore::FloatSize> {
+ auto cgEvent = event.CGEvent;
+ if (!cgEvent)
+ return std::nullopt;
+
+ auto ioHIDEvent = adoptCF(CGEventCopyIOHIDEvent(cgEvent));
+ if (!ioHIDEvent)
+ return std::nullopt;
+
+ return { WebCore::FloatSize(-IOHIDEventGetFloatValue(ioHIDEvent.get(), kIOHIDEventFieldScrollX), -IOHIDEventGetFloatValue(ioHIDEvent.get(), kIOHIDEventFieldScrollY)) };
+ }();
+
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);
+ scrollCount, unacceleratedScrollingDelta, modifiers, timestamp, ioHIDEventWallTime, rawPlatformDelta);
}
WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(NSEvent *event, bool handledByInputMethod, bool replacesSoftSpace, const Vector<WebCore::KeypressCommand>& commands)