Skip to content
Permalink
Browse files
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.


Canonical link: https://commits.webkit.org/174563@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199304 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
alanbujtas committed Apr 11, 2016
1 parent d9106c3 commit 86e1f18c49c2970b73fa3b0f69f77717cd05e08d
Showing 6 changed files with 87 additions and 4 deletions.
@@ -1,3 +1,17 @@
2016-04-11 Zalan Bujtas <zalan@apple.com>

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 <cdumez@apple.com>

DOMTokenList.contains() should not throw
@@ -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>
@@ -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>
@@ -245,6 +245,8 @@ fast/scrolling/scroll-animator-basic-events.html [ Skip ]
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 ]
@@ -1,3 +1,19 @@
2016-04-11 Zalan Bujtas <zalan@apple.com>

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 <oliver@apple.com>

Remove compile time define for SEPARATED_HEAP
@@ -154,16 +154,17 @@ void TextPainter::paintText(const TextRun& textRun, int length, const FloatRect&
// 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);

0 comments on commit 86e1f18

Please sign in to comment.