<!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>[163878] 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/163878">163878</a></dd>
<dt>Author</dt> <dd>hyatt@apple.com</dd>
<dt>Date</dt> <dd>2014-02-11 08:51:45 -0800 (Tue, 11 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[New Multicolumn] Make columns work with line grids
https://bugs.webkit.org/show_bug.cgi?id=128555

Reviewed by Antti Koivisto.

Added line-snap-into-columns.html and line-snap-inside-columns.html

Source/WebCore: 

* rendering/LayoutState.cpp:
(WebCore::LayoutState::LayoutState):
* rendering/LayoutState.h:
(WebCore::LayoutState::pageOffset):
(WebCore::LayoutState::setLineGridPaginationOrigin):
Change the LayoutState to call into the renderer to compute the line
grid pagination origin instead of doing it directly. Added the
appropriate getters and setters to enable the renderer to do this.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::computeLineGridPaginationOrigin):
 * rendering/RenderBlock.h:
An implementation for the old multi-column code. The logic is the
same with tweaks made now that the method is on the renderer instead.

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::pageLogicalTopForOffset):
Fix a bug with flow threads and pageLogicalTopForOffset. Normal CSS region-based
flow threads are never embedded in an enclosing pagination context, so they
didn't add in the firstPageLogicalTop (or subtract it when computing the region
hit). Multi-column flow threads do need to subtract out the firstPageLogicalTop,
since it can occur somewhere on the page.
        
Ultimately regions will need to get smarter here too if they want to work with
line grids, but for now I just fixed multi-column.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::isUnsplittableForPagination):
Undo this change, since it prevents the inheritance of line grids into the
multi-column layout.

* rendering/RenderMultiColumnFlowThread.cpp:
(WebCore::RenderMultiColumnFlowThread::computeLineGridPaginationOrigin):
* rendering/RenderMultiColumnFlowThread.h:
An implementation for the new multi-column code. The logic is the
same as the old code. Code duplication is ok, since the old multi-column method
in RenderBlock will just be deleted once the new code is turned on, and it's easier
not to intertwine them.

LayoutTests: 

