Repository navigation
fix(session-ui): compute highlight styles once per subtree in Chromium - #60513
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
There was a problem hiding this comment.
Looks sound. In Chromium the inherited rules compute the same colours as the old per-element rules. I checked nested elements in the timeline, tokens in Pierre's shadow root (selection and find), and the tool error card. currentColor still keeps each element's own text colour. The quote, highlight and diff regression tests in timeline-stream.spec.ts pass. I didn't re-measure the benchmark, and I didn't run the Gecko/WebKit @supports not branch in a browser.
The public API is unchanged (CSS only).
No blocking concerns.
Related: #54291
Chromium computes a highlight style (
::selection,::highlight(...)) during style recalc for every element a highlight rule matches. Our universal and descendant highlight rules matched every timeline element, so each restyled element paid for up to four extra pseudo-element styles. Chromium 134+ inherits highlight styles, so each rule now matches one ancestor (:root, the timeline scroller, the diff host), and descendants inherit the result.flowchart LR subgraph Before R1[":root"] --- A1["row ✱"] --- B1["p ✱"] --- C1["span ✱"] end subgraph After R2[":root ✱"] -.inherits.-> A2["row"] -.-> B2["p"] -.-> C2["span"] end✱ = element that computes its own highlight styles
@supports selector(:host-context(*))selects the inherited rules.:host-context()is Blink-only, and Gecko and WebKit have declined to implement it.@supports notbranch.:host-context(), it falls back to today's rules: still correct, just slower again.quote-highlight.css)tool-error-card.css)app/src/index.css)::selection, find, and quote highlights inside Pierre's shadow root (pierre/index.ts)Benchmark
Production build, 320-turn session, Chromium 148, no CPU throttle. Each figure is the median of 3 interleaved runs. "Frame busy" is main-thread time per 16.7 ms frame, taken from a Chrome trace.
devdevVisual
Added by the opencode bot (AI-generated).
Related: #54291