Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Issue 2326033002: Prepare to use invalidation set for adding/removing RuleSets. (Closed)

Created:
4 years, 3 months ago by rune
Modified:
4 years, 3 months ago
Reviewers:
Eric Willigers
CC:
chromium-reviews, blink-reviews-css, dglazkov+blink, apavlov+blink_chromium.org, darktears, blink-reviews, rwlbuis
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Prepare to use invalidation set for adding/removing RuleSets. Currently, we sometimes use StyleSheetInvalidationAnalysis to be smart about recalculating affected element when adding/removing a stylesheet. The plan is to start using the StyleInvalidator to trigger style recalculations When adding/removing stylesheets. We will then use the invalidation sets from the stylesheet RuleSet and schedule them on elements in the stylesheet's document or shadow tree. We fall back to a full recalc for the document / shadow tree for if we find selectors which don't have simple selectors for which we have an invalidation set we can use. This is similar to what we do with the universalSiblingInvalidationSet for DOM mutations. This first implementation supports id, class, attribute, and type selectors in the rightmost compound[1]. We could later support to use invalidation sets for universal pseudo class rules like ":hover". The invalidations are to be scheduled for elements in the same TreeScope as the stylesheet, including the host element. Rules which are boundary crossing have their features collected in ScopedStyleResolver::addTreeBoundaryCrossingRules() and not in their respective stylesheet's RuleSet. We fall back to full style recalc for rules containing ::content, ::shadow, and /deep/. ::slotted rules are currently also collected on the ScopedStyleResolver, but in order to avoid full recalcs, we do LocalStyleChange on slot-distributed elements for RuleSet invalidations when there are ::slotted rules in the RuleSet. As mentioned earlier we will schedule invalidations on the host element as well, which means we will schedule the invalidation set for ".a" for ":host(.a)". :host-context() do also support RuleSet invalidation as long as there are features in addition to the ones inside the :host-context() pseudo. As for sibling invalidations on DOM mutations, negated selectors like ":not(.a)" are considered universal. This CL is split out of [2]. The next step is to land the invalidation code in StyleEngine from the same CL. [1] Even though we don't have invalidation sets for tag names, we can check the presence of rules in the tag name hash map for the RuleSet. This means "body *" will cause a full recalc, but "body" won't. Also note that "div.enabled" will cause every div element to be invalidated because the rule would end up in the class rule hashmap. [2] https://codereview.chromium.org/1913833002/ R=ericwilligers@chromium.org BUG=567021 Committed: https://crrev.com/9831d308f547fba256521a119b21b6f87db43e4e Cr-Commit-Position: refs/heads/master@{#419704}

Patch Set 1 #

Total comments: 1

Patch Set 2 : Boundary crossing rule features not collected in stylesheet ruleset. #

Patch Set 3 : Rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+212 lines, -9 lines) Patch
M third_party/WebKit/Source/core/css/RuleFeature.h View 1 2 4 chunks +4 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/RuleFeature.cpp View 1 2 8 chunks +42 lines, -9 lines 0 comments Download
M third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp View 1 3 chunks +152 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/css/RuleSet.h View 1 1 chunk +14 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 23 (16 generated)
rune
ptal
4 years, 3 months ago (2016-09-09 13:54:29 UTC) #3
rune
https://codereview.chromium.org/2326033002/diff/1/third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp File third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp (right): https://codereview.chromium.org/2326033002/diff/1/third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp#newcode1063 third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp:1063: expectFullRecalcForRuleSetInvalidation(false); This is not going to work since we're ...
4 years, 3 months ago (2016-09-14 07:47:31 UTC) #6
rune
Ready for review.
4 years, 3 months ago (2016-09-18 20:21:53 UTC) #16
Eric Willigers
lgtm
4 years, 3 months ago (2016-09-20 01:41:00 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2326033002/40001
4 years, 3 months ago (2016-09-20 06:42:15 UTC) #19
commit-bot: I haz the power
Committed patchset #3 (id:40001)
4 years, 3 months ago (2016-09-20 09:21:19 UTC) #21
commit-bot: I haz the power
4 years, 3 months ago (2016-09-20 09:23:26 UTC) #23
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/9831d308f547fba256521a119b21b6f87db43e4e
Cr-Commit-Position: refs/heads/master@{#419704}

Powered by Google App Engine
This is Rietveld 408576698