Changeset 285165 in webkit
- Timestamp:
- Nov 2, 2021, 10:09:53 AM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
Shared/WebWheelEventCoalescer.cpp (modified) (4 diffs)
-
Shared/WebWheelEventCoalescer.h (modified) (3 diffs)
-
UIProcess/WebPageProxy.cpp (modified) (2 diffs)
-
UIProcess/WebPageProxy.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r285164 r285165 1 2021-11-02 Simon Fraser <simon.fraser@apple.com> 2 3 Revert the wheel event coalescing added in r277587 4 https://bugs.webkit.org/show_bug.cgi?id=232602 5 <rdar://84908023> 6 7 Reviewed by Wenson Hsieh. 8 9 This wheel event coalescing was added to allow the tail end of momentum scrolls on 10 120Hz devices to fall back to 60fps for power reasons. However, the OS does this for 11 us, so we don't need to do our own coalescing. 12 13 * Shared/WebWheelEventCoalescer.cpp: 14 (WebKit::WebWheelEventCoalescer::shouldDispatchEvent): 15 (WebKit::WebWheelEventCoalescer::isMomentumPhaseEvent): Deleted. 16 * Shared/WebWheelEventCoalescer.h: 17 (WebKit::WebWheelEventCoalescer::shouldCoalesceEventsDuringDeceleration const): Deleted. 18 (WebKit::WebWheelEventCoalescer::setShouldCoalesceEventsDuringDeceleration): Deleted. 19 (): Deleted. 20 * UIProcess/WebPageProxy.cpp: 21 (WebKit::WebPageProxy::wheelEventCoalescer): 22 (WebKit::WebPageProxy::windowScreenDidChange): 23 (WebKit::WebPageProxy::shouldCoalesceWheelEventsDuringDeceleration const): Deleted. 24 * UIProcess/WebPageProxy.h: 25 1 26 2021-11-02 Patrick Angle <pangle@apple.com> 2 27 -
trunk/Source/WebKit/Shared/WebWheelEventCoalescer.cpp
r278253 r285165 30 30 #include "NativeWebWheelEvent.h" 31 31 #include "WebEventConversion.h" 32 #include <WebCore/AnimationFrameRate.h>33 32 #include <wtf/text/TextStream.h> 34 33 … … 88 87 } 89 88 90 bool WebWheelEventCoalescer::isMomentumPhaseEvent(const WebWheelEvent& event)91 {92 return event.phase() == WebWheelEvent::Phase::PhaseNone && event.momentumPhase() == WebWheelEvent::Phase::PhaseChanged;93 }94 95 89 bool WebWheelEventCoalescer::shouldDispatchEventNow(const WebWheelEvent& event) const 96 90 { … … 142 136 bool WebWheelEventCoalescer::shouldDispatchEvent(const NativeWebWheelEvent& event) 143 137 { 144 LOG_WITH_STREAM(WheelEvents, stream << "WebWheelEventCoalescer::shouldDispatchEvent " << event << " (" << m_wheelEventQueue.size() << " events in the queue, " << m_eventsBeingProcessed.size() << " event sequences being processed , coalesce during decleration " << m_shouldCoalesceEventsDuringDeceleration << ")");138 LOG_WITH_STREAM(WheelEvents, stream << "WebWheelEventCoalescer::shouldDispatchEvent " << event << " (" << m_wheelEventQueue.size() << " events in the queue, " << m_eventsBeingProcessed.size() << " event sequences being processed)"); 145 139 146 140 m_wheelEventQueue.append(event); 147 148 auto lastEventInterval = event.timestamp() - m_lastEventTime;149 m_lastEventTime = event.timestamp();150 151 if (isMomentumPhaseEvent(event) && shouldCoalesceEventsDuringDeceleration() && lastEventInterval) {152 constexpr double momentumVelocityEventFrequencyReductionThreashold = 320.0; // Points per second.153 auto instantaneousVelocity = std::max(std::abs(event.delta().width()), std::abs(event.delta().height())) / lastEventInterval.seconds();154 155 constexpr auto maxCoalescingInterval = WebCore::FullSpeedAnimationInterval;156 auto lastDispatchedEventInterval = event.timestamp() - m_lastDispatchedEventTime;157 158 if (instantaneousVelocity < momentumVelocityEventFrequencyReductionThreashold && lastDispatchedEventInterval < maxCoalescingInterval) {159 LOG_WITH_STREAM(WheelEvents, stream << " coalesced event that came within " << lastDispatchedEventInterval.milliseconds() << " of previous dispatch");160 return false;161 }162 }163 141 164 142 if (!m_eventsBeingProcessed.isEmpty()) { … … 171 149 } 172 150 173 m_lastDispatchedEventTime = event.timestamp();174 151 return true; 175 152 } -
trunk/Source/WebKit/Shared/WebWheelEventCoalescer.h
r278253 r285165 29 29 #include <wtf/Deque.h> 30 30 #include <wtf/FastMalloc.h> 31 #include <wtf/WallTime.h>32 31 33 32 namespace WebKit { … … 44 43 bool hasEventsBeingProcessed() const { return !m_eventsBeingProcessed.isEmpty(); } 45 44 46 bool shouldCoalesceEventsDuringDeceleration() const { return m_shouldCoalesceEventsDuringDeceleration; }47 void setShouldCoalesceEventsDuringDeceleration(bool shouldCoalsce) { m_shouldCoalesceEventsDuringDeceleration = shouldCoalsce; }48 49 45 void clear(); 50 46 … … 55 51 static WebWheelEvent coalesce(const WebWheelEvent&, const WebWheelEvent&); 56 52 57 static bool isMomentumPhaseEvent(const WebWheelEvent&);58 59 53 bool shouldDispatchEventNow(const WebWheelEvent&) const; 60 54 61 55 Deque<NativeWebWheelEvent, 2> m_wheelEventQueue; 62 56 Deque<std::unique_ptr<CoalescedEventSequence>> m_eventsBeingProcessed; 63 64 WallTime m_lastEventTime;65 WallTime m_lastDispatchedEventTime;66 bool m_shouldCoalesceEventsDuringDeceleration { false };67 57 }; 68 58 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r285159 r285165 2947 2947 WebWheelEventCoalescer& WebPageProxy::wheelEventCoalescer() 2948 2948 { 2949 if (!m_wheelEventCoalescer) {2949 if (!m_wheelEventCoalescer) 2950 2950 m_wheelEventCoalescer = makeUnique<WebWheelEventCoalescer>(); 2951 m_wheelEventCoalescer->setShouldCoalesceEventsDuringDeceleration(shouldCoalesceWheelEventsDuringDeceleration());2952 }2953 2951 2954 2952 return *m_wheelEventCoalescer; 2955 }2956 2957 bool WebPageProxy::shouldCoalesceWheelEventsDuringDeceleration() const2958 {2959 #if HAVE(CVDISPLAYLINK)2960 if (!m_displayID)2961 return false;2962 2963 auto framesPerSecond = m_process->processPool().nominalFramesPerSecondForDisplay(*m_displayID);2964 return framesPerSecond > WebCore::FullSpeedFramesPerSecond;2965 #else2966 return false;2967 #endif2968 2953 } 2969 2954 … … 3948 3933 { 3949 3934 m_displayID = displayID; 3950 3951 if (m_wheelEventCoalescer)3952 m_wheelEventCoalescer->setShouldCoalesceEventsDuringDeceleration(shouldCoalesceWheelEventsDuringDeceleration());3953 3935 3954 3936 if (!hasRunningProcess()) -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r285047 r285165 2388 2388 2389 2389 WebWheelEventCoalescer& wheelEventCoalescer(); 2390 bool shouldCoalesceWheelEventsDuringDeceleration() const;2391 2390 2392 2391 #if HAVE(CVDISPLAYLINK)
Note:
See TracChangeset
for help on using the changeset viewer.