- Revision
- 123684
- Author
- m...@apple.com
- Date
- 2012-07-25 17:30:35 -0700 (Wed, 25 Jul 2012)
Log Message
Hit testing in one column or in the gap between cloumns along the block axis can return a result from the wrong column
https://bugs.webkit.org/show_bug.cgi?id=92311
Reviewed by Anders Carlsson.
Source/WebCore:
Tests: fast/multicol/hit-test-end-of-column.html
fast/multicol/hit-test-gap-block-axis.html
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::positionForPointWithInlineChildren): To prevent hits after the last
line on a given column from returning the next line in the next column, added a check if
the hit occurred within the pagination strut of a line. Covered by the first test.
(WebCore::RenderBlock::adjustPointToColumnContents): Added clamp-to-column logic for the
block-axis case. This prevents hits near the bottom of the top half of the gap from bleeding
into the top of the next column. Covered by the second test.
LayoutTests:
* fast/multicol/hit-test-end-of-column-expected.txt: Added.
* fast/multicol/hit-test-end-of-column.html: Added.
* fast/multicol/hit-test-gap-block-axis-expected.txt: Added.
* fast/multicol/hit-test-gap-block-axis.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (123683 => 123684)
--- trunk/LayoutTests/ChangeLog 2012-07-26 00:24:57 UTC (rev 123683)
+++ trunk/LayoutTests/ChangeLog 2012-07-26 00:30:35 UTC (rev 123684)
@@ -1,3 +1,15 @@
+2012-07-25 Dan Bernstein <m...@apple.com>
+
+ Hit testing in one column or in the gap between cloumns along the block axis can return a result from the wrong column
+ https://bugs.webkit.org/show_bug.cgi?id=92311
+
+ Reviewed by Anders Carlsson.
+
+ * fast/multicol/hit-test-end-of-column-expected.txt: Added.
+ * fast/multicol/hit-test-end-of-column.html: Added.
+ * fast/multicol/hit-test-gap-block-axis-expected.txt: Added.
+ * fast/multicol/hit-test-gap-block-axis.html: Added.
+
2012-07-25 Ryosuke Niwa <rn...@webkit.org>
Improve the output of editing/pasteboard/paste-noscript-xhtml.xhtml
Added: trunk/LayoutTests/fast/multicol/hit-test-end-of-column-expected.txt (0 => 123684)
--- trunk/LayoutTests/fast/multicol/hit-test-end-of-column-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/multicol/hit-test-end-of-column-expected.txt 2012-07-26 00:30:35 UTC (rev 123684)
@@ -0,0 +1,2 @@
+Lorem ipsum dolor sit amet consectetur elit.
+PASS
Added: trunk/LayoutTests/fast/multicol/hit-test-end-of-column.html (0 => 123684)
--- trunk/LayoutTests/fast/multicol/hit-test-end-of-column.html (rev 0)
+++ trunk/LayoutTests/fast/multicol/hit-test-end-of-column.html 2012-07-26 00:30:35 UTC (rev 123684)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<div id="target" style="
+ outline: dashed lightblue;
+ width: 400px;
+ -webkit-columns: 2;
+ -webkit-column-gap: 0;
+ height: 90px;
+ font: 20px ahem;
+">Lorem ipsum dolor sit amet consectetur elit.</div>
+<p id="result">
+ FAIL: Test did not run.
+</p>
+<script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ // Clicking below the last line in the first column should not select anything from the first
+ // line on the second column.
+ var target = document.getElementById("target");
+ var hitOffset = document.caretRangeFromPoint(target.offsetLeft + 45, target.offsetTop + 87).startOffset;
+ document.getElementById("result").innerText = hitOffset === 26 || hitOffset === 24 ? "PASS" : "FAIL: hit offset " + hitOffset + ".";
+</script>
Added: trunk/LayoutTests/fast/multicol/hit-test-gap-block-axis-expected.txt (0 => 123684)
--- trunk/LayoutTests/fast/multicol/hit-test-gap-block-axis-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/multicol/hit-test-gap-block-axis-expected.txt 2012-07-26 00:30:35 UTC (rev 123684)
@@ -0,0 +1,3 @@
+PASS
+
+Lorem ipsum dolor sit amet consectetur elit.
Added: trunk/LayoutTests/fast/multicol/hit-test-gap-block-axis.html (0 => 123684)
--- trunk/LayoutTests/fast/multicol/hit-test-gap-block-axis.html (rev 0)
+++ trunk/LayoutTests/fast/multicol/hit-test-gap-block-axis.html 2012-07-26 00:30:35 UTC (rev 123684)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<p id="result">
+ FAIL: Test did not run.
+</p>
+<div id="target" style="
+ outline: dashed lightblue;
+ width: 200px;
+ -webkit-column-axis: vertical;
+ -webkit-column-gap: 100px;
+ height: 90px;
+ font: 20px ahem;
+ color: rgba(0, 0, 0, 0.5);
+">Lorem ipsum dolor sit amet consectetur elit.</div>
+<script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ // Clicking in the gap after the first column should not select anything from the second column.
+ var target = document.getElementById("target");
+ var hitOffset = document.caretRangeFromPoint(target.offsetLeft + 45, target.offsetTop + 115).startOffset;
+ document.getElementById("result").innerText = hitOffset === 26 || hitOffset === 24 ? "PASS" : "FAIL: hit offset " + hitOffset + ".";
+</script>
Modified: trunk/Source/WebCore/ChangeLog (123683 => 123684)
--- trunk/Source/WebCore/ChangeLog 2012-07-26 00:24:57 UTC (rev 123683)
+++ trunk/Source/WebCore/ChangeLog 2012-07-26 00:30:35 UTC (rev 123684)
@@ -1,3 +1,21 @@
+2012-07-25 Dan Bernstein <m...@apple.com>
+
+ Hit testing in one column or in the gap between cloumns along the block axis can return a result from the wrong column
+ https://bugs.webkit.org/show_bug.cgi?id=92311
+
+ Reviewed by Anders Carlsson.
+
+ Tests: fast/multicol/hit-test-end-of-column.html
+ fast/multicol/hit-test-gap-block-axis.html
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::positionForPointWithInlineChildren): To prevent hits after the last
+ line on a given column from returning the next line in the next column, added a check if
+ the hit occurred within the pagination strut of a line. Covered by the first test.
+ (WebCore::RenderBlock::adjustPointToColumnContents): Added clamp-to-column logic for the
+ block-axis case. This prevents hits near the bottom of the top half of the gap from bleeding
+ into the top of the next column. Covered by the second test.
+
2012-07-25 David Grogan <dgro...@chromium.org>
IndexedDB: Make db.version return an integer if appropriate
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (123683 => 123684)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2012-07-26 00:24:57 UTC (rev 123683)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2012-07-26 00:30:35 UTC (rev 123684)
@@ -4925,6 +4925,10 @@
continue;
if (!firstRootBoxWithChildren)
firstRootBoxWithChildren = root;
+
+ if (root->paginationStrut() && pointInLogicalContents.y() < root->logicalTop())
+ break;
+
lastRootBoxWithChildren = root;
// check if this root line box is located at this y coordinate
@@ -5247,16 +5251,23 @@
if (isHorizontalWritingMode() == (colInfo->progressionAxis() == ColumnInfo::InlineAxis)) {
LayoutRect gapAndColumnRect(colRect.x() - halfColGap, colRect.y(), colRect.width() + colGap, colRect.height());
if (point.x() >= gapAndColumnRect.x() && point.x() < gapAndColumnRect.maxX()) {
- // FIXME: The clamping that follows is not completely right for right-to-left
- // content.
- // Clamp everything above the column to its top left.
- if (point.y() < gapAndColumnRect.y())
- point = gapAndColumnRect.location();
- // Clamp everything below the column to the next column's top left. If there is
- // no next column, this still maps to just after this column.
- else if (point.y() >= gapAndColumnRect.maxY()) {
- point = gapAndColumnRect.location();
- point.move(0, gapAndColumnRect.height());
+ if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) {
+ // FIXME: The clamping that follows is not completely right for right-to-left
+ // content.
+ // Clamp everything above the column to its top left.
+ if (point.y() < gapAndColumnRect.y())
+ point = gapAndColumnRect.location();
+ // Clamp everything below the column to the next column's top left. If there is
+ // no next column, this still maps to just after this column.
+ else if (point.y() >= gapAndColumnRect.maxY()) {
+ point = gapAndColumnRect.location();
+ point.move(0, gapAndColumnRect.height());
+ }
+ } else {
+ if (point.x() < colRect.x())
+ point.setX(colRect.x());
+ else if (point.x() >= colRect.maxX())
+ point.setX(colRect.maxX() - 1);
}
// We're inside the column. Translate the x and y into our column coordinate space.
@@ -5272,16 +5283,23 @@
} else {
LayoutRect gapAndColumnRect(colRect.x(), colRect.y() - halfColGap, colRect.width(), colRect.height() + colGap);
if (point.y() >= gapAndColumnRect.y() && point.y() < gapAndColumnRect.maxY()) {
- // FIXME: The clamping that follows is not completely right for right-to-left
- // content.
- // Clamp everything above the column to its top left.
- if (point.x() < gapAndColumnRect.x())
- point = gapAndColumnRect.location();
- // Clamp everything below the column to the next column's top left. If there is
- // no next column, this still maps to just after this column.
- else if (point.x() >= gapAndColumnRect.maxX()) {
- point = gapAndColumnRect.location();
- point.move(gapAndColumnRect.width(), 0);
+ if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) {
+ // FIXME: The clamping that follows is not completely right for right-to-left
+ // content.
+ // Clamp everything above the column to its top left.
+ if (point.x() < gapAndColumnRect.x())
+ point = gapAndColumnRect.location();
+ // Clamp everything below the column to the next column's top left. If there is
+ // no next column, this still maps to just after this column.
+ else if (point.x() >= gapAndColumnRect.maxX()) {
+ point = gapAndColumnRect.location();
+ point.move(gapAndColumnRect.width(), 0);
+ }
+ } else {
+ if (point.y() < colRect.y())
+ point.setY(colRect.y());
+ else if (point.y() >= colRect.maxY())
+ point.setY(colRect.maxY() - 1);
}
// We're inside the column. Translate the x and y into our column coordinate space.