<!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>[165261] 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/165261">165261</a></dd>
<dt>Author</dt> <dd>bjonesbe@adobe.com</dd>
<dt>Date</dt> <dd>2014-03-07 08:25:12 -0800 (Fri, 07 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[CSS Shapes] inset does not properly clamp large corner radii
https://bugs.webkit.org/show_bug.cgi?id=129726

Reviewed by Dirk Schulze.

Source/WebCore:

Make sure that radii that are larger than 50% of the associated shape
dimension (height or width) are properly reduced the same way as
border-radius radii are.

Test: fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-large-radius.html

* rendering/shapes/Shape.cpp:
(WebCore::ensureRadiiDoNotOverlap): Drive by style fix.
(WebCore::Shape::createShape): Scale radii the same way as border
    radii are scaled.
* platform/graphics/FloatRoundedRect.h:
(WebCore::calcBorderRadiiConstraintScaleFor): Move border radii
    constraint calculation function out so that it can be shared by
    the shape code.
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::getRoundedBorderFor): Call renamed scale function.

LayoutTests:

* fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-large-radius-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-large-radius.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="#trunkSourceWebCoreplatformgraphicsFloatRoundedRecth">trunk/Source/WebCore/platform/graphics/FloatRoundedRect.h</a></li>
<li><a href="#trunkSourceWebCorerenderingshapesShapecpp">trunk/Source/WebCore/rendering/shapes/Shape.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleRenderStylecpp">trunk/Source/WebCore/rendering/style/RenderStyle.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsetroundedlargeradiusexpectedhtml">trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-large-radius-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsetroundedlargeradiushtml">trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-large-radius.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (165260 => 165261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-03-07 13:39:00 UTC (rev 165260)
+++ trunk/LayoutTests/ChangeLog        2014-03-07 16:25:12 UTC (rev 165261)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2014-03-07  Bem Jones-Bey  &lt;bjonesbe@adobe.com&gt;
+
+        [CSS Shapes] inset does not properly clamp large corner radii
+        https://bugs.webkit.org/show_bug.cgi?id=129726
+
+        Reviewed by Dirk Schulze.
+
+        * fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-large-radius-expected.html: Added.
+        * fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-large-radius.html: Added.
+
</ins><span class="cx"> 2014-03-07  Michał Pakuła vel Rutka  &lt;m.pakula@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed EFL gardening
</span></span></pre></div>
<a id="trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsetroundedlargeradiusexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-large-radius-expected.html (0 => 165261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-large-radius-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-large-radius-expected.html        2014-03-07 16:25:12 UTC (rev 165261)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;style&gt;
+.container {
+    position: relative;
+    font: 20px/1 Ahem, sans-serif;
+    width: 500px;
+    height: 200px;
+    border: 1px solid black;
+}
+
+.rounded-rect {
+    width: 320px;
+    height: 160px;
+    border-radius: 80px;
+    background-color: blue;
+}
+
+#right-rounded-rect-outline {
+    position: absolute;
+    top: 20px;
+    right: 0px;
+}
+
+
+.right-rounded-rect-float-line {
+    float: right;
+    clear: right;
+    height: 20px;
+}
+&lt;/style&gt;
+&lt;body&gt;
+&lt;div class=&quot;container&quot; style=&quot;text-align: right&quot;&gt;
+X&lt;br/&gt;
+    &lt;div id=&quot;right-rounded-rect-outline&quot; class=&quot;rounded-rect&quot;&gt;&lt;/div&gt;
+    &lt;!-- generated right-rounded-rect-float-line divs will be inserted here --&gt;
+X&lt;br/&gt;
+X&lt;br/&gt;
+X&lt;br/&gt;
+X&lt;br/&gt;
+X&lt;br/&gt;
+X&lt;br/&gt;
+X&lt;br/&gt;
+X&lt;br/&gt;
+X
+&lt;/div&gt;
+&lt;script src=&quot;../resources/rounded-rectangle.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/subpixel-utils.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+genRightRoundedRectFloatShapeOutsideRefTest({
+    roundedRect: {x: 0, y: 20, width: 320, height: 160, rx: 80, ry: 80},
+    containerWidth: 500,
+    containerHeight: 200,
+    lineHeight: 20,
+    floatElementClassSuffix: &quot;rounded-rect-float-line&quot;,
+    insertElementIdSuffix: &quot;rounded-rect-outline&quot;,
+});
+&lt;/script&gt;
+
+&lt;p&gt;Requires Ahem font. There is a 0px size inset applied on the right float with 200px radius.&lt;br&gt;
+The black squares should trace the left side of the rounded rectangle's blue outline.&lt;/p&gt;
+&lt;p&gt;Bug &lt;a href=&quot;http://webkit.org/b/129726&quot;&gt;129726&lt;/a&gt;: [CSS Shapes] inset does not properly clamp large corner radii&lt;/p&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastshapesshapeoutsidefloatsshapeoutsidefloatsinsetroundedlargeradiushtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-large-radius.html (0 => 165261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-large-radius.html                                (rev 0)
+++ trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-large-radius.html        2014-03-07 16:25:12 UTC (rev 165261)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;style&gt;
+.container {
+    font: 20px/1 Ahem, sans-serif;
+    width: 500px;
+    height: 200px;
+    border: 1px solid black;
+}
+
+.rounded-rect {
+    width: 320px;
+    height: 160px;
+    background-color: blue;
+    border-radius: 200px;
+    -webkit-shape-outside: inset(0px round 200px);
+}
+&lt;/style&gt;
+
+&lt;body&gt;
+&lt;div class=&quot;container&quot; style=&quot;text-align: right&quot;&gt;
+X&lt;br/&gt;
+    &lt;div style=&quot;float: right&quot; class=&quot;rounded-rect&quot;&gt;&lt;/div&gt;
+X&lt;br/&gt;
+X&lt;br/&gt;
+X&lt;br/&gt;
+X&lt;br/&gt;
+X&lt;br/&gt;
+X&lt;br/&gt;
+X&lt;br/&gt;
+X&lt;br/&gt;
+X
+&lt;/div&gt;
+
+&lt;p&gt;Requires Ahem font. There is a 0px size inset applied on the right float with 200px radius.&lt;br&gt;
+The black squares should trace the left side of the rounded rectangle's blue outline.&lt;/p&gt;
+&lt;p&gt;Bug &lt;a href=&quot;http://webkit.org/b/129726&quot;&gt;129726&lt;/a&gt;: [CSS Shapes] inset does not properly clamp large corner radii&lt;/p&gt;
+
+&lt;/body&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (165260 => 165261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-03-07 13:39:00 UTC (rev 165260)
+++ trunk/Source/WebCore/ChangeLog        2014-03-07 16:25:12 UTC (rev 165261)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2014-03-07  Bem Jones-Bey  &lt;bjonesbe@adobe.com&gt;
+
+        [CSS Shapes] inset does not properly clamp large corner radii
+        https://bugs.webkit.org/show_bug.cgi?id=129726
+
+        Reviewed by Dirk Schulze.
+
+        Make sure that radii that are larger than 50% of the associated shape
+        dimension (height or width) are properly reduced the same way as
+        border-radius radii are.
+
+        Test: fast/shapes/shape-outside-floats/shape-outside-floats-inset-rounded-large-radius.html
+
+        * rendering/shapes/Shape.cpp:
+        (WebCore::ensureRadiiDoNotOverlap): Drive by style fix.
+        (WebCore::Shape::createShape): Scale radii the same way as border
+            radii are scaled.
+        * platform/graphics/FloatRoundedRect.h:
+        (WebCore::calcBorderRadiiConstraintScaleFor): Move border radii
+            constraint calculation function out so that it can be shared by
+            the shape code.
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::getRoundedBorderFor): Call renamed scale function.
+
</ins><span class="cx"> 2014-03-07  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GST] Set name to several timeout sources
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFloatRoundedRecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FloatRoundedRect.h (165260 => 165261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FloatRoundedRect.h        2014-03-07 13:39:00 UTC (rev 165260)
+++ trunk/Source/WebCore/platform/graphics/FloatRoundedRect.h        2014-03-07 16:25:12 UTC (rev 165261)
</span><span class="lines">@@ -134,6 +134,38 @@
</span><span class="cx">     return a.rect() == b.rect() &amp;&amp; a.radii() == b.radii();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline float calcBorderRadiiConstraintScaleFor(const FloatRect&amp; rect, const FloatRoundedRect::Radii&amp; radii)
+{
+    // Constrain corner radii using CSS3 rules:
+    // http://www.w3.org/TR/css3-background/#the-border-radius
+
+    float factor = 1;
+    float radiiSum;
+
+    // top
+    radiiSum = radii.topLeft().width() + radii.topRight().width(); // Casts to avoid integer overflow.
+    if (radiiSum &gt; rect.width())
+        factor = std::min(rect.width() / radiiSum, factor);
+
+    // bottom
+    radiiSum = radii.bottomLeft().width() + radii.bottomRight().width();
+    if (radiiSum &gt; rect.width())
+        factor = std::min(rect.width() / radiiSum, factor);
+
+    // left
+    radiiSum = radii.topLeft().height() + radii.bottomLeft().height();
+    if (radiiSum &gt; rect.height())
+        factor = std::min(rect.height() / radiiSum, factor);
+
+    // right
+    radiiSum = radii.topRight().height() + radii.bottomRight().height();
+    if (radiiSum &gt; rect.height())
+        factor = std::min(rect.height() / radiiSum, factor);
+
+    ASSERT(factor &lt;= 1);
+    return factor;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // FloatRoundedRect_h
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingshapesShapecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/shapes/Shape.cpp (165260 => 165261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/shapes/Shape.cpp        2014-03-07 13:39:00 UTC (rev 165260)
+++ trunk/Source/WebCore/rendering/shapes/Shape.cpp        2014-03-07 16:25:12 UTC (rev 165261)
</span><span class="lines">@@ -100,7 +100,7 @@
</span><span class="cx">     return size.transposedSize();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline void ensureRadiiDoNotOverlap(FloatRect &amp;bounds, FloatSize &amp;radii)
</del><ins>+static inline void ensureRadiiDoNotOverlap(FloatRect&amp; bounds, FloatSize&amp; radii)
</ins><span class="cx"> {
</span><span class="cx">     float widthRatio = bounds.width() / (2 * radii.width());
</span><span class="cx">     float heightRatio = bounds.height() / (2 * radii.height());
</span><span class="lines">@@ -239,6 +239,8 @@
</span><span class="cx">             floatSizeForLengthSize(inset.bottomLeftRadius(), boxSize),
</span><span class="cx">             floatSizeForLengthSize(inset.bottomRightRadius(), boxSize));
</span><span class="cx"> 
</span><ins>+        cornerRadii.scale(calcBorderRadiiConstraintScaleFor(logicalRect, cornerRadii));
+
</ins><span class="cx">         shape = createInsetShape(FloatRoundedRect(logicalRect, cornerRadii));
</span><span class="cx">         break;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStylecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (165260 => 165261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp        2014-03-07 13:39:00 UTC (rev 165260)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp        2014-03-07 16:25:12 UTC (rev 165261)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #include &quot;ContentData.h&quot;
</span><span class="cx"> #include &quot;CursorList.h&quot;
</span><span class="cx"> #include &quot;CSSPropertyNames.h&quot;
</span><ins>+#include &quot;FloatRoundedRect.h&quot;
</ins><span class="cx"> #include &quot;Font.h&quot;
</span><span class="cx"> #include &quot;FontSelector.h&quot;
</span><span class="cx"> #include &quot;Pagination.h&quot;
</span><span class="lines">@@ -1066,38 +1067,6 @@
</span><span class="cx">             valueForLength(border.bottomRight().height(), size.height(), renderView)));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static float calcConstraintScaleFor(const LayoutRect&amp; rect, const RoundedRect::Radii&amp; radii)
-{
-    // Constrain corner radii using CSS3 rules:
-    // http://www.w3.org/TR/css3-background/#the-border-radius
-    
-    float factor = 1;
-    float radiiSum;
-
-    // top
-    radiiSum = radii.topLeft().width() + radii.topRight().width(); // Casts to avoid integer overflow.
-    if (radiiSum &gt; rect.width())
-        factor = std::min(rect.width() / radiiSum, factor);
-
-    // bottom
-    radiiSum = radii.bottomLeft().width() + radii.bottomRight().width();
-    if (radiiSum &gt; rect.width())
-        factor = std::min(rect.width() / radiiSum, factor);
-    
-    // left
-    radiiSum = radii.topLeft().height() + radii.bottomLeft().height();
-    if (radiiSum &gt; rect.height())
-        factor = std::min(rect.height() / radiiSum, factor);
-    
-    // right
-    radiiSum = radii.topRight().height() + radii.bottomRight().height();
-    if (radiiSum &gt; rect.height())
-        factor = std::min(rect.height() / radiiSum, factor);
-    
-    ASSERT(factor &lt;= 1);
-    return factor;
-}
-
</del><span class="cx"> StyleImage* RenderStyle::listStyleImage() const { return rareInheritedData-&gt;listStyleImage.get(); }
</span><span class="cx"> void RenderStyle::setListStyleImage(PassRefPtr&lt;StyleImage&gt; v)
</span><span class="cx"> {
</span><span class="lines">@@ -1120,7 +1089,7 @@
</span><span class="cx">     RoundedRect roundedRect(borderRect);
</span><span class="cx">     if (hasBorderRadius()) {
</span><span class="cx">         RoundedRect::Radii radii = calcRadiiFor(surround-&gt;border, borderRect.size(), renderView);
</span><del>-        radii.scale(calcConstraintScaleFor(borderRect, radii));
</del><ins>+        radii.scale(calcBorderRadiiConstraintScaleFor(borderRect, radii));
</ins><span class="cx">         roundedRect.includeLogicalEdges(radii, isHorizontalWritingMode(), includeLogicalLeftEdge, includeLogicalRightEdge);
</span><span class="cx">     }
</span><span class="cx">     return roundedRect;
</span></span></pre>
</div>
</div>

</body>
</html>