mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:47:35 +00:00
LibWeb: Remove CSS::StyleInvalidator in favor of dirtying + lazy update
Style updates are lazy since late last year, so the StyleInvalidator is actually hurting us more than it's helping by running the entire CSS selector machine on the whole DOM for every attribute change. Instead, simply mark the entire DOM dirty and let the lazy style update mechanism run *once* on next event loop iteration.
This commit is contained in:
parent
e6f279dada
commit
04bec7a4f5
6 changed files with 37 additions and 86 deletions
29
Base/res/html/misc/attr-invalidate-style.html
Normal file
29
Base/res/html/misc/attr-invalidate-style.html
Normal file
|
@ -0,0 +1,29 @@
|
|||
<html>
|
||||
<head>
|
||||
<style>
|
||||
div[foo] { background-color: green; }
|
||||
div[bar] > div { background-color: red; }
|
||||
div[baz] ~ div { background-color: blue; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id=bar><div>RED</div></div>
|
||||
<div id=foo>GREEN</div>
|
||||
<div id=baz></div>
|
||||
<div>BLUE</div>
|
||||
<script>
|
||||
setTimeout(function() {
|
||||
for (let id of ["foo", "bar", "baz"]) {
|
||||
let e = document.getElementById(id);
|
||||
e.setAttribute(id, "");
|
||||
}
|
||||
setTimeout(function() {
|
||||
for (let id of ["foo", "bar", "baz"]) {
|
||||
let e = document.getElementById(id);
|
||||
e.removeAttribute(id);
|
||||
}
|
||||
}, 1000);
|
||||
}, 1000);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue