[webkit-changes] [WebKit/WebKit] 76bb96: Defer to non-anonymous ancestor when determining s...

Daniel Jalkut noreply at github.com
Sun Nov 26 23:15:53 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 76bb9606ee1b4724d5df8ad4b259092268af8fe0
      https://github.com/WebKit/WebKit/commit/76bb9606ee1b4724d5df8ad4b259092268af8fe0
  Author: Daniel Jalkut <jalkut at red-sweater.com>
  Date:   2023-11-26 (Sun, 26 Nov 2023)

  Changed paths:
    A LayoutTests/fast/selectors/selection-gap-background-color-expected.html
    A LayoutTests/fast/selectors/selection-gap-background-color.html
    M Source/WebCore/rendering/RenderElement.cpp

  Log Message:
  -----------
  Defer to non-anonymous ancestor when determining selection background color for anonymous blocks.
https://bugs.webkit.org/show_bug.cgi?id=263658

Reviewed by Ryosuke Niwa.

There is a precedent for anonymous blocks deferring to their non-anonymous
ancestors when deriving selectionBackgroundColor. For example RenderText
defers to its ancestor in order to ensure text blocks are colored correctly
when a custom color has been set with a Selection pseudo-element. This
change addresses the failure to defer to an ancestor when painting the
selection on gaps between two blocks with uneven widths. By deferring to
nonAnonymousAncestor at the RenderElement level, it should ensure a fix for
bug #263658 as well as potentially alleviating failures in other areas that
have not yet been diagnosed. Because the change is limited to anonymous nodes,
and because the selectionBackgroundColor is only consulted specifically when
managing the painting of selected ranges, I believe this is a low risk proposal
which cleanly addresses the linked bug report.

* LayoutTests/platform/mac/fast/selectors/selection-gap-background-color-expected.png: Added.
* LayoutTests/platform/mac/fast/selectors/selection-gap-background-color.html: Added.
* Source/WebCore/rendering/RenderElement.cpp:
(WebCore::RenderElement::selectionBackgroundColor const):

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




More information about the webkit-changes mailing list