Title: [291554] releases/WebKitGTK/webkit-2.36
Revision
291554
Author
carlo...@webkit.org
Date
2022-03-21 01:45:10 -0700 (Mon, 21 Mar 2022)

Log Message

Merge r291552 - REGRESSION(r286955): Rendering Links during search: highlighting fails
https://bugs.webkit.org/show_bug.cgi?id=237816

Reviewed by Simon Fraser.

Source/WebCore:

Since r286955 the same coalesced marked text loop is used for painting the foreground text in case of text with
decorations. StyledMarkedText::coalesceAdjacentWithEqualDecorations() doesn't take into account the text style,
so when selected foreground color is different we end up painting the whole decorated text with the same
foreground color for the selected and non-selected parts.

Test: fast/text/selection-with-text-decorations.html

* rendering/StyledMarkedText.cpp:
(WebCore::StyledMarkedText::coalesceAdjacentWithEqualDecorations): Take into account the text styles too.
* rendering/TextBoxPainter.cpp:
(WebCore::TextBoxPainter::paintForegroundAndDecorations): Do not call
StyledMarkedText::coalesceAdjacentWithEqualForeground() in case of text with decorations, since it's unused.

LayoutTests:

* fast/text/selection-with-text-decorations-expected.html: Added.
* fast/text/selection-with-text-decorations.html: Added.
* platform/ios/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.36/LayoutTests/ChangeLog (291553 => 291554)


--- releases/WebKitGTK/webkit-2.36/LayoutTests/ChangeLog	2022-03-21 08:45:03 UTC (rev 291553)
+++ releases/WebKitGTK/webkit-2.36/LayoutTests/ChangeLog	2022-03-21 08:45:10 UTC (rev 291554)
@@ -1,3 +1,14 @@
+2022-03-21  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        REGRESSION(r286955): Rendering Links during search: highlighting fails
+        https://bugs.webkit.org/show_bug.cgi?id=237816
+
+        Reviewed by Simon Fraser.
+
+        * fast/text/selection-with-text-decorations-expected.html: Added.
+        * fast/text/selection-with-text-decorations.html: Added.
+        * platform/ios/TestExpectations:
+
 2022-03-01  Cameron McCormack  <hey...@apple.com>
 
         Make input element UA shadow tree creation lazy

Added: releases/WebKitGTK/webkit-2.36/LayoutTests/fast/text/selection-with-text-decorations-expected.html (0 => 291554)


--- releases/WebKitGTK/webkit-2.36/LayoutTests/fast/text/selection-with-text-decorations-expected.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.36/LayoutTests/fast/text/selection-with-text-decorations-expected.html	2022-03-21 08:45:10 UTC (rev 291554)
@@ -0,0 +1,18 @@
+<head>
+<style>
+div {
+    display: inline-block;
+    clip-path: inset(0px 1px 0px 0px); /* workaround for mac. See webkit.org/b/237816. */
+    font-family: monospace;
+    font-size: 18px;
+    text-decoration: underline;
+    text-decoration-color: lightgreen;
+    text-decoration-thickness: 1ex;
+    text-underline-offset: -1.25ex;
+    text-decoration-skip-ink: none;
+    text-decoration-skip: none;
+}
+</style>
+</head>
+<div><span style="color: red;">Hello</span> I have a cool underline</div>
+

Added: releases/WebKitGTK/webkit-2.36/LayoutTests/fast/text/selection-with-text-decorations.html (0 => 291554)


--- releases/WebKitGTK/webkit-2.36/LayoutTests/fast/text/selection-with-text-decorations.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.36/LayoutTests/fast/text/selection-with-text-decorations.html	2022-03-21 08:45:10 UTC (rev 291554)
@@ -0,0 +1,25 @@
+<head>
+<style>
+div {
+    display: inline-block;
+    clip-path: inset(0px 1px 0px 0px); /* workaround for mac. See webkit.org/b/237816. */
+    font-family: monospace;
+    font-size: 18px;
+    text-decoration: underline;
+    text-decoration-color: lightgreen;
+    text-decoration-thickness: 1ex;
+    text-underline-offset: -1.25ex;
+    text-decoration-skip-ink: none;
+    text-decoration-skip: none;
+}
+div::selection {
+    color: red;
+    background: transparent;
+}
+</style>
+</head>
+<div id="target">Hello I have a cool underline</div>
+<script>
+var target = document.getElementById("target").firstChild;
+getSelection().setBaseAndExtent(target, 0, target, 5);
+</script>

Modified: releases/WebKitGTK/webkit-2.36/LayoutTests/platform/ios/TestExpectations (291553 => 291554)


