<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[167817] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/167817">167817</a></dd>
<dt>Author</dt> <dd>hyatt@apple.com</dd>
<dt>Date</dt> <dd>2014-04-25 13:20:48 -0700 (Fri, 25 Apr 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[New Multicolumn] fast/multicol/hit-test-* layout tests all fail
https://bugs.webkit.org/show_bug.cgi?id=132081

Reviewed by Dean Jackson.


Source/WebCore: 
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.

LayoutTests: 
* 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.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockh">trunk/Source/WebCore/rendering/RenderBlock.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderMultiColumnFlowThreadcpp">trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderMultiColumnSetcpp">trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderMultiColumnSeth">trunk/Source/WebCore/rendering/RenderMultiColumnSet.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestaboveorbelowexpectedtxt">trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-above-or-below-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestaboveorbelowhtml">trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-above-or-below.html</a></li>
<li><a href="#trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestblockaxisflippedexpectedtxt">trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-block-axis-flipped-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestblockaxisflippedhtml">trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-block-axis-flipped.html</a></li>
<li><a href="#trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestendofcolumnexpectedtxt">trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestendofcolumnwithlineheightexpectedtxt">trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-with-line-height-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestendofcolumnwithlineheighthtml">trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-with-line-height.html</a></li>
<li><a href="#trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestendofcolumnhtml">trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column.html</a></li>
<li><a href="#trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestfloatexpectedtxt">trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-float-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestfloathtml">trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-float.html</a></li>
<li><a href="#trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestgapbetweenpagesexpectedtxt">trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestgapbetweenpagesflippedexpectedtxt">trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-flipped-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestgapbetweenpagesflippedhtml">trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-flipped.html</a></li>
<li><a href="#trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestgapbetweenpageshtml">trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages.html</a></li>
<li><a href="#trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestgapblockaxisexpectedtxt">trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-block-axis-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestgapblockaxishtml">trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-block-axis.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (167816 => 167817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-04-25 19:45:06 UTC (rev 167816)
+++ trunk/LayoutTests/ChangeLog        2014-04-25 20:20:48 UTC (rev 167817)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2014-04-25  David Hyatt  &lt;hyatt@apple.com&gt;
+
+        [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.
+
</ins><span class="cx"> 2014-04-25  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r167799): ASSERTION in parseGridTemplateShorthand in fast/css-grid-layout/grid-template-shorthand-get-set.html
</span></span></pre></div>
<a id="trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestaboveorbelowexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-above-or-below-expected.txt (0 => 167817)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+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.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestaboveorbelowhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-above-or-below.html (0 => 167817)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+&lt;script&gt;
+if (window.internals)
+        internals.settings.setRegionBasedColumnsEnabled(true);
+&lt;/script&gt;
+&lt;body style=&quot;margin: 0&quot;&gt;
+&lt;div style=&quot;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;&quot;&gt;
+    123&lt;div style=&quot;background-color: blue; height: 70px;&quot;&gt;&lt;/div&gt;abc&lt;br&gt;def&lt;div style=&quot;background-color: blue; height: 60px;&quot;&gt;&lt;/div&gt;ghi&lt;br&gt;jkl&lt;div style=&quot;background-color: blue; height: 110px;&quot;&gt;&lt;/div&gt;mno&lt;/div&gt;
+&lt;pre id=&quot;console&quot; style=&quot;display: none;&quot;&gt;&lt;/pre&gt;
+&lt;script&gt;
+    function characterAtPoint(x, y)
+    {
+        var range = document.caretRangeFromPoint(x, y);
+        if (range.startContainer.nodeType !== Node.TEXT_NODE)
+            return null;
+        if (range.startOffset &gt;= range.startContainer.length)
+            return null;
+        return range.startContainer.data[range.startOffset];
+    }
+
+    function log(message)
+    {
+        document.getElementById(&quot;console&quot;).appendChild(document.createTextNode(message + &quot;\n&quot;));
+    }
+
+    function test(x, y, character)
+    {
+        var actualCharacter = characterAtPoint(x, y);
+        if (character === actualCharacter)
+            log (&quot;Character at &quot; + x + &quot;, &quot; + y + &quot; is &quot; + character + &quot; as expected.&quot;);
+        else
+            log (&quot;FAIL: Character at &quot; + x + &quot;, &quot; + y + &quot; is &quot; + actualCharacter + &quot;. Expected &quot; + character + &quot;.&quot;);
+    }
+
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    test(150, 25, &quot;1&quot;);
+    test(350, 25, &quot;d&quot;);
+    test(550, 25, &quot;j&quot;);
+    test(750, 25, &quot;m&quot;);
+
+    test(150, 275, &quot;d&quot;);
+    test(350, 275, &quot;j&quot;);
+    test(550, 275, &quot;m&quot;);
+    test(750, 275, null);
+
+    test(150, 475, &quot;d&quot;);
+    test(350, 475, &quot;j&quot;);
+    test(550, 475, &quot;m&quot;);
+    test(750, 475, null);
+
+    document.getElementById(&quot;console&quot;).style.display = &quot;block&quot;;
+&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestblockaxisflippedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-block-axis-flipped-expected.txt (0 => 167817)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestblockaxisflippedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-block-axis-flipped.html (0 => 167817)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+&lt;script&gt;
+if (window.internals)
+        internals.settings.setRegionBasedColumnsEnabled(true);
+&lt;/script&gt;
+&lt;div style=&quot;-webkit-writing-mode: horizontal-bt;&quot;&gt;
+    &lt;div style=&quot;
+        margin-top: 300px;
+        outline: dashed lightblue;
+        height: 100px;
+        width: 100px;
+        border-bottom: 25px solid;
+        -webkit-column-axis: vertical;
+        -webkit-column-gap: 50px;
+    &quot;&gt;
+        &lt;div style=&quot;height: 100px; background-color: silver;&quot;&gt;&lt;/div&gt;
+        &lt;div id=&quot;target&quot; style=&quot;height: 100px; background-color: silver;&quot;&gt;&lt;/div&gt;
+        &lt;div style=&quot;height: 100px; background-color: silver;&quot;&gt;&lt;/div&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+&lt;p id=&quot;result&quot;&gt;FAIL: Test did not run.&lt;/p&gt;
+&lt;script&gt;
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    var hitContainer = document.caretRangeFromPoint(208, 208).startContainer;
+    var target = document.getElementById(&quot;target&quot;);
+    document.getElementById(&quot;result&quot;).innerText = hitContainer === target ? &quot;PASS&quot; : &quot;FAIL&quot;;
+&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestendofcolumnexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-expected.txt (0 => 167817)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+Lorem ipsum dolor sit amet consectetur elit.
+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestendofcolumnwithlineheightexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-with-line-height-expected.txt (0 => 167817)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+Lorem ipsum dolor sit amet
+PASS
+PASS
+PASS
+PASS
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestendofcolumnwithlineheighthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-with-line-height.html (0 => 167817)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;script&gt;
+if (window.internals)
+        internals.settings.setRegionBasedColumnsEnabled(true);
+&lt;/script&gt;
+&lt;style&gt;
+#foo:hover { color:red }
+&lt;/style&gt;
+&lt;div id=&quot;target&quot; style=&quot;
+    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;
+&quot;&gt;Lorem ipsum dolor sit &lt;span id=&quot;foo&quot;&gt;amet&lt;/span&gt;&lt;/div&gt;
+&lt;pre id=&quot;console&quot;&gt;&lt;/pre&gt;
+&lt;script&gt;
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    function log(message)
+    {
+        document.getElementById(&quot;console&quot;).appendChild(document.createTextNode(message + &quot;\n&quot;));
+    }
+
+    // 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(&quot;target&quot;);
+    var hitOffset = document.caretRangeFromPoint(target.offsetLeft + 190, target.offsetTop + 77).startOffset;
+    log(hitOffset === 11 ? &quot;PASS&quot; : &quot;FAIL: hit offset &quot; + hitOffset + &quot;.&quot;);
+
+    // 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 ? &quot;PASS&quot; : &quot;FAIL: hit offset &quot; + hitOffset + &quot;.&quot;);
+
+    // Now test with a flipped lines writing mode.
+    target.style.webkitWritingMode = &quot;horizontal-bt&quot;;
+
+    // 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 ? &quot;PASS&quot; : &quot;FAIL: hit offset &quot; + hitOffset + &quot;.&quot;);
+
+    // 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 ? &quot;PASS&quot; : &quot;FAIL: hit offset &quot; + hitOffset + &quot;.&quot;);
+&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestendofcolumnhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column.html (0 => 167817)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;script&gt;
+if (window.internals)
+        internals.settings.setRegionBasedColumnsEnabled(true);
+&lt;/script&gt;
+&lt;div id=&quot;target&quot; style=&quot;
+    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;
+&quot;&gt;Lorem ipsum dolor sit amet consectetur elit.&lt;/div&gt;
+&lt;p id=&quot;result&quot;&gt;
+    FAIL: Test did not run.
+&lt;/p&gt;
+&lt;script&gt;
+    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(&quot;target&quot;);
+    var hitOffset = document.caretRangeFromPoint(target.offsetLeft + 45, target.offsetTop + 87).startOffset;
+    document.getElementById(&quot;result&quot;).innerText = hitOffset === 26 || hitOffset === 24 ? &quot;PASS&quot; : &quot;FAIL: hit offset &quot; + hitOffset + &quot;.&quot;;
+&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestfloatexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-float-expected.txt (0 => 167817)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+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
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestfloathtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-float.html (0 => 167817)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+&lt;script&gt;
+if (window.internals)
+        internals.settings.setRegionBasedColumnsEnabled(true);
+&lt;/script&gt;&lt;style&gt;
+    #target { width: 50px; height: 50px; background-color: red; margin: 10px; }
+    #target:hover { background-color: green; }
+&lt;/style&gt;
+&lt;p&gt;
+    Test for &lt;i&gt;&lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=44730&quot;&gt;https://bugs.webkit.org/show_bug.cgi?id=44730&lt;/a&gt;
+    Floats inside of multicol fail to hit test&lt;/i&gt;.
+&lt;/p&gt;
+&lt;p&gt;
+    The red square should turn green when hovered.
+&lt;/p&gt;
+&lt;div style=&quot;-webkit-columns:2; -webkit-column-fill:auto; columns:2; column-fill:auto; margin: 100; width: 300; height: 200; outline: solid black;&quot;&gt;
+    &lt;div&gt;
+        &lt;div style=&quot;height: 250px; background-color: purple;&quot;&gt;&lt;/div&gt;
+        &lt;div style=&quot;float: right; background-color: lightyellow; margin: 5px;&quot;&gt;
+            &lt;div id=&quot;target&quot;&gt;&lt;/div&gt;
+        &lt;/div&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+&lt;div id=&quot;result&quot;&gt;FAIL: Test did not run.&lt;/div&gt;
+&lt;script&gt;
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    var result = document.getElementById(&quot;result&quot;);
+    var hitElement = document.elementFromPoint(370, 250);
+    if (hitElement === document.getElementById(&quot;target&quot;))
+        result.innerText = &quot;PASS&quot;;
+    else
+        result.innerText = &quot;FAIL: Hit &quot; + hitElement;
+&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestgapbetweenpagesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-expected.txt (0 => 167817)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestgapbetweenpagesflippedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-flipped-expected.txt (0 => 167817)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+PASS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestgapbetweenpagesflippedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-flipped.html (0 => 167817)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+&lt;html&gt;
+&lt;script&gt;
+if (window.internals)
+        internals.settings.setRegionBasedColumnsEnabled(true);
+&lt;/script&gt;
+    &lt;body style=&quot;margin: 0; -webkit-writing-mode: horizontal-bt;&quot;&gt;
+        &lt;div style=&quot;height: 50%;&quot;&gt;&lt;/div&gt;
+        &lt;div style=&quot;height: 50%;&quot;&gt;&lt;/div&gt;
+        &lt;div id=&quot;target&quot; style=&quot;height: 50%;&quot;&gt;&lt;/div&gt;
+        &lt;div style=&quot;height: 50%;&quot;&gt;&lt;/div&gt;
+        &lt;div id=&quot;result&quot;&gt;FAIL: Test did not run (DumpRenderTree or WebKitTestRunner needed)&lt;/div&gt;
+        &lt;script&gt;
+            if (window.testRunner) {
+                testRunner.dumpAsText();
+                internals.setPagination(&quot;LeftToRightPaginated&quot;, 20, 100);
+                document.getElementById(&quot;result&quot;).innerText = document.caretRangeFromPoint(115, 550).startContainer === document.getElementById(&quot;target&quot;)
+                    ? &quot;PASS&quot; : &quot;FAIL&quot;;
+            }
+        &lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestgapbetweenpageshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages.html (0 => 167817)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+&lt;html&gt;
+&lt;script&gt;
+if (window.internals)
+        internals.settings.setRegionBasedColumnsEnabled(true);
+&lt;/script&gt;
+    &lt;body style=&quot;margin: 0;&quot;&gt;
+        &lt;div style=&quot;height: 50%;&quot;&gt;&lt;/div&gt;
+        &lt;div style=&quot;height: 50%;&quot;&gt;&lt;/div&gt;
+        &lt;div id=&quot;target&quot; style=&quot;height: 50%;&quot;&gt;&lt;/div&gt;
+        &lt;div style=&quot;height: 50%;&quot;&gt;&lt;/div&gt;
+        &lt;div id=&quot;result&quot;&gt;FAIL: Test did not run (DumpRenderTree or WebKitTestRunner needed)&lt;/div&gt;
+        &lt;script&gt;
+            if (window.testRunner) {
+                testRunner.dumpAsText();
+                internals.setPagination(&quot;LeftToRightPaginated&quot;, 20, 100);
+                document.getElementById(&quot;result&quot;).innerText = document.caretRangeFromPoint(115, 50).startContainer === document.getElementById(&quot;target&quot;)
+                    ? &quot;PASS&quot; : &quot;FAIL&quot;;
+            }
+        &lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestgapblockaxisexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-block-axis-expected.txt (0 => 167817)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+PASS
+
+Lorem ipsum dolor sit amet consectetur elit.
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmulticolnewmulticolcomparewitholdimplhittestgapblockaxishtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-block-axis.html (0 => 167817)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;script&gt;
+if (window.internals)
+        internals.settings.setRegionBasedColumnsEnabled(true);
+&lt;/script&gt;
+
+&lt;p id=&quot;result&quot;&gt;
+    FAIL: Test did not run.
+&lt;/p&gt;
+&lt;div id=&quot;target&quot; style=&quot;
+    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);
+&quot;&gt;Lorem ipsum dolor sit amet consectetur elit.&lt;/div&gt;
+&lt;script&gt;
+    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(&quot;target&quot;);
+    var hitOffset = document.caretRangeFromPoint(target.offsetLeft + 45, target.offsetTop + 115).startOffset;
+    document.getElementById(&quot;result&quot;).innerText = hitOffset === 26 || hitOffset === 24 ? &quot;PASS&quot; : &quot;FAIL: hit offset &quot; + hitOffset + &quot;.&quot;;
+&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (167816 => 167817)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2014-04-25  David Hyatt  &lt;hyatt@apple.com&gt;
+
+        [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.
+
</ins><span class="cx"> 2014-04-25  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Mark some things with WTF_MAKE_FAST_ALLOCATED.
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlock.h (167816 => 167817)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -418,6 +418,9 @@
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Can devirtualize once old column code is gone.
</span><span class="cx">     virtual void computeLineGridPaginationOrigin(LayoutState&amp;) const;
</span><ins>+    
+    // Adjust from painting offsets to the local coords of this renderer
+    void offsetForContents(LayoutPoint&amp;) const;
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     virtual void addOverflowFromChildren();
</span><span class="lines">@@ -568,9 +571,6 @@
</span><span class="cx">     virtual ColumnInfo::PaginationUnit paginationUnit() const;
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><del>-    // Adjust from painting offsets to the local coords of this renderer
-    void offsetForContents(LayoutPoint&amp;) const;
-
</del><span class="cx">     virtual bool requiresColumns(int computedColumnCount) const;
</span><span class="cx"> 
</span><span class="cx">     bool updateLogicalWidthAndColumnWidth();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderMultiColumnFlowThreadcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp (167816 => 167817)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -155,6 +155,7 @@
</span><span class="cx">     // Reparent children preceding the flow thread into the flow thread. It's multicol content
</span><span class="cx">     // now. At this point there's obviously nothing after the flow thread, but renderers (column
</span><span class="cx">     // sets and spanners) will be inserted there as we insert elements into the flow thread.
</span><ins>+    LayoutStateDisabler layoutStateDisabler(&amp;view());
</ins><span class="cx">     multicolContainer-&gt;moveChildrenTo(this, multicolContainer-&gt;firstChild(), this, true);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderMultiColumnSetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp (167816 => 167817)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #include &quot;RenderMultiColumnSet.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;FrameView.h&quot;
</span><ins>+#include &quot;HitTestResult.h&quot;
</ins><span class="cx"> #include &quot;PaintInfo.h&quot;
</span><span class="cx"> #include &quot;RenderLayer.h&quot;
</span><span class="cx"> #include &quot;RenderMultiColumnFlowThread.h&quot;
</span><span class="lines">@@ -869,101 +870,105 @@
</span><span class="cx">         addVisualOverflow(lastRect);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-VisiblePosition RenderMultiColumnSet::positionForPoint(const LayoutPoint&amp; physicalPoint, const RenderRegion*)
</del><ins>+VisiblePosition RenderMultiColumnSet::positionForPoint(const LayoutPoint&amp; logicalPoint, const RenderRegion*)
</ins><span class="cx"> {
</span><ins>+    return multiColumnFlowThread()-&gt;positionForPoint(translateRegionPointToFlowThread(logicalPoint, ClampHitTestTranslationToColumns), this);
+}
+
+LayoutPoint RenderMultiColumnSet::translateRegionPointToFlowThread(const LayoutPoint &amp; logicalPoint, ColumnHitTestTranslationMode clampMode) const
+{
</ins><span class="cx">     // Determine which columns we intersect.
</span><span class="cx">     LayoutUnit colGap = columnGap();
</span><span class="cx">     LayoutUnit halfColGap = colGap / 2;
</span><del>-    LayoutPoint columnPoint(columnRectAt(0).location());
-    LayoutUnit logicalOffset = 0;
-    
</del><ins>+
</ins><span class="cx">     bool progressionIsInline = multiColumnFlowThread()-&gt;progressionIsInline();
</span><span class="cx"> 
</span><del>-    LayoutPoint point = physicalPoint;
</del><ins>+    LayoutPoint point = logicalPoint;
</ins><span class="cx">     
</span><span class="cx">     for (unsigned i = 0; i &lt; columnCount(); i++) {
</span><span class="cx">         // Add in half the column gap to the left and right of the rect.
</span><span class="cx">         LayoutRect colRect = columnRectAt(i);
</span><del>-        flipForWritingMode(colRect);
</del><span class="cx">         if (isHorizontalWritingMode() == progressionIsInline) {
</span><span class="cx">             LayoutRect gapAndColumnRect(colRect.x() - halfColGap, colRect.y(), colRect.width() + colGap, colRect.height());
</span><span class="cx">             if (point.x() &gt;= gapAndColumnRect.x() &amp;&amp; point.x() &lt; gapAndColumnRect.maxX()) {
</span><del>-                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() &lt; 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() &gt;= gapAndColumnRect.maxY()) {
-                        point = gapAndColumnRect.location();
-                        point.move(0, gapAndColumnRect.height());
</del><ins>+                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() &lt; 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() &gt;= gapAndColumnRect.maxY()) {
+                            point = gapAndColumnRect.location();
+                            point.move(0, gapAndColumnRect.height());
+                        }
+                    } else {
+                        if (point.x() &lt; colRect.x())
+                            point.setX(colRect.x());
+                        else if (point.x() &gt;= colRect.maxX())
+                            point.setX(colRect.maxX() - 1);
</ins><span class="cx">                     }
</span><del>-                } else {
-                    if (point.x() &lt; colRect.x())
-                        point.setX(colRect.x());
-                    else if (point.x() &gt;= colRect.maxX())
-                        point.setX(colRect.maxX() - 1);
</del><span class="cx">                 }
</span><del>-
-                // 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);
</del><span class="cx">                 
</span><del>-                LayoutRect portion = flowThreadPortionRect();
-                flipForWritingMode(portion);
-                point.move(isHorizontalWritingMode() ? LayoutUnit() : portion.x(), isHorizontalWritingMode() ? portion.y() : LayoutUnit());
-                return multiColumnFlowThread()-&gt;positionForPoint(point, this);
</del><ins>+                LayoutSize offsetInColumn = point - colRect.location();
+                LayoutRect flowThreadPortion = flowThreadPortionRectAt(i);
+                
+                return flowThreadPortion.location() + offsetInColumn;
</ins><span class="cx">             }
</span><del>-
-            // Move to the next position.
-            logicalOffset += progressionIsInline ? colRect.height() : colRect.width();
</del><span class="cx">         } else {
</span><span class="cx">             LayoutRect gapAndColumnRect(colRect.x(), colRect.y() - halfColGap, colRect.width(), colRect.height() + colGap);
</span><span class="cx">             if (point.y() &gt;= gapAndColumnRect.y() &amp;&amp; point.y() &lt; gapAndColumnRect.maxY()) {
</span><del>-                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() &lt; 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() &gt;= gapAndColumnRect.maxX()) {
-                        point = gapAndColumnRect.location();
-                        point.move(gapAndColumnRect.width(), 0);
</del><ins>+                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() &lt; 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() &gt;= gapAndColumnRect.maxX()) {
+                            point = gapAndColumnRect.location();
+                            point.move(gapAndColumnRect.width(), 0);
+                        }
+                    } else {
+                        if (point.y() &lt; colRect.y())
+                            point.setY(colRect.y());
+                        else if (point.y() &gt;= colRect.maxY())
+                            point.setY(colRect.maxY() - 1);
</ins><span class="cx">                     }
</span><del>-                } else {
-                    if (point.y() &lt; colRect.y())
-                        point.setY(colRect.y());
-                    else if (point.y() &gt;= colRect.maxY())
-                        point.setY(colRect.maxY() - 1);
</del><span class="cx">                 }
</span><del>-
-                // 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());
</del><span class="cx">                 
</span><del>-                LayoutRect portion = flowThreadPortionRect();
-                flipForWritingMode(portion);
-                point.move(isHorizontalWritingMode() ? LayoutUnit() : portion.x(), isHorizontalWritingMode() ? portion.y() : LayoutUnit());
-                
-                return multiColumnFlowThread()-&gt;positionForPoint(point, this);
</del><ins>+                LayoutSize offsetInColumn = point - colRect.location();
+                LayoutRect flowThreadPortion = flowThreadPortionRectAt(i);
+                return flowThreadPortion.location() + offsetInColumn;
</ins><span class="cx">             }
</span><del>-
-            // Move to the next position.
-            logicalOffset += progressionIsInline ? colRect.width() : colRect.height();
</del><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return VisiblePosition();
</del><ins>+    return logicalPoint;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RenderMultiColumnSet::updateHitTestResult(HitTestResult&amp; result, const LayoutPoint&amp; point)
+{
+    if (result.innerNode() || !parent()-&gt;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);
+    }
+}
+
</ins><span class="cx"> const char* RenderMultiColumnSet::renderName() const
</span><span class="cx"> {    
</span><span class="cx">     return &quot;RenderMultiColumnSet&quot;;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderMultiColumnSeth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderMultiColumnSet.h (167816 => 167817)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -119,6 +119,14 @@
</span><span class="cx">     
</span><span class="cx">     void paintColumnRules(PaintInfo&amp;, const LayoutPoint&amp; paintOffset);
</span><span class="cx"> 
</span><ins>+    enum ColumnHitTestTranslationMode {
+        ClampHitTestTranslationToColumns,
+        DoNotClampHitTestTranslationToColumns
+    };
+    LayoutPoint translateRegionPointToFlowThread(const LayoutPoint &amp; logicalPoint, ColumnHitTestTranslationMode = DoNotClampHitTestTranslationToColumns) const;
+
+    virtual void updateHitTestResult(HitTestResult&amp;, const LayoutPoint&amp;) override;
+    
</ins><span class="cx"> protected:
</span><span class="cx">     void addOverflowFromChildren() override;
</span><span class="cx">     
</span></span></pre>
</div>
</div>

</body>
</html>