Changeset 242102 in webkit


Ignore:
Timestamp:
Feb 26, 2019, 1:01:28 PM (7 years ago)
Author:
Alan Bujtas
Message:

[ContentChangeObserver] Move style recalc schedule observation logic to ContentChangeObserver
https://bugs.webkit.org/show_bug.cgi?id=195062
<rdar://problem/48409258>

Reviewed by Tim Horton.

Also rename registerDOMTimerForContentObservationIfNeeded to be consistent with the did* naming style.

  • dom/Document.cpp:

(WebCore::Document::scheduleStyleRecalc):

  • page/DOMTimer.cpp:

(WebCore::DOMTimer::install):

  • page/ios/ContentChangeObserver.h:
  • page/ios/ContentChangeObserver.mm:

(WebCore::ContentChangeObserver::didInstallDOMTimer):
(WebCore::ContentChangeObserver::didScheduleStyleRecalc):
(WebCore::ContentChangeObserver::registerDOMTimerForContentObservationIfNeeded): Deleted.

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r242099 r242102  
     12019-02-26  Zalan Bujtas  <zalan@apple.com>
     2
     3        [ContentChangeObserver] Move style recalc schedule observation logic to ContentChangeObserver
     4        https://bugs.webkit.org/show_bug.cgi?id=195062
     5        <rdar://problem/48409258>
     6
     7        Reviewed by Tim Horton.
     8
     9        Also rename registerDOMTimerForContentObservationIfNeeded to be consistent with the did* naming style.
     10
     11        * dom/Document.cpp:
     12        (WebCore::Document::scheduleStyleRecalc):
     13        * page/DOMTimer.cpp:
     14        (WebCore::DOMTimer::install):
     15        * page/ios/ContentChangeObserver.h:
     16        * page/ios/ContentChangeObserver.mm:
     17        (WebCore::ContentChangeObserver::didInstallDOMTimer):
     18        (WebCore::ContentChangeObserver::didScheduleStyleRecalc):
     19        (WebCore::ContentChangeObserver::registerDOMTimerForContentObservationIfNeeded): Deleted.
     20
    1212019-02-26  Chris Dumez  <cdumez@apple.com>
    222
  • trunk/Source/WebCore/dom/Document.cpp

    r242093 r242102  
    18101810
    18111811    ASSERT(childNeedsStyleRecalc() || m_needsFullStyleRebuild);
    1812 
    1813 #if PLATFORM(IOS_FAMILY)
    1814     if (auto* page = this->page()) {
    1815         auto& contentChangeObserver = page->contentChangeObserver();
    1816         if (contentChangeObserver.isObservingStyleRecalcScheduling()) {
    1817             LOG_WITH_STREAM(ContentObservation, stream << "Document(" << this << ")::scheduleStyleRecalc: register this style recalc schedule and observe when it fires.");
    1818             contentChangeObserver.setObservedContentChange(WKContentIndeterminateChange);
    1819         }
    1820     }
    1821 #endif
    1822 
    18231812    auto shouldThrottleStyleRecalc = [&] {
    18241813        if (!view() || !view()->isVisuallyNonEmpty())
     
    18331822
    18341823    m_styleRecalcTimer.startOneShot(0_s);
     1824#if PLATFORM(IOS_FAMILY)
     1825    if (auto* page = this->page())
     1826        page->contentChangeObserver().didScheduleStyleRecalc();
     1827#endif
    18351828
    18361829    InspectorInstrumentation::didScheduleStyleRecalculation(*this);
  • trunk/Source/WebCore/page/DOMTimer.cpp

    r242058 r242102  
    224224#if PLATFORM(IOS_FAMILY)
    225225    if (is<Document>(context))
    226         downcast<Document>(context).page()->contentChangeObserver().registerDOMTimerForContentObservationIfNeeded(*timer, timeout, singleShot);
     226        downcast<Document>(context).page()->contentChangeObserver().didInstallDOMTimer(*timer, timeout, singleShot);
    227227#endif
    228228    return timer->m_timeoutId;
  • trunk/Source/WebCore/page/ios/ContentChangeObserver.h

    r242094 r242102  
    3939    ContentChangeObserver(Page&);
    4040
    41     void registerDOMTimerForContentObservationIfNeeded(const DOMTimer&, Seconds timeout, bool singleShot);
     41    void didInstallDOMTimer(const DOMTimer&, Seconds timeout, bool singleShot);
    4242    void removeDOMTimer(const DOMTimer&);
    4343    void startObservingDOMTimerExecute(const DOMTimer&);
    4444    void stopObservingDOMTimerExecute(const DOMTimer&);
    4545
     46    void didScheduleStyleRecalc();
    4647    void startObservingStyleResolve();
    4748    void stopObservingStyleResolve();
     
    5051    WEBCORE_EXPORT void stopObservingContentChanges();
    5152
    52     bool isObservingStyleRecalcScheduling();
    53 
    54     void setShouldObserveNextStyleRecalc(bool);
    55     bool shouldObserveNextStyleRecalc();
    56 
    57     void setObservedContentChange(WKContentChange);
    5853    WEBCORE_EXPORT WKContentChange observedContentChange();
    5954
     
    8681    void stopObservingStyleRecalcScheduling();
    8782
     83    void setShouldObserveNextStyleRecalc(bool);
     84    bool shouldObserveNextStyleRecalc();
     85
    8886    bool isObservingContentChanges();
     87    bool isObservingStyleRecalcScheduling();
     88
     89    void setObservedContentChange(WKContentChange);
    8990
    9091    Page& m_page;
  • trunk/Source/WebCore/page/ios/ContentChangeObserver.mm

    r242094 r242102  
    4141}
    4242
    43 void ContentChangeObserver::registerDOMTimerForContentObservationIfNeeded(const DOMTimer& timer, Seconds timeout, bool singleShot)
     43void ContentChangeObserver::didInstallDOMTimer(const DOMTimer& timer, Seconds timeout, bool singleShot)
    4444{
    4545    if (!m_page.mainFrame().document())
     
    5353    setObservedContentChange(WKContentIndeterminateChange);
    5454    addObservedDOMTimer(timer);
    55     LOG_WITH_STREAM(ContentObservation, stream << "registerDOMTimerForContentObservationIfNeeded: registed this timer: (" << &timer << ") and observe when it fires.");
     55    LOG_WITH_STREAM(ContentObservation, stream << "didInstallDOMTimer: register this timer: (" << &timer << ") and observe when it fires.");
    5656}
    5757
     
    8585        setShouldObserveNextStyleRecalc(true);
    8686    }
     87}
     88
     89void ContentChangeObserver::didScheduleStyleRecalc()
     90{
     91    if (!isObservingStyleRecalcScheduling())
     92        return;
     93    LOG(ContentObservation, "didScheduleStyleRecalc: register this style recalc schedule and observe when it fires.");
     94    setObservedContentChange(WKContentIndeterminateChange);
    8795}
    8896
Note: See TracChangeset for help on using the changeset viewer.