Changeset 242366 in webkit
- Timestamp:
- Mar 4, 2019, 11:33:04 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
page/ios/ContentChangeObserver.cpp (modified) (11 diffs)
-
page/ios/ContentChangeObserver.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r242365 r242366 1 2019-03-04 Zalan Bujtas <zalan@apple.com> 2 3 [ContentChangeObserver] Decouple mouseMoved event and the "is observing content change" status. 4 https://bugs.webkit.org/show_bug.cgi?id=195286 5 6 Reviewed by Simon Fraser. 7 8 Now isObservingContentChanges returns true only when we are actively observing content change during timer firing and/or style recalculating. 9 This patch also renames a couple of functions to follow the didStart/didFinish pattern. 10 11 * page/ios/ContentChangeObserver.cpp: 12 (WebCore::ContentChangeObserver::domTimerExecuteDidStart): 13 (WebCore::ContentChangeObserver::domTimerExecuteDidFinish): 14 (WebCore::ContentChangeObserver::styleRecalcDidStart): 15 (WebCore::ContentChangeObserver::styleRecalcDidFinish): 16 (WebCore::ContentChangeObserver::mouseMovedDidStart): 17 (WebCore::ContentChangeObserver::mouseMovedDidFinish): 18 (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc): 19 (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope): 20 (WebCore::ContentChangeObserver::MouseMovedScope::MouseMovedScope): 21 (WebCore::ContentChangeObserver::MouseMovedScope::~MouseMovedScope): 22 (WebCore::ContentChangeObserver::StyleRecalcScope::StyleRecalcScope): 23 (WebCore::ContentChangeObserver::StyleRecalcScope::~StyleRecalcScope): 24 (WebCore::ContentChangeObserver::DOMTimerScope::DOMTimerScope): 25 (WebCore::ContentChangeObserver::DOMTimerScope::~DOMTimerScope): 26 (WebCore::ContentChangeObserver::startObservingDOMTimerExecute): Deleted. 27 (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute): Deleted. 28 (WebCore::ContentChangeObserver::startObservingStyleRecalc): Deleted. 29 (WebCore::ContentChangeObserver::stopObservingStyleRecalc): Deleted. 30 (WebCore::ContentChangeObserver::startObservingMouseMoved): Deleted. 31 (WebCore::ContentChangeObserver::stopObservingMouseMoved): Deleted. 32 (WebCore::ContentChangeObserver::setShouldObserveStyleRecalc): Deleted. 33 * page/ios/ContentChangeObserver.h: 34 (WebCore::ContentChangeObserver::setShouldObserveDOMTimerScheduling): 35 (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling const): 36 (WebCore::ContentChangeObserver::isObservingStyleRecalc const): 37 (WebCore::ContentChangeObserver::isObservingContentChanges const): 38 (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling): Deleted. 39 (WebCore::ContentChangeObserver::stopObservingDOMTimerScheduling): Deleted. 40 (WebCore::ContentChangeObserver::shouldObserveStyleRecalc const): Deleted. 41 1 42 2019-03-04 Yusuke Suzuki <ysuzuki@apple.com> 2 43 -
trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp
r242340 r242366 67 67 } 68 68 69 void ContentChangeObserver:: startObservingDOMTimerExecute(const DOMTimer& timer)69 void ContentChangeObserver::domTimerExecuteDidStart(const DOMTimer& timer) 70 70 { 71 71 if (!containsObservedDOMTimer(timer)) … … 73 73 LOG_WITH_STREAM(ContentObservation, stream << "startObservingDOMTimerExecute: start observing (" << &timer << ") timer callback."); 74 74 75 m_ isObservingContentChanges= true;76 } 77 78 void ContentChangeObserver:: stopObservingDOMTimerExecute(const DOMTimer& timer)75 m_domTimerisBeingExecuted = true; 76 } 77 78 void ContentChangeObserver::domTimerExecuteDidFinish(const DOMTimer& timer) 79 79 { 80 80 if (!containsObservedDOMTimer(timer)) … … 82 82 LOG_WITH_STREAM(ContentObservation, stream << "stopObservingDOMTimerExecute: stop observing (" << &timer << ") timer callback."); 83 83 84 m_ isObservingContentChanges= false;84 m_domTimerisBeingExecuted = false; 85 85 unregisterDOMTimer(timer); 86 setShouldObserve StyleRecalc(m_document.hasPendingStyleRecalc());86 setShouldObserveNextStyleRecalc(m_document.hasPendingStyleRecalc()); 87 87 notifyContentChangeIfNeeded(); 88 88 } 89 89 90 void ContentChangeObserver::st artObservingStyleRecalc()91 { 92 if (! shouldObserveStyleRecalc())90 void ContentChangeObserver::styleRecalcDidStart() 91 { 92 if (!isObservingStyleRecalc()) 93 93 return; 94 94 if (hasVisibleChangeState()) … … 96 96 LOG(ContentObservation, "startObservingStyleRecalc: start observing style recalc."); 97 97 98 m_ isObservingContentChanges= true;99 } 100 101 void ContentChangeObserver::st opObservingStyleRecalc()102 { 103 if (! shouldObserveStyleRecalc())98 m_styleRecalcIsBeingExecuted = true; 99 } 100 101 void ContentChangeObserver::styleRecalcDidFinish() 102 { 103 if (!isObservingStyleRecalc()) 104 104 return; 105 105 LOG(ContentObservation, "stopObservingStyleRecalc: stop observing style recalc"); 106 106 107 setShouldObserveStyleRecalc(false);108 m_isObservingContentChanges = false;107 m_styleRecalcIsBeingExecuted = false; 108 setShouldObserveNextStyleRecalc(false); 109 109 adjustObservedState(Event::StyleRecalcFinished); 110 110 notifyContentChangeIfNeeded(); … … 139 139 } 140 140 141 void ContentChangeObserver:: startObservingMouseMoved()141 void ContentChangeObserver::mouseMovedDidStart() 142 142 { 143 143 ASSERT(!m_document.hasPendingStyleRecalc()); 144 144 clearObservedDOMTimers(); 145 startObservingDOMTimerScheduling(); 146 m_isObservingContentChanges = true; 145 setShouldObserveDOMTimerScheduling(true); 147 146 adjustObservedState(Event::ContentObservationStarted); 148 147 } 149 148 150 void ContentChangeObserver::stopObservingMouseMoved() 151 { 152 stopObservingDOMTimerScheduling(); 153 m_isObservingContentChanges = false; 149 void ContentChangeObserver::mouseMovedDidFinish() 150 { 151 setShouldObserveDOMTimerScheduling(false); 154 152 } 155 153 … … 171 169 } 172 170 173 void ContentChangeObserver::setShouldObserve StyleRecalc(bool shouldObserve)171 void ContentChangeObserver::setShouldObserveNextStyleRecalc(bool shouldObserve) 174 172 { 175 173 if (shouldObserve) 176 174 LOG(ContentObservation, "Wait until next style recalc fires."); 177 m_ shouldObserveStyleRecalc = shouldObserve;175 m_isObservingStyleRecalc = shouldObserve; 178 176 } 179 177 … … 247 245 : m_contentChangeObserver(document.contentChangeObserver()) 248 246 , m_element(element) 249 , m_needsObserving(m_contentChangeObserver.isObservingContentChanges() && m_contentChangeObserver.observedContentChange() != WKContentVisibilityChange)247 , m_needsObserving(m_contentChangeObserver.isObservingContentChanges() && !m_contentChangeObserver.hasVisibleChangeState()) 250 248 { 251 249 if (m_needsObserving) { … … 284 282 : m_contentChangeObserver(document.contentChangeObserver()) 285 283 { 286 m_contentChangeObserver. startObservingMouseMoved();284 m_contentChangeObserver.mouseMovedDidStart(); 287 285 } 288 286 289 287 ContentChangeObserver::MouseMovedScope::~MouseMovedScope() 290 288 { 291 m_contentChangeObserver. stopObservingMouseMoved();289 m_contentChangeObserver.mouseMovedDidFinish(); 292 290 } 293 291 … … 295 293 : m_contentChangeObserver(document.contentChangeObserver()) 296 294 { 297 m_contentChangeObserver.st artObservingStyleRecalc();295 m_contentChangeObserver.styleRecalcDidStart(); 298 296 } 299 297 300 298 ContentChangeObserver::StyleRecalcScope::~StyleRecalcScope() 301 299 { 302 m_contentChangeObserver.st opObservingStyleRecalc();300 m_contentChangeObserver.styleRecalcDidFinish(); 303 301 } 304 302 … … 308 306 { 309 307 if (m_contentChangeObserver) 310 m_contentChangeObserver-> startObservingDOMTimerExecute(m_domTimer);308 m_contentChangeObserver->domTimerExecuteDidStart(m_domTimer); 311 309 } 312 310 … … 314 312 { 315 313 if (m_contentChangeObserver) 316 m_contentChangeObserver-> stopObservingDOMTimerExecute(m_domTimer);314 m_contentChangeObserver->domTimerExecuteDidFinish(m_domTimer); 317 315 } 318 316 -
trunk/Source/WebCore/page/ios/ContentChangeObserver.h
r242340 r242366 87 87 88 88 private: 89 void startObservingMouseMoved();90 void stopObservingMouseMoved();89 void mouseMovedDidStart(); 90 void mouseMovedDidFinish(); 91 91 92 void startObservingDOMTimerScheduling() { m_isObservingDOMTimerScheduling = true; } 93 void stopObservingDOMTimerScheduling() { m_isObservingDOMTimerScheduling = false; } 94 95 void startObservingDOMTimerExecute(const DOMTimer&); 96 void stopObservingDOMTimerExecute(const DOMTimer&); 97 98 void startObservingStyleRecalc(); 99 void stopObservingStyleRecalc(); 100 92 void setShouldObserveDOMTimerScheduling(bool observe) { m_isObservingDOMTimerScheduling = observe; } 93 bool isObservingDOMTimerScheduling() const { return m_isObservingDOMTimerScheduling; } 94 void domTimerExecuteDidStart(const DOMTimer&); 95 void domTimerExecuteDidFinish(const DOMTimer&); 101 96 void registerDOMTimer(const DOMTimer&); 102 97 void unregisterDOMTimer(const DOMTimer&); 103 bool isObservingDOMTimerScheduling() const { return m_isObservingDOMTimerScheduling; }104 98 bool containsObservedDOMTimer(const DOMTimer& timer) const { return m_DOMTimerList.contains(&timer); } 105 99 106 void setShouldObserveStyleRecalc(bool); 107 bool shouldObserveStyleRecalc() const { return m_shouldObserveStyleRecalc; } 100 void styleRecalcDidStart(); 101 void styleRecalcDidFinish(); 102 void setShouldObserveNextStyleRecalc(bool); 103 bool isObservingStyleRecalc() const { return m_isObservingStyleRecalc; } 108 104 109 bool isObservingContentChanges() const { return m_ isObservingContentChanges; }105 bool isObservingContentChanges() const { return m_domTimerisBeingExecuted || m_styleRecalcIsBeingExecuted; } 110 106 111 107 void clearObservedDOMTimers() { m_DOMTimerList.clear(); } … … 133 129 Document& m_document; 134 130 HashSet<const DOMTimer*> m_DOMTimerList; 135 bool m_shouldObserveStyleRecalc { false }; 131 bool m_isObservingStyleRecalc { false }; 132 bool m_styleRecalcIsBeingExecuted { false }; 136 133 bool m_isObservingDOMTimerScheduling { false }; 137 bool m_ isObservingContentChanges{ false };134 bool m_domTimerisBeingExecuted { false }; 138 135 }; 139 136
Note:
See TracChangeset
for help on using the changeset viewer.