Changeset 286900 in webkit
- Timestamp:
- Dec 10, 2021, 7:43:48 PM (5 years ago)
- Location:
- trunk/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
-
trunk/Source/WebKit/ChangeLog
r286896 r286900 1 2021-12-10 Tim Horton <timothy_horton@apple.com> 2 3 Momentum Event Dispatcher: Magic Mouse doesn't use momentum event dispatcher 4 https://bugs.webkit.org/show_bug.cgi?id=234189 5 <rdar://problem/86344954> 6 7 Reviewed by Simon Fraser. 8 9 * Shared/mac/ScrollingAccelerationCurveMac.mm: 10 (WebKit::fromIOHIDDevice): 11 Fix the FIXME here about the additional fallback values; it turns out 12 Magic Mouse is one device that does not have a value for 13 kIOHIDScrollAccelerationTypeKey, so we need the full fallback chain to support it. 14 15 * UIProcess/WebPageProxy.cpp: 16 (WebKit::WebPageProxy::sendWheelEvent): 17 Un-wrapping this optional results in losing the engaged state, and sending 18 a garbage ScrollingAccelerationCurve across the wire. 19 The message argument is also an optional, so just pass it along. 20 21 The result of this bug was that if you had ever used a device with a curve 22 for a given page, and then used a device with no curve, MomentumEventDispatcher 23 would have a garbage curve (from this message trying to "unset" the optional), 24 and a garbage curve results in chaotic scrolling. 25 1 26 2021-12-10 Michael Saboff <msaboff@apple.com> 2 27 -
trunk/Source/WebKit/Shared/mac/ScrollingAccelerationCurveMac.mm
r286483 r286900 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 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r286894 r286900 2963 2963 #if ENABLE(MOMENTUM_EVENT_DISPATCHER) 2964 2964 if (event.momentumPhase() == WebWheelEvent::PhaseBegan && m_scrollingAccelerationCurve != m_lastSentScrollingAccelerationCurve) { 2965 connection->send(Messages::EventDispatcher::SetScrollingAccelerationCurve(m_webPageID, *m_scrollingAccelerationCurve), 0, { }, Thread::QOS::UserInteractive);2965 connection->send(Messages::EventDispatcher::SetScrollingAccelerationCurve(m_webPageID, m_scrollingAccelerationCurve), 0, { }, Thread::QOS::UserInteractive); 2966 2966 m_lastSentScrollingAccelerationCurve = m_scrollingAccelerationCurve; 2967 2967 }
Note:
See TracChangeset
for help on using the changeset viewer.