-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always rebuild CascadeLayerMap if active style sheets changed
The existing implementation: - Resets a tree scope's style (include cascade layers) if the change type is ActiveSheetsChanged - Rebuilds a tree scope's cascade layers only if the changed sheets involve cascade layers This results in a bug that we if modify a sheet that does not have cascade layers, then the previous CascadeLayerMap is cleared but not rebuilt, and as a result, all previously previously layered rules break into the default layer. This patch fixes it by rebuilding the CascadeLayerMap in that case. Layer-related invalidations remain the same as before. Fixed: 1313357 Change-Id: I702a6421416aea2634537b6d9650399b68e25f0a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3572544 Auto-Submit: Xiaocheng Hu <xiaochengh@chromium.org> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org> Cr-Commit-Position: refs/heads/main@{#989813}
- Loading branch information
1 parent
e5953c8
commit 2e3ca05
Showing
4 changed files
with
92 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
third_party/blink/web_tests/external/wpt/css/css-cascade/layer-media-toggle.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
<title>CSS Cascade Layers: Tests against a Chrome bug that modifying a sheet affects existing layers</title> | ||
<link rel="help" href="https://drafts.csswg.org/css-cascade-5/#layering"> | ||
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1313357"> | ||
<link rel="author" href="mailto:xiaochengh@chromium.org"> | ||
<link rel="match" href="reference/ref-filled-green-100px-square.xht"> | ||
|
||
<style> | ||
@layer foo, bar; | ||
@layer bar { | ||
#target { background-color: green; } | ||
} | ||
@layer foo { | ||
#target { background-color: red; } | ||
} | ||
</style> | ||
<style media="print" id="toggle"> | ||
#target { | ||
width: 100px; | ||
height: 100px; | ||
} | ||
</style> | ||
|
||
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p> | ||
<div id="target"></div> | ||
|
||
<script> | ||
document.body.offsetWidth; // Force style calculation | ||
document.getElementById('toggle').media = 'all'; | ||
</script> |