mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 15:19:42 +00:00
LibWeb: Don't rebuild rule cache so eagerly to check for :has/:defined
Instead, change the APIs from "has :foo" to "may have :foo" and return true if we don't have a valid rule cache at the moment. This allows us to defer the rebuilding of the rule cache until a later time, for the cost of a wider invalidation at the moment. Do note that if our rule cache is invalid, the whole document has invalid style anyway! So this is actually always less work. :^) Knocks ~1 second of loading time off of https://wpt.fyi/
This commit is contained in:
parent
3b3f06ca68
commit
4bef0d0aea
Notes:
github-actions[bot]
2025-01-24 16:55:43 +00:00
Author: https://github.com/awesomekling
Commit: 4bef0d0aea
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3356
5 changed files with 13 additions and 12 deletions
|
@ -408,7 +408,7 @@ void Node::invalidate_style(StyleInvalidationReason reason)
|
|||
|
||||
// FIXME: This is very not optimal! We should figure out a smaller set of elements to invalidate,
|
||||
// but right now the :has() selector means we have to invalidate everything.
|
||||
if (!is_document() && document().style_computer().has_has_selectors()) {
|
||||
if (!is_document() && document().style_computer().may_have_has_selectors()) {
|
||||
document().invalidate_style(reason);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue