<!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>[160130] 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/160130">160130</a></dd>
<dt>Author</dt> <dd>zoltan@webkit.org</dd>
<dt>Date</dt> <dd>2013-12-04 14:53:24 -0800 (Wed, 04 Dec 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>[CSS Shapes] Support inset for shape-outside
<https://webkit.org/b/125112>
Reviewed by David Hyatt.
Source/WebCore:
This patch adds inset support for shape-outside. Parsing has previously landed in <a href="http://trac.webkit.org/projects/webkit/changeset/159968">r159968</a>.
Specification: http://dev.w3.org/csswg/css-shapes/#supported-basic-shapes
Tests: fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-left.html
fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-right.html
fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-left.html
fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-right.html
fast/shapes/shape-outside-floats/shape-outside-floats-inset.html
* platform/LengthSize.h:
(WebCore::LengthSize::floatSize): Add conversion to FloatSize.
* rendering/shapes/Shape.cpp:
(WebCore::Shape::createShape): Handle inset case.
LayoutTests:
* fast/shapes/resources/rounded-rectangle.js: Add support to generate partially rounded rectangles.
(scanConvertRoundedRectangleOutside):
(genLeftRoundedRectFloatShapeOutsideRefTest):
(genRightRoundedRectFloatShapeOutsideRefTest):
* fast/shapes/shape-outside-floats/shape-outside-floats-inset-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-left-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-left.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-right-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-right.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-left-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-left.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-right-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-right.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-inset.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastshapesresourcesroundedrectanglejs">trunk/LayoutTests/fast/shapes/resources/rounded-rectangle.js</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformLengthSizeh">trunk/Source/WebCore/platform/LengthSize.h</a></li>
<li><a href="#trunkSourceWebCorerenderingshapesShapecpp">trunk/Source/WebCore/rendering/shapes/Shape.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsetexpectedhtml">trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsetroundedbottomleftexpectedhtml">trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-left-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsetroundedbottomlefthtml">trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-left.html</a></li>
<li><a href="#trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsetroundedbottomrightexpectedhtml">trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-right-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsetroundedbottomrighthtml">trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-right.html</a></li>
<li><a href="#trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsetroundedtopleftexpectedhtml">trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-left-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsetroundedtoplefthtml">trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-left.html</a></li>
<li><a href="#trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsetroundedtoprightexpectedhtml">trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-right-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsetroundedtoprighthtml">trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-right.html</a></li>
<li><a href="#trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsethtml">trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (160129 => 160130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2013-12-04 22:51:37 UTC (rev 160129)
+++ trunk/LayoutTests/ChangeLog        2013-12-04 22:53:24 UTC (rev 160130)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2013-12-04 Zoltan Horvath <zoltan@webkit.org>
+
+ [CSS Shapes] Support inset for shape-outside
+ <https://webkit.org/b/125112>
+
+ Reviewed by David Hyatt.
+
+ * fast/shapes/resources/rounded-rectangle.js: Add support to generate partially rounded rectangles.
+ (scanConvertRoundedRectangleOutside):
+ (genLeftRoundedRectFloatShapeOutsideRefTest):
+ (genRightRoundedRectFloatShapeOutsideRefTest):
+ * fast/shapes/shape-outside-floats/shape-outside-floats-inset-expected.html: Added.
+ * fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-left-expected.html: Added.
+ * fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-left.html: Added.
+ * fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-right-expected.html: Added.
+ * fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-right.html: Added.
+ * fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-left-expected.html: Added.
+ * fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-left.html: Added.
+ * fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-right-expected.html: Added.
+ * fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-right.html: Added.
+ * fast/shapes/shape-outside-floats/shape-outside-floats-inset.html: Added.
+
</ins><span class="cx"> 2013-12-04 Bear Travis <betravis@adobe.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: [CSS Shapes] Support raster shape visualizations
</span></span></pre></div>
<a id="trunkLayoutTestsfastshapesresourcesroundedrectanglejs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/shapes/resources/rounded-rectangle.js (160129 => 160130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shapes/resources/rounded-rectangle.js        2013-12-04 22:51:37 UTC (rev 160129)
+++ trunk/LayoutTests/fast/shapes/resources/rounded-rectangle.js        2013-12-04 22:53:24 UTC (rev 160130)
</span><span class="lines">@@ -3,20 +3,27 @@
</span><span class="cx"> return rx * Math.sqrt(1 - (yi * yi) / (ry * ry));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function scanConvertRoundedRectangleOutside(r, height, lineHeight)
</del><ins>+function scanConvertRoundedRectangleOutside(r, height, lineHeight, corner)
</ins><span class="cx"> {
</span><span class="cx"> var intervals = [];
</span><ins>+ var upperCorner = true;
+ var lowerCorner = true;
</ins><span class="cx">
</span><ins>+ if (corner == "upper")
+ lowerCorner = false;
+ else if (corner == "lower")
+ upperCorner = false;
+
</ins><span class="cx"> for (var y = 0; y < height; y += lineHeight) {
</span><span class="cx"> if (y + lineHeight <= r.y || y >= r.y + r.height)
</span><span class="cx"> continue;
</span><span class="cx">
</span><del>- if (y + lineHeight < r.y + r.ry) {
</del><ins>+ if (upperCorner && (y + lineHeight < r.y + r.ry)) {
</ins><span class="cx"> // within the upper rounded corner part of the rectangle
</span><span class="cx"> var dx = ellipseXIntercept(y + lineHeight - r.y - r.ry, r.rx, r.ry);
</span><span class="cx"> intervals.push( { y: y, left: r.x + r.rx - dx, right: r.x + r.width - r.rx + dx} );
</span><span class="cx"> }
</span><del>- else if (y > r.y + r.height - r.ry) {
</del><ins>+ else if (lowerCorner && (y > r.y + r.height - r.ry)) {
</ins><span class="cx"> // within the lower rounded corner part of the rectangle
</span><span class="cx"> var dx = ellipseXIntercept(y - (r.y + r.height - r.ry), r.rx, r.ry);
</span><span class="cx"> intervals.push( { y: y, left: r.x + r.rx - dx, right: r.x + r.width - r.rx + dx} );
</span><span class="lines">@@ -37,7 +44,7 @@
</span><span class="cx"> function genLeftRoundedRectFloatShapeOutsideRefTest(args)
</span><span class="cx"> {
</span><span class="cx"> var leftRoundedRect = args.roundedRect;
</span><del>- var leftRoundedRectIntervals = scanConvertRoundedRectangleOutside(leftRoundedRect, args.containerHeight, args.lineHeight);
</del><ins>+ var leftRoundedRectIntervals = scanConvertRoundedRectangleOutside(leftRoundedRect, args.containerHeight, args.lineHeight, args.corner);
</ins><span class="cx"> var leftFloatDivs = leftRoundedRectIntervals.map(function(interval) {
</span><span class="cx"> var width = SubPixelLayout.snapToLayoutUnit(interval.right);
</span><span class="cx"> var cls = "left-" + args.floatElementClassSuffix;
</span><span class="lines">@@ -50,11 +57,11 @@
</span><span class="cx"> {
</span><span class="cx"> var rightRoundedRect = Object.create(args.roundedRect);
</span><span class="cx"> rightRoundedRect.x = args.containerWidth - args.roundedRect.width;
</span><del>- var rightRoundedRectIntervals = scanConvertRoundedRectangleOutside(rightRoundedRect, args.containerHeight, args.lineHeight);
</del><ins>+ var rightRoundedRectIntervals = scanConvertRoundedRectangleOutside(rightRoundedRect, args.containerHeight, args.lineHeight, args.corner);
</ins><span class="cx"> var rightFloatDivs = rightRoundedRectIntervals.map(function(interval) {
</span><span class="cx"> var width = args.containerWidth - SubPixelLayout.snapToLayoutUnit(interval.left);
</span><span class="cx"> var cls = "right-" + args.floatElementClassSuffix;
</span><span class="cx"> return '<div class="' + cls + '" style="width:' + width + 'px"></div>';
</span><span class="cx"> });
</span><span class="cx"> document.getElementById("right-" + args.insertElementIdSuffix).insertAdjacentHTML('afterend', rightFloatDivs.join("\n"));
</span><del>-}
</del><span class="cx">\ No newline at end of file
</span><ins>+}
</ins></span></pre></div>
<a id="trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsetexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-expected.html (0 => 160130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-expected.html         (rev 0)
+++ trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-expected.html        2013-12-04 22:53:24 UTC (rev 160130)
</span><span class="lines">@@ -0,0 +1,74 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ .test {
+ font: 20px/1 Ahem, sans-serif;
+ border: 1px solid black;
+ line-height: 20px;
+ }
+ .container {
+ width: 60px;
+ height: 60px;
+ display: inline-block;
+ }
+ .float {
+ width: 40px;
+ height: 40px;
+ }
+ .top {
+ height: 20px;
+ }
+ .right {
+ width: 20px;
+ }
+ .bottom {
+ height: 20px;
+ }
+ .left {
+ width: 20px;
+ }
+ </style>
+</head>
+<body>
+ <div class="test container">
+ XXX
+ <div style="float: left" class="float top"></div>
+ X
+ XXX
+ </div>
+ <div class="test container">
+ XXX
+ <div style="float: right" class="float top"></div>
+ X
+ XXX
+ </div>
+ <div class="test container">
+ <div style="float: left" class="float right"></div>
+ XX
+ XX
+ XXX
+ </div>
+ <div class="test container">
+ <div style="float: left" class="float bottom"></div>
+ X
+ XXX
+ XXX
+ </div>
+ <div class="test container">
+ <div style="float: right" class="float bottom"></div>
+ X
+ XXX
+ XXX
+ </div>
+ <div class="test container">
+ <div style="float: right" class="float left"></div>
+ XX
+ XX
+ XXX
+ </div>
+
+ <p>Requires Ahem font. Each container contains a different inset shape-outside.
+ <p>Bug <a href="http://webkit.org/b/125112">125112</a>: [CSS Shapes] Support inset for shape-outside</p>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsetroundedbottomleftexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-left-expected.html (0 => 160130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-left-expected.html         (rev 0)
+++ trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-left-expected.html        2013-12-04 22:53:24 UTC (rev 160130)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.container {
+ position: relative;
+ font: 20px/1 Ahem, sans-serif;
+ width: 500px;
+ height: 200px;
+ border: 1px solid black;
+}
+
+.rounded-rect {
+ width: 320px;
+ height: 160px;
+ border-bottom-left-radius: 60px 40px;
+ border: 1px solid blue;
+}
+
+#right-rounded-rect-outline {
+ position: absolute;
+ top: 20px;
+ right: 0px;
+}
+
+.right-rounded-rect-float-line {
+ float: right;
+ clear: right;
+ height: 20px;
+}
+</style>
+<body>
+<div class="container" style="text-align: right">
+X<br/>
+ <div id="right-rounded-rect-outline" class="rounded-rect"></div>
+ <!-- generated right-rounded-rect-float-line divs will be inserted here -->
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+X
+</div>
+<script src="../resources/rounded-rectangle.js"></script>
+<script src="../resources/subpixel-utils.js"></script>
+<script>
+genRightRoundedRectFloatShapeOutsideRefTest({
+ roundedRect: {x: 0, y: 22, width: 322, height: 160, rx: 60, ry: 40},
+ containerWidth: 500,
+ containerHeight: 200,
+ lineHeight: 20,
+ floatElementClassSuffix: "rounded-rect-float-line",
+ insertElementIdSuffix: "rounded-rect-outline",
+ corner: "lower"
+});
+</script>
+
+<p>Requires Ahem font. There is a 0px size inset applied on the right float with 60px/40px bottom left radius.<br>
+The black squares should trace the left side of the rounded rectangle's blue outline.</p>
+<p>Bug <a href="http://webkit.org/b/125112">125112</a>: [CSS Shapes] Support inset for shape-outside</p>
+
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsetroundedbottomlefthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-left.html (0 => 160130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-left.html         (rev 0)
+++ trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-left.html        2013-12-04 22:53:24 UTC (rev 160130)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<style>
+.container {
+ font: 20px/1 Ahem, sans-serif;
+ width: 500px;
+ height: 200px;
+ border: 1px solid black;
+}
+
+.rounded-rect {
+ width: 320px;
+ height: 160px;
+ border: 1px solid blue;
+ border-bottom-left-radius: 60px 40px;
+ -webkit-shape-outside: inset(0px 0px 0px 0px round 0 0 0 60px / 0 0 0 40px);
+}
+</style>
+
+<body>
+<div class="container" style="text-align: right">
+X<br/>
+ <div style="float: right" class="rounded-rect"></div>
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+X
+</div>
+
+<p>Requires Ahem font. There is a 0px size inset applied on the right float with 60px/40px bottom left radius.<br>
+The black squares should trace the left side of the rounded rectangle's blue outline.</p>
+<p>Bug <a href="http://webkit.org/b/125112">125112</a>: [CSS Shapes] Support inset for shape-outside</p>
+
+</body>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsetroundedbottomrightexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-right-expected.html (0 => 160130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-right-expected.html         (rev 0)
+++ trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-right-expected.html        2013-12-04 22:53:24 UTC (rev 160130)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.container {
+ position: relative;
+ font: 20px/1 Ahem, sans-serif;
+ width: 500px;
+ height: 200px;
+ border: 1px solid black;
+}
+
+.rounded-rect {
+ width: 320px;
+ height: 160px;
+ border-bottom-right-radius: 200px 40px;
+ border: 1px solid blue;
+}
+
+#left-rounded-rect-outline {
+ position: absolute;
+ top: 20px;
+}
+
+.left-rounded-rect-float-line {
+ float: left;
+ clear: left;
+ height: 20px;
+}
+</style>
+<body>
+<div class="container">
+X<br/>
+ <div id="left-rounded-rect-outline" class="rounded-rect"></div>
+ <!-- generated right-rounded-rect-float-line divs will be inserted here -->
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+&nbsp;X
+</div>
+<script src="../resources/rounded-rectangle.js"></script>
+<script src="../resources/subpixel-utils.js"></script>
+<script>
+genLeftRoundedRectFloatShapeOutsideRefTest({
+ roundedRect: {x: 0, y: 22, width: 322, height: 160, rx: 200, ry: 40},
+ containerWidth: 500,
+ containerHeight: 200,
+ lineHeight: 20,
+ floatElementClassSuffix: "rounded-rect-float-line",
+ insertElementIdSuffix: "rounded-rect-outline",
+ corner: "lower"
+});
+</script>
+
+<p>Requires Ahem font. There is a 0px size inset applied on the right float with 60px/40px bottom right radius.<br>
+The black squares should trace the right side of the rounded rectangle's blue outline.
+The last line contains a non-break space in order to avoid rounding/painting problems in the test.</p>
+<p>Bug <a href="http://webkit.org/b/125112">125112</a>: [CSS Shapes] Support inset for shape-outside</p>
+
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsetroundedbottomrighthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-right.html (0 => 160130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-right.html         (rev 0)
+++ trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-right.html        2013-12-04 22:53:24 UTC (rev 160130)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<style>
+.container {
+ font: 20px/1 Ahem, sans-serif;
+ width: 500px;
+ height: 200px;
+ border: 1px solid black;
+}
+
+.rounded-rect {
+ width: 320px;
+ height: 160px;
+ border: 1px solid blue;
+ border-bottom-right-radius: 200px 40px;
+ -webkit-shape-outside: inset(0px 0px 0px 0px round 0 0 200px 0 / 0 0 40px);
+}
+</style>
+
+<body>
+<div class="container">
+X<br/>
+ <div style="float: left" class="rounded-rect"></div>
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+&nbsp;X
+</div>
+
+<p>Requires Ahem font. There is a 0px size inset applied on the right float with 60px/40px bottom right radius.<br>
+The black squares should trace the right side of the rounded rectangle's blue outline.
+The last line contains a non-break space in order to avoid rounding/painting problems in the test.</p>
+<p>Bug <a href="http://webkit.org/b/125112">125112</a>: [CSS Shapes] Support inset for shape-outside</p>
+
+</body>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsetroundedtopleftexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-left-expected.html (0 => 160130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-left-expected.html         (rev 0)
+++ trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-left-expected.html        2013-12-04 22:53:24 UTC (rev 160130)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.container {
+ position: relative;
+ font: 20px/1 Ahem, sans-serif;
+ width: 500px;
+ height: 200px;
+ border: 1px solid black;
+}
+
+.rounded-rect {
+ width: 320px;
+ height: 160px;
+ border-top-left-radius: 60px 40px;
+ border: 1px solid blue;
+}
+
+#right-rounded-rect-outline {
+ position: absolute;
+ top: 20px;
+ right: 0px;
+}
+
+
+.right-rounded-rect-float-line {
+ float: right;
+ clear: right;
+ height: 20px;
+}
+</style>
+<body>
+<div class="container" style="text-align: right">
+X<br/>
+ <div id="right-rounded-rect-outline" class="rounded-rect"></div>
+ <!-- generated right-rounded-rect-float-line divs will be inserted here -->
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+X
+</div>
+<script src="../resources/rounded-rectangle.js"></script>
+<script src="../resources/subpixel-utils.js"></script>
+<script>
+genRightRoundedRectFloatShapeOutsideRefTest({
+ roundedRect: {x: 0, y: 20, width: 322, height: 160, rx: 60, ry: 40},
+ containerWidth: 500,
+ containerHeight: 200,
+ lineHeight: 20,
+ floatElementClassSuffix: "rounded-rect-float-line",
+ insertElementIdSuffix: "rounded-rect-outline",
+ corner: "upper"
+});
+</script>
+
+<p>Requires Ahem font. There is a 0px size inset applied on the right float with 60px/40px top left radius.<br>
+The black squares should trace the left side of the rounded rectangle's blue outline.</p>
+<p>Bug <a href="http://webkit.org/b/125112">125112</a>: [CSS Shapes] Support inset for shape-outside</p>
+
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsetroundedtoplefthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-left.html (0 => 160130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-left.html         (rev 0)
+++ trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-left.html        2013-12-04 22:53:24 UTC (rev 160130)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<style>
+.container {
+ font: 20px/1 Ahem, sans-serif;
+ width: 500px;
+ height: 200px;
+ border: 1px solid black;
+}
+
+.rounded-rect {
+ width: 320px;
+ height: 160px;
+ border: 1px solid blue;
+ border-top-left-radius: 60px 40px;
+ -webkit-shape-outside: inset(0px 0px 0px 0px round 60px 0 0 0 / 40px);
+}
+</style>
+
+<body>
+<div class="container" style="text-align: right">
+X<br/>
+ <div style="float: right" class="rounded-rect"></div>
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+X<br/>
+X
+</div>
+
+<p>Requires Ahem font. There is a 0px size inset applied on the right float with 60px/40px top left radius.<br>
+The black squares should trace the left side of the rounded rectangle's blue outline.</p>
+<p>Bug <a href="http://webkit.org/b/125112">125112</a>: [CSS Shapes] Support inset for shape-outside</p>
+
+</body>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsetroundedtoprightexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-right-expected.html (0 => 160130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-right-expected.html         (rev 0)
+++ trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-right-expected.html        2013-12-04 22:53:24 UTC (rev 160130)
</span><span class="lines">@@ -0,0 +1,60 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.container {
+ position: relative;
+ font: 20px/1 Ahem, sans-serif;
+ width: 500px;
+ height: 200px;
+ border: 1px solid black;
+}
+
+.rounded-rect {
+ width: 320px;
+ height: 160px;
+ border-top-right-radius: 200px 40px;
+ border: 1px solid blue;
+}
+
+#left-rounded-rect-outline {
+ position: absolute;
+ top: 20px;
+}
+
+.left-rounded-rect-float-line {
+ float: left;
+ clear: left;
+ height: 20px;
+}
+</style>
+<body>
+<div class="container">
+X<br/>
+ <div id="left-rounded-rect-outline" class="rounded-rect"></div>
+ <!-- generated right-rounded-rect-float-line divs will be inserted here -->
+&nbsp;X<br/>
+X<br/>
+X
+</div>
+<script src="../resources/rounded-rectangle.js"></script>
+<script src="../resources/subpixel-utils.js"></script>
+<script>
+genLeftRoundedRectFloatShapeOutsideRefTest({
+ roundedRect: {x: 0, y: 20, width: 322, height: 160, rx: 200, ry: 40},
+ containerWidth: 500,
+ containerHeight: 200,
+ lineHeight: 20,
+ floatElementClassSuffix: "rounded-rect-float-line",
+ insertElementIdSuffix: "rounded-rect-outline",
+ corner: "upper"
+});
+</script>
+
+<p>Requires Ahem font. There is a 0px size inset applied on the right float with 60px/40px top right radius.<br>
+The black squares should trace the right side of the rounded rectangle's blue outline.
+The second line contains a non-break space in order to avoid rounding/painting problems in the test.</p>
+<p>Bug <a href="http://webkit.org/b/125112">125112</a>: [CSS Shapes] Support inset for shape-outside</p>
+
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsetroundedtoprighthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-right.html (0 => 160130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-right.html         (rev 0)
+++ trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-right.html        2013-12-04 22:53:24 UTC (rev 160130)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<style>
+.container {
+ font: 20px/1 Ahem, sans-serif;
+ width: 500px;
+ height: 200px;
+ border: 1px solid black;
+}
+
+.rounded-rect {
+ width: 320px;
+ height: 160px;
+ border: 1px solid blue;
+ border-top-right-radius: 200px 40px;
+ -webkit-shape-outside: inset(0px 0px 0px 0px round 0 200px 0 0 / 0 40px);
+}
+</style>
+
+<body>
+<div class="container">
+X<br/>
+ <div style="float: left" class="rounded-rect"></div>
+&nbsp;X<br/>
+X<br/>
+X
+</div>
+
+<p>Requires Ahem font. There is a 0px size inset applied on the right float with 60px/40px top right radius.<br>
+The black squares should trace the right side of the rounded rectangle's blue outline.
+The second line contains a non-break space in order to avoid rounding/painting problems in the test.</p>
+<p>Bug <a href="http://webkit.org/b/125112">125112</a>: [CSS Shapes] Support inset for shape-outside</p>
+
+</body>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsethtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset.html (0 => 160130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset.html         (rev 0)
+++ trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset.html        2013-12-04 22:53:24 UTC (rev 160130)
</span><span class="lines">@@ -0,0 +1,74 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<style>
+ .test {
+ font: 20px/1 Ahem, sans-serif;
+ border: 1px solid black;
+ line-height: 20px;
+ }
+ .container {
+ width: 60px;
+ height: 60px;
+ display: inline-block;
+ }
+ .float {
+ width: 40px;
+ height: 40px;
+ }
+ .top {
+ -webkit-shape-outside: inset(20px 0 0 0);
+ }
+ .right {
+ -webkit-shape-outside: inset(0 20px 0 0);
+ }
+ .bottom {
+ -webkit-shape-outside: inset(0 0 20px 0);
+ }
+ .left {
+ -webkit-shape-outside: inset(0 0 0 20px);
+ }
+</style>
+</head>
+<body>
+ <div class="test container">
+ <div style="float: left" class="float top"></div>
+ XXX
+ X
+ XXX
+ </div>
+ <div class="test container">
+ <div style="float: right" class="float top"></div>
+ XXX
+ X
+ XXX
+ </div>
+ <div class="test container">
+ <div style="float: left" class="float right"></div>
+ XX
+ XX
+ XXX
+ </div>
+ <div class="test container">
+ <div style="float: left" class="float bottom"></div>
+ X
+ XXX
+ XXX
+ </div>
+ <div class="test container">
+ <div style="float: right" class="float bottom"></div>
+ X
+ XXX
+ XXX
+ </div>
+ <div class="test container">
+ <div style="float: right" class="float left"></div>
+ XX
+ XX
+ XXX
+ </div>
+
+ <p>Requires Ahem font. Each container contains a different inset shape-outside.</0>
+ <p>Bug <a href="http://webkit.org/b/125112">125112</a>: [CSS Shapes] Support inset for shape-outside</p>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (160129 => 160130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2013-12-04 22:51:37 UTC (rev 160129)
+++ trunk/Source/WebCore/ChangeLog        2013-12-04 22:53:24 UTC (rev 160130)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2013-12-04 Zoltan Horvath <zoltan@webkit.org>
+
+ [CSS Shapes] Support inset for shape-outside
+ <https://webkit.org/b/125112>
+
+ Reviewed by David Hyatt.
+
+ This patch adds inset support for shape-outside. Parsing has previously landed in r159968.
+ Specification: http://dev.w3.org/csswg/css-shapes/#supported-basic-shapes
+
+ Tests: fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-left.html
+ fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-bottom-right.html
+ fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-left.html
+ fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-top-right.html
+ fast/shapes/shape-outside-floats/shape-outside-floats-inset.html
+
+ * platform/LengthSize.h:
+ (WebCore::LengthSize::floatSize): Add conversion to FloatSize.
+ * rendering/shapes/Shape.cpp:
+ (WebCore::Shape::createShape): Handle inset case.
+
</ins><span class="cx"> 2013-12-04 Bear Travis <betravis@adobe.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: [CSS Shapes] Support raster shape visualizations
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformLengthSizeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/LengthSize.h (160129 => 160130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/LengthSize.h        2013-12-04 22:51:37 UTC (rev 160129)
+++ trunk/Source/WebCore/platform/LengthSize.h        2013-12-04 22:53:24 UTC (rev 160130)
</span><span class="lines">@@ -21,6 +21,7 @@
</span><span class="cx"> #ifndef LengthSize_h
</span><span class="cx"> #define LengthSize_h
</span><span class="cx">
</span><ins>+#include "FloatSize.h"
</ins><span class="cx"> #include "Length.h"
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -53,6 +54,11 @@
</span><span class="cx"> return LengthSize(m_width.blend(from.width(), progress), m_height.blend(from.height(), progress));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ FloatSize floatSize() const
+ {
+ return FloatSize(m_width.value(), m_height.value());
+ }
+
</ins><span class="cx"> private:
</span><span class="cx"> Length m_width;
</span><span class="cx"> Length m_height;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingshapesShapecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/shapes/Shape.cpp (160129 => 160130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/shapes/Shape.cpp        2013-12-04 22:51:37 UTC (rev 160129)
+++ trunk/Source/WebCore/rendering/shapes/Shape.cpp        2013-12-04 22:53:24 UTC (rev 160130)
</span><span class="lines">@@ -222,6 +222,31 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ case BasicShape::BasicShapeInsetType: {
+ const BasicShapeInset* rectangle = static_cast<const BasicShapeInset*>(basicShape);
+ float left = floatValueForLength(rectangle->left(), boxWidth);
+ float top = floatValueForLength(rectangle->top(), boxHeight);
+
+ FloatRect rect(left,
+ top,
+ boxWidth - left - floatValueForLength(rectangle->right(), boxWidth),
+ boxHeight - top - floatValueForLength(rectangle->bottom(), boxHeight));
+ FloatRect logicalRect = physicalRectToLogical(rect, logicalBoxSize.height(), writingMode);
+
+ // FloatRoundedRect constuctor has different order for the corners: topLeft, topRight, bottomLeft, bottomRight
+ FloatRoundedRect logicalBounds(logicalRect,
+ rectangle->topLeftRadius().floatSize(),
+ rectangle->topRightRadius().floatSize(),
+ rectangle->bottomLeftRadius().floatSize(),
+ rectangle->bottomRightRadius().floatSize());
+
+ float shapeMargin = floatValueForLength(margin, 0);
+ float shapePadding = floatValueForLength(padding, 0);
+
+ shape = createBoxShape(logicalBounds, shapeMargin, shapePadding);
+ break;
+ }
+
</ins><span class="cx"> default:
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>