Changeset 153872 in webkit


Ignore:
Timestamp:
Aug 8, 2013, 5:47:36 PM (12 years ago)
Author:
Simon Fraser
Message:

Kill updateStyleForAllDocuments()
https://bugs.webkit.org/show_bug.cgi?id=118093

Reviewed by Geoff Garen.

We should never have to eagerly update style, especially for all documents
that the process knows about. The WebKit model is to update style when
required for layout etc, not to update it eagerly.

This is historical code whose origins are lost in the mists of KHTML.
r42384 makes it possible to do away with this eager updating, and
r55568 removed some calls. Discussion in bug 32580 suggests that
form control code still need this, but tests still pass without it.

  • bindings/js/JSCallbackData.cpp:

(WebCore::JSCallbackData::invokeCallback):

  • bindings/js/JSCustomXPathNSResolver.cpp:

(WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):

  • dom/Document.cpp:

(WebCore::Document::scheduleStyleRecalc):
(WebCore::Document::unscheduleStyleRecalc):

  • dom/Document.h:
  • dom/Element.cpp:

(WebCore::Element::setActive):

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r153867 r153872  
     12013-08-08  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Kill updateStyleForAllDocuments()
     4        https://bugs.webkit.org/show_bug.cgi?id=118093
     5
     6        Reviewed by Geoff Garen.
     7
     8        We should never have to eagerly update style, especially for all documents
     9        that the process knows about. The WebKit model is to update style when
     10        required for layout etc, not to update it eagerly.
     11       
     12        This is historical code whose origins are lost in the mists of KHTML.
     13        r42384 makes it possible to do away with this eager updating, and
     14        r55568 removed some calls. Discussion in bug 32580 suggests that
     15        form control code still need this, but tests still pass without it.
     16
     17        * bindings/js/JSCallbackData.cpp:
     18        (WebCore::JSCallbackData::invokeCallback):
     19        * bindings/js/JSCustomXPathNSResolver.cpp:
     20        (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
     21        * dom/Document.cpp:
     22        (WebCore::Document::scheduleStyleRecalc):
     23        (WebCore::Document::unscheduleStyleRecalc):
     24        * dom/Document.h:
     25        * dom/Element.cpp:
     26        (WebCore::Element::setActive):
     27
    1282013-08-08  Jer Noble  <jer.noble@apple.com>
    229
  • trunk/Source/WebCore/bindings/js/JSCallbackData.cpp

    r148119 r153872  
    7373    InspectorInstrumentationCookie cookie = JSMainThreadExecState::instrumentFunctionCall(context, callType, callData);
    7474
    75     bool contextIsDocument = context->isDocument();
    76     JSValue result = contextIsDocument
     75    JSValue result = context->isDocument()
    7776        ? JSMainThreadExecState::call(exec, function, callType, callData, thisValue, args)
    7877        : JSC::call(exec, function, callType, callData, thisValue, args);
    7978
    8079    InspectorInstrumentation::didCallFunction(cookie);
    81 
    82     if (contextIsDocument)
    83         Document::updateStyleForAllDocuments();
    8480
    8581    if (exec->hadException()) {
  • trunk/Source/WebCore/bindings/js/JSCustomXPathNSResolver.cpp

    r149125 r153872  
    102102    }
    103103
    104     Document::updateStyleForAllDocuments();
    105 
    106104    return result;
    107105}
  • trunk/Source/WebCore/dom/Document.cpp

    r153829 r153872  
    380380}
    381381
    382 static HashSet<Document*>* documentsThatNeedStyleRecalc = 0;
    383 
    384382uint64_t Document::s_globalTreeVersion = 0;
    385383
     
    17011699    ASSERT(childNeedsStyleRecalc() || m_pendingStyleRecalcShouldForce);
    17021700
    1703     if (!documentsThatNeedStyleRecalc)
    1704         documentsThatNeedStyleRecalc = new HashSet<Document*>;
    1705     documentsThatNeedStyleRecalc->add(this);
    1706    
    17071701    // FIXME: Why on earth is this here? This is clearly misplaced.
    17081702    invalidateAccessKeyMap();
     
    17161710{
    17171711    ASSERT(!childNeedsStyleRecalc());
    1718 
    1719     if (documentsThatNeedStyleRecalc)
    1720         documentsThatNeedStyleRecalc->remove(this);
    17211712
    17221713    m_styleRecalcTimer.stop();
     
    18551846    AnimationUpdateBlock animationUpdateBlock(m_frame ? m_frame->animation() : 0);
    18561847    recalcStyle(Style::NoChange);
    1857 }
    1858 
    1859 void Document::updateStyleForAllDocuments()
    1860 {
    1861     ASSERT(isMainThread());
    1862     if (!documentsThatNeedStyleRecalc)
    1863         return;
    1864 
    1865     while (documentsThatNeedStyleRecalc->size()) {
    1866         HashSet<Document*>::iterator it = documentsThatNeedStyleRecalc->begin();
    1867         Document* doc = *it;
    1868         documentsThatNeedStyleRecalc->remove(doc);
    1869         doc->updateStyleIfNeeded();
    1870     }
    18711848}
    18721849
  • trunk/Source/WebCore/dom/Document.h

    r153829 r153872  
    526526    void pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int& marginTop, int& marginRight, int& marginBottom, int& marginLeft);
    527527
    528     static void updateStyleForAllDocuments(); // FIXME: Try to reduce the # of calls to this function.
    529528    CachedResourceLoader* cachedResourceLoader() { return m_cachedResourceLoader.get(); }
    530529
  • trunk/Source/WebCore/dom/Element.cpp

    r153835 r153872  
    486486#endif
    487487
    488         Document::updateStyleForAllDocuments();
     488        document()->updateStyleIfNeeded();
     489
    489490        // Do an immediate repaint.
    490491        if (renderer())
Note: See TracChangeset for help on using the changeset viewer.