Changeset 159104 in webkit


Ignore:
Timestamp:
Nov 12, 2013 6:40:29 AM (10 years ago)
Author:
akling@apple.com
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.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r159100 r159104  
     12013-11-11  Andreas Kling  <akling@apple.com>
     2
     3        Elements with class names automatically get unique ElementData.
     4        <https://webkit.org/b/124184>
     5
     6        We were calling Element::ensureUniqueElementData() for all Elements
     7        with a non-empty list of class names. Doing that on parser-fresh
     8        Elements caused us to upgrade them to UniqueElementData despite not
     9        needing it (ElementData::setClass() is a const function for caching
     10        the "cooked" class and can be called on ShareableElementData.)
     11
     12        1.09 MB progression on HTML5 spec at <http://whatwg.org/c>
     13
     14        Reviewed by Antti Koivisto.
     15
    1162013-11-12  Zan Dobersek  <zdobersek@igalia.com>
    217
  • trunk/Source/WebCore/dom/Element.cpp

    r159036 r159104  
    11981198    if (classStringHasClassName(newClassString)) {
    11991199        const bool shouldFoldCase = document().inQuirksMode();
    1200         const SpaceSplitString oldClasses = ensureUniqueElementData().classNames();
     1200        // Note: We'll need ElementData, but it doesn't have to be UniqueElementData.
     1201        if (!elementData())
     1202            ensureUniqueElementData();
     1203        const SpaceSplitString oldClasses = elementData()->classNames();
    12011204        elementData()->setClass(newClassString, shouldFoldCase);
    12021205        const SpaceSplitString& newClasses = elementData()->classNames();
Note: See TracChangeset for help on using the changeset viewer.