Bug 102623 - StyledElement: Make handling the "style" attribute a litte faster.
Summary: StyledElement: Make handling the "style" attribute a litte faster.
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: 102598
  Show dependency treegraph
 
Reported: 2012-11-18 16:39 PST by Andreas Kling
Modified: 2012-11-18 19:18 PST (History)
4 users (show)

See Also:


Attachments
Patch (4.78 KB, patch)
2012-11-18 16:40 PST, Andreas Kling
ojan: review+
ojan: commit-queue-
Details | Formatted Diff | Diff
Patch for landing (4.78 KB, patch)
2012-11-18 17:41 PST, Andreas Kling
no flags 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-11-18 16:39:14 PST
We know that "style" is never a presentation attribute, so we could avoid the isPresentationAttribute() virtual dispatch.
Comment 1 Andreas Kling 2012-11-18 16:40:55 PST
Created attachment 174861 [details]
Patch
Comment 2 Ojan Vafai 2012-11-18 16:56:11 PST
Comment on attachment 174861 [details]
Patch

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

> Source/WebCore/dom/Element.cpp:776
> +    } if (name == classAttr)

This is missing an else?
Comment 3 Ojan Vafai 2012-11-18 16:59:07 PST
Please fix the else issue. Otherwise, looks good. 

Is this actually addressing the issues that caused the regression or just fixing the top issues in the sample for that test?
Comment 4 Andreas Kling 2012-11-18 17:04:19 PST
(In reply to comment #3)
> Please fix the else issue. Otherwise, looks good. 
> 
> Is this actually addressing the issues that caused the regression or just fixing the top issues in the sample for that test?

The regression is caused by taking the longer, arguably more correct, path for notifying the element that its "style" attribute has changed. (Previously, the function that clones all attributes from one element to another below Node.cloneNode would check for the "style" attribute and bypass Element::attributeChanged(), calling StyledElement::styleAttributeChanged() directly in an effort to avoid invoking the CSS parser.)

I'd rather not keep that hack in there so I'm posting a couple of patches to lubricate the normal attributeChanged() path. :)
Comment 5 Andreas Kling 2012-11-18 17:41:02 PST
Created attachment 174866 [details]
Patch for landing
Comment 6 WebKit Review Bot 2012-11-18 19:17:33 PST
Comment on attachment 174866 [details]
Patch for landing

Clearing flags on attachment: 174866

Committed r135101: <http://trac.webkit.org/changeset/135101>
Comment 7 WebKit Review Bot 2012-11-18 19:17:37 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Ojan Vafai 2012-11-18 19:18:47 PST
Makes sense. Wasn't questioning the value of these patches. Just trying to understand. Thanks!

FWIW, in addition to being a performance gain, I think the code just makes more sense after this patch.