Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5dd82e774cf8a2ead554aa962a73e855606b1d4c
      
https://github.com/WebKit/WebKit/commit/5dd82e774cf8a2ead554aa962a73e855606b1d4c
  Author: Antti Koivisto <[email protected]>
  Date:   2026-08-23 (Sun, 23 Aug 2026)

  Changed paths:
    M LayoutTests/fast/repaint/highlight-pseudo-rule-change-expected.txt
    M LayoutTests/fast/repaint/highlight-pseudo-rule-change.html
    M Source/WebCore/rendering/RenderElement.cpp
    M Source/WebCore/rendering/RenderElement.h
    M Source/WebCore/rendering/RenderText.h
    M Source/WebCore/rendering/StyledMarkedText.cpp
    M Source/WebCore/rendering/TextBoxPainter.cpp
    M Source/WebCore/rendering/TextPaintStyle.cpp

  Log Message:
  -----------
  ::selection fails to repaint on style change
https://bugs.webkit.org/show_bug.cgi?id=321846
rdar://184994906

Reviewed by Alan Baradlay.

Active selections fail to visually update if ::selection style
changes. The repaint code compares
the highlight pseudo-element styles cached in the parent ComputedStyle, and 
::selection was still
resolving without caching, so there was never a previous style to compare 
against.

* LayoutTests/fast/repaint/highlight-pseudo-rule-change-expected.txt:
* LayoutTests/fast/repaint/highlight-pseudo-rule-change.html:

The ::selection case passes now.

* Source/WebCore/rendering/RenderElement.cpp:
(WebCore::RenderElement::selectionPseudoStyle const):

Use textSegmentPseudoStyle(), which already does this with 
lazyPseudoElementStyle(). It was an
exact copy of what selectionPseudoStyle() was doing, minus the caching.

* Source/WebCore/rendering/RenderElement.h:
* Source/WebCore/rendering/RenderText.h:
(WebCore::RenderText::selectionPseudoStyle const):

* Source/WebCore/rendering/StyledMarkedText.cpp:
(WebCore::resolveStyleForMarkedText):
*
Source/WebCore/rendering/TextBoxPainter.cpp:
(WebCore::TextBoxPainter::paintForegroundAndDecorations):
* Source/WebCore/rendering/TextPaintStyle.cpp:
(WebCore::computeTextSelectionPaintStyle):

The returned style is now owned by the parent ComputedStyle rather than the 
caller, so the locals
need to be CheckedPtr.

Canonical link: 
https://flagged.apple.com:443/proxy?t2=DS9f2f8cB6&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzE5NjYyQG1haW4=&emid=8ebbdb23-7e30-4974-b545-b8a523afce6e&c=11



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

Reply via email to