Title: [164231] trunk
Revision
164231
Author
stav...@adobe.com
Date
2014-02-17 11:10:42 -0800 (Mon, 17 Feb 2014)

Log Message

[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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (164230 => 164231)


--- trunk/LayoutTests/ChangeLog	2014-02-17 19:08:49 UTC (rev 164230)
+++ trunk/LayoutTests/ChangeLog	2014-02-17 19:10:42 UTC (rev 164231)
@@ -1,3 +1,25 @@
+2014-02-17  Radu Stavila  <stav...@adobe.com>
+
+        [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.
+
 2014-02-17  Brendan Long  <b.l...@cablelabs.com>
 
         DataCue.data should be a copy of the input ArrayBuffer, not a pointer

Added: trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-expected.html (0 => 164231)


--- 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)
@@ -0,0 +1,33 @@
+<!doctype html>
+<html>
+	<head>
+		<style>
+			.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;
+			}
+		</style>
+	</head>
+	<body>
+		<a href="" 128815</a>
+		<p>All borders of the <span style="color:red">content</span> are over the padding area of the <span style="color:blue">region</span>.<br/>All 4 borders should be visible.</p>
+
+		<div class="region" id="region1">
+			<div id="innerDiv">
+				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.
+			</div>
+		</div>
+	</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-fragmented-expected.html (0 => 164231)


--- 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)
@@ -0,0 +1,50 @@
+<!doctype html>
+<html>
+	<head>
+		<style>
+			.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;
+			}
+		</style>
+	</head>
+	<body>
+		<a href="" 128815</a>
+		<p>The borders of the <span style="color:red">content</span> are over the padding area of the <span style="color:blue">region</span>.<br/>All 4 borders should be visible.</p>
+
+		<div class="region" id="region1">
+			<div class="content" id="content1">
+				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 
+			</div>
+		</div>
+
+		<div class="region" id="region2">
+			<div class="content" id="content2">
+				 an unknown printer took a galley of type and scrambled it to make a type specimen book.
+			</div>
+		</div>
+	</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-fragmented.html (0 => 164231)


--- 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)
@@ -0,0 +1,39 @@
+<!doctype html>
+<html>
+	<head>
+		<style>
+			.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;
+			}
+		</style>
+	</head>
+	<body>
+		<a href="" 128815</a>
+		<p>The borders of the <span style="color:red">content</span> are over the padding area of the <span style="color:blue">region</span>.<br/>All 4 borders should be visible.</p>
+
+		<div id="innerDiv">
+			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.
+		</div>
+
+		<div class="region" id="region1"></div>
+		<div class="region" id="region2"></div>
+	</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-horiz-bt-expected.html (0 => 164231)


--- 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)
@@ -0,0 +1,37 @@
+<!doctype html>
+<html>
+	<head>
+		<style>
+			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;
+			}
+		</style>
+	</head>
+	<body>
+		<a href="" 128815</a>
+		<p>All borders of the <span style="color:red">content</span> are over the padding area of the <span style="color:blue">region</span>.<br/>All 4 borders should be visible.</p>
+
+		<div class="region" id="region1">
+			<div id="innerDiv">
+				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.
+			</div>
+		</div>
+	</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-horiz-bt.html (0 => 164231)


--- 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)
@@ -0,0 +1,39 @@
+<!doctype html>
+<html>
+	<head>
+		<style>
+			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;
+			}
+		</style>
+	</head>
+	<body>
+		<a href="" 128815</a>
+		<p>All borders of the <span style="color:red">content</span> are over the padding area of the <span style="color:blue">region</span>.<br/>All 4 borders should be visible.</p>
+
+		<div id="innerDiv">
+			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.
+		</div>
+
+		<div class="region" id="region1"></div>
+	</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-vert-lr-expected.html (0 => 164231)


--- 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)
@@ -0,0 +1,37 @@
+<!doctype html>
+<html>
+	<head>
+		<style>
+			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;
+			}
+		</style>
+	</head>
+	<body>
+		<a href="" 128815</a>
+		<p>All borders of the <span style="color:red">content</span> are over the padding area of the <span style="color:blue">region</span>.<br/>All 4 borders should be visible.</p>
+
+		<div class="region" id="region1">
+			<div id="innerDiv">
+				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.
+			</div>
+		</div>
+	</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-vert-lr.html (0 => 164231)


--- 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)
@@ -0,0 +1,39 @@
+<!doctype html>
+<html>
+	<head>
+		<style>
+			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;
+			}
+		</style>
+	</head>
+	<body>
+		<a href="" 128815</a>
+		<p>All borders of the <span style="color:red">content</span> are over the padding area of the <span style="color:blue">region</span>.<br/>All 4 borders should be visible.</p>
+
+		<div id="innerDiv">
+			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.
+		</div>
+
+		<div class="region" id="region1"></div>
+	</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-vert-rl-expected.html (0 => 164231)


