Bug 126177 - REGRESSION(r133214): Don't invalidate style when adding classes that don't match rules
Summary: REGRESSION(r133214): Don't invalidate style when adding classes that don't ma...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: BlinkMergeCandidate
Depends on:
Blocks:
 
Reported: 2013-12-23 12:53 PST by Ryosuke Niwa
Modified: 2014-01-27 09:08 PST (History)
6 users (show)

See Also:


Attachments
patch (3.27 KB, patch)
2014-01-27 08:42 PST, Antti Koivisto
andersca: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2013-12-23 12:53:27 PST
Consider merging https://chromium.googlesource.com/chromium/blink/+/50ffb9fad31542e86de85e3305894d99b1d81d34
or come up with a better fix if the regression exists in WebKit.

r133214 caused a regression by making us mark elements for style recalc
when adding new classes that don't match any rules due to a logic error
in checkSelectorForClassChange. This patch corrects the logic error so
that now adding and removing class names that don't match rules will
not trigger a style recalc.

To facilitate testing this patch I added a new Internals API:
updateStyleAndReturnAffectedElementCount(). It updates the style of the document
and returns the number of elements that had a style computed for them. This
will also allow writing future tests when we make things smarter to avoid
recalcs.
Comment 1 Antti Koivisto 2014-01-27 08:42:52 PST
Created attachment 222328 [details]
patch
Comment 2 Antti Koivisto 2014-01-27 09:08:39 PST
https://trac.webkit.org/r162843