<!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>[164231] 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/164231">164231</a></dd>
<dt>Author</dt> <dd>stavila@adobe.com</dd>
<dt>Date</dt> <dd>2014-02-17 11:10:42 -0800 (Mon, 17 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[CSS Regions] The box decorations of an element overflowing a region should be clipped at the border box, not the content box
https://bugs.webkit.org/show_bug.cgi?id=128815

Reviewed by Andrei Bucur.

Source/WebCore:

Elements flowed into a region should not be painted past the region's content box
if they continue to flow into another region in that direction.
If they do not continue into another region in that direction, they should be
painted all the way to the region's border box.
Regions with overflow:hidden will apply clip at the border box, not the content box.

Tests: fast/regions/box-decorations-over-region-padding-fragmented.html
       fast/regions/box-decorations-over-region-padding-horiz-bt.html
       fast/regions/box-decorations-over-region-padding-vert-lr.html
       fast/regions/box-decorations-over-region-padding-vert-rl.html
       fast/regions/box-decorations-over-region-padding.html

* rendering/RenderNamedFlowFragment.cpp:
(WebCore::RenderNamedFlowFragment::flowThreadPortionRectForClipping):
* rendering/RenderNamedFlowFragment.h:
* rendering/RenderRegion.cpp:
(WebCore::RenderRegion::rectFlowPortionForBox):

LayoutTests:

Added tests for the painting of the borders of elements flowed into regions
over the region's padding area, for regions with overflow:hidden.
Tests were added for all writing modes.

* fast/regions/box-decorations-over-region-padding-expected.html: Added.
* fast/regions/box-decorations-over-region-padding-fragmented-expected.html: Added.
* fast/regions/box-decorations-over-region-padding-fragmented.html: Added.
* fast/regions/box-decorations-over-region-padding-horiz-bt-expected.html: Added.
* fast/regions/box-decorations-over-region-padding-horiz-bt.html: Added.
* fast/regions/box-decorations-over-region-padding-vert-lr-expected.html: Added.
* fast/regions/box-decorations-over-region-padding-vert-lr.html: Added.
* fast/regions/box-decorations-over-region-padding-vert-rl-expected.html: Added.
* fast/regions/box-decorations-over-region-padding-vert-rl.html: Added.
* fast/regions/box-decorations-over-region-padding.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="#trunkSourceWebCorerenderingRenderNamedFlowFragmentcpp">trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderNamedFlowFragmenth">trunk/Source/WebCore/rendering/RenderNamedFlowFragment.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderRegioncpp">trunk/Source/WebCore/rendering/RenderRegion.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastregionsboxdecorationsoverregionpaddingexpectedhtml">trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastregionsboxdecorationsoverregionpaddingfragmentedexpectedhtml">trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-fragmented-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastregionsboxdecorationsoverregionpaddingfragmentedhtml">trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-fragmented.html</a></li>
<li><a href="#trunkLayoutTestsfastregionsboxdecorationsoverregionpaddinghorizbtexpectedhtml">trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-horiz-bt-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastregionsboxdecorationsoverregionpaddinghorizbthtml">trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-horiz-bt.html</a></li>
<li><a href="#trunkLayoutTestsfastregionsboxdecorationsoverregionpaddingvertlrexpectedhtml">trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-vert-lr-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastregionsboxdecorationsoverregionpaddingvertlrhtml">trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-vert-lr.html</a></li>
<li><a href="#trunkLayoutTestsfastregionsboxdecorationsoverregionpaddingvertrlexpectedhtml">trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-vert-rl-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastregionsboxdecorationsoverregionpaddingvertrlhtml">trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-vert-rl.html</a></li>
<li><a href="#trunkLayoutTestsfastregionsboxdecorationsoverregionpaddinghtml">trunk/LayoutTests/fast/regions/box-decorations-over-region-padding.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (164230 => 164231)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-02-17 19:08:49 UTC (rev 164230)
+++ trunk/LayoutTests/ChangeLog        2014-02-17 19:10:42 UTC (rev 164231)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2014-02-17  Radu Stavila  &lt;stavila@adobe.com&gt;
+
+        [CSS Regions] The box decorations of an element overflowing a region should be clipped at the border box, not the content box
+        https://bugs.webkit.org/show_bug.cgi?id=128815
+
+        Reviewed by Andrei Bucur.
+
+        Added tests for the painting of the borders of elements flowed into regions
+        over the region's padding area, for regions with overflow:hidden.
+        Tests were added for all writing modes.
+
+        * fast/regions/box-decorations-over-region-padding-expected.html: Added.
+        * fast/regions/box-decorations-over-region-padding-fragmented-expected.html: Added.
+        * fast/regions/box-decorations-over-region-padding-fragmented.html: Added.
+        * fast/regions/box-decorations-over-region-padding-horiz-bt-expected.html: Added.
+        * fast/regions/box-decorations-over-region-padding-horiz-bt.html: Added.
+        * fast/regions/box-decorations-over-region-padding-vert-lr-expected.html: Added.
+        * fast/regions/box-decorations-over-region-padding-vert-lr.html: Added.
+        * fast/regions/box-decorations-over-region-padding-vert-rl-expected.html: Added.
+        * fast/regions/box-decorations-over-region-padding-vert-rl.html: Added.
+        * fast/regions/box-decorations-over-region-padding.html: Added.
+
</ins><span class="cx"> 2014-02-17  Brendan Long  &lt;b.long@cablelabs.com&gt;
</span><span class="cx"> 
</span><span class="cx">         DataCue.data should be a copy of the input ArrayBuffer, not a pointer
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionsboxdecorationsoverregionpaddingexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-expected.html (0 => 164231)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-expected.html        2014-02-17 19:10:42 UTC (rev 164231)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+        &lt;head&gt;
+                &lt;style&gt;
+                        .region {
+                                margin-top: 30px;
+                                width: 300px;
+                                height: 180px;
+                                border: 2px solid blue;
+                                padding: 22px 50px 40px 30px;
+                                overflow: hidden;
+                        }
+                        #innerDiv {
+                                margin-top: -20px;
+                                margin-left: -25px;
+                                border: solid 2px red;
+                                color: red;
+                                width: 340px;
+                                height: 220px;
+                        }
+                &lt;/style&gt;
+        &lt;/head&gt;
+        &lt;body&gt;
+                &lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=128815&quot;&gt;Bug 128815&lt;/a&gt;
+                &lt;p&gt;All borders of the &lt;span style=&quot;color:red&quot;&gt;content&lt;/span&gt; are over the padding area of the &lt;span style=&quot;color:blue&quot;&gt;region&lt;/span&gt;.&lt;br/&gt;All 4 borders should be visible.&lt;/p&gt;
+
+                &lt;div class=&quot;region&quot; id=&quot;region1&quot;&gt;
+                        &lt;div id=&quot;innerDiv&quot;&gt;
+                                Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Lorem Ipsum is simply dummy text of the printing and typesetting industry.
+                        &lt;/div&gt;
+                &lt;/div&gt;
+        &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionsboxdecorationsoverregionpaddingfragmentedexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-fragmented-expected.html (0 => 164231)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-fragmented-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-fragmented-expected.html        2014-02-17 19:10:42 UTC (rev 164231)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+        &lt;head&gt;
+                &lt;style&gt;
+                        .content {
+                                font-family: Ahem;
+                                border: solid 2px red;
+                                color: red;
+                        }
+                        #content1 {
+                                border-bottom: none;
+                                height: 180px;
+                        }
+                        #content2 {
+                                border-top: none;
+                        }
+
+                        .region {
+                                width: 250px;
+                                height: 182px;
+                                margin: 5px;
+                                border: 2px solid blue;
+                                padding: 22px 50px 40px 30px;
+                                overflow: hidden;
+                        }
+                        #region1 {
+                                float: left;
+                        }
+                        #region2 {
+                                float: right;
+                        }
+                &lt;/style&gt;
+        &lt;/head&gt;
+        &lt;body&gt;
+                &lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=128815&quot;&gt;Bug 128815&lt;/a&gt;
+                &lt;p&gt;The borders of the &lt;span style=&quot;color:red&quot;&gt;content&lt;/span&gt; are over the padding area of the &lt;span style=&quot;color:blue&quot;&gt;region&lt;/span&gt;.&lt;br/&gt;All 4 borders should be visible.&lt;/p&gt;
+
+                &lt;div class=&quot;region&quot; id=&quot;region1&quot;&gt;
+                        &lt;div class=&quot;content&quot; id=&quot;content1&quot;&gt;
+                                Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when 
+                        &lt;/div&gt;
+                &lt;/div&gt;
+
+                &lt;div class=&quot;region&quot; id=&quot;region2&quot;&gt;
+                        &lt;div class=&quot;content&quot; id=&quot;content2&quot;&gt;
+                                 an unknown printer took a galley of type and scrambled it to make a type specimen book.
+                        &lt;/div&gt;
+                &lt;/div&gt;
+        &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionsboxdecorationsoverregionpaddingfragmentedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-fragmented.html (0 => 164231)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-fragmented.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-fragmented.html        2014-02-17 19:10:42 UTC (rev 164231)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+        &lt;head&gt;
+                &lt;style&gt;
+                        .region {
+                                -webkit-flow-from: flow;
+                                width: 250px;
+                                height: 182px;
+                                margin: 5px;
+                                border: 2px solid blue;
+                                padding: 22px 50px 40px 30px;
+                                overflow: hidden;
+                        }
+                        #region1 {
+                                float: left;
+                        }
+                        #region2 {
+                                float: right;
+                        }
+                        #innerDiv {
+                                -webkit-flow-into: flow;
+                                font-family: Ahem;
+                                border: solid 2px red;
+                                color: red;
+                        }
+                &lt;/style&gt;
+        &lt;/head&gt;
+        &lt;body&gt;
+                &lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=128815&quot;&gt;Bug 128815&lt;/a&gt;
+                &lt;p&gt;The borders of the &lt;span style=&quot;color:red&quot;&gt;content&lt;/span&gt; are over the padding area of the &lt;span style=&quot;color:blue&quot;&gt;region&lt;/span&gt;.&lt;br/&gt;All 4 borders should be visible.&lt;/p&gt;
+
+                &lt;div id=&quot;innerDiv&quot;&gt;
+                        Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
+                &lt;/div&gt;
+
+                &lt;div class=&quot;region&quot; id=&quot;region1&quot;&gt;&lt;/div&gt;
+                &lt;div class=&quot;region&quot; id=&quot;region2&quot;&gt;&lt;/div&gt;
+        &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionsboxdecorationsoverregionpaddinghorizbtexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-horiz-bt-expected.html (0 => 164231)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-horiz-bt-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-horiz-bt-expected.html        2014-02-17 19:10:42 UTC (rev 164231)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+        &lt;head&gt;
+                &lt;style&gt;
+                        html {
+                                -webkit-writing-mode: horizontal-bt;
+                        }
+                        .region {
+                                margin-top: 30px;
+                                width: 300px;
+                                height: 180px;
+                                border: 2px solid blue;
+                                padding: 22px 100px 40px 30px;
+                                overflow: hidden;
+                        }
+                        #innerDiv {
+                                -webkit-font-smoothing: none;
+                                margin-bottom: -35px;
+                                margin-left: -15px;
+                                border: solid 2px red;
+                                color: red;
+                                width: 340px;
+                                height: 220px;
+                        }
+                &lt;/style&gt;
+        &lt;/head&gt;
+        &lt;body&gt;
+                &lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=128815&quot;&gt;Bug 128815&lt;/a&gt;
+                &lt;p&gt;All borders of the &lt;span style=&quot;color:red&quot;&gt;content&lt;/span&gt; are over the padding area of the &lt;span style=&quot;color:blue&quot;&gt;region&lt;/span&gt;.&lt;br/&gt;All 4 borders should be visible.&lt;/p&gt;
+
+                &lt;div class=&quot;region&quot; id=&quot;region1&quot;&gt;
+                        &lt;div id=&quot;innerDiv&quot;&gt;
+                                Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Lorem Ipsum is simply dummy text of the printing and typesetting industry.
+                        &lt;/div&gt;
+                &lt;/div&gt;
+        &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionsboxdecorationsoverregionpaddinghorizbthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-horiz-bt.html (0 => 164231)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-horiz-bt.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-horiz-bt.html        2014-02-17 19:10:42 UTC (rev 164231)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+        &lt;head&gt;
+                &lt;style&gt;
+                        html {
+                                -webkit-writing-mode: horizontal-bt;
+                        }
+                        .region {
+                                margin-top: 30px;
+                                -webkit-flow-from: flow;
+                                width: 300px;
+                                height: 180px;
+                                border: 2px solid blue;
+                                padding: 22px 100px 40px 30px;
+                                overflow: hidden;
+                        }
+                        #innerDiv {
+                                -webkit-flow-into: flow;
+                                -webkit-font-smoothing: none;
+                                margin-bottom: -35px;
+                                margin-left: -15px;
+                                border: solid 2px red;
+                                color: red;
+                                width: 340px;
+                                height: 220px;
+                        }
+                &lt;/style&gt;
+        &lt;/head&gt;
+        &lt;body&gt;
+                &lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=128815&quot;&gt;Bug 128815&lt;/a&gt;
+                &lt;p&gt;All borders of the &lt;span style=&quot;color:red&quot;&gt;content&lt;/span&gt; are over the padding area of the &lt;span style=&quot;color:blue&quot;&gt;region&lt;/span&gt;.&lt;br/&gt;All 4 borders should be visible.&lt;/p&gt;
+
+                &lt;div id=&quot;innerDiv&quot;&gt;
+                        Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Lorem Ipsum is simply dummy text of the printing and typesetting industry.
+                &lt;/div&gt;
+
+                &lt;div class=&quot;region&quot; id=&quot;region1&quot;&gt;&lt;/div&gt;
+        &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionsboxdecorationsoverregionpaddingvertlrexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-vert-lr-expected.html (0 => 164231)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-vert-lr-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-vert-lr-expected.html        2014-02-17 19:10:42 UTC (rev 164231)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+        &lt;head&gt;
+                &lt;style&gt;
+                        html {
+                                -webkit-writing-mode: vertical-lr;
+                        }
+                        .region {
+                                margin-top: 30px;
+                                width: 300px;
+                                height: 180px;
+                                border: 2px solid blue;
+                                padding: 22px 100px 40px 30px;
+                                overflow: hidden;
+                        }
+                        #innerDiv {
+                                -webkit-font-smoothing: none;
+                                margin-top: -15px;
+                                margin-left: -15px;
+                                border: solid 2px red;
+                                color: red;
+                                width: 340px;
+                                height: 220px;
+                        }
+                &lt;/style&gt;
+        &lt;/head&gt;
+        &lt;body&gt;
+                &lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=128815&quot;&gt;Bug 128815&lt;/a&gt;
+                &lt;p&gt;All borders of the &lt;span style=&quot;color:red&quot;&gt;content&lt;/span&gt; are over the padding area of the &lt;span style=&quot;color:blue&quot;&gt;region&lt;/span&gt;.&lt;br/&gt;All 4 borders should be visible.&lt;/p&gt;
+
+                &lt;div class=&quot;region&quot; id=&quot;region1&quot;&gt;
+                        &lt;div id=&quot;innerDiv&quot;&gt;
+                                Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Lorem Ipsum is simply dummy text of the printing and typesetting industry.
+                        &lt;/div&gt;
+                &lt;/div&gt;
+        &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionsboxdecorationsoverregionpaddingvertlrhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-vert-lr.html (0 => 164231)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-vert-lr.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-vert-lr.html        2014-02-17 19:10:42 UTC (rev 164231)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+        &lt;head&gt;
+                &lt;style&gt;
+                        html {
+                                -webkit-writing-mode: vertical-lr;
+                        }
+                        .region {
+                                margin-top: 30px;
+                                -webkit-flow-from: flow;
+                                width: 300px;
+                                height: 180px;
+                                border: 2px solid blue;
+                                padding: 22px 100px 40px 30px;
+                                overflow: hidden;
+                        }
+                        #innerDiv {
+                                -webkit-flow-into: flow;
+                                -webkit-font-smoothing: none;
+                                margin-top: -15px;
+                                margin-left: -15px;
+                                border: solid 2px red;
+                                color: red;
+                                width: 340px;
+                                height: 220px;
+                        }
+                &lt;/style&gt;
+        &lt;/head&gt;
+        &lt;body&gt;
+                &lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=128815&quot;&gt;Bug 128815&lt;/a&gt;
+                &lt;p&gt;All borders of the &lt;span style=&quot;color:red&quot;&gt;content&lt;/span&gt; are over the padding area of the &lt;span style=&quot;color:blue&quot;&gt;region&lt;/span&gt;.&lt;br/&gt;All 4 borders should be visible.&lt;/p&gt;
+
+                &lt;div id=&quot;innerDiv&quot;&gt;
+                        Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Lorem Ipsum is simply dummy text of the printing and typesetting industry.
+                &lt;/div&gt;
+
+                &lt;div class=&quot;region&quot; id=&quot;region1&quot;&gt;&lt;/div&gt;
+        &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionsboxdecorationsoverregionpaddingvertrlexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-vert-rl-expected.html (0 => 164231)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-vert-rl-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-vert-rl-expected.html        2014-02-17 19:10:42 UTC (rev 164231)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+        &lt;head&gt;
+                &lt;style&gt;
+                        html {
+                                -webkit-writing-mode: vertical-rl;
+                        }
+                        .region {
+                                margin-top: 30px;
+                                width: 300px;
+                                height: 180px;
+                                border: 2px solid blue;
+                                padding: 22px 50px 40px 30px;
+                                overflow: hidden;
+                        }
+                        #innerDiv {
+                                -webkit-font-smoothing: none;
+                                margin-top: -15px;
+                                margin-right: -15px;
+                                border: solid 2px red;
+                                color: red;
+                                width: 340px;
+                                height: 220px;
+                        }
+                &lt;/style&gt;
+        &lt;/head&gt;
+        &lt;body&gt;
+                &lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=128815&quot;&gt;Bug 128815&lt;/a&gt;
+                &lt;p&gt;All borders of the &lt;span style=&quot;color:red&quot;&gt;content&lt;/span&gt; are over the padding area of the &lt;span style=&quot;color:blue&quot;&gt;region&lt;/span&gt;.&lt;br/&gt;All 4 borders should be visible.&lt;/p&gt;
+
+                &lt;div class=&quot;region&quot; id=&quot;region1&quot;&gt;
+                        &lt;div id=&quot;innerDiv&quot;&gt;
+                                Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Lorem Ipsum is simply dummy text of the printing and typesetting industry.
+                        &lt;/div&gt;
+                &lt;/div&gt;
+        &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionsboxdecorationsoverregionpaddingvertrlhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-vert-rl.html (0 => 164231)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-vert-rl.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-vert-rl.html        2014-02-17 19:10:42 UTC (rev 164231)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+        &lt;head&gt;
+                &lt;style&gt;
+                        html {
+                                -webkit-writing-mode: vertical-rl;
+                        }
+                        .region {
+                                margin-top: 30px;
+                                -webkit-flow-from: flow;
+                                width: 300px;
+                                height: 180px;
+                                border: 2px solid blue;
+                                padding: 22px 50px 40px 30px;
+                                overflow: hidden;
+                        }
+                        #innerDiv {
+                                -webkit-flow-into: flow;
+                                -webkit-font-smoothing: none;
+                                margin-top: -15px;
+                                margin-right: -15px;
+                                border: solid 2px red;
+                                color: red;
+                                width: 340px;
+                                height: 220px;
+                        }
+                &lt;/style&gt;
+        &lt;/head&gt;
+        &lt;body&gt;
+                &lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=128815&quot;&gt;Bug 128815&lt;/a&gt;
+                &lt;p&gt;All borders of the &lt;span style=&quot;color:red&quot;&gt;content&lt;/span&gt; are over the padding area of the &lt;span style=&quot;color:blue&quot;&gt;region&lt;/span&gt;.&lt;br/&gt;All 4 borders should be visible.&lt;/p&gt;
+
+                &lt;div id=&quot;innerDiv&quot;&gt;
+                        Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Lorem Ipsum is simply dummy text of the printing and typesetting industry.
+                &lt;/div&gt;
+
+                &lt;div class=&quot;region&quot; id=&quot;region1&quot;&gt;&lt;/div&gt;
+        &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfastregionsboxdecorationsoverregionpaddinghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/regions/box-decorations-over-region-padding.html (0 => 164231)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/regions/box-decorations-over-region-padding.html                                (rev 0)
+++ trunk/LayoutTests/fast/regions/box-decorations-over-region-padding.html        2014-02-17 19:10:42 UTC (rev 164231)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+        &lt;head&gt;
+                &lt;style&gt;
+                        .region {
+                                margin-top: 30px;
+                                -webkit-flow-from: flow;
+                                width: 300px;
+                                height: 180px;
+                                border: 2px solid blue;
+                                padding: 22px 50px 40px 30px;
+                                overflow: hidden;
+                        }
+                        #innerDiv {
+                                -webkit-flow-into: flow;
+                                margin-top: -20px;
+                                margin-left: -25px;
+                                border: solid 2px red;
+                                color: red;
+                                width: 340px;
+                                height: 220px;
+                        }
+                &lt;/style&gt;
+        &lt;/head&gt;
+        &lt;body&gt;
+                &lt;a href=&quot;https://bugs.webkit.org/show_bug.cgi?id=128815&quot;&gt;Bug 128815&lt;/a&gt;
+                &lt;p&gt;All borders of the &lt;span style=&quot;color:red&quot;&gt;content&lt;/span&gt; are over the padding area of the &lt;span style=&quot;color:blue&quot;&gt;region&lt;/span&gt;.&lt;br/&gt;All 4 borders should be visible.&lt;/p&gt;
+
+                &lt;div id=&quot;innerDiv&quot;&gt;
+                        Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Lorem Ipsum is simply dummy text of the printing and typesetting industry.
+                &lt;/div&gt;
+
+                &lt;div class=&quot;region&quot; id=&quot;region1&quot;&gt;&lt;/div&gt;
+        &lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (164230 => 164231)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-17 19:08:49 UTC (rev 164230)
+++ trunk/Source/WebCore/ChangeLog        2014-02-17 19:10:42 UTC (rev 164231)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2014-02-17  Radu Stavila  &lt;stavila@adobe.com&gt;
+
+        [CSS Regions] The box decorations of an element overflowing a region should be clipped at the border box, not the content box
+        https://bugs.webkit.org/show_bug.cgi?id=128815
+
+        Reviewed by Andrei Bucur.
+
+        Elements flowed into a region should not be painted past the region's content box
+        if they continue to flow into another region in that direction.
+        If they do not continue into another region in that direction, they should be
+        painted all the way to the region's border box.
+        Regions with overflow:hidden will apply clip at the border box, not the content box.
+
+        Tests: fast/regions/box-decorations-over-region-padding-fragmented.html
+               fast/regions/box-decorations-over-region-padding-horiz-bt.html
+               fast/regions/box-decorations-over-region-padding-vert-lr.html
+               fast/regions/box-decorations-over-region-padding-vert-rl.html
+               fast/regions/box-decorations-over-region-padding.html
+
+        * rendering/RenderNamedFlowFragment.cpp:
+        (WebCore::RenderNamedFlowFragment::flowThreadPortionRectForClipping):
+        * rendering/RenderNamedFlowFragment.h:
+        * rendering/RenderRegion.cpp:
+        (WebCore::RenderRegion::rectFlowPortionForBox):
+
</ins><span class="cx"> 2014-02-17  Brendan Long  &lt;b.long@cablelabs.com&gt;
</span><span class="cx"> 
</span><span class="cx">         DataCue.data should be a copy of the input ArrayBuffer, not a pointer
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderNamedFlowFragmentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp (164230 => 164231)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp        2014-02-17 19:08:49 UTC (rev 164230)
+++ trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp        2014-02-17 19:10:42 UTC (rev 164231)
</span><span class="lines">@@ -188,6 +188,45 @@
</span><span class="cx">     return styleToUse.logicalMaxHeight().isUndefined() ? RenderFlowThread::maxLogicalHeight() : toRenderBlock(parent())-&gt;computeReplacedLogicalHeightUsing(styleToUse.logicalMaxHeight());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+LayoutRect RenderNamedFlowFragment::flowThreadPortionRectForClipping(bool isFirstRegionInRange, bool isLastRegionInRange) const
+{
+    // Elements flowed into a region should not be painted past the region's content box
+    // if they continue to flow into another region in that direction.
+    // If they do not continue into another region in that direction, they should be
+    // painted all the way to the region's border box.
+    // Regions with overflow:hidden will apply clip at the border box, not the content box.
+    
+    LayoutRect clippingRect = flowThreadPortionRect();
+    if (regionContainer()-&gt;style().hasPadding()) {
+        if (isFirstRegionInRange) {
+            if (flowThread()-&gt;isHorizontalWritingMode()) {
+                clippingRect.move(0, -regionContainer()-&gt;paddingBefore());
+                clippingRect.expand(0, regionContainer()-&gt;paddingBefore());
+            } else {
+                clippingRect.move(-regionContainer()-&gt;paddingBefore(), 0);
+                clippingRect.expand(regionContainer()-&gt;paddingBefore(), 0);
+            }
+        }
+        
+        if (isLastRegionInRange) {
+            if (flowThread()-&gt;isHorizontalWritingMode())
+                clippingRect.expand(0, regionContainer()-&gt;paddingAfter());
+            else
+                clippingRect.expand(regionContainer()-&gt;paddingAfter(), 0);
+        }
+        
+        if (flowThread()-&gt;isHorizontalWritingMode()) {
+            clippingRect.move(-regionContainer()-&gt;paddingStart(), 0);
+            clippingRect.expand(regionContainer()-&gt;paddingStart() + regionContainer()-&gt;paddingEnd(), 0);
+        } else {
+            clippingRect.move(0, -regionContainer()-&gt;paddingStart());
+            clippingRect.expand(0, regionContainer()-&gt;paddingStart() + regionContainer()-&gt;paddingEnd());
+        }
+    }
+    
+    return clippingRect;
+}
+
</ins><span class="cx"> void RenderNamedFlowFragment::layoutBlock(bool relayoutChildren, LayoutUnit)
</span><span class="cx"> {
</span><span class="cx">     StackStats::LayoutCheckPoint layoutCheckPoint;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderNamedFlowFragmenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderNamedFlowFragment.h (164230 => 164231)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderNamedFlowFragment.h        2014-02-17 19:08:49 UTC (rev 164230)
+++ trunk/Source/WebCore/rendering/RenderNamedFlowFragment.h        2014-02-17 19:10:42 UTC (rev 164231)
</span><span class="lines">@@ -59,6 +59,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual LayoutUnit pageLogicalHeight() const;
</span><span class="cx">     LayoutUnit maxPageLogicalHeight() const;
</span><ins>+    
+    LayoutRect flowThreadPortionRectForClipping(bool isFirstRegionInRange, bool isLastRegionInRange) const;
</ins><span class="cx"> 
</span><span class="cx">     bool isPseudoElementRegion() const { return parent() &amp;&amp; parent()-&gt;isPseudoElement(); }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderRegioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderRegion.cpp (164230 => 164231)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderRegion.cpp        2014-02-17 19:08:49 UTC (rev 164230)
+++ trunk/Source/WebCore/rendering/RenderRegion.cpp        2014-02-17 19:10:42 UTC (rev 164231)
</span><span class="lines">@@ -521,8 +521,15 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     bool isLastRegionWithRegionFragmentBreak = (isLastRegion() &amp;&amp; (style().regionFragment() == BreakRegionFragment));
</span><del>-    if (hasOverflowClip() || isLastRegionWithRegionFragmentBreak)
-        mappedRect.intersect(flowThreadPortionRect());
</del><ins>+    if (hasOverflowClip() || isLastRegionWithRegionFragmentBreak) {
+        LayoutRect portionRect;
+        if (isRenderNamedFlowFragment())
+            portionRect = toRenderNamedFlowFragment(this)-&gt;flowThreadPortionRectForClipping(this == startRegion, this == endRegion);
+        else
+            portionRect = flowThreadPortionRect();
+        
+        mappedRect.intersect(portionRect);
+    }
</ins><span class="cx"> 
</span><span class="cx">     return mappedRect.isEmpty() ? mappedRect : m_flowThread-&gt;mapFromFlowThreadToLocal(box, mappedRect);
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>