Title: [159104] trunk/Source/WebCore
Revision
159104
Author
[email protected]
Date
2013-11-12 06:40:29 -0800 (Tue, 12 Nov 2013)

Log Message

Elements with class names automatically get unique ElementData.
<https://webkit.org/b/124184>

We were calling Element::ensureUniqueElementData() for all Elements
with a non-empty list of class names. Doing that on parser-fresh
Elements caused us to upgrade them to UniqueElementData despite not
needing it (ElementData::setClass() is a const function for caching
the "cooked" class and can be called on ShareableElementData.)

1.09 MB progression on HTML5 spec at <http://whatwg.org/c>

Reviewed by Antti Koivisto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (159103 => 159104)


--- trunk/Source/WebCore/ChangeLog	2013-11-12 14:13:41 UTC (rev 159103)
+++ trunk/Source/WebCore/ChangeLog	2013-11-12 14:40:29 UTC (rev 159104)
@@ -1,3 +1,18 @@
+2013-11-11  Andreas Kling  <[email protected]>
+
+        Elements with class names automatically get unique ElementData.
+        <https://webkit.org/b/124184>
+
+        We were calling Element::ensureUniqueElementData() for all Elements
+        with a non-empty list of class names. Doing that on parser-fresh
+        Elements caused us to upgrade them to UniqueElementData despite not
+        needing it (ElementData::setClass() is a const function for caching
+        the "cooked" class and can be called on ShareableElementData.)
+
+        1.09 MB progression on HTML5 spec at <http://whatwg.org/c>
+
+        Reviewed by Antti Koivisto.
+
 2013-11-12  Zan Dobersek  <[email protected]>
 
         JSC bindings generator should generate deletable JSC functions

Modified: trunk/Source/WebCore/dom/Element.cpp (159103 => 159104)


--- trunk/Source/WebCore/dom/Element.cpp	2013-11-12 14:13:41 UTC (rev 159103)
+++ trunk/Source/WebCore/dom/Element.cpp	2013-11-12 14:40:29 UTC (rev 159104)
@@ -1197,7 +1197,10 @@
 
     if (classStringHasClassName(newClassString)) {
         const bool shouldFoldCase = document().inQuirksMode();
-        const SpaceSplitString oldClasses = ensureUniqueElementData().classNames();
+        // Note: We'll need ElementData, but it doesn't have to be UniqueElementData.
+        if (!elementData())
+            ensureUniqueElementData();
+        const SpaceSplitString oldClasses = elementData()->classNames();
         elementData()->setClass(newClassString, shouldFoldCase);
         const SpaceSplitString& newClasses = elementData()->classNames();
         shouldInvalidateStyle = testShouldInvalidateStyle && checkSelectorForClassChange(oldClasses, newClasses, *styleResolver);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to