Title: [153672] trunk/Source/WebCore
Revision
153672
Author
akl...@apple.com
Date
2013-08-02 15:11:07 -0700 (Fri, 02 Aug 2013)

Log Message

Removing a <link> element with an empty stylesheet shouldn't trigger style recalc.
<http://webkit.org/b/119442>
<rdar://problem/14631785>

Reviewed by Antti Koivisto.

Let Document decide whether or not to do a style recalc after a <link> element is removed.
This avoids unnecessary work when removing a <link> that refers to an empty style sheet.

Some Facebook pages have a <link rel="stylesheet" href="" that gets
removed during the initial page load, causing style recalc.

* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::removedFrom):

    Use DeferRecalcStyleIfNeeded. Since the style sheet is being removed, it will either
    cause a recalc (because it's no longer in the set of active sheets) or do nothing.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (153671 => 153672)


--- trunk/Source/WebCore/ChangeLog	2013-08-02 21:50:56 UTC (rev 153671)
+++ trunk/Source/WebCore/ChangeLog	2013-08-02 22:11:07 UTC (rev 153672)
@@ -1,3 +1,23 @@
+2013-08-02  Andreas Kling  <akl...@apple.com>
+
+        Removing a <link> element with an empty stylesheet shouldn't trigger style recalc.
+        <http://webkit.org/b/119442>
+        <rdar://problem/14631785>
+
+        Reviewed by Antti Koivisto.
+
+        Let Document decide whether or not to do a style recalc after a <link> element is removed.
+        This avoids unnecessary work when removing a <link> that refers to an empty style sheet.
+
+        Some Facebook pages have a <link rel="stylesheet" href="" that gets
+        removed during the initial page load, causing style recalc.
+
+        * html/HTMLLinkElement.cpp:
+        (WebCore::HTMLLinkElement::removedFrom):
+
+            Use DeferRecalcStyleIfNeeded. Since the style sheet is being removed, it will either
+            cause a recalc (because it's no longer in the set of active sheets) or do nothing.
+
 2013-08-02  Patrick Gansterer  <par...@webkit.org>
 
         Remove WebCore folder from include statements

Modified: trunk/Source/WebCore/html/HTMLLinkElement.cpp (153671 => 153672)


--- trunk/Source/WebCore/html/HTMLLinkElement.cpp	2013-08-02 21:50:56 UTC (rev 153671)
+++ trunk/Source/WebCore/html/HTMLLinkElement.cpp	2013-08-02 22:11:07 UTC (rev 153672)
@@ -280,7 +280,7 @@
         removePendingSheet(RemovePendingSheetNotifyLater);
 
     if (document()->renderer())
-        document()->styleResolverChanged(DeferRecalcStyle);
+        document()->styleResolverChanged(DeferRecalcStyleIfNeeded);
 }
 
 void HTMLLinkElement::finishParsingChildren()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to