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

Issue 170873004: Fix issue in which removing a class does not always invalidate style (Closed)

Created:
6 years, 10 months ago by chrishtr
Modified:
6 years, 10 months ago
Reviewers:
esprehn, rune, ojan
CC:
blink-reviews, dglazkov+blink, rune+blink, apavlov+blink_chromium.org, ed+blinkwatch_opera.com, darktears
Visibility:
Public.

Description

Fix issue in which removing a class does not always invalidate style on the element losing the class. The situation in which it fails is the following: .class1 .class2 {} <div class='class1'> <div id='inner' class='class2'> </div> </div> then code like: document.querySelector('#inner').className = '' Previously, an invalidation run would be scheduled, which calls RuleFeatureSet::invalidateStyleForClassChange, but since the class that is being mutated does not exist on the inner element, the variable thisElementNeedsStyleRecalc was never set to true. What we should do instead is set a local style recalc on every element which has a pending invalidation list, because a pending invalidation list means that code must have done something to that element with CSSOM, and hence we should assume style needs to be recomputed. (In fact we do know that for sure since code excecuted earlier verifies that the CSSOM mutation needs some sort of style recalc.) BUG=344376 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=167392

Patch Set 1 #

Patch Set 2 : Added more test expectations. #

Total comments: 4

Patch Set 3 : Fixed comments. #

Total comments: 4

Patch Set 4 : Addressed comments. #

Patch Set 5 : Fixed bug - was not clearing the NeedsStyleInvalidation bit correctly. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+45 lines, -19 lines) Patch
M LayoutTests/fast/css/invalidation/targeted-class-style-invalidation.html View 1 2 2 chunks +20 lines, -6 lines 0 comments Download
M LayoutTests/fast/css/invalidation/targeted-class-style-invalidation-expected.txt View 1 1 chunk +4 lines, -1 line 0 comments Download
M LayoutTests/virtual/targetedstylerecalc/fast/css/invalidation/targeted-class-style-invalidation-expected.txt View 1 1 chunk +3 lines, -0 lines 0 comments Download
M Source/core/css/RuleFeature.cpp View 1 2 3 4 3 chunks +17 lines, -12 lines 0 comments Download
M Source/core/dom/Node.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 15 (0 generated)
chrishtr
Fix issue in which removing a class does not always invalidate style on the element ...
6 years, 10 months ago (2014-02-18 21:55:26 UTC) #1
chrishtr
6 years, 10 months ago (2014-02-18 21:55:39 UTC) #2
rune
lgtm https://codereview.chromium.org/170873004/diff/30001/LayoutTests/fast/css/invalidation/targeted-class-style-invalidation.html File LayoutTests/fast/css/invalidation/targeted-class-style-invalidation.html (right): https://codereview.chromium.org/170873004/diff/30001/LayoutTests/fast/css/invalidation/targeted-class-style-invalidation.html#newcode11 LayoutTests/fast/css/invalidation/targeted-class-style-invalidation.html:11: <div id="innerChild"> Nit: "innerChild" id unused. Would make ...
6 years, 10 months ago (2014-02-18 22:13:24 UTC) #3
ojan
I can see from the test case that this gets the right number of recalc'ed ...
6 years, 10 months ago (2014-02-18 22:15:30 UTC) #4
chrishtr
@ojan: updated CL description.
6 years, 10 months ago (2014-02-18 22:30:38 UTC) #5
chrishtr
https://codereview.chromium.org/170873004/diff/30001/LayoutTests/fast/css/invalidation/targeted-class-style-invalidation.html File LayoutTests/fast/css/invalidation/targeted-class-style-invalidation.html (right): https://codereview.chromium.org/170873004/diff/30001/LayoutTests/fast/css/invalidation/targeted-class-style-invalidation.html#newcode11 LayoutTests/fast/css/invalidation/targeted-class-style-invalidation.html:11: <div id="innerChild"> On 2014/02/18 22:13:24, rune - CET wrote: ...
6 years, 10 months ago (2014-02-18 22:33:15 UTC) #6
esprehn
https://codereview.chromium.org/170873004/diff/110001/Source/core/css/RuleFeature.cpp File Source/core/css/RuleFeature.cpp (right): https://codereview.chromium.org/170873004/diff/110001/Source/core/css/RuleFeature.cpp#newcode389 Source/core/css/RuleFeature.cpp:389: foundInvalidationSet = true; Isn't this bool identical to foundInvalidationSet ...
6 years, 10 months ago (2014-02-18 22:52:33 UTC) #7
ojan
lgtm Maybe add a FIXME for the issue we discussed in person (i.e. if there ...
6 years, 10 months ago (2014-02-18 22:53:38 UTC) #8
chrishtr
https://codereview.chromium.org/170873004/diff/110001/Source/core/css/RuleFeature.cpp File Source/core/css/RuleFeature.cpp (right): https://codereview.chromium.org/170873004/diff/110001/Source/core/css/RuleFeature.cpp#newcode389 Source/core/css/RuleFeature.cpp:389: foundInvalidationSet = true; On 2014/02/18 22:52:33, esprehn wrote: > ...
6 years, 10 months ago (2014-02-18 23:14:30 UTC) #9
chrishtr
https://codereview.chromium.org/170873004/diff/30001/Source/core/css/RuleFeature.cpp File Source/core/css/RuleFeature.cpp (right): https://codereview.chromium.org/170873004/diff/30001/Source/core/css/RuleFeature.cpp#newcode387 Source/core/css/RuleFeature.cpp:387: if (InvalidationList* invalidationList = m_pendingInvalidationMap.get(element)) { On 2014/02/18 22:53:39, ...
6 years, 10 months ago (2014-02-18 23:19:13 UTC) #10
esprehn
On 2014/02/18 23:14:30, Chris Harrelson wrote: > ... > Source/core/css/RuleFeature.cpp:418: thisElementNeedsStyleRecalc = > thisElementNeedsStyleRecalc || ...
6 years, 10 months ago (2014-02-18 23:24:15 UTC) #11
chrishtr
On Tue, Feb 18, 2014 at 3:24 PM, <esprehn@chromium.org> wrote: > On 2014/02/18 23:14:30, Chris ...
6 years, 10 months ago (2014-02-18 23:30:39 UTC) #12
chrishtr
The CQ bit was checked by chrishtr@chromium.org
6 years, 10 months ago (2014-02-19 00:24:18 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/chrishtr@chromium.org/170873004/210006
6 years, 10 months ago (2014-02-19 00:24:32 UTC) #14
commit-bot: I haz the power
6 years, 10 months ago (2014-02-19 01:52:05 UTC) #15
Message was sent while issue was closed.
Change committed as 167392

Powered by Google App Engine
This is Rietveld 408576698