ladybird/Libraries
Andreas Kling 66263f142b LibWeb: Add StyleScope to keep style caches per Document/ShadowRoot
Before this change, we've been maintaining various StyleComputer caches
at the document level.

This made sense for old-school documents without shadow trees, since
all the style information was document-wide anyway. However, documents
with many shadow trees ended up suffering since any time you mutated
a style sheet inside a shadow tree, *all* style caches for the entire
document would get invalidated.

This was particularly expensive on Reddit, which has tons of shadow
trees with their own style elements. Every time we'd create one of their
custom elements, we'd invalidate the document-level "rule cache" and
have to rebuild it, taking about ~60ms each time (ouch).

This commit introduces a new object called StyleScope.

Every Document and ShadowRoot has its own StyleScope. Rule caches etc
are moved from StyleComputer to StyleScope.

Rule cache invalidation now happens at StyleScope level. As an example,
rule cache rebuilds now take ~1ms on Reddit instead of ~60ms.

This is largely a mechanical change, moving things around, but there's
one key detail to be aware of: due to the :host selector, which works
across the shadow DOM boundary and reaches from inside a shadow tree out
into the light tree, there are various places where we have to check
both the shadow tree's StyleScope *and* the document-level StyleScope
in order to get all rules that may apply.
2025-11-14 22:05:33 +01:00
..
LibCompress CMake: Rename serenity_* helper functions/macros to ladybird_* 2025-07-03 23:19:41 +02:00
LibCore LibCore: Do not require rvalue references to resolve/reject promises 2025-11-12 09:06:21 -05:00
LibCrypto Everywhere: Clean up AD-HOC and FIXME comments without colons 2025-11-13 15:56:04 +01:00
LibDatabase LibDatabase+RequestServer: Store ByteString data as a BLOB 2025-11-12 09:06:21 -05:00
LibDevTools LibDevTools+LibWebView: Implement initial accessibility tree view 2025-10-20 10:51:19 +01:00
LibDiff CMake: Rename serenity_* helper functions/macros to ladybird_* 2025-07-03 23:19:41 +02:00
LibDNS LibDNS: Remove LibCore::DateTime dependency 2025-09-30 12:39:01 +02:00
LibFileSystem CMake: Rename serenity_* helper functions/macros to ladybird_* 2025-07-03 23:19:41 +02:00
LibGC LibGC: Add GC::Heap::the() 2025-11-01 08:40:32 +01:00
LibGfx LibGfx+LibWeb: Use mipmaps for downscaling images 2025-11-12 15:59:01 +01:00
LibHTTP LibHTTP: Add a method to remove a header from a HeaderMap 2025-11-02 13:03:29 -05:00
LibIDL LibIDL: Support extended attributes on namespace members 2025-09-11 17:06:44 +01:00
LibImageDecoderClient CMake: Rename serenity_* helper functions/macros to ladybird_* 2025-07-03 23:19:41 +02:00
LibIPC LibIPC: Change TransportSocket to read and write on I/O thread 2025-11-02 22:43:10 +01:00
LibJS LibJS: Handle negativity in Temporal's ApplyUnsignedRoundingMode 2025-11-14 06:32:49 -05:00
LibLine Everywhere: Slap some [[clang::lifetimebound]] where appropriate 2025-09-01 11:11:38 +02:00
LibMain AK: Expose helpers to invoke Windows runtime config directly in main() 2025-10-29 21:07:52 -06:00
LibMedia LibMedia+Tests: Clear the current block when seeking in MatroskaDemuxer 2025-11-13 13:48:17 +01:00
LibRegex LibRegex: Start alternation opt nodes with an empty vector 2025-11-08 11:51:27 +01:00
LibRequests LibRequests+RequestServer: Add a method to estimate disk cache size 2025-11-12 09:06:21 -05:00
LibSyntax Everywhere: Slap some [[clang::lifetimebound]] where appropriate 2025-09-01 11:11:38 +02:00
LibTest AK: Expose helpers to invoke Windows runtime config directly in main() 2025-10-29 21:07:52 -06:00
LibTextCodec LibTextCodec: Enable EXPLICIT_SYMBOL_EXPORT 2025-08-23 16:04:36 -06:00
LibThreading LibThreading: Remove Weakable from Thread 2025-09-22 17:28:21 -05:00
LibTLS LibTLS: Use Windows-specific method to set default certificate store 2025-08-23 18:35:45 -06:00
LibUnicode LibRegex+LibUnicode: Add unicode string properties 2025-10-24 13:24:55 -04:00
LibURL LibURL: Add a few missing internal page factories 2025-09-18 07:27:24 -04:00
LibWasm Meta: Increase the line length enforced by prettier to 120 2025-10-31 19:55:50 -04:00
LibWeb LibWeb: Add StyleScope to keep style caches per Document/ShadowRoot 2025-11-14 22:05:33 +01:00
LibWebSocket Everywhere: Clean up AD-HOC and FIXME comments without colons 2025-11-13 15:56:04 +01:00
LibWebView LibWeb: Add --headless=manual option to run until explicit exit 2025-11-14 08:58:18 -05:00
LibXML LibWeb+LibXML: Make Listener::set_source(ByteString) fallible 2025-10-02 02:25:28 +02:00
CMakeLists.txt LibDatabase+LibWebView: Extract our SQLite wrapper to its own library 2025-10-14 13:40:33 +02:00