Title: [153872] trunk/Source/WebCore
Revision
153872
Author
[email protected]
Date
2013-08-08 17:47:36 -0700 (Thu, 08 Aug 2013)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (153871 => 153872)


--- trunk/Source/WebCore/ChangeLog	2013-08-09 00:40:01 UTC (rev 153871)
+++ trunk/Source/WebCore/ChangeLog	2013-08-09 00:47:36 UTC (rev 153872)
@@ -1,3 +1,30 @@
+2013-08-08  Simon Fraser  <[email protected]>
+
+        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):
+
 2013-08-08  Jer Noble  <[email protected]>
 
         [EME] MediaKey APIs should be prefixed.

Modified: trunk/Source/WebCore/bindings/js/JSCallbackData.cpp (153871 => 153872)


--- trunk/Source/WebCore/bindings/js/JSCallbackData.cpp	2013-08-09 00:40:01 UTC (rev 153871)
+++ trunk/Source/WebCore/bindings/js/JSCallbackData.cpp	2013-08-09 00:47:36 UTC (rev 153872)
@@ -72,16 +72,12 @@
 
     InspectorInstrumentationCookie cookie = JSMainThreadExecState::instrumentFunctionCall(context, callType, callData);
 
-    bool contextIsDocument = context->isDocument();
-    JSValue result = contextIsDocument
+    JSValue result = context->isDocument()
         ? JSMainThreadExecState::call(exec, function, callType, callData, thisValue, args)
         : JSC::call(exec, function, callType, callData, thisValue, args);
 
     InspectorInstrumentation::didCallFunction(cookie);
 
-    if (contextIsDocument)
-        Document::updateStyleForAllDocuments();
-
     if (exec->hadException()) {
         reportCurrentException(exec);
         if (raisedException)

Modified: trunk/Source/WebCore/bindings/js/JSCustomXPathNSResolver.cpp (153871 => 153872)


--- trunk/Source/WebCore/bindings/js/JSCustomXPathNSResolver.cpp	2013-08-09 00:40:01 UTC (rev 153871)
+++ trunk/Source/WebCore/bindings/js/JSCustomXPathNSResolver.cpp	2013-08-09 00:47:36 UTC (rev 153872)
@@ -101,8 +101,6 @@
             result = retval.toString(exec)->value(exec);
     }
 
-    Document::updateStyleForAllDocuments();
-
     return result;
 }
 

Modified: trunk/Source/WebCore/dom/Document.cpp (153871 => 153872)


--- trunk/Source/WebCore/dom/Document.cpp	2013-08-09 00:40:01 UTC (rev 153871)
+++ trunk/Source/WebCore/dom/Document.cpp	2013-08-09 00:47:36 UTC (rev 153872)
@@ -379,8 +379,6 @@
     frame->document()->domWindow()->printErrorMessage(message);
 }
 
-static HashSet<Document*>* documentsThatNeedStyleRecalc = 0;
-
 uint64_t Document::s_globalTreeVersion = 0;
 
 static const double timeBeforeThrowingAwayStyleResolverAfterLastUseInSeconds = 30;
@@ -1700,10 +1698,6 @@
 
     ASSERT(childNeedsStyleRecalc() || m_pendingStyleRecalcShouldForce);
 
-    if (!documentsThatNeedStyleRecalc)
-        documentsThatNeedStyleRecalc = new HashSet<Document*>;
-    documentsThatNeedStyleRecalc->add(this);
-    
     // FIXME: Why on earth is this here? This is clearly misplaced.
     invalidateAccessKeyMap();
     
@@ -1716,9 +1710,6 @@
 {
     ASSERT(!childNeedsStyleRecalc());
 
-    if (documentsThatNeedStyleRecalc)
-        documentsThatNeedStyleRecalc->remove(this);
-
     m_styleRecalcTimer.stop();
     m_pendingStyleRecalcShouldForce = false;
 }
@@ -1856,20 +1847,6 @@
     recalcStyle(Style::NoChange);
 }
 
-void Document::updateStyleForAllDocuments()
-{
-    ASSERT(isMainThread());
-    if (!documentsThatNeedStyleRecalc)
-        return;
-
-    while (documentsThatNeedStyleRecalc->size()) {
-        HashSet<Document*>::iterator it = documentsThatNeedStyleRecalc->begin();
-        Document* doc = *it;
-        documentsThatNeedStyleRecalc->remove(doc);
-        doc->updateStyleIfNeeded();
-    }
-}
-
 void Document::updateLayout()
 {
     ASSERT(isMainThread());

Modified: trunk/Source/WebCore/dom/Document.h (153871 => 153872)


--- trunk/Source/WebCore/dom/Document.h	2013-08-09 00:40:01 UTC (rev 153871)
+++ trunk/Source/WebCore/dom/Document.h	2013-08-09 00:47:36 UTC (rev 153872)
@@ -525,7 +525,6 @@
     // auto is specified.
     void pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int& marginTop, int& marginRight, int& marginBottom, int& marginLeft);
 
-    static void updateStyleForAllDocuments(); // FIXME: Try to reduce the # of calls to this function.
     CachedResourceLoader* cachedResourceLoader() { return m_cachedResourceLoader.get(); }
 
     virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;

Modified: trunk/Source/WebCore/dom/Element.cpp (153871 => 153872)


--- trunk/Source/WebCore/dom/Element.cpp	2013-08-09 00:40:01 UTC (rev 153871)
+++ trunk/Source/WebCore/dom/Element.cpp	2013-08-09 00:47:36 UTC (rev 153872)
@@ -485,7 +485,8 @@
         double startTime = currentTime();
 #endif
 
-        Document::updateStyleForAllDocuments();
+        document()->updateStyleIfNeeded();
+
         // Do an immediate repaint.
         if (renderer())
             renderer()->repaint(true);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to