Bug 78812

Summary: Removing the last presentation attribute should result in a null attributeStyle().
Product: WebKit Reporter: Andreas Kling <kling>
Component: DOMAssignee: Andreas Kling <kling>
Status: RESOLVED FIXED    
Severity: Normal CC: eric, koivisto
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 78798    
Attachments:
Description Flags
Patch koivisto: review+

Description Andreas Kling 2012-02-16 07:40:50 PST
Hanging an empty attribute style on a StyledElement is a waste of resources. If updateAttributeStyle() doesn't find any presentation attributes we should set a null attributeStyle.
Comment 1 Andreas Kling 2012-02-16 07:45:48 PST
Created attachment 127377 [details]
Patch
Comment 2 Andreas Kling 2012-02-16 08:18:01 PST
Comment on attachment 127377 [details]
Patch

We can avoid the heap allocation altogether if we don't have any presentation attributes..
Comment 3 Andreas Kling 2012-02-16 08:33:12 PST
Comment on attachment 127377 [details]
Patch

Actually, calling the isPresentationAttribute() virtual on every attribute is more expensive than avoiding the temporary StylePropertySet.
Comment 4 Eric Seidel (no email) 2012-02-16 15:09:58 PST
So this is a performance fix?  Memory fix?  Or is this in any way visible to the web?
Comment 5 Andreas Kling 2012-02-17 01:02:05 PST
Committed r108049: <http://trac.webkit.org/changeset/108049>
Comment 6 Andreas Kling 2012-02-17 01:21:01 PST
(In reply to comment #4)
> So this is a performance fix?  Memory fix?  Or is this in any way visible to the web?

It's a small performance and memory fix for cases where removing an attribute on an element and causing it to no longer have any presentation attributes is slightly more efficient.