Title: [199995] releases/WebKitGTK/webkit-2.12
Revision
199995
Author
[email protected]
Date
2016-04-25 05:14:41 -0700 (Mon, 25 Apr 2016)

Log Message

Merge r199304 - REGRESSION (r193857): Text selection causes text to disappear.
https://bugs.webkit.org/show_bug.cgi?id=156448
rdar://problem/25578952

Reviewed by Simon Fraser.

Apparently when the end position of the selection range is smaller than the start position, we need
to repaint the entire text as it indicates selection clearing.

Source/WebCore:

Test: fast/text/text-disappear-on-deselect.html

* rendering/TextPainter.cpp:
(WebCore::TextPainter::paintText):

LayoutTests:

* fast/text/text-disappear-on-deselect-expected.html: Added.
* fast/text/text-disappear-on-deselect.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog (199994 => 199995)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog	2016-04-25 12:11:40 UTC (rev 199994)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/ChangeLog	2016-04-25 12:14:41 UTC (rev 199995)
@@ -1,3 +1,17 @@
+2016-04-11  Zalan Bujtas  <[email protected]>
+
+        REGRESSION (r193857): Text selection causes text to disappear.
+        https://bugs.webkit.org/show_bug.cgi?id=156448
+        rdar://problem/25578952
+
+        Reviewed by Simon Fraser.
+
+        Apparently when the end position of the selection range is smaller than the start position, we need
+        to repaint the entire text as it indicates selection clearing.
+
+        * fast/text/text-disappear-on-deselect-expected.html: Added.
+        * fast/text/text-disappear-on-deselect.html: Added.
+
 2016-04-07  Brent Fulgham  <[email protected]>
 
         Wheel event callback removing the window causes crash in WebCore.

Added: releases/WebKitGTK/webkit-2.12/LayoutTests/fast/text/text-disappear-on-deselect-expected.html (0 => 199995)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/fast/text/text-disappear-on-deselect-expected.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/fast/text/text-disappear-on-deselect-expected.html	2016-04-25 12:14:41 UTC (rev 199995)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that deselecting text over multiple lines does not make the text disappear.</title>
+<style>
+div {
+    font-family: Ahem;
+    font-size: 10px;
+}
+
+.red {
+    color: red;
+}
+</style>
+</head>
+<body>
+<div><span class=red>foobar</span><br>
+<span class=red>f</span>oobar  foobar</div>
+</body>
+</html>

Added: releases/WebKitGTK/webkit-2.12/LayoutTests/fast/text/text-disappear-on-deselect.html (0 => 199995)


--- releases/WebKitGTK/webkit-2.12/LayoutTests/fast/text/text-disappear-on-deselect.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.12/LayoutTests/fast/text/text-disappear-on-deselect.html	2016-04-25 12:14:41 UTC (rev 199995)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that deselecting text over multiple lines does not make the text disappear.</title>
+<style>
+div {
+    font-family: Ahem;
+    font-size: 10px;
+}
+
+::selection {
+    color: red;
+}
+</style>
+</head>
+<body>
+<div id=foobar>foobar<br>
+foobar  foobar</div>
+<script>
+var target = document.getElementById("foobar");
+if (window.eventSender) {
+    window.eventSender.mouseMoveTo(target.offsetLeft, target.offsetTop);
+    window.eventSender.mouseDown();
+    window.eventSender.mouseMoveTo(target.offsetLeft + 10, target.offsetTop + target.offsetHeight + 15);
+    window.eventSender.mouseMoveTo(target.offsetLeft + 10, target.offsetTop + target.offsetHeight - 5);
+    window.eventSender.mouseUp();
+}
+</script>
+</body>
+</html>
\ No newline at end of file

Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog (199994 => 199995)


--- releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog	2016-04-25 12:11:40 UTC (rev 199994)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog	2016-04-25 12:14:41 UTC (rev 199995)
@@ -1,3 +1,19 @@
+2016-04-11  Zalan Bujtas  <[email protected]>
+
+        REGRESSION (r193857): Text selection causes text to disappear.
+        https://bugs.webkit.org/show_bug.cgi?id=156448
+        rdar://problem/25578952
+
+        Reviewed by Simon Fraser.
+
+        Apparently when the end position of the selection range is smaller than the start position, we need
+        to repaint the entire text as it indicates selection clearing.
+
+        Test: fast/text/text-disappear-on-deselect.html
+
+        * rendering/TextPainter.cpp:
+        (WebCore::TextPainter::paintText):
+
 2016-04-09  Konstantin Tokarev  <[email protected]>
 
         Fixed compilation of JPEGImageDecoder with libjpeg v9.

Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/TextPainter.cpp (199994 => 199995)


--- releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/TextPainter.cpp	2016-04-25 12:11:40 UTC (rev 199994)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/TextPainter.cpp	2016-04-25 12:14:41 UTC (rev 199995)
@@ -154,16 +154,17 @@
         // effect, so only when we know we're stroking, do a save/restore.
         GraphicsContextStateSaver stateSaver(m_context, m_textPaintStyle.strokeWidth > 0);
         updateGraphicsContext(m_context, m_textPaintStyle);
-        if (paintSelectedTextSeparately) {
+        bool fullPaint = !paintSelectedTextSeparately || selectionEnd <= selectionStart;
+        if (fullPaint)
+            paintTextAndEmphasisMarksIfNeeded(textRun, boxRect, textOrigin, 0, length, m_textPaintStyle, m_textShadow);
+        else {
             // Paint the before and after selection parts.
             if (selectionStart > 0)
                 paintTextAndEmphasisMarksIfNeeded(textRun, boxRect, textOrigin, 0, selectionStart, m_textPaintStyle, m_textShadow);
             if (selectionEnd < length)
                 paintTextAndEmphasisMarksIfNeeded(textRun, boxRect, textOrigin, selectionEnd, length, m_textPaintStyle, m_textShadow);
-        } else
-            paintTextAndEmphasisMarksIfNeeded(textRun, boxRect, textOrigin, 0, length, m_textPaintStyle, m_textShadow);
+        }
     }
-
     // Paint only the text that is selected.
     if ((paintSelectedTextOnly || paintSelectedTextSeparately) && selectionStart < selectionEnd) {
         GraphicsContextStateSaver stateSaver(m_context, m_selectionPaintStyle.strokeWidth > 0);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to