Title: [199304] trunk
Revision
199304
Author
[email protected]
Date
2016-04-11 12:31:12 -0700 (Mon, 11 Apr 2016)

Log Message

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: trunk/LayoutTests/ChangeLog (199303 => 199304)


--- trunk/LayoutTests/ChangeLog	2016-04-11 19:31:04 UTC (rev 199303)
+++ trunk/LayoutTests/ChangeLog	2016-04-11 19:31:12 UTC (rev 199304)
@@ -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-11  Chris Dumez  <[email protected]>
 
         DOMTokenList.contains() should not throw

Added: trunk/LayoutTests/fast/text/text-disappear-on-deselect-expected.html (0 => 199304)


--- trunk/LayoutTests/fast/text/text-disappear-on-deselect-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/text-disappear-on-deselect-expected.html	2016-04-11 19:31:12 UTC (rev 199304)
@@ -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: trunk/LayoutTests/fast/text/text-disappear-on-deselect.html (0 => 199304)


--- trunk/LayoutTests/fast/text/text-disappear-on-deselect.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/text-disappear-on-deselect.html	2016-04-11 19:31:12 UTC (rev 199304)
@@ -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: trunk/LayoutTests/platform/ios-simulator/TestExpectations (199303 => 199304)


--- trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-04-11 19:31:04 UTC (rev 199303)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-04-11 19:31:12 UTC (rev 199304)
@@ -245,7 +245,9 @@
 fast/scrolling/scroll-animator-overlay-scrollbars-hovered.html [ Skip ]
 fast/scrolling/scroll-animator-select-list-events.html [ Skip ]
 fast/events/prevent-default-prevents-interaction-with-scrollbars.html [ Skip ]
+fast/text/text-disappear-on-deselect.html [ ImageOnlyFailure ]
 
+
 webkit.org/b/148695 fast/shadow-dom [ Pass ]
 webkit.org/b/149440 fast/shadow-dom/css-scoping-shadow-host-functional-rule.html [ ImageOnlyFailure ]
 webkit.org/b/149441 fast/shadow-dom/css-scoping-shadow-slotted-rule.html [ ImageOnlyFailure ]

Modified: trunk/Source/WebCore/ChangeLog (199303 => 199304)


--- trunk/Source/WebCore/ChangeLog	2016-04-11 19:31:04 UTC (rev 199303)
+++ trunk/Source/WebCore/ChangeLog	2016-04-11 19:31:12 UTC (rev 199304)
@@ -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-05  Oliver Hunt  <[email protected]>
 
         Remove compile time define for SEPARATED_HEAP

Modified: trunk/Source/WebCore/rendering/TextPainter.cpp (199303 => 199304)


--- trunk/Source/WebCore/rendering/TextPainter.cpp	2016-04-11 19:31:04 UTC (rev 199303)
+++ trunk/Source/WebCore/rendering/TextPainter.cpp	2016-04-11 19:31:12 UTC (rev 199304)
@@ -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