Bug 100776

Summary: Avoid unnecessary style recalcs on class attribute mutation
Product: WebKit Reporter: Antti Koivisto <koivisto>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: allan.jensen, cmarcelo, kling, macpherson, menard, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch
kling: review-
another try kling: review+

Antti Koivisto
Reported 2012-10-30 11:48:39 PDT
There is no need to invalidate element style on class attribute change if neither the added or removed classes featured in any active stylesheet.
Attachments
patch (12.09 KB, patch)
2012-10-30 12:13 PDT, Antti Koivisto
kling: review-
another try (12.65 KB, patch)
2012-10-30 12:53 PDT, Antti Koivisto
kling: review+
Antti Koivisto
Comment 1 2012-10-30 12:13:11 PDT
Andreas Kling
Comment 2 2012-10-30 12:30:26 PDT
Comment on attachment 171495 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=171495&action=review Cool idea! r- for causing unnecessary conversions from immutable to mutable attribute data, rest looks good. > Source/WebCore/css/RuleFeature.cpp:46 > + end = other.classesInRules.end(); > + for (HashSet<AtomicStringImpl*>::iterator it = other.classesInRules.begin(); it != end; ++it) > + classesInRules.add(*it); Looks like we could be using const_iterators in this function. > Source/WebCore/dom/Element.cpp:786 > + SpaceSplitString oldClasses = mutableAttributeData()->classNames(); This will force promotion from ImmutableElementAttributeData to MutableElementAttributeData for all elements with a class attribute the first time they're parsed. > Source/WebCore/dom/SpaceSplitString.cpp:122 > + // FIXME: add() does not allow duplicates but createVector() does. Huh.
Antti Koivisto
Comment 3 2012-10-30 12:53:58 PDT
Created attachment 171509 [details] another try
Antti Koivisto
Comment 4 2012-10-30 13:34:41 PDT
Note You need to log in before you can comment on or make changes to this bug.