Title: [140638] trunk/Source/WebCore
Revision
140638
Author
[email protected]
Date
2013-01-23 20:06:22 -0800 (Wed, 23 Jan 2013)

Log Message

Don't allocate rare data on every Element on removal
https://bugs.webkit.org/show_bug.cgi?id=107756

Patch by Elliott Sprehn <[email protected]> on 2013-01-23
Reviewed by Eric Seidel.

We should not allocate an ElementRareData for every element
in Element::removedFrom. Previously calls to setIsInTopLayer
would unconditionally call ensureElementRareData(), and this was
called from Element::removedFrom meaning removing an element
made the entire subtree suddenly balloon to huge in size as each
one got an ElementRareData.

This is a regression from my patch on Bug 103912 where I removed a check
that avoided this allocation.

No new tests needed, covered by existing tests.

* dom/Element.cpp:
(WebCore::Element::setIsInTopLayer):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (140637 => 140638)


--- trunk/Source/WebCore/ChangeLog	2013-01-24 03:52:52 UTC (rev 140637)
+++ trunk/Source/WebCore/ChangeLog	2013-01-24 04:06:22 UTC (rev 140638)
@@ -1,3 +1,25 @@
+2013-01-23  Elliott Sprehn  <[email protected]>
+
+        Don't allocate rare data on every Element on removal
+        https://bugs.webkit.org/show_bug.cgi?id=107756
+
+        Reviewed by Eric Seidel.
+
+        We should not allocate an ElementRareData for every element
+        in Element::removedFrom. Previously calls to setIsInTopLayer
+        would unconditionally call ensureElementRareData(), and this was
+        called from Element::removedFrom meaning removing an element
+        made the entire subtree suddenly balloon to huge in size as each
+        one got an ElementRareData.
+
+        This is a regression from my patch on Bug 103912 where I removed a check
+        that avoided this allocation.
+
+        No new tests needed, covered by existing tests.
+
+        * dom/Element.cpp:
+        (WebCore::Element::setIsInTopLayer):
+
 2013-01-23  Adam Barth  <[email protected]>
 
         BackgroundHTMLParser should use more const references to avoid copy constructors

Modified: trunk/Source/WebCore/dom/Element.cpp (140637 => 140638)


--- trunk/Source/WebCore/dom/Element.cpp	2013-01-24 03:52:52 UTC (rev 140637)
+++ trunk/Source/WebCore/dom/Element.cpp	2013-01-24 04:06:22 UTC (rev 140638)
@@ -2401,6 +2401,8 @@
 
 void Element::setIsInTopLayer(bool inTopLayer)
 {
+    if (isInTopLayer() == inTopLayer)
+        return;
     ensureElementRareData()->setIsInTopLayer(inTopLayer);
     setNeedsStyleRecalc(SyntheticStyleChange);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to