Title: [103043] trunk/Source/WebCore
Revision
103043
Author
kl...@webkit.org
Date
2011-12-16 00:51:18 -0800 (Fri, 16 Dec 2011)

Log Message

Don't call Document::body() twice in the same function.
<http://webkit.org/b/74683>

Reviewed by Dan Bernstein.

Document::body() is O(n), so we should avoid calling it multiple
times unnecessarily.

* dom/Document.cpp:
(WebCore::Document::updateLayoutIgnorePendingStylesheets):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (103042 => 103043)


--- trunk/Source/WebCore/ChangeLog	2011-12-16 08:49:53 UTC (rev 103042)
+++ trunk/Source/WebCore/ChangeLog	2011-12-16 08:51:18 UTC (rev 103043)
@@ -1,3 +1,16 @@
+2011-12-16  Andreas Kling  <kl...@webkit.org>
+
+        Don't call Document::body() twice in the same function.
+        <http://webkit.org/b/74683>
+
+        Reviewed by Dan Bernstein.
+
+        Document::body() is O(n), so we should avoid calling it multiple
+        times unnecessarily.
+
+        * dom/Document.cpp:
+        (WebCore::Document::updateLayoutIgnorePendingStylesheets):
+
 2011-12-16  Daniel Sievers  <siev...@chromium.org>
 
         [Chromium] Add trace events for decoding and drawing images.

Modified: trunk/Source/WebCore/dom/Document.cpp (103042 => 103043)


--- trunk/Source/WebCore/dom/Document.cpp	2011-12-16 08:49:53 UTC (rev 103042)
+++ trunk/Source/WebCore/dom/Document.cpp	2011-12-16 08:51:18 UTC (rev 103043)
@@ -1675,7 +1675,8 @@
         // moment.  If it were more refined, we might be able to do something better.)
         // It's worth noting though that this entire method is a hack, since what we really want to do is
         // suspend JS instead of doing a layout with inaccurate information.
-        if (body() && !body()->renderer() && m_pendingSheetLayout == NoLayoutWithPendingSheets) {
+        HTMLElement* bodyElement = body();
+        if (bodyElement && !bodyElement->renderer() && m_pendingSheetLayout == NoLayoutWithPendingSheets) {
             m_pendingSheetLayout = DidLayoutWithPendingSheets;
             styleSelectorChanged(RecalcStyleImmediately);
         } else if (m_hasNodesWithPlaceholderStyle)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to