mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 19:59:17 +00:00
Before this change, we would go through every known pseudo element and compute style for it whenever recomputing the style of an element. This led to disastrous performance on pages with selectors like `::selection` or `::placeholder`, as they'd effectively match every single element and thus we'd compute multiple additional styles for every element in the DOM. The fix is simple: only recompute `before` and `after` pseudo element styles, since those are the only two pseudo elements that generate *new* nodes -- other pseudo elements refer to (possibly) existing nodes or concepts within the DOM (or internal shadow DOM). This makes style updates take ~40ms on our GitHub repo instead of ~220ms. It's still slower than it should be, but a huge improvement.
132 KiB
132 KiB