Diff
Modified: trunk/LayoutTests/ChangeLog (167816 => 167817)
--- trunk/LayoutTests/ChangeLog 2014-04-25 19:45:06 UTC (rev 167816)
+++ trunk/LayoutTests/ChangeLog 2014-04-25 20:20:48 UTC (rev 167817)
@@ -1,3 +1,27 @@
+2014-04-25 David Hyatt <[email protected]>
+
+ [New Multicolumn] fast/multicol/hit-test-* layout tests all fail
+ https://bugs.webkit.org/show_bug.cgi?id=132081
+
+ Reviewed by Dean Jackson.
+
+ * fast/multicol/newmulticol/compare-with-old-impl/hit-test-above-or-below-expected.txt: Added.
+ * fast/multicol/newmulticol/compare-with-old-impl/hit-test-above-or-below.html: Added.
+ * fast/multicol/newmulticol/compare-with-old-impl/hit-test-block-axis-flipped-expected.txt: Added.
+ * fast/multicol/newmulticol/compare-with-old-impl/hit-test-block-axis-flipped.html: Added.
+ * fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-expected.txt: Added.
+ * fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-with-line-height-expected.txt: Added.
+ * fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-with-line-height.html: Added.
+ * fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column.html: Added.
+ * fast/multicol/newmulticol/compare-with-old-impl/hit-test-float-expected.txt: Added.
+ * fast/multicol/newmulticol/compare-with-old-impl/hit-test-float.html: Added.
+ * fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-expected.txt: Added.
+ * fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-flipped-expected.txt: Added.
+ * fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-flipped.html: Added.
+ * fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages.html: Added.
+ * fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-block-axis-expected.txt: Added.
+ * fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-block-axis.html: Added.
+
2014-04-25 Tim Horton <[email protected]>
REGRESSION(r167799): ASSERTION in parseGridTemplateShorthand in fast/css-grid-layout/grid-template-shorthand-get-set.html
Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-above-or-below-expected.txt (0 => 167817)
--- trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-above-or-below-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-above-or-below-expected.txt 2014-04-25 20:20:48 UTC (rev 167817)
@@ -0,0 +1,19 @@
+123
+abc
+def
+ghi
+jkl
+mno
+Character at 150, 25 is 1 as expected.
+Character at 350, 25 is d as expected.
+Character at 550, 25 is j as expected.
+Character at 750, 25 is m as expected.
+Character at 150, 275 is d as expected.
+Character at 350, 275 is j as expected.
+Character at 550, 275 is m as expected.
+Character at 750, 275 is null as expected.
+Character at 150, 475 is d as expected.
+Character at 350, 475 is j as expected.
+Character at 550, 475 is m as expected.
+Character at 750, 475 is null as expected.
+
Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-above-or-below.html (0 => 167817)
--- trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-above-or-below.html (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-above-or-below.html 2014-04-25 20:20:48 UTC (rev 167817)
@@ -0,0 +1,53 @@
+<script>
+if (window.internals)
+ internals.settings.setRegionBasedColumnsEnabled(true);
+</script>
+<body style="margin: 0">
+<div style="margin: 50px; background-color: lightblue; width: 800px; height: 200px; -webkit-column-width:185px; -webkit-column-gap:15px; -webkit-column-fill:auto; column-width:185px; column-gap:15px; column-fill:auto; font-family: Ahem; font-size: 50px; line-height: 1;">
+ 123<div style="background-color: blue; height: 70px;"></div>abc<br>def<div style="background-color: blue; height: 60px;"></div>ghi<br>jkl<div style="background-color: blue; height: 110px;"></div>mno</div>
+<pre id="console" style="display: none;"></pre>
+<script>
+ function characterAtPoint(x, y)
+ {
+ var range = document.caretRangeFromPoint(x, y);
+ if (range.startContainer.nodeType !== Node.TEXT_NODE)
+ return null;
+ if (range.startOffset >= range.startContainer.length)
+ return null;
+ return range.startContainer.data[range.startOffset];
+ }
+
+ function log(message)
+ {
+ document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
+ }
+
+ function test(x, y, character)
+ {
+ var actualCharacter = characterAtPoint(x, y);
+ if (character === actualCharacter)
+ log ("Character at " + x + ", " + y + " is " + character + " as expected.");
+ else
+ log ("FAIL: Character at " + x + ", " + y + " is " + actualCharacter + ". Expected " + character + ".");
+ }
+
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ test(150, 25, "1");
+ test(350, 25, "d");
+ test(550, 25, "j");
+ test(750, 25, "m");
+
+ test(150, 275, "d");
+ test(350, 275, "j");
+ test(550, 275, "m");
+ test(750, 275, null);
+
+ test(150, 475, "d");
+ test(350, 475, "j");
+ test(550, 475, "m");
+ test(750, 475, null);
+
+ document.getElementById("console").style.display = "block";
+</script>
Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-block-axis-flipped-expected.txt (0 => 167817)
--- trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-block-axis-flipped-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-block-axis-flipped-expected.txt 2014-04-25 20:20:48 UTC (rev 167817)
@@ -0,0 +1 @@
+PASS
Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-block-axis-flipped.html (0 => 167817)
--- trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-block-axis-flipped.html (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-block-axis-flipped.html 2014-04-25 20:20:48 UTC (rev 167817)
@@ -0,0 +1,28 @@
+<script>
+if (window.internals)
+ internals.settings.setRegionBasedColumnsEnabled(true);
+</script>
+<div style="-webkit-writing-mode: horizontal-bt;">
+ <div style="
+ margin-top: 300px;
+ outline: dashed lightblue;
+ height: 100px;
+ width: 100px;
+ border-bottom: 25px solid;
+ -webkit-column-axis: vertical;
+ -webkit-column-gap: 50px;
+ ">
+ <div style="height: 100px; background-color: silver;"></div>
+ <div id="target" style="height: 100px; background-color: silver;"></div>
+ <div style="height: 100px; background-color: silver;"></div>
+ </div>
+</div>
+<p id="result">FAIL: Test did not run.</p>
+<script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ var hitContainer = document.caretRangeFromPoint(208, 208).startContainer;
+ var target = document.getElementById("target");
+ document.getElementById("result").innerText = hitContainer === target ? "PASS" : "FAIL";
+</script>
Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-expected.txt (0 => 167817)
--- trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-expected.txt 2014-04-25 20:20:48 UTC (rev 167817)
@@ -0,0 +1,2 @@
+Lorem ipsum dolor sit amet consectetur elit.
+PASS
Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-with-line-height-expected.txt (0 => 167817)
--- trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-with-line-height-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-with-line-height-expected.txt 2014-04-25 20:20:48 UTC (rev 167817)
@@ -0,0 +1,6 @@
+Lorem ipsum dolor sit amet
+PASS
+PASS
+PASS
+PASS
+
Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-with-line-height.html (0 => 167817)
--- trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-with-line-height.html (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-with-line-height.html 2014-04-25 20:20:48 UTC (rev 167817)
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<script>
+if (window.internals)
+ internals.settings.setRegionBasedColumnsEnabled(true);
+</script>
+<style>
+#foo:hover { color:red }
+</style>
+<div id="target" style="
+ outline: dashed lightblue;
+ -webkit-columns: 2;
+ -webkit-column-gap: 0;
+ -webkit-column-fill: auto;
+ columns: 2;
+ column-gap: 0;
+ column-fill: auto;
+ width: 400px;
+ height: 80px;
+ font: 20px ahem;
+ line-height: 2;
+">Lorem ipsum dolor sit <span id="foo">amet</span></div>
+<pre id="console"></pre>
+<script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ function log(message)
+ {
+ document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
+ }
+
+ // 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 + 190, target.offsetTop + 77).startOffset;
+ log(hitOffset === 11 ? "PASS" : "FAIL: hit offset " + hitOffset + ".");
+
+ // Clicking above the first line in the second column should not snap to the beginning of the line.
+ hitOffset = document.caretRangeFromPoint(target.offsetLeft + 250, target.offsetTop + 2).startOffset;
+ log(hitOffset === 14 ? "PASS" : "FAIL: hit offset " + hitOffset + ".");
+
+ // Now test with a flipped lines writing mode.
+ target.style.webkitWritingMode = "horizontal-bt";
+
+ // Clicking above the last line in the first column should not select anything from the first
+ // line on the second column.
+ hitOffset = document.caretRangeFromPoint(target.offsetLeft + 190, target.offsetTop + 3).startOffset;
+ log(hitOffset === 11 ? "PASS" : "FAIL: hit offset " + hitOffset + ".");
+
+ // Clicking below the first line in the second column should not snap to the beginning of the line.
+ hitOffset = document.caretRangeFromPoint(target.offsetLeft + 250, target.offsetTop + 78).startOffset;
+ log(hitOffset === 14 ? "PASS" : "FAIL: hit offset " + hitOffset + ".");
+</script>
Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column.html (0 => 167817)
--- trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column.html (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column.html 2014-04-25 20:20:48 UTC (rev 167817)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<script>
+if (window.internals)
+ internals.settings.setRegionBasedColumnsEnabled(true);
+</script>
+<div id="target" style="
+ outline: dashed lightblue;
+ width: 400px;
+ -webkit-columns: 2;
+ -webkit-column-gap: 0;
+ -webkit-column-fill: auto;
+ columns: 2;
+ column-gap: 0;
+ column-fill: auto;
+ 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.testRunner)
+ testRunner.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/newmulticol/compare-with-old-impl/hit-test-float-expected.txt (0 => 167817)
--- trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-float-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-float-expected.txt 2014-04-25 20:20:48 UTC (rev 167817)
@@ -0,0 +1,5 @@
+Test for https://bugs.webkit.org/show_bug.cgi?id=44730 Floats inside of multicol fail to hit test.
+
+The red square should turn green when hovered.
+
+PASS
Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-float.html (0 => 167817)
--- trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-float.html (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-float.html 2014-04-25 20:20:48 UTC (rev 167817)
@@ -0,0 +1,34 @@
+<script>
+if (window.internals)
+ internals.settings.setRegionBasedColumnsEnabled(true);
+</script><style>
+ #target { width: 50px; height: 50px; background-color: red; margin: 10px; }
+ #target:hover { background-color: green; }
+</style>
+<p>
+ Test for <i><a href=""
+ Floats inside of multicol fail to hit test</i>.
+</p>
+<p>
+ The red square should turn green when hovered.
+</p>
+<div style="-webkit-columns:2; -webkit-column-fill:auto; columns:2; column-fill:auto; margin: 100; width: 300; height: 200; outline: solid black;">
+ <div>
+ <div style="height: 250px; background-color: purple;"></div>
+ <div style="float: right; background-color: lightyellow; margin: 5px;">
+ <div id="target"></div>
+ </div>
+ </div>
+</div>
+<div id="result">FAIL: Test did not run.</div>
+<script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ var result = document.getElementById("result");
+ var hitElement = document.elementFromPoint(370, 250);
+ if (hitElement === document.getElementById("target"))
+ result.innerText = "PASS";
+ else
+ result.innerText = "FAIL: Hit " + hitElement;
+</script>
Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-expected.txt (0 => 167817)
--- trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-expected.txt 2014-04-25 20:20:48 UTC (rev 167817)
@@ -0,0 +1 @@
+PASS
Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-flipped-expected.txt (0 => 167817)
--- trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-flipped-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-flipped-expected.txt 2014-04-25 20:20:48 UTC (rev 167817)
@@ -0,0 +1 @@
+PASS
Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-flipped.html (0 => 167817)
--- trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-flipped.html (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-flipped.html 2014-04-25 20:20:48 UTC (rev 167817)
@@ -0,0 +1,21 @@
+<html>
+<script>
+if (window.internals)
+ internals.settings.setRegionBasedColumnsEnabled(true);
+</script>
+ <body style="margin: 0; -webkit-writing-mode: horizontal-bt;">
+ <div style="height: 50%;"></div>
+ <div style="height: 50%;"></div>
+ <div id="target" style="height: 50%;"></div>
+ <div style="height: 50%;"></div>
+ <div id="result">FAIL: Test did not run (DumpRenderTree or WebKitTestRunner needed)</div>
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ internals.setPagination("LeftToRightPaginated", 20, 100);
+ document.getElementById("result").innerText = document.caretRangeFromPoint(115, 550).startContainer === document.getElementById("target")
+ ? "PASS" : "FAIL";
+ }
+ </script>
+ </body>
+</html>
Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages.html (0 => 167817)
--- trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages.html (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages.html 2014-04-25 20:20:48 UTC (rev 167817)
@@ -0,0 +1,21 @@
+<html>
+<script>
+if (window.internals)
+ internals.settings.setRegionBasedColumnsEnabled(true);
+</script>
+ <body style="margin: 0;">
+ <div style="height: 50%;"></div>
+ <div style="height: 50%;"></div>
+ <div id="target" style="height: 50%;"></div>
+ <div style="height: 50%;"></div>
+ <div id="result">FAIL: Test did not run (DumpRenderTree or WebKitTestRunner needed)</div>
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ internals.setPagination("LeftToRightPaginated", 20, 100);
+ document.getElementById("result").innerText = document.caretRangeFromPoint(115, 50).startContainer === document.getElementById("target")
+ ? "PASS" : "FAIL";
+ }
+ </script>
+ </body>
+</html>
Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-block-axis-expected.txt (0 => 167817)
--- trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-block-axis-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-block-axis-expected.txt 2014-04-25 20:20:48 UTC (rev 167817)
@@ -0,0 +1,3 @@
+PASS
+
+Lorem ipsum dolor sit amet consectetur elit.
Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-block-axis.html (0 => 167817)
--- trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-block-axis.html (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-block-axis.html 2014-04-25 20:20:48 UTC (rev 167817)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<script>
+if (window.internals)
+ internals.settings.setRegionBasedColumnsEnabled(true);
+</script>
+
+<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.testRunner)
+ testRunner.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 (167816 => 167817)
--- trunk/Source/WebCore/ChangeLog 2014-04-25 19:45:06 UTC (rev 167816)
+++ trunk/Source/WebCore/ChangeLog 2014-04-25 20:20:48 UTC (rev 167817)
@@ -1,3 +1,34 @@
+2014-04-25 David Hyatt <[email protected]>
+
+ [New Multicolumn] fast/multicol/hit-test-* layout tests all fail
+ https://bugs.webkit.org/show_bug.cgi?id=132081
+
+ Reviewed by Dean Jackson.
+
+ Added a bunch of tests in fast/multicol/newmulticol/compare-with-old-impl/hit-test-*.html
+
+ * rendering/RenderBlock.h:
+ Make offsetForContents public, since I need to call it from RenderMultiColumnSet.
+
+ * rendering/RenderMultiColumnFlowThread.cpp:
+ (WebCore::RenderMultiColumnFlowThread::populate):
+ Stop an ASSERT in the new columns code on the hit tests by making sure layout state is
+ disabled when moving children around.
+
+ * rendering/RenderMultiColumnSet.cpp:
+ (WebCore::RenderMultiColumnSet::positionForPoint):
+ Refactor this function to call a helper function instead, translateRegionPointToFlowThread.
+
+ (WebCore::RenderMultiColumnSet::translateRegionPointToFlowThread):
+ This function is logical (unlike the mistaken physical function I first implemented in
+ positionForPoint).
+
+ (WebCore::RenderMultiColumnSet::updateHitTestResult):
+ * rendering/RenderMultiColumnSet.h:
+ Overridden to fill in the correct local coordinate when the HTML document is inside a paginated
+ RenderView. Note that column spans don't actually work, but once we move over to a
+ non-column based pagination API, that will become irrelevant.
+
2014-04-25 Andreas Kling <[email protected]>
Mark some things with WTF_MAKE_FAST_ALLOCATED.
Modified: trunk/Source/WebCore/rendering/RenderBlock.h (167816 => 167817)
--- trunk/Source/WebCore/rendering/RenderBlock.h 2014-04-25 19:45:06 UTC (rev 167816)
+++ trunk/Source/WebCore/rendering/RenderBlock.h 2014-04-25 20:20:48 UTC (rev 167817)
@@ -418,6 +418,9 @@
// FIXME: Can devirtualize once old column code is gone.
virtual void computeLineGridPaginationOrigin(LayoutState&) const;
+
+ // Adjust from painting offsets to the local coords of this renderer
+ void offsetForContents(LayoutPoint&) const;
protected:
virtual void addOverflowFromChildren();
@@ -568,9 +571,6 @@
virtual ColumnInfo::PaginationUnit paginationUnit() const;
protected:
- // Adjust from painting offsets to the local coords of this renderer
- void offsetForContents(LayoutPoint&) const;
-
virtual bool requiresColumns(int computedColumnCount) const;
bool updateLogicalWidthAndColumnWidth();
Modified: trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp (167816 => 167817)
--- trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp 2014-04-25 19:45:06 UTC (rev 167816)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp 2014-04-25 20:20:48 UTC (rev 167817)
@@ -155,6 +155,7 @@
// Reparent children preceding the flow thread into the flow thread. It's multicol content
// now. At this point there's obviously nothing after the flow thread, but renderers (column
// sets and spanners) will be inserted there as we insert elements into the flow thread.
+ LayoutStateDisabler layoutStateDisabler(&view());
multicolContainer->moveChildrenTo(this, multicolContainer->firstChild(), this, true);
}
Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp (167816 => 167817)
--- trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp 2014-04-25 19:45:06 UTC (rev 167816)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp 2014-04-25 20:20:48 UTC (rev 167817)
@@ -27,6 +27,7 @@
#include "RenderMultiColumnSet.h"
#include "FrameView.h"
+#include "HitTestResult.h"
#include "PaintInfo.h"
#include "RenderLayer.h"
#include "RenderMultiColumnFlowThread.h"
@@ -869,101 +870,105 @@
addVisualOverflow(lastRect);
}
-VisiblePosition RenderMultiColumnSet::positionForPoint(const LayoutPoint& physicalPoint, const RenderRegion*)
+VisiblePosition RenderMultiColumnSet::positionForPoint(const LayoutPoint& logicalPoint, const RenderRegion*)
{
+ return multiColumnFlowThread()->positionForPoint(translateRegionPointToFlowThread(logicalPoint, ClampHitTestTranslationToColumns), this);
+}
+
+LayoutPoint RenderMultiColumnSet::translateRegionPointToFlowThread(const LayoutPoint & logicalPoint, ColumnHitTestTranslationMode clampMode) const
+{
// Determine which columns we intersect.
LayoutUnit colGap = columnGap();
LayoutUnit halfColGap = colGap / 2;
- LayoutPoint columnPoint(columnRectAt(0).location());
- LayoutUnit logicalOffset = 0;
-
+
bool progressionIsInline = multiColumnFlowThread()->progressionIsInline();
- LayoutPoint point = physicalPoint;
+ LayoutPoint point = logicalPoint;
for (unsigned i = 0; i < columnCount(); i++) {
// Add in half the column gap to the left and right of the rect.
LayoutRect colRect = columnRectAt(i);
- flipForWritingMode(colRect);
if (isHorizontalWritingMode() == progressionIsInline) {
LayoutRect gapAndColumnRect(colRect.x() - halfColGap, colRect.y(), colRect.width() + colGap, colRect.height());
if (point.x() >= gapAndColumnRect.x() && point.x() < gapAndColumnRect.maxX()) {
- if (progressionIsInline) {
- // 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 (clampMode == ClampHitTestTranslationToColumns) {
+ if (progressionIsInline) {
+ // 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);
}
- } 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.
- if (progressionIsInline)
- point.move(columnPoint.x() - colRect.x(), (!style().isFlippedBlocksWritingMode() ? logicalOffset : -logicalOffset));
- else
- point.move((!style().isFlippedBlocksWritingMode() ? logicalOffset : -logicalOffset) - colRect.x() + borderLeft() + paddingLeft(), 0);
- LayoutRect portion = flowThreadPortionRect();
- flipForWritingMode(portion);
- point.move(isHorizontalWritingMode() ? LayoutUnit() : portion.x(), isHorizontalWritingMode() ? portion.y() : LayoutUnit());
- return multiColumnFlowThread()->positionForPoint(point, this);
+ LayoutSize offsetInColumn = point - colRect.location();
+ LayoutRect flowThreadPortion = flowThreadPortionRectAt(i);
+
+ return flowThreadPortion.location() + offsetInColumn;
}
-
- // Move to the next position.
- logicalOffset += progressionIsInline ? colRect.height() : colRect.width();
} else {
LayoutRect gapAndColumnRect(colRect.x(), colRect.y() - halfColGap, colRect.width(), colRect.height() + colGap);
if (point.y() >= gapAndColumnRect.y() && point.y() < gapAndColumnRect.maxY()) {
- if (progressionIsInline) {
- // 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 (clampMode == ClampHitTestTranslationToColumns) {
+ if (progressionIsInline) {
+ // 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);
}
- } 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.
- if (progressionIsInline)
- point.move((!style().isFlippedBlocksWritingMode() ? logicalOffset : -logicalOffset), columnPoint.y() - colRect.y());
- else
- point.move(0, (!style().isFlippedBlocksWritingMode() ? logicalOffset : -logicalOffset) - colRect.y() + borderTop() + paddingTop());
- LayoutRect portion = flowThreadPortionRect();
- flipForWritingMode(portion);
- point.move(isHorizontalWritingMode() ? LayoutUnit() : portion.x(), isHorizontalWritingMode() ? portion.y() : LayoutUnit());
-
- return multiColumnFlowThread()->positionForPoint(point, this);
+ LayoutSize offsetInColumn = point - colRect.location();
+ LayoutRect flowThreadPortion = flowThreadPortionRectAt(i);
+ return flowThreadPortion.location() + offsetInColumn;
}
-
- // Move to the next position.
- logicalOffset += progressionIsInline ? colRect.width() : colRect.height();
}
}
- return VisiblePosition();
+ return logicalPoint;
}
+void RenderMultiColumnSet::updateHitTestResult(HitTestResult& result, const LayoutPoint& point)
+{
+ if (result.innerNode() || !parent()->isRenderView())
+ return;
+
+ // Note this does not work with column spans, but once we implement RenderPageSet, we can move this code
+ // over there instead (and spans of course won't be allowed on pages).
+ Node* node = document().documentElement();
+ if (node) {
+ result.setInnerNode(node);
+ if (!result.innerNonSharedNode())
+ result.setInnerNonSharedNode(node);
+ LayoutPoint adjustedPoint = translateRegionPointToFlowThread(point);
+ view().offsetForContents(adjustedPoint);
+ result.setLocalPoint(adjustedPoint);
+ }
+}
+
const char* RenderMultiColumnSet::renderName() const
{
return "RenderMultiColumnSet";
Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.h (167816 => 167817)
--- trunk/Source/WebCore/rendering/RenderMultiColumnSet.h 2014-04-25 19:45:06 UTC (rev 167816)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnSet.h 2014-04-25 20:20:48 UTC (rev 167817)
@@ -119,6 +119,14 @@
void paintColumnRules(PaintInfo&, const LayoutPoint& paintOffset);
+ enum ColumnHitTestTranslationMode {
+ ClampHitTestTranslationToColumns,
+ DoNotClampHitTestTranslationToColumns
+ };
+ LayoutPoint translateRegionPointToFlowThread(const LayoutPoint & logicalPoint, ColumnHitTestTranslationMode = DoNotClampHitTestTranslationToColumns) const;
+
+ virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&) override;
+
protected:
void addOverflowFromChildren() override;