--- 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)
@@ -0,0 +1,37 @@
+<!doctype html>
+<html>
+	<head>
+		<style>
+			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;
+			}
+		</style>
+	</head>
+	<body>
+		<a href="" 128815</a>
+		<p>All borders of the <span style="color:red">content</span> are over the padding area of the <span style="color:blue">region</span>.<br/>All 4 borders should be visible.</p>
+
+		<div class="region" id="region1">
+			<div id="innerDiv">
+				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.
+			</div>
+		</div>
+	</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/regions/box-decorations-over-region-padding-vert-rl.html (0 => 164231)


--- 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)
@@ -0,0 +1,39 @@
+<!doctype html>
+<html>
+	<head>
+		<style>
+			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;
+			}
+		</style>
+	</head>
+	<body>
+		<a href="" 128815</a>
+		<p>All borders of the <span style="color:red">content</span> are over the padding area of the <span style="color:blue">region</span>.<br/>All 4 borders should be visible.</p>
+
+		<div id="innerDiv">
+			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.
+		</div>
+
+		<div class="region" id="region1"></div>
+	</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/regions/box-decorations-over-region-padding.html (0 => 164231)


--- 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)
@@ -0,0 +1,35 @@
+<!doctype html>
+<html>
+	<head>
+		<style>
+			.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;
+			}
+		</style>
+	</head>
+	<body>
+		<a href="" 128815</a>
+		<p>All borders of the <span style="color:red">content</span> are over the padding area of the <span style="color:blue">region</span>.<br/>All 4 borders should be visible.</p>
+
+		<div id="innerDiv">
+			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.
+		</div>
+
+		<div class="region" id="region1"></div>
+	</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (164230 => 164231)


--- 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)
@@ -1,3 +1,28 @@
+2014-02-17  Radu Stavila  <stav...@adobe.com>
+
+        [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):
+
 2014-02-17  Brendan Long  <b.l...@cablelabs.com>
 
         DataCue.data should be a copy of the input ArrayBuffer, not a pointer

Modified: trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp (164230 => 164231)


--- 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)
@@ -188,6 +188,45 @@
     return styleToUse.logicalMaxHeight().isUndefined() ? RenderFlowThread::maxLogicalHeight() : toRenderBlock(parent())->computeReplacedLogicalHeightUsing(styleToUse.logicalMaxHeight());
 }
 
+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()->style().hasPadding()) {
+        if (isFirstRegionInRange) {
+            if (flowThread()->isHorizontalWritingMode()) {
+                clippingRect.move(0, -regionContainer()->paddingBefore());
+                clippingRect.expand(0, regionContainer()->paddingBefore());
+            } else {
+                clippingRect.move(-regionContainer()->paddingBefore(), 0);
+                clippingRect.expand(regionContainer()->paddingBefore(), 0);
+            }
+        }
+        
+        if (isLastRegionInRange) {
+            if (flowThread()->isHorizontalWritingMode())
+                clippingRect.expand(0, regionContainer()->paddingAfter());
+            else
+                clippingRect.expand(regionContainer()->paddingAfter(), 0);
+        }
+        
+        if (flowThread()->isHorizontalWritingMode()) {
+            clippingRect.move(-regionContainer()->paddingStart(), 0);
+            clippingRect.expand(regionContainer()->paddingStart() + regionContainer()->paddingEnd(), 0);
+        } else {
+            clippingRect.move(0, -regionContainer()->paddingStart());
+            clippingRect.expand(0, regionContainer()->paddingStart() + regionContainer()->paddingEnd());
+        }
+    }
+    
+    return clippingRect;
+}
+
 void RenderNamedFlowFragment::layoutBlock(bool relayoutChildren, LayoutUnit)
 {
     StackStats::LayoutCheckPoint layoutCheckPoint;

Modified: trunk/Source/WebCore/rendering/RenderNamedFlowFragment.h (164230 => 164231)


--- 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)
@@ -59,6 +59,8 @@
 
     virtual LayoutUnit pageLogicalHeight() const;
     LayoutUnit maxPageLogicalHeight() const;
+    
+    LayoutRect flowThreadPortionRectForClipping(bool isFirstRegionInRange, bool isLastRegionInRange) const;
 
     bool isPseudoElementRegion() const { return parent() && parent()->isPseudoElement(); }
 

Modified: trunk/Source/WebCore/rendering/RenderRegion.cpp (164230 => 164231)


--- 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)
@@ -521,8 +521,15 @@
     }
 
     bool isLastRegionWithRegionFragmentBreak = (isLastRegion() && (style().regionFragment() == BreakRegionFragment));
-    if (hasOverflowClip() || isLastRegionWithRegionFragmentBreak)
-        mappedRect.intersect(flowThreadPortionRect());
+    if (hasOverflowClip() || isLastRegionWithRegionFragmentBreak) {
+        LayoutRect portionRect;
+        if (isRenderNamedFlowFragment())
+            portionRect = toRenderNamedFlowFragment(this)->flowThreadPortionRectForClipping(this == startRegion, this == endRegion);
+        else
+            portionRect = flowThreadPortionRect();
+        
+        mappedRect.intersect(portionRect);
+    }
 
     return mappedRect.isEmpty() ? mappedRect : m_flowThread->mapFromFlowThreadToLocal(box, mappedRect);
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to