Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information