Bug 124184 - Elements with class names automatically get unique ElementData.
Summary: Elements with class names automatically get unique ElementData.
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andreas Kling
Depends on:
Reported: 2013-11-11 22:14 PST by Andreas Kling
Modified: 2013-11-13 13:51 PST (History)
5 users (show)

See Also:

Patch! (1.87 KB, patch)
2013-11-11 22:19 PST, Andreas Kling
koivisto: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kling 2013-11-11 22:14:32 PST
We're upgrading a lot of our ElementData to UniqueElementData for no reason.
Comment 1 Andreas Kling 2013-11-11 22:19:06 PST
Created attachment 216634 [details]
Comment 2 Antti Koivisto 2013-11-12 00:06:29 PST
Comment on attachment 216634 [details]

nice catch
Comment 3 Darin Adler 2013-11-12 17:59:08 PST
Comment on attachment 216634 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=216634&action=review

> Source/WebCore/dom/Element.cpp:1202
> -        const SpaceSplitString oldClasses = ensureUniqueElementData().classNames();
> +        // Note: We'll need ElementData, but it doesn't have to be UniqueElementData.
> +        if (!elementData())
> +            ensureUniqueElementData();

Doesn’t this idiom come up anywhere else? I would expect it to be called ensureElementData, except we don’t use the word ensure for this these days, do we?
Comment 4 Andreas Kling 2013-11-13 13:51:58 PST