Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 85d296cb7e71cc5f936d194e7a393c56436235d5
      
https://github.com/WebKit/WebKit/commit/85d296cb7e71cc5f936d194e7a393c56436235d5
  Author: Antti Koivisto <[email protected]>
  Date:   2026-08-14 (Fri, 14 Aug 2026)

  Changed paths:
    A 
LayoutTests/fast/repaint/highlight-pseudo-rule-change-document-wide-expected.txt
    A LayoutTests/fast/repaint/highlight-pseudo-rule-change-document-wide.html
    A LayoutTests/fast/repaint/highlight-pseudo-rule-change-expected.txt
    A LayoutTests/fast/repaint/highlight-pseudo-rule-change.html
    M Source/WebCore/rendering/MarkedText.cpp
    M Source/WebCore/rendering/StyledMarkedText.cpp
    M Source/WebCore/style/StyleDifference.cpp
    M Source/WebCore/style/StyleScope.cpp
    M Source/WebCore/style/StyleTreeResolver.cpp

  Log Message:
  -----------
  [Custom Highlight] ::highlight() pseudo-element is not repainted after a CSS 
rule change.
https://bugs.webkit.org/show_bug.cgi?id=321530
rdar://184643272

Reviewed by Megan Gardner.

We were completely missing repaint code for highlight pseudo-elements.

For ::highlight() specifically we also failed to cache the styles in parent 
ComputedStyle so
we also couldn't compare them for changes in the new repaint code.

Tests: fast/repaint/highlight-pseudo-rule-change-document-wide.html
       fast/repaint/highlight-pseudo-rule-change.html
* 
LayoutTests/fast/repaint/highlight-pseudo-rule-change-document-wide-expected.txt:
 Added.
* LayoutTests/fast/repaint/highlight-pseudo-rule-change-document-wide.html: 
Added.
* LayoutTests/fast/repaint/highlight-pseudo-rule-change-expected.txt: Added.
* LayoutTests/fast/repaint/highlight-pseudo-rule-change.html: Added.

::selection still doesn't repaint since selectionPseudoStyle() doesn't cache 
the style.
It is left as a failing case in the test.

* Source/WebCore/rendering/MarkedText.cpp:
(WebCore::MarkedText::collectForHighlights):
* Source/WebCore/rendering/StyledMarkedText.cpp:
(WebCore::resolveStyleForMarkedText):

Use lazyPseudoElementStyle() instead of resolvePseudoElementStyle(). Lazy 
version
does caching in parent ComputedStyle which is needed for repainting. It is also
more efficient as we don't recompute the style unnecessarily.

* Source/WebCore/style/StyleDifference.cpp:
(WebCore::Style::DifferenceFunctions::changeRequiresRepaint):
(WebCore::Style::DifferenceFunctions::highlightPseudoElementStyleChangeRequiresRepaint):

Add repaint issuing code for highlight pseudo-elements.

* Source/WebCore/style/StyleScope.cpp:
(WebCore::Style::Scope::didChangeViewportSize):

Ensure we check viewport units in pseudo-elements too to not regress
custom-highlight-dynamic-viewport-metrics-first-line-001.html

* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolveElement):

Resolve descendants when a highlight pseudo-element style changes, since they 
inherit from it.
Nothing did this before because nothing cached the styles, so paint just 
recomputed them. Needed
to not regress css-conditional/container-queries/pseudo-elements-010.html, 
where the style that
paints is cached on the span inside the element the changing rule matches.

Canonical link: https://commits.webkit.org/319169@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to