Bug 124184

Summary: Elements with class names automatically get unique ElementData.
Product: WebKit Reporter: Andreas Kling <kling>
Component: DOMAssignee: Andreas Kling <kling>
Severity: Normal CC: cmarcelo, commit-queue, esprehn+autocc, kangil.han, kling
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Description Flags
Patch! koivisto: review+

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