* fast/multicol/newmulticol/line-grid-inside-columns-expected.html: Added.
* fast/multicol/newmulticol/line-grid-inside-columns.html: Added.
* fast/multicol/newmulticol/line-grid-into-columns-expected.html: Added.
* fast/multicol/newmulticol/line-grid-into-columns.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="#trunkSourceWebCorerenderingLayoutStatecpp">trunk/Source/WebCore/rendering/LayoutState.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingLayoutStateh">trunk/Source/WebCore/rendering/LayoutState.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockcpp">trunk/Source/WebCore/rendering/RenderBlock.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockh">trunk/Source/WebCore/rendering/RenderBlock.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockFlowcpp">trunk/Source/WebCore/rendering/RenderBlockFlow.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxcpp">trunk/Source/WebCore/rendering/RenderBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderMultiColumnFlowThreadcpp">trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderMultiColumnFlowThreadh">trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastmulticolnewmulticollinegridinsidecolumnsexpectedhtml">trunk/LayoutTests/fast/multicol/newmulticol/line-grid-inside-columns-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastmulticolnewmulticollinegridinsidecolumnshtml">trunk/LayoutTests/fast/multicol/newmulticol/line-grid-inside-columns.html</a></li>
<li><a href="#trunkLayoutTestsfastmulticolnewmulticollinegridintocolumnsexpectedhtml">trunk/LayoutTests/fast/multicol/newmulticol/line-grid-into-columns-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastmulticolnewmulticollinegridintocolumnshtml">trunk/LayoutTests/fast/multicol/newmulticol/line-grid-into-columns.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (163877 => 163878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-02-11 16:27:41 UTC (rev 163877)
+++ trunk/LayoutTests/ChangeLog        2014-02-11 16:51:45 UTC (rev 163878)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-02-10  David Hyatt  &lt;hyatt@apple.com&gt;
+
+        [New Multicolumn] Make columns work with line grids
+        https://bugs.webkit.org/show_bug.cgi?id=128555
+
+        Reviewed by Antti Koivisto.
+
+        Added line-snap-into-columns.html and line-snap-inside-columns.html
+
+        * fast/multicol/newmulticol/line-grid-inside-columns-expected.html: Added.
+        * fast/multicol/newmulticol/line-grid-inside-columns.html: Added.
+        * fast/multicol/newmulticol/line-grid-into-columns-expected.html: Added.
+        * fast/multicol/newmulticol/line-grid-into-columns.html: Added.
+
</ins><span class="cx"> 2014-02-11  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         IDB: storage/indexeddb/mozilla/cursor-update-updates-indexes.html ASSERTs
</span></span></pre></div>
<a id="trunkLayoutTestsfastmulticolnewmulticollinegridinsidecolumnsexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/multicol/newmulticol/line-grid-inside-columns-expected.html (0 => 163878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/multicol/newmulticol/line-grid-inside-columns-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/line-grid-inside-columns-expected.html        2014-02-11 16:51:45 UTC (rev 163878)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+.grid { -webkit-line-grid: simple; -webkit-line-snap: baseline; 
+        font-size:36px; }&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;div style=&quot;height:500px; border:2px solid red; -webkit-column-count:2; -webkit-column-fill:auto; column-count:2; column-fill:auto;&quot;&gt;
+&lt;div class=&quot;grid&quot;&gt;
+&lt;div style=&quot;font-size:16px&quot;&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+&lt;/div&gt;
+&lt;div style=&quot;font-size:24px&quot;&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+&lt;/div&gt;
+&lt;div style=&quot;font-size:10px&quot;&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+&lt;/div&gt;
+&lt;div style=&quot;font-size:18px&quot;&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+&lt;/div&gt;
+&lt;/div&gt;
+&lt;/div&gt;
+&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmulticolnewmulticollinegridinsidecolumnshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/multicol/newmulticol/line-grid-inside-columns.html (0 => 163878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/multicol/newmulticol/line-grid-inside-columns.html                                (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/line-grid-inside-columns.html        2014-02-11 16:51:45 UTC (rev 163878)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+.grid { -webkit-line-grid: simple; -webkit-line-snap: baseline; 
+        font-size:36px; }&lt;/style&gt;
+&lt;script&gt;
+internals.settings.setRegionBasedColumnsEnabled(true)
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;div style=&quot;height:500px; border:2px solid red; -webkit-column-count:2; -webkit-column-fill:auto; column-count:2; column-fill:auto;&quot;&gt;
+&lt;div class=&quot;grid&quot;&gt;
+&lt;div style=&quot;font-size:16px&quot;&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+&lt;/div&gt;
+&lt;div style=&quot;font-size:24px&quot;&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+&lt;/div&gt;
+&lt;div style=&quot;font-size:10px&quot;&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+&lt;/div&gt;
+&lt;div style=&quot;font-size:18px&quot;&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+&lt;/div&gt;
+&lt;/div&gt;
+&lt;/div&gt;
+&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmulticolnewmulticollinegridintocolumnsexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/multicol/newmulticol/line-grid-into-columns-expected.html (0 => 163878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/multicol/newmulticol/line-grid-into-columns-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/line-grid-into-columns-expected.html        2014-02-11 16:51:45 UTC (rev 163878)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+.grid { -webkit-line-grid: simple; -webkit-line-snap: baseline; 
+        font-size:36px; position:relative; width:800px}&lt;/style&gt;
+&lt;/head&gt;
+&lt;body style=&quot;margin:0&quot;&gt;
+
+&lt;div class=&quot;grid&quot;&gt;
+&lt;div style=&quot;position:absolute;left:0;right:0;top:0;bottom:0; font-family:'Ahem'; z-index:-1; color:lime; font-size:32px; white-space:nowrap; overflow:hidden&quot;&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+&lt;/div&gt;
+&lt;div style=&quot;height:500px; -webkit-column-count:2; -webkit-column-fill:auto; column-count:2; column-fill:auto; padding:20px&quot;&gt;
+&lt;div style=&quot;font-size:16px&quot;&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+&lt;/div&gt;
+&lt;div style=&quot;font-size:24px&quot;&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+&lt;/div&gt;
+&lt;div style=&quot;font-size:10px&quot;&gt;
+All of this text even though it's smaller should be on the 36px
+grid.
+&lt;/div&gt;
+&lt;/div&gt;
+&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmulticolnewmulticollinegridintocolumnshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/multicol/newmulticol/line-grid-into-columns.html (0 => 163878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/multicol/newmulticol/line-grid-into-columns.html                                (rev 0)
+++ trunk/LayoutTests/fast/multicol/newmulticol/line-grid-into-columns.html        2014-02-11 16:51:45 UTC (rev 163878)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+.grid { -webkit-line-grid: simple; -webkit-line-snap: baseline; 
+        font-size:36px; position:relative; width:800px}&lt;/style&gt;
+&lt;script&gt;
+internals.settings.setRegionBasedColumnsEnabled(true)
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body style=&quot;margin:0&quot;&gt;
+
+&lt;div class=&quot;grid&quot;&gt;
+&lt;div style=&quot;position:absolute;left:0;right:0;top:0;bottom:0; font-family:'Ahem'; z-index:-1; color:lime; font-size:32px; white-space:nowrap; overflow:hidden&quot;&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&lt;br&gt;
+&lt;/div&gt;
+&lt;div style=&quot;height:500px; -webkit-column-count:2; -webkit-column-fill:auto; column-count:2; column-fill:auto; padding:20px&quot;&gt;
+&lt;div style=&quot;font-size:16px&quot;&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+&lt;/div&gt;
+&lt;div style=&quot;font-size:24px&quot;&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+All of this text even though it's smaller should be on the 36px
+grid. The grid should reset at the top of the second column.&lt;br&gt;
+&lt;/div&gt;
+&lt;div style=&quot;font-size:10px&quot;&gt;
+All of this text even though it's smaller should be on the 36px
+grid.
+&lt;/div&gt;
+&lt;/div&gt;
+&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (163877 => 163878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-11 16:27:41 UTC (rev 163877)
+++ trunk/Source/WebCore/ChangeLog        2014-02-11 16:51:45 UTC (rev 163878)
</span><span class="lines">@@ -1,3 +1,51 @@
</span><ins>+2014-02-10  David Hyatt  &lt;hyatt@apple.com&gt;
+
+        [New Multicolumn] Make columns work with line grids
+        https://bugs.webkit.org/show_bug.cgi?id=128555
+
+        Reviewed by Antti Koivisto.
+
+        Added line-snap-into-columns.html and line-snap-inside-columns.html
+
+        * rendering/LayoutState.cpp:
+        (WebCore::LayoutState::LayoutState):
+        * rendering/LayoutState.h:
+        (WebCore::LayoutState::pageOffset):
+        (WebCore::LayoutState::setLineGridPaginationOrigin):
+        Change the LayoutState to call into the renderer to compute the line
+        grid pagination origin instead of doing it directly. Added the
+        appropriate getters and setters to enable the renderer to do this.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::computeLineGridPaginationOrigin):
+         * rendering/RenderBlock.h:
+        An implementation for the old multi-column code. The logic is the
+        same with tweaks made now that the method is on the renderer instead.
+
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::pageLogicalTopForOffset):
+        Fix a bug with flow threads and pageLogicalTopForOffset. Normal CSS region-based
+        flow threads are never embedded in an enclosing pagination context, so they
+        didn't add in the firstPageLogicalTop (or subtract it when computing the region
+        hit). Multi-column flow threads do need to subtract out the firstPageLogicalTop,
+        since it can occur somewhere on the page.
+        
+        Ultimately regions will need to get smarter here too if they want to work with
+        line grids, but for now I just fixed multi-column.
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::isUnsplittableForPagination):
+        Undo this change, since it prevents the inheritance of line grids into the
+        multi-column layout.
+
+        * rendering/RenderMultiColumnFlowThread.cpp:
+        (WebCore::RenderMultiColumnFlowThread::computeLineGridPaginationOrigin):
+        * rendering/RenderMultiColumnFlowThread.h:
+        An implementation for the new multi-column code. The logic is the
+        same as the old code. Code duplication is ok, since the old multi-column method
+        in RenderBlock will just be deleted once the new code is turned on, and it's easier
+        not to intertwine them.
+
</ins><span class="cx"> 2014-02-11  Radu Stavila  &lt;stavila@adobe.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CSS Regions] Overflow above the first region is not properly painted for regions with padding
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingLayoutStatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/LayoutState.cpp (163877 => 163878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/LayoutState.cpp        2014-02-11 16:27:41 UTC (rev 163877)
+++ trunk/Source/WebCore/rendering/LayoutState.cpp        2014-02-11 16:51:45 UTC (rev 163878)
</span><span class="lines">@@ -126,8 +126,8 @@
</span><span class="cx">     
</span><span class="cx">     m_isPaginated = m_pageLogicalHeight || m_columnInfo || renderer-&gt;isRenderFlowThread();
</span><span class="cx"> 
</span><del>-    if (lineGrid() &amp;&amp; renderer-&gt;hasColumns() &amp;&amp; renderer-&gt;style().hasInlineColumnAxis())
-        computeLineGridPaginationOrigin(renderer);
</del><ins>+    if (lineGrid() &amp;&amp; (lineGrid()-&gt;style().writingMode() == renderer-&gt;style().writingMode()) &amp;&amp; renderer-&gt;isRenderBlock())
+        toRenderBlock(renderer)-&gt;computeLineGridPaginationOrigin(*this);
</ins><span class="cx"> 
</span><span class="cx">     // If we have a new grid to track, then add it to our set.
</span><span class="cx">     if (renderer-&gt;style().lineGrid() != RenderStyle::initialLineGrid() &amp;&amp; renderer-&gt;isRenderBlockFlow())
</span><span class="lines">@@ -224,46 +224,4 @@
</span><span class="cx">     m_lineGridOffset = m_layoutOffset; 
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void LayoutState::computeLineGridPaginationOrigin(RenderBox* renderer)
-{
-    // We need to cache a line grid pagination origin so that we understand how to reset the line grid
-    // at the top of each column.
-    // Get the current line grid and offset.
-    if (!lineGrid() || lineGrid()-&gt;style().writingMode() != renderer-&gt;style().writingMode())
-        return;
-
-    // Get the hypothetical line box used to establish the grid.
-    RootInlineBox* lineGridBox = lineGrid()-&gt;lineGridBox();
-    if (!lineGridBox)
-        return;
-    
-    bool isHorizontalWritingMode = lineGrid()-&gt;isHorizontalWritingMode();
-
-    LayoutUnit lineGridBlockOffset = isHorizontalWritingMode ? lineGridOffset().height() : lineGridOffset().width();
-
-    // Now determine our position on the grid. Our baseline needs to be adjusted to the nearest baseline multiple
-    // as established by the line box.
-    // FIXME: Need to handle crazy line-box-contain values that cause the root line box to not be considered. I assume
-    // the grid should honor line-box-contain.
-    LayoutUnit gridLineHeight = lineGridBox-&gt;lineBottomWithLeading() - lineGridBox-&gt;lineTopWithLeading();
-    if (!gridLineHeight)
-        return;
-
-    LayoutUnit firstLineTopWithLeading = lineGridBlockOffset + lineGridBox-&gt;lineTopWithLeading();
-    
-    if (isPaginated() &amp;&amp; pageLogicalHeight()) {
-        LayoutUnit pageLogicalTop = renderer-&gt;isHorizontalWritingMode() ? m_pageOffset.height() : m_pageOffset.width();
-        if (pageLogicalTop &gt; firstLineTopWithLeading) {
-            // Shift to the next highest line grid multiple past the page logical top. Cache the delta
-            // between this new value and the page logical top as the pagination origin.
-            LayoutUnit remainder = roundToInt(pageLogicalTop - firstLineTopWithLeading) % roundToInt(gridLineHeight);
-            LayoutUnit paginationDelta = gridLineHeight - remainder;
-            if (isHorizontalWritingMode)
-                m_lineGridPaginationOrigin.setHeight(paginationDelta);
-            else
-                m_lineGridPaginationOrigin.setWidth(paginationDelta);
-        }
-    }
-}
-
</del><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingLayoutStateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/LayoutState.h (163877 => 163878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/LayoutState.h        2014-02-11 16:27:41 UTC (rev 163877)
+++ trunk/Source/WebCore/rendering/LayoutState.h        2014-02-11 16:51:45 UTC (rev 163878)
</span><span class="lines">@@ -86,6 +86,9 @@
</span><span class="cx"> 
</span><span class="cx">     LayoutSize layoutOffset() const { return m_layoutOffset; }
</span><span class="cx"> 
</span><ins>+    LayoutSize pageOffset() const { return m_pageOffset; }
+    void setLineGridPaginationOrigin(const LayoutSize&amp; origin) { m_lineGridPaginationOrigin = origin; }
+    
</ins><span class="cx">     bool needsBlockDirectionLocationSetBeforeLayout() const { return m_lineGrid || (m_isPaginated &amp;&amp; m_pageLogicalHeight); }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CSS_SHAPES) &amp;&amp; ENABLE(CSS_SHAPE_INSIDE)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (163877 => 163878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlock.cpp        2014-02-11 16:27:41 UTC (rev 163877)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp        2014-02-11 16:51:45 UTC (rev 163878)
</span><span class="lines">@@ -5310,6 +5310,52 @@
</span><span class="cx">     return newBox;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RenderBlock::computeLineGridPaginationOrigin(LayoutState&amp; layoutState) const
+{
+    if (!hasColumns() || !style().hasInlineColumnAxis())
+        return;
+    
+    // We need to cache a line grid pagination origin so that we understand how to reset the line grid
+    // at the top of each column.
+    // Get the current line grid and offset.
+    const auto lineGrid = layoutState.lineGrid();
+    if (!lineGrid)
+        return;
+
+    // Get the hypothetical line box used to establish the grid.
+    auto lineGridBox = lineGrid-&gt;lineGridBox();
+    if (!lineGridBox)
+        return;
+    
+    bool isHorizontalWritingMode = lineGrid-&gt;isHorizontalWritingMode();
+
+    LayoutUnit lineGridBlockOffset = isHorizontalWritingMode ? layoutState.lineGridOffset().height() : layoutState.lineGridOffset().width();
+
+    // Now determine our position on the grid. Our baseline needs to be adjusted to the nearest baseline multiple
+    // as established by the line box.
+    // FIXME: Need to handle crazy line-box-contain values that cause the root line box to not be considered. I assume
+    // the grid should honor line-box-contain.
+    LayoutUnit gridLineHeight = lineGridBox-&gt;lineBottomWithLeading() - lineGridBox-&gt;lineTopWithLeading();
+    if (!gridLineHeight)
+        return;
+
+    LayoutUnit firstLineTopWithLeading = lineGridBlockOffset + lineGridBox-&gt;lineTopWithLeading();
+    
+    if (layoutState.isPaginated() &amp;&amp; layoutState.pageLogicalHeight()) {
+        LayoutUnit pageLogicalTop = isHorizontalWritingMode ? layoutState.pageOffset().height() : layoutState.pageOffset().width();
+        if (pageLogicalTop &gt; firstLineTopWithLeading) {
+            // Shift to the next highest line grid multiple past the page logical top. Cache the delta
+            // between this new value and the page logical top as the pagination origin.
+            LayoutUnit remainder = roundToInt(pageLogicalTop - firstLineTopWithLeading) % roundToInt(gridLineHeight);
+            LayoutUnit paginationDelta = gridLineHeight - remainder;
+            if (isHorizontalWritingMode)
+                layoutState.setLineGridPaginationOrigin(LayoutSize(layoutState.lineGridPaginationOrigin().width(), paginationDelta));
+            else
+                layoutState.setLineGridPaginationOrigin(LayoutSize(paginationDelta, layoutState.lineGridPaginationOrigin().height()));
+        }
+    }
+}
+
</ins><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> void RenderBlock::checkPositionedObjectsNeedLayout()
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlock.h (163877 => 163878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlock.h        2014-02-11 16:27:41 UTC (rev 163877)
+++ trunk/Source/WebCore/rendering/RenderBlock.h        2014-02-11 16:51:45 UTC (rev 163878)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+class LayoutState;
</ins><span class="cx"> class LineLayoutState;
</span><span class="cx"> class LogicalSelectionOffsetCaches;
</span><span class="cx"> class RenderInline;
</span><span class="lines">@@ -426,6 +427,9 @@
</span><span class="cx">     bool isTopLayoutOverflowAllowed() const override;
</span><span class="cx">     bool isLeftLayoutOverflowAllowed() const override;
</span><span class="cx"> 
</span><ins>+    // FIXME: Can devirtualize once old column code is gone.
+    virtual void computeLineGridPaginationOrigin(LayoutState&amp;) const;
+
</ins><span class="cx"> protected:
</span><span class="cx">     virtual void addOverflowFromChildren();
</span><span class="cx">     // FIXME-BLOCKFLOW: Remove virtualization when all callers have moved to RenderBlockFlow
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockFlowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (163877 => 163878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp        2014-02-11 16:27:41 UTC (rev 163877)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp        2014-02-11 16:51:45 UTC (rev 163878)
</span><span class="lines">@@ -1772,7 +1772,7 @@
</span><span class="cx">             return 0;
</span><span class="cx">         return cumulativeOffset - roundToInt(cumulativeOffset - firstPageLogicalTop) % roundToInt(pageLogicalHeight);
</span><span class="cx">     }
</span><del>-    return flowThread-&gt;pageLogicalTopForOffset(cumulativeOffset);
</del><ins>+    return firstPageLogicalTop + flowThread-&gt;pageLogicalTopForOffset(cumulativeOffset - firstPageLogicalTop);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> LayoutUnit RenderBlockFlow::pageLogicalHeightForOffset(LayoutUnit offset) const
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (163877 => 163878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.cpp        2014-02-11 16:27:41 UTC (rev 163877)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp        2014-02-11 16:51:45 UTC (rev 163878)
</span><span class="lines">@@ -4408,10 +4408,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool RenderBox::isUnsplittableForPagination() const
</span><span class="cx"> {
</span><del>-    return isReplaced() || hasUnsplittableScrollingOverflow() || (parent() &amp;&amp; isWritingModeRoot())
-        // FIXME: Treat multi-column elements as unsplittable for now. Remove once we implement the correct
-        // fragmentation model for multicolumn.
-        || isMultiColumnBlockFlow();
</del><ins>+    return isReplaced() || hasUnsplittableScrollingOverflow() || (parent() &amp;&amp; isWritingModeRoot());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> LayoutUnit RenderBox::lineHeight(bool /*firstLine*/, LineDirectionMode direction, LinePositionMode /*linePositionMode*/) const
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderMultiColumnFlowThreadcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp (163877 => 163878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp        2014-02-11 16:27:41 UTC (rev 163877)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp        2014-02-11 16:51:45 UTC (rev 163878)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;RenderMultiColumnFlowThread.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;LayoutState.h&quot;
</ins><span class="cx"> #include &quot;RenderMultiColumnSet.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -126,4 +127,50 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RenderMultiColumnFlowThread::computeLineGridPaginationOrigin(LayoutState&amp; layoutState) const
+{
+    if (!progressionIsInline())
+        return;
+    
+    // We need to cache a line grid pagination origin so that we understand how to reset the line grid
+    // at the top of each column.
+    // Get the current line grid and offset.
+    const auto lineGrid = layoutState.lineGrid();
+    if (!lineGrid)
+        return;
+
+    // Get the hypothetical line box used to establish the grid.
+    auto lineGridBox = lineGrid-&gt;lineGridBox();
+    if (!lineGridBox)
+        return;
+    
+    bool isHorizontalWritingMode = lineGrid-&gt;isHorizontalWritingMode();
+
+    LayoutUnit lineGridBlockOffset = isHorizontalWritingMode ? layoutState.lineGridOffset().height() : layoutState.lineGridOffset().width();
+
+    // Now determine our position on the grid. Our baseline needs to be adjusted to the nearest baseline multiple
+    // as established by the line box.
+    // FIXME: Need to handle crazy line-box-contain values that cause the root line box to not be considered. I assume
+    // the grid should honor line-box-contain.
+    LayoutUnit gridLineHeight = lineGridBox-&gt;lineBottomWithLeading() - lineGridBox-&gt;lineTopWithLeading();
+    if (!gridLineHeight)
+        return;
+
+    LayoutUnit firstLineTopWithLeading = lineGridBlockOffset + lineGridBox-&gt;lineTopWithLeading();
+    
+    if (layoutState.isPaginated() &amp;&amp; layoutState.pageLogicalHeight()) {
+        LayoutUnit pageLogicalTop = isHorizontalWritingMode ? layoutState.pageOffset().height() : layoutState.pageOffset().width();
+        if (pageLogicalTop &gt; firstLineTopWithLeading) {
+            // Shift to the next highest line grid multiple past the page logical top. Cache the delta
+            // between this new value and the page logical top as the pagination origin.
+            LayoutUnit remainder = roundToInt(pageLogicalTop - firstLineTopWithLeading) % roundToInt(gridLineHeight);
+            LayoutUnit paginationDelta = gridLineHeight - remainder;
+            if (isHorizontalWritingMode)
+                layoutState.setLineGridPaginationOrigin(LayoutSize(layoutState.lineGridPaginationOrigin().width(), paginationDelta));
+            else
+                layoutState.setLineGridPaginationOrigin(LayoutSize(paginationDelta, layoutState.lineGridPaginationOrigin().height()));
+        }
+    }
</ins><span class="cx"> }
</span><ins>+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderMultiColumnFlowThreadh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.h (163877 => 163878)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.h        2014-02-11 16:27:41 UTC (rev 163877)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.h        2014-02-11 16:51:45 UTC (rev 163878)
</span><span class="lines">@@ -61,6 +61,8 @@
</span><span class="cx">     bool progressionIsReversed() const { return m_progressionIsReversed; }
</span><span class="cx">     void setProgressionIsReversed(bool reversed) { m_progressionIsReversed = reversed; }
</span><span class="cx">     
</span><ins>+    virtual void computeLineGridPaginationOrigin(LayoutState&amp;) const override;
+    
</ins><span class="cx"> private:
</span><span class="cx">     virtual const char* renderName() const override;
</span><span class="cx">     virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&amp;) const override;
</span></span></pre>
</div>
</div>

</body>
</html>