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.
<rdar://problem/13727709>
Created attachment 199498 [details] Proposed patch
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.
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.
Committed r149047: <http://trac.webkit.org/changeset/149047>