Bug 78812 - Removing the last presentation attribute should result in a null attributeStyle().
Summary: Removing the last presentation attribute should result in a null attributeSty...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andreas Kling
URL:
Keywords:
Depends on:
Blocks: 78798
  Show dependency treegraph
 
Reported: 2012-02-16 07:40 PST by Andreas Kling
Modified: 2012-02-17 01:21 PST (History)
2 users (show)

See Also:


Attachments
Patch (2.65 KB, patch)
2012-02-16 07:45 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 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.