Bug 95451

Summary: Share inline style between cloned Nodes (copy on write.)
Product: WebKit Reporter: Andreas Kling <kling>
Component: DOMAssignee: Andreas Kling <kling>
Status: RESOLVED FIXED    
Severity: Normal CC: cmarcelo, macpherson, menard, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Pätch koivisto: review+

Description Andreas Kling 2012-08-30 06:02:06 PDT
Cloning a Node shouldn't have to clone the inline style (if there is one) - we could share them until either one mutates.
Comment 1 Andreas Kling 2012-08-30 06:08:11 PDT
Created attachment 161456 [details]
Pätch
Comment 2 Antti Koivisto 2012-08-30 06:51:14 PDT
Comment on attachment 161456 [details]
Pätch

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

r=me

> Source/WebCore/css/StylePropertySet.cpp:69
> +PassRefPtr<StylePropertySet> StylePropertySet::makeImmutable() const
> +{
> +    if (!isMutable())
> +        return const_cast<StylePropertySet*>(this);
> +    return createImmutable(m_mutablePropertyVector->data(), m_mutablePropertyVector->size(), cssParserMode());
> +}

Name does not really describe this function well. I don't have great ideas though, maybe copyIfNeeded() or similar?
Comment 3 Andreas Kling 2012-09-01 10:47:47 PDT
Committed r127375: <http://trac.webkit.org/changeset/127375>