--- releases/WebKitGTK/webkit-2.36/LayoutTests/platform/ios/TestExpectations	2022-03-21 08:45:03 UTC (rev 291553)
+++ releases/WebKitGTK/webkit-2.36/LayoutTests/platform/ios/TestExpectations	2022-03-21 08:45:10 UTC (rev 291554)
@@ -134,6 +134,7 @@
 fast/selectors/text-field-selection-text-shadow.html  [ WontFix ]
 fast/selectors/text-field-selection-window-inactive-stroke-color.html  [ WontFix ]
 fast/selectors/text-field-selection-window-inactive-text-shadow.html  [ WontFix ]
+fast/text/selection-with-text-decorations.html  [ WontFix ]
 
 # Plugins are not supported on iOS
 plugins

Modified: releases/WebKitGTK/webkit-2.36/Source/WebCore/ChangeLog (291553 => 291554)


--- releases/WebKitGTK/webkit-2.36/Source/WebCore/ChangeLog	2022-03-21 08:45:03 UTC (rev 291553)
+++ releases/WebKitGTK/webkit-2.36/Source/WebCore/ChangeLog	2022-03-21 08:45:10 UTC (rev 291554)
@@ -1,3 +1,23 @@
+2022-03-21  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        REGRESSION(r286955): Rendering Links during search: highlighting fails
+        https://bugs.webkit.org/show_bug.cgi?id=237816
+
+        Reviewed by Simon Fraser.
+
+        Since r286955 the same coalesced marked text loop is used for painting the foreground text in case of text with
+        decorations. StyledMarkedText::coalesceAdjacentWithEqualDecorations() doesn't take into account the text style,
+        so when selected foreground color is different we end up painting the whole decorated text with the same
+        foreground color for the selected and non-selected parts.
+
+        Test: fast/text/selection-with-text-decorations.html
+
+        * rendering/StyledMarkedText.cpp:
+        (WebCore::StyledMarkedText::coalesceAdjacentWithEqualDecorations): Take into account the text styles too.
+        * rendering/TextBoxPainter.cpp:
+        (WebCore::TextBoxPainter::paintForegroundAndDecorations): Do not call
+        StyledMarkedText::coalesceAdjacentWithEqualForeground() in case of text with decorations, since it's unused.
+
 2022-03-20  Philippe Normand  <pnorm...@igalia.com>
 
         REGRESSION(r289154) [GSTREAMER] webrtc/vp8-then-h264.html is crashing after SDK update to fdo 21.08 and Gstreamer 1.20

Modified: releases/WebKitGTK/webkit-2.36/Source/WebCore/rendering/StyledMarkedText.cpp (291553 => 291554)


--- releases/WebKitGTK/webkit-2.36/Source/WebCore/rendering/StyledMarkedText.cpp	2022-03-21 08:45:03 UTC (rev 291553)
+++ releases/WebKitGTK/webkit-2.36/Source/WebCore/rendering/StyledMarkedText.cpp	2022-03-21 08:45:10 UTC (rev 291554)
@@ -198,7 +198,7 @@
 Vector<StyledMarkedText> StyledMarkedText::coalesceAdjacentWithEqualDecorations(const Vector<StyledMarkedText>& markedTexts)
 {
     return coalesceAdjacent(markedTexts, [&](auto& a, auto& b) {
-        return a.textDecorationStyles == b.textDecorationStyles && a.textShadow == b.textShadow && a.alpha == b.alpha;
+        return a.textDecorationStyles == b.textDecorationStyles && a.textStyles == b.textStyles && a.textShadow == b.textShadow && a.alpha == b.alpha;
     });
 }
 

Modified: releases/WebKitGTK/webkit-2.36/Source/WebCore/rendering/TextBoxPainter.cpp (291553 => 291554)


--- releases/WebKitGTK/webkit-2.36/Source/WebCore/rendering/TextBoxPainter.cpp	2022-03-21 08:45:03 UTC (rev 291553)
+++ releases/WebKitGTK/webkit-2.36/Source/WebCore/rendering/TextBoxPainter.cpp	2022-03-21 08:45:10 UTC (rev 291554)
@@ -185,9 +185,6 @@
         });
     }
 
-    // Coalesce styles of adjacent marked texts to minimize the number of drawing commands.
-    auto coalescedStyledMarkedTexts = StyledMarkedText::coalesceAdjacentWithEqualForeground(styledMarkedTexts);
-
     auto textDecorations = m_style.textDecorationsInEffect();
     bool highlightDecorations = !MarkedText::collectForHighlights(m_renderer, m_selectableRange, MarkedText::PaintPhase::Decoration).isEmpty();
     bool lineDecorations = !textDecorations.isEmpty();
@@ -240,6 +237,9 @@
             }
         }
     } else {
+        // Coalesce styles of adjacent marked texts to minimize the number of drawing commands.
+        auto coalescedStyledMarkedTexts = StyledMarkedText::coalesceAdjacentWithEqualForeground(styledMarkedTexts);
+
         for (auto& markedText : coalescedStyledMarkedTexts)
             paintForeground(markedText);
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to