⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 242366 in webkit


Ignore:
Timestamp:
Mar 4, 2019, 11:33:04 AM (7 years ago)
Author:
Alan Bujtas
Message:

[ContentChangeObserver] Decouple mouseMoved event and the "is observing content change" status.
https://bugs.webkit.org/show_bug.cgi?id=195286

Reviewed by Simon Fraser.

Now isObservingContentChanges returns true only when we are actively observing content change during timer firing and/or style recalculating.
This patch also renames a couple of functions to follow the didStart/didFinish pattern.

  • page/ios/ContentChangeObserver.cpp:

(WebCore::ContentChangeObserver::domTimerExecuteDidStart):
(WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
(WebCore::ContentChangeObserver::styleRecalcDidStart):
(WebCore::ContentChangeObserver::styleRecalcDidFinish):
(WebCore::ContentChangeObserver::mouseMovedDidStart):
(WebCore::ContentChangeObserver::mouseMovedDidFinish):
(WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
(WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
(WebCore::ContentChangeObserver::MouseMovedScope::MouseMovedScope):
(WebCore::ContentChangeObserver::MouseMovedScope::~MouseMovedScope):
(WebCore::ContentChangeObserver::StyleRecalcScope::StyleRecalcScope):
(WebCore::ContentChangeObserver::StyleRecalcScope::~StyleRecalcScope):
(WebCore::ContentChangeObserver::DOMTimerScope::DOMTimerScope):
(WebCore::ContentChangeObserver::DOMTimerScope::~DOMTimerScope):
(WebCore::ContentChangeObserver::startObservingDOMTimerExecute): Deleted.
(WebCore::ContentChangeObserver::stopObservingDOMTimerExecute): Deleted.
(WebCore::ContentChangeObserver::startObservingStyleRecalc): Deleted.
(WebCore::ContentChangeObserver::stopObservingStyleRecalc): Deleted.
(WebCore::ContentChangeObserver::startObservingMouseMoved): Deleted.
(WebCore::ContentChangeObserver::stopObservingMouseMoved): Deleted.
(WebCore::ContentChangeObserver::setShouldObserveStyleRecalc): Deleted.

  • page/ios/ContentChangeObserver.h:

(WebCore::ContentChangeObserver::setShouldObserveDOMTimerScheduling):
(WebCore::ContentChangeObserver::isObservingDOMTimerScheduling const):
(WebCore::ContentChangeObserver::isObservingStyleRecalc const):
(WebCore::ContentChangeObserver::isObservingContentChanges const):
(WebCore::ContentChangeObserver::startObservingDOMTimerScheduling): Deleted.
(WebCore::ContentChangeObserver::stopObservingDOMTimerScheduling): Deleted.
(WebCore::ContentChangeObserver::shouldObserveStyleRecalc const): Deleted.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r242365 r242366  
     12019-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
    1422019-03-04  Yusuke Suzuki  <ysuzuki@apple.com>
    243
  • trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp

    r242340 r242366  
    6767}
    6868
    69 void ContentChangeObserver::startObservingDOMTimerExecute(const DOMTimer& timer)
     69void ContentChangeObserver::domTimerExecuteDidStart(const DOMTimer& timer)
    7070{
    7171    if (!containsObservedDOMTimer(timer))
     
    7373    LOG_WITH_STREAM(ContentObservation, stream << "startObservingDOMTimerExecute: start observing (" << &timer << ") timer callback.");
    7474
    75     m_isObservingContentChanges = true;
    76 }
    77 
    78 void ContentChangeObserver::stopObservingDOMTimerExecute(const DOMTimer& timer)
     75    m_domTimerisBeingExecuted = true;
     76}
     77
     78void ContentChangeObserver::domTimerExecuteDidFinish(const DOMTimer& timer)
    7979{
    8080    if (!containsObservedDOMTimer(timer))
     
    8282    LOG_WITH_STREAM(ContentObservation, stream << "stopObservingDOMTimerExecute: stop observing (" << &timer << ") timer callback.");
    8383
    84     m_isObservingContentChanges = false;
     84    m_domTimerisBeingExecuted = false;
    8585    unregisterDOMTimer(timer);
    86     setShouldObserveStyleRecalc(m_document.hasPendingStyleRecalc());
     86    setShouldObserveNextStyleRecalc(m_document.hasPendingStyleRecalc());
    8787    notifyContentChangeIfNeeded();
    8888}
    8989
    90 void ContentChangeObserver::startObservingStyleRecalc()
    91 {
    92     if (!shouldObserveStyleRecalc())
     90void ContentChangeObserver::styleRecalcDidStart()
     91{
     92    if (!isObservingStyleRecalc())
    9393        return;
    9494    if (hasVisibleChangeState())
     
    9696    LOG(ContentObservation, "startObservingStyleRecalc: start observing style recalc.");
    9797
    98     m_isObservingContentChanges = true;
    99 }
    100 
    101 void ContentChangeObserver::stopObservingStyleRecalc()
    102 {
    103     if (!shouldObserveStyleRecalc())
     98    m_styleRecalcIsBeingExecuted = true;
     99}
     100
     101void ContentChangeObserver::styleRecalcDidFinish()
     102{
     103    if (!isObservingStyleRecalc())
    104104        return;
    105105    LOG(ContentObservation, "stopObservingStyleRecalc: stop observing style recalc");
    106106
    107     setShouldObserveStyleRecalc(false);
    108     m_isObservingContentChanges = false;
     107    m_styleRecalcIsBeingExecuted = false;
     108    setShouldObserveNextStyleRecalc(false);
    109109    adjustObservedState(Event::StyleRecalcFinished);
    110110    notifyContentChangeIfNeeded();
     
    139139}
    140140
    141 void ContentChangeObserver::startObservingMouseMoved()
     141void ContentChangeObserver::mouseMovedDidStart()
    142142{
    143143    ASSERT(!m_document.hasPendingStyleRecalc());
    144144    clearObservedDOMTimers();
    145     startObservingDOMTimerScheduling();
    146     m_isObservingContentChanges = true;
     145    setShouldObserveDOMTimerScheduling(true);
    147146    adjustObservedState(Event::ContentObservationStarted);
    148147}
    149148
    150 void ContentChangeObserver::stopObservingMouseMoved()
    151 {
    152     stopObservingDOMTimerScheduling();
    153     m_isObservingContentChanges = false;
     149void ContentChangeObserver::mouseMovedDidFinish()
     150{
     151    setShouldObserveDOMTimerScheduling(false);
    154152}
    155153
     
    171169}
    172170
    173 void ContentChangeObserver::setShouldObserveStyleRecalc(bool shouldObserve)
     171void ContentChangeObserver::setShouldObserveNextStyleRecalc(bool shouldObserve)
    174172{
    175173    if (shouldObserve)
    176174        LOG(ContentObservation, "Wait until next style recalc fires.");
    177     m_shouldObserveStyleRecalc = shouldObserve;
     175    m_isObservingStyleRecalc = shouldObserve;
    178176}
    179177
     
    247245    : m_contentChangeObserver(document.contentChangeObserver())
    248246    , m_element(element)
    249     , m_needsObserving(m_contentChangeObserver.isObservingContentChanges() && m_contentChangeObserver.observedContentChange() != WKContentVisibilityChange)
     247    , m_needsObserving(m_contentChangeObserver.isObservingContentChanges() && !m_contentChangeObserver.hasVisibleChangeState())
    250248{
    251249    if (m_needsObserving) {
     
    284282    : m_contentChangeObserver(document.contentChangeObserver())
    285283{
    286     m_contentChangeObserver.startObservingMouseMoved();
     284    m_contentChangeObserver.mouseMovedDidStart();
    287285}
    288286
    289287ContentChangeObserver::MouseMovedScope::~MouseMovedScope()
    290288{
    291     m_contentChangeObserver.stopObservingMouseMoved();
     289    m_contentChangeObserver.mouseMovedDidFinish();
    292290}
    293291
     
    295293    : m_contentChangeObserver(document.contentChangeObserver())
    296294{
    297     m_contentChangeObserver.startObservingStyleRecalc();
     295    m_contentChangeObserver.styleRecalcDidStart();
    298296}
    299297
    300298ContentChangeObserver::StyleRecalcScope::~StyleRecalcScope()
    301299{
    302     m_contentChangeObserver.stopObservingStyleRecalc();
     300    m_contentChangeObserver.styleRecalcDidFinish();
    303301}
    304302
     
    308306{
    309307    if (m_contentChangeObserver)
    310         m_contentChangeObserver->startObservingDOMTimerExecute(m_domTimer);
     308        m_contentChangeObserver->domTimerExecuteDidStart(m_domTimer);
    311309}
    312310
     
    314312{
    315313    if (m_contentChangeObserver)
    316         m_contentChangeObserver->stopObservingDOMTimerExecute(m_domTimer);
     314        m_contentChangeObserver->domTimerExecuteDidFinish(m_domTimer);
    317315}
    318316
  • trunk/Source/WebCore/page/ios/ContentChangeObserver.h

    r242340 r242366  
    8787
    8888private:
    89     void startObservingMouseMoved();
    90     void stopObservingMouseMoved();
     89    void mouseMovedDidStart();
     90    void mouseMovedDidFinish();
    9191
    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&);
    10196    void registerDOMTimer(const DOMTimer&);
    10297    void unregisterDOMTimer(const DOMTimer&);
    103     bool isObservingDOMTimerScheduling() const { return m_isObservingDOMTimerScheduling; }
    10498    bool containsObservedDOMTimer(const DOMTimer& timer) const { return m_DOMTimerList.contains(&timer); }
    10599
    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; }
    108104
    109     bool isObservingContentChanges() const { return m_isObservingContentChanges; }
     105    bool isObservingContentChanges() const { return m_domTimerisBeingExecuted || m_styleRecalcIsBeingExecuted; }
    110106
    111107    void clearObservedDOMTimers() { m_DOMTimerList.clear(); }
     
    133129    Document& m_document;
    134130    HashSet<const DOMTimer*> m_DOMTimerList;
    135     bool m_shouldObserveStyleRecalc { false };
     131    bool m_isObservingStyleRecalc { false };
     132    bool m_styleRecalcIsBeingExecuted { false };
    136133    bool m_isObservingDOMTimerScheduling { false };
    137     bool m_isObservingContentChanges { false };
     134    bool m_domTimerisBeingExecuted { false };
    138135};
    139136
Note: See TracChangeset for help on using the changeset viewer.