Changeset 286973 in webkit
- Timestamp:
- Dec 13, 2021, 12:56:48 PM (5 years ago)
- Location:
- branches/safari-612-branch/Source/WebKit
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
Shared/mac/ScrollingAccelerationCurveMac.mm (modified) (2 diffs)
-
UIProcess/WebPageProxy.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-612-branch/Source/WebKit/ChangeLog
r286806 r286973 1 2021-12-13 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r286900. rdar://problem/86344954 4 5 Momentum Event Dispatcher: Magic Mouse doesn't use momentum event dispatcher 6 https://bugs.webkit.org/show_bug.cgi?id=234189 7 <rdar://problem/86344954> 8 9 Reviewed by Simon Fraser. 10 11 * Shared/mac/ScrollingAccelerationCurveMac.mm: 12 (WebKit::fromIOHIDDevice): 13 Fix the FIXME here about the additional fallback values; it turns out 14 Magic Mouse is one device that does not have a value for 15 kIOHIDScrollAccelerationTypeKey, so we need the full fallback chain to support it. 16 17 * UIProcess/WebPageProxy.cpp: 18 (WebKit::WebPageProxy::sendWheelEvent): 19 Un-wrapping this optional results in losing the engaged state, and sending 20 a garbage ScrollingAccelerationCurve across the wire. 21 The message argument is also an optional, so just pass it along. 22 23 The result of this bug was that if you had ever used a device with a curve 24 for a given page, and then used a device with no curve, MomentumEventDispatcher 25 would have a garbage curve (from this message trying to "unset" the optional), 26 and a garbage curve results in chaotic scrolling. 27 28 29 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@286900 268f45cc-cd09-0410-ab3c-d52691b4dbfc 30 31 2021-12-10 Tim Horton <timothy_horton@apple.com> 32 33 Momentum Event Dispatcher: Magic Mouse doesn't use momentum event dispatcher 34 https://bugs.webkit.org/show_bug.cgi?id=234189 35 <rdar://problem/86344954> 36 37 Reviewed by Simon Fraser. 38 39 * Shared/mac/ScrollingAccelerationCurveMac.mm: 40 (WebKit::fromIOHIDDevice): 41 Fix the FIXME here about the additional fallback values; it turns out 42 Magic Mouse is one device that does not have a value for 43 kIOHIDScrollAccelerationTypeKey, so we need the full fallback chain to support it. 44 45 * UIProcess/WebPageProxy.cpp: 46 (WebKit::WebPageProxy::sendWheelEvent): 47 Un-wrapping this optional results in losing the engaged state, and sending 48 a garbage ScrollingAccelerationCurve across the wire. 49 The message argument is also an optional, so just pass it along. 50 51 The result of this bug was that if you had ever used a device with a curve 52 for a given page, and then used a device with no curve, MomentumEventDispatcher 53 would have a garbage curve (from this message trying to "unset" the optional), 54 and a garbage curve results in chaotic scrolling. 55 1 56 2021-12-09 Alan Coon <alancoon@apple.com> 2 57 -
branches/safari-612-branch/Source/WebKit/Shared/mac/ScrollingAccelerationCurveMac.mm
r286691 r286973 117 117 } 118 118 119 // FIXME: There is some additional fallback to implement here, though this seems usually sufficient. 120 auto scrollAccelerationType = adoptCF(dynamic_cf_cast<CFStringRef>(IOHIDServiceClientCopyProperty(ioHIDService.get(), CFSTR("HIDScrollAccelerationType")))); 121 if (!scrollAccelerationType) { 122 RELEASE_LOG(ScrollAnimations, "ScrollingAccelerationCurve::fromIOHIDDevice failed to look up acceleration type"); 119 auto readFixedPointServiceKey = [&] (CFStringRef key) -> std::optional<float> { 120 auto valueCF = adoptCF(dynamic_cf_cast<CFNumberRef>(IOHIDServiceClientCopyProperty(ioHIDService.get(), key))); 121 if (!valueCF) 122 return std::nullopt; 123 return fromFixedPoint([(NSNumber *)valueCF.get() floatValue]); 124 }; 125 126 auto scrollAcceleration = [&] () -> std::optional<float> { 127 if (auto scrollAccelerationType = adoptCF(dynamic_cf_cast<CFStringRef>(IOHIDServiceClientCopyProperty(ioHIDService.get(), CFSTR("HIDScrollAccelerationType"))))) { 128 if (auto acceleration = readFixedPointServiceKey(scrollAccelerationType.get())) 129 return acceleration; 130 } 131 132 if (auto acceleration = readFixedPointServiceKey(CFSTR(kIOHIDMouseScrollAccelerationKey))) 133 return acceleration; 134 135 if (auto acceleration = readFixedPointServiceKey(CFSTR(kIOHIDScrollAccelerationKey))) 136 return acceleration; 137 138 return std::nullopt; 139 }(); 140 if (!scrollAcceleration) { 141 RELEASE_LOG(ScrollAnimations, "ScrollingAccelerationCurve::fromIOHIDDevice failed to look up acceleration"); 123 142 return std::nullopt; 124 143 } 125 144 126 auto scrollAccelerationCF = adoptCF(dynamic_cf_cast<CFNumberRef>(IOHIDServiceClientCopyProperty(ioHIDService.get(), scrollAccelerationType.get()))); 127 if (!scrollAccelerationCF) { 128 RELEASE_LOG(ScrollAnimations, "ScrollingAccelerationCurve::fromIOHIDDevice failed to look up acceleration value"); 129 return std::nullopt; 130 } 131 auto scrollAcceleration = fromFixedPoint(fromCFNumber(scrollAccelerationCF.get())); 132 133 auto resolutionCF = adoptCF(dynamic_cf_cast<CFNumberRef>(IOHIDServiceClientCopyProperty(ioHIDService.get(), CFSTR(kIOHIDScrollResolutionKey)))); 134 if (!resolutionCF) { 145 auto resolution = readFixedPointServiceKey(CFSTR(kIOHIDScrollResolutionKey)); 146 if (!resolution) { 135 147 RELEASE_LOG(ScrollAnimations, "ScrollingAccelerationCurve::fromIOHIDDevice failed to look up resolution"); 136 148 return std::nullopt; 137 149 } 138 auto resolution = fromFixedPoint([(NSNumber *)resolutionCF.get() floatValue]);139 150 140 151 static CFStringRef dispatchFrameRateKey = CFSTR("ScrollMomentumDispatchRate"); … … 143 154 float frameRate = frameRateCF ? fromCFNumber(frameRateCF.get()) : defaultDispatchFrameRate; 144 155 145 return fromIOHIDCurveArrayWithAcceleration((NSArray *)curves.get(), scrollAcceleration,resolution, frameRate);156 return fromIOHIDCurveArrayWithAcceleration((NSArray *)curves.get(), *scrollAcceleration, *resolution, frameRate); 146 157 } 147 158 -
branches/safari-612-branch/Source/WebKit/UIProcess/WebPageProxy.cpp
r286740 r286973 2943 2943 #if ENABLE(MOMENTUM_EVENT_DISPATCHER) 2944 2944 if (event.momentumPhase() == WebWheelEvent::PhaseBegan && m_scrollingAccelerationCurve != m_lastSentScrollingAccelerationCurve) { 2945 connection->send(Messages::EventDispatcher::SetScrollingAccelerationCurve(m_webPageID, *m_scrollingAccelerationCurve), 0, { }, Thread::QOS::UserInteractive);2945 connection->send(Messages::EventDispatcher::SetScrollingAccelerationCurve(m_webPageID, m_scrollingAccelerationCurve), 0, { }, Thread::QOS::UserInteractive); 2946 2946 m_lastSentScrollingAccelerationCurve = m_scrollingAccelerationCurve; 2947 2947 }
Note:
See TracChangeset
for help on using the changeset viewer.