Diff
Modified: trunk/LayoutTests/ChangeLog (151893 => 151894)
--- trunk/LayoutTests/ChangeLog 2013-06-24 06:20:34 UTC (rev 151893)
+++ trunk/LayoutTests/ChangeLog 2013-06-24 07:32:21 UTC (rev 151894)
@@ -1,3 +1,17 @@
+2013-06-24 Zalan Bujtas <[email protected]>
+
+ Hittest finds the truncated text instead of the floating input, when the input is clicked.
+ https://bugs.webkit.org/show_bug.cgi?id=115675
+
+ Reviewed by David Hyatt.
+
+ Ignore truncated text on inline textbox and everything beyond the ellipsis box on
+ the root inlinebox while hittesting. (provided that nodeAtPoint finds no hit for any of
+ the root inline's children.)
+
+ * fast/css/text-overflow-ellipsis-and-floating-input-hittest-expected.txt: Added.
+ * fast/css/text-overflow-ellipsis-and-floating-input-hittest.html: Added.
+
2013-06-23 Brent Fulgham <[email protected]>
AX: Rebaseline test after r151868
Added: trunk/LayoutTests/fast/css/text-overflow-ellipsis-and-floating-input-hittest-expected.txt (0 => 151894)
--- trunk/LayoutTests/fast/css/text-overflow-ellipsis-and-floating-input-hittest-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/text-overflow-ellipsis-and-floating-input-hittest-expected.txt 2013-06-24 07:32:21 UTC (rev 151894)
@@ -0,0 +1,16 @@
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+
+Hittest for the vertical mode needs updating after fixing this: Text does not get truncated properly in vertical writing mode when overflow:hidden and text-overflow:ellipsis are set
+
+PASS document.elementFromPoint(inputLeft + 10, inputTop).id is 'right-floating-input'
+PASS document.elementFromPoint(inputLeft - 10, inputTop).id is 'container-ltr'
+PASS document.elementFromPoint(inputRight - 10, inputTop).id is 'left-floating-input'
+PASS document.elementFromPoint(inputRight + 10, inputTop).id is 'container-rtl'
+PASS document.elementFromPoint(inputRight - 10, inputTop).id is 'container-vertical-rl'
+PASS document.elementFromPoint(inputRight, inputTop - 10).id is 'container-vertical-rl'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/css/text-overflow-ellipsis-and-floating-input-hittest.html (0 => 151894)
--- trunk/LayoutTests/fast/css/text-overflow-ellipsis-and-floating-input-hittest.html (rev 0)
+++ trunk/LayoutTests/fast/css/text-overflow-ellipsis-and-floating-input-hittest.html 2013-06-24 07:32:21 UTC (rev 151894)
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+
+function offset(elem) {
+ var result = {top: 0, left: 0};
+ for (; elem; elem = elem.offsetParent) {
+ result.left += elem.offsetLeft;
+ result.top += elem.offsetTop;
+ }
+ return result;
+}
+
+function test() {
+ var inputBox = document.getElementById('right-floating-input');
+ inputLeft = offset(inputBox).left;
+ inputTop = offset(inputBox).top;
+ shouldBe("document.elementFromPoint(inputLeft + 10, inputTop).id", "'right-floating-input'");
+ shouldBe("document.elementFromPoint(inputLeft - 10, inputTop).id", "'container-ltr'");
+
+ inputBox = document.getElementById('left-floating-input');
+ inputRight = offset(inputBox).left + inputBox.offsetWidth;
+ inputTop = offset(inputBox).top;
+ shouldBe("document.elementFromPoint(inputRight - 10, inputTop).id", "'left-floating-input'");
+ shouldBe("document.elementFromPoint(inputRight + 10, inputTop).id", "'container-rtl'");
+
+ inputBox = document.getElementById('vertial-left-floating-input');
+ inputRight = offset(inputBox).left + inputBox.offsetWidth;;
+ inputTop = offset(inputBox).top;
+ shouldBe("document.elementFromPoint(inputRight - 10, inputTop).id", "'container-vertical-rl'");
+ shouldBe("document.elementFromPoint(inputRight, inputTop - 10).id", "'container-vertical-rl'");
+
+ isSuccessfullyParsed();
+}
+</script>
+
+<style>
+ div {
+ text-overflow: ellipsis;
+ overflow: hidden;
+ white-space: nowrap;
+ border: solid 1px red;
+ padding: 10px;
+ }
+
+ #container-vertical-rl {
+ -webkit-writing-mode: vertical-rl;
+ height: 150px;
+ }
+</style>
+</head>
+<body _onload_="test()">
+ <div id='container-ltr'><input id='right-floating-input' style='float: right' type='text'>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+ </div>
+ <div dir='rtl' id='container-rtl'><input id='left-floating-input' style='float: left' type='text'>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+ </div>
+ <div id='container-vertical-rl'><input id='vertial-left-floating-input' style='float: right' type='text'>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+ </div>
+ <br>
+ <div>Hittest for the vertical mode needs updating after fixing this: <a href=''>Text does not get truncated properly in vertical writing mode when overflow:hidden and text-overflow:ellipsis are set</a></div>
+ <br>
+ <div id="console"></div>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (151893 => 151894)
--- trunk/Source/WebCore/ChangeLog 2013-06-24 06:20:34 UTC (rev 151893)
+++ trunk/Source/WebCore/ChangeLog 2013-06-24 07:32:21 UTC (rev 151894)
@@ -1,3 +1,22 @@
+2013-06-24 Zalan Bujtas <[email protected]>
+
+ Hittest finds the truncated text instead of the floating input, when the input is clicked.
+ https://bugs.webkit.org/show_bug.cgi?id=115675
+
+ Reviewed by David Hyatt.
+
+ Ignore truncated text on inline textbox and everything beyond the ellipsis box on
+ the root inlinebox while hittesting. (provided that nodeAtPoint finds no hit for any of
+ the root inline's children.)
+
+ Test: fast/css/text-overflow-ellipsis-and-floating-input-hittest.html
+
+ * rendering/InlineFlowBox.cpp:
+ (WebCore::InlineFlowBox::nodeAtPoint):
+ * rendering/InlineTextBox.cpp:
+ (WebCore::InlineTextBox::nodeAtPoint):
+ (WebCore::InlineTextBox::paint):
+
2013-06-17 Darin Adler <[email protected]>
Sort all the Xcode project files
Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (151893 => 151894)
--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp 2013-06-24 06:20:34 UTC (rev 151893)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp 2013-06-24 07:32:21 UTC (rev 151894)
@@ -1051,6 +1051,26 @@
}
// Now check ourselves. Pixel snap hit testing.
+ if (!visibleToHitTesting())
+ return false;
+
+ // Do not hittest content beyond the ellipsis box.
+ if (isRootInlineBox() && hasEllipsisBox()) {
+ const EllipsisBox* ellipsisBox = root()->ellipsisBox();
+ LayoutRect boundsRect(roundedFrameRect());
+
+ if (isHorizontal())
+ renderer()->style()->isLeftToRightDirection() ? boundsRect.shiftXEdgeTo(ellipsisBox->right()) : boundsRect.setWidth(ellipsisBox->left() - left());
+ else
+ boundsRect.shiftYEdgeTo(ellipsisBox->right());
+
+ flipForWritingMode(boundsRect);
+ boundsRect.moveBy(accumulatedOffset);
+ // We are beyond the ellipsis box.
+ if (locationInContainer.intersects(boundsRect))
+ return false;
+ }
+
LayoutRect frameRect = roundedFrameRect();
LayoutUnit minX = frameRect.x();
LayoutUnit minY = frameRect.y();
@@ -1073,7 +1093,7 @@
flipForWritingMode(rect);
rect.moveBy(accumulatedOffset);
- if (visibleToHitTesting() && locationInContainer.intersects(rect)) {
+ if (locationInContainer.intersects(rect)) {
renderer()->updateHitTestResult(result, flipForWritingMode(locationInContainer.point() - toLayoutSize(accumulatedOffset))); // Don't add in m_x or m_y here, we want coords in the containing block's space.
if (!result.addNodeToRectBasedTestResult(renderer()->node(), request, locationInContainer, rect))
return true;
Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (151893 => 151894)
--- trunk/Source/WebCore/rendering/InlineTextBox.cpp 2013-06-24 06:20:34 UTC (rev 151893)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp 2013-06-24 07:32:21 UTC (rev 151894)
@@ -372,13 +372,29 @@
bool InlineTextBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/)
{
+ if (!visibleToHitTesting())
+ return false;
+
if (isLineBreak())
return false;
- FloatPoint boxOrigin = locationIncludingFlipping();
- boxOrigin.moveBy(accumulatedOffset);
- FloatRect rect(boxOrigin, size());
- if (m_truncation != cFullTruncation && visibleToHitTesting() && locationInContainer.intersects(rect)) {
+ if (m_truncation == cFullTruncation)
+ return false;
+
+ FloatRect rect(locationIncludingFlipping(), size());
+ // Make sure truncated text is ignored while hittesting.
+ if (m_truncation != cNoTruncation) {
+ LayoutUnit widthOfVisibleText = toRenderText(renderer())->width(m_start, m_truncation, textPos(), isFirstLineStyle());
+
+ if (isHorizontal())
+ renderer()->style()->isLeftToRightDirection() ? rect.setWidth(widthOfVisibleText) : rect.shiftXEdgeTo(right() - widthOfVisibleText);
+ else
+ rect.setHeight(widthOfVisibleText);
+ }
+
+ rect.moveBy(accumulatedOffset);
+
+ if (locationInContainer.intersects(rect)) {
renderer()->updateHitTestResult(result, flipForWritingMode(locationInContainer.point() - toLayoutSize(accumulatedOffset)));
if (!result.addNodeToRectBasedTestResult(renderer()->node(), request, locationInContainer, rect))
return true;
@@ -533,7 +549,6 @@
// truncated string i.e. |Hello|CBA| -> |...lo|CBA|
LayoutUnit widthOfVisibleText = toRenderText(renderer())->width(m_start, m_truncation, textPos(), isFirstLineStyle());
LayoutUnit widthOfHiddenText = m_logicalWidth - widthOfVisibleText;
- // FIXME: The hit testing logic also needs to take this translation into account.
LayoutSize truncationOffset(isLeftToRightDirection() ? widthOfHiddenText : -widthOfHiddenText, 0);
adjustedPaintOffset.move(isHorizontal() ? truncationOffset : truncationOffset.transposedSize());
}