WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
115116
CSS attribute selectors cause unnecessary style recalc when setting attribute to same value.
https://bugs.webkit.org/show_bug.cgi?id=115116
Summary
CSS attribute selectors cause unnecessary style recalc when setting attribute...
Andreas Kling
Reported
Wednesday, April 24, 2013 6:06:31 PM UTC
Setting an attribute to the same value it already has should never trigger a style recalc due to attribute selectors. The code is currently too dumb to figure this out, and ends up restyling the same stuff over and over.
Attachments
Proposed patch
(2.21 KB, patch)
2013-04-24 10:26 PDT
,
Andreas Kling
simon.fraser
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
Wednesday, April 24, 2013 6:07:27 PM UTC
<
rdar://problem/13727709
>
Andreas Kling
Comment 2
Wednesday, April 24, 2013 6:26:13 PM UTC
Created
attachment 199498
[details]
Proposed patch
Simon Fraser (smfr)
Comment 3
Wednesday, April 24, 2013 6:38:28 PM UTC
Comment on
attachment 199498
[details]
Proposed patch View in context:
https://bugs.webkit.org/attachment.cgi?id=199498&action=review
> Source/WebCore/ChangeLog:13 > + This reduces unnecessary style recalculation in MAS content.
"MAS" is pretty meaningless in this context.
Antti Koivisto
Comment 4
Wednesday, April 24, 2013 6:41:33 PM UTC
Comment on
attachment 199498
[details]
Proposed patch View in context:
https://bugs.webkit.org/attachment.cgi?id=199498&action=review
Better fixes involve some significant refactoring, this is ok for now.
> Source/WebCore/dom/Element.cpp:-878 > else if (name == HTMLNames::pseudoAttr) > shouldInvalidateStyle |= testShouldInvalidateStyle && isInShadowTree(); > > - shouldInvalidateStyle |= testShouldInvalidateStyle && styleResolver->hasSelectorForAttribute(name.localName());
It seem wrong that attributeChanged() is called when attribute does not change. It would be better to fix that.
> Source/WebCore/dom/Element.cpp:2726 > + if (oldValue != newValue) { > + if (attached() && document()->styleResolver() && document()->styleResolver()->hasSelectorForAttribute(name.localName())) > + setNeedsStyleRecalc(); > + }
Bit sad that the invalidation code gets spread around like this.
Andreas Kling
Comment 5
Wednesday, April 24, 2013 6:42:21 PM UTC
Committed
r149047
: <
http://trac.webkit.org/changeset/149047
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug