<!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>[214010] 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/214010">214010</a></dd>
<dt>Author</dt> <dd>hyatt@apple.com</dd>
<dt>Date</dt> <dd>2017-03-15 15:09:59 -0700 (Wed, 15 Mar 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Positioned SVG not sized correctly
https://bugs.webkit.org/show_bug.cgi?id=169693
&lt;rdar://problem/30996893&gt;

Reviewed by Zalan Bujtas.

Source/WebCore:

Test: svg/in-html/rect-positioned.html

Change computeReplacedLogicalHeight to take an estimatedUsedWidth. This
value is used instead of the available logical width to resolve replaced
elements without intrinsic sizes but with aspect ratios set.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeReplacedLogicalHeight):
* rendering/RenderBox.h:
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeConstrainedLogicalWidth):
(WebCore::RenderReplaced::computeReplacedLogicalWidth):
(WebCore::RenderReplaced::computeReplacedLogicalHeight):
* rendering/RenderReplaced.h:
* rendering/RenderVideo.cpp:
(WebCore::RenderVideo::computeReplacedLogicalHeight): Deleted.
* rendering/RenderVideo.h:
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::computeReplacedLogicalWidth):
(WebCore::RenderSVGRoot::computeReplacedLogicalHeight):
* rendering/svg/RenderSVGRoot.h:

LayoutTests:

* svg/in-html/rect-positioned-expected.html: Added.
* svg/in-html/rect-positioned.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="#trunkSourceWebCorerenderingRenderBoxcpp">trunk/Source/WebCore/rendering/RenderBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxh">trunk/Source/WebCore/rendering/RenderBox.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderReplacedcpp">trunk/Source/WebCore/rendering/RenderReplaced.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderReplacedh">trunk/Source/WebCore/rendering/RenderReplaced.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderVideocpp">trunk/Source/WebCore/rendering/RenderVideo.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderVideoh">trunk/Source/WebCore/rendering/RenderVideo.h</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgRenderSVGRootcpp">trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgRenderSVGRooth">trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestssvginhtmlrectpositionedexpectedhtml">trunk/LayoutTests/svg/in-html/rect-positioned-expected.html</a></li>
<li><a href="#trunkLayoutTestssvginhtmlrectpositionedhtml">trunk/LayoutTests/svg/in-html/rect-positioned.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (214009 => 214010)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-03-15 22:04:50 UTC (rev 214009)
+++ trunk/LayoutTests/ChangeLog        2017-03-15 22:09:59 UTC (rev 214010)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2017-03-15  Dave Hyatt  &lt;hyatt@apple.com&gt;
+
+        Positioned SVG not sized correctly
+        https://bugs.webkit.org/show_bug.cgi?id=169693
+        &lt;rdar://problem/30996893&gt;
+
+        Reviewed by Zalan Bujtas.
+
+        * svg/in-html/rect-positioned-expected.html: Added.
+        * svg/in-html/rect-positioned.html: Added.
+
</ins><span class="cx"> 2017-03-15  Ryan Haddad  &lt;ryanhaddad@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Clean up TestExpectations for some WPT LayoutTests.
</span></span></pre></div>
<a id="trunkLayoutTestssvginhtmlrectpositionedexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/in-html/rect-positioned-expected.html (0 => 214010)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/in-html/rect-positioned-expected.html                                (rev 0)
+++ trunk/LayoutTests/svg/in-html/rect-positioned-expected.html        2017-03-15 22:09:59 UTC (rev 214010)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;body&gt;
+        &lt;p&gt;This blue rectangle is drawn via SVG.&lt;/p&gt;
+        
+        &lt;div style=&quot;width:600px;height:200px;background-color:lime; position:relative&quot;&gt;
+            &lt;svg viewBox=&quot;0 0 300 100&quot; preserveAspectRatio=&quot;xMidYMid&quot;&gt;
+                &lt;&lt;rect width=&quot;300&quot; height=&quot;100&quot; style=&quot;fill:rgb(0,0,255);stroke-width:3;stroke:rgb(0,0,0)&quot; /&gt;
+            &lt;/svg&gt;
+    &lt;/body&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestssvginhtmlrectpositionedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/in-html/rect-positioned.html (0 => 214010)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/in-html/rect-positioned.html                                (rev 0)
+++ trunk/LayoutTests/svg/in-html/rect-positioned.html        2017-03-15 22:09:59 UTC (rev 214010)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;body&gt;
+        &lt;p&gt;This blue rectangle is drawn via SVG.&lt;/p&gt;
+        
+        &lt;div style=&quot;width:600px;height:200px;background-color:lime; position:relative&quot;&gt;
+            &lt;svg viewBox=&quot;0 0 300 100&quot; preserveAspectRatio=&quot;xMidYMid&quot; style=&quot;position:absolute;top:0;right:0;bottom:0;left:0&quot;&gt;
+                &lt;&lt;rect width=&quot;300&quot; height=&quot;100&quot; style=&quot;fill:rgb(0,0,255);stroke-width:3;stroke:rgb(0,0,0)&quot; /&gt;
+            &lt;/svg&gt;
+    &lt;/body&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (214009 => 214010)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-03-15 22:04:50 UTC (rev 214009)
+++ trunk/Source/WebCore/ChangeLog        2017-03-15 22:09:59 UTC (rev 214010)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2017-03-15  Dave Hyatt  &lt;hyatt@apple.com&gt;
+
+        Positioned SVG not sized correctly
+        https://bugs.webkit.org/show_bug.cgi?id=169693
+        &lt;rdar://problem/30996893&gt;
+
+        Reviewed by Zalan Bujtas.
+
+        Test: svg/in-html/rect-positioned.html
+
+        Change computeReplacedLogicalHeight to take an estimatedUsedWidth. This
+        value is used instead of the available logical width to resolve replaced
+        elements without intrinsic sizes but with aspect ratios set.
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeReplacedLogicalHeight):
+        * rendering/RenderBox.h:
+        * rendering/RenderReplaced.cpp:
+        (WebCore::RenderReplaced::computeConstrainedLogicalWidth):
+        (WebCore::RenderReplaced::computeReplacedLogicalWidth):
+        (WebCore::RenderReplaced::computeReplacedLogicalHeight):
+        * rendering/RenderReplaced.h:
+        * rendering/RenderVideo.cpp:
+        (WebCore::RenderVideo::computeReplacedLogicalHeight): Deleted.
+        * rendering/RenderVideo.h:
+        * rendering/svg/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::computeReplacedLogicalWidth):
+        (WebCore::RenderSVGRoot::computeReplacedLogicalHeight):
+        * rendering/svg/RenderSVGRoot.h:
+
</ins><span class="cx"> 2017-03-15  Antoine Quint  &lt;graouts@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Modern Media Controls] Using the arrow keys to navigate in the tracks menu also scrolls the page
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (214009 => 214010)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.cpp        2017-03-15 22:04:50 UTC (rev 214009)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp        2017-03-15 22:09:59 UTC (rev 214010)
</span><span class="lines">@@ -3149,7 +3149,7 @@
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-LayoutUnit RenderBox::computeReplacedLogicalHeight() const
</del><ins>+LayoutUnit RenderBox::computeReplacedLogicalHeight(std::optional&lt;LayoutUnit&gt;) const
</ins><span class="cx"> {
</span><span class="cx">     return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(MainOrPreferredSize, style().logicalHeight()));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.h (214009 => 214010)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.h        2017-03-15 22:04:50 UTC (rev 214009)
+++ trunk/Source/WebCore/rendering/RenderBox.h        2017-03-15 22:09:59 UTC (rev 214010)
</span><span class="lines">@@ -430,7 +430,7 @@
</span><span class="cx">     LayoutUnit computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit logicalHeight) const;
</span><span class="cx"> 
</span><span class="cx">     virtual LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred  = ComputeActual) const;
</span><del>-    virtual LayoutUnit computeReplacedLogicalHeight() const;
</del><ins>+    virtual LayoutUnit computeReplacedLogicalHeight(std::optional&lt;LayoutUnit&gt; estimatedUsedWidth = std::nullopt) const;
</ins><span class="cx"> 
</span><span class="cx">     std::optional&lt;LayoutUnit&gt; computePercentageLogicalHeight(const Length&amp; height) const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderReplacedcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (214009 => 214010)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderReplaced.cpp        2017-03-15 22:04:50 UTC (rev 214009)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp        2017-03-15 22:09:59 UTC (rev 214010)
</span><span class="lines">@@ -408,6 +408,25 @@
</span><span class="cx">     intrinsicRatio = intrinsicSize.width() / intrinsicSize.height();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+LayoutUnit RenderReplaced::computeConstrainedLogicalWidth(ShouldComputePreferred shouldComputePreferred) const
+{
+    if (shouldComputePreferred == ComputePreferred)
+        return computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit(), ComputePreferred);
+
+    // The aforementioned 'constraint equation' used for block-level, non-replaced
+    // elements in normal flow:
+    // 'margin-left' + 'border-left-width' + 'padding-left' + 'width' +
+    // 'padding-right' + 'border-right-width' + 'margin-right' = width of
+    // containing block
+    LayoutUnit logicalWidth = containingBlock()-&gt;availableLogicalWidth();
+    
+    // This solves above equation for 'width' (== logicalWidth).
+    LayoutUnit marginStart = minimumValueForLength(style().marginStart(), logicalWidth);
+    LayoutUnit marginEnd = minimumValueForLength(style().marginEnd(), logicalWidth);
+    logicalWidth = std::max(LayoutUnit(), (logicalWidth - (marginStart + marginEnd + (size().width() - clientWidth()))));
+    return computeReplacedLogicalWidthRespectingMinMaxWidth(logicalWidth, shouldComputePreferred);
+}
+
</ins><span class="cx"> LayoutUnit RenderReplaced::computeReplacedLogicalWidth(ShouldComputePreferred shouldComputePreferred) const
</span><span class="cx"> {
</span><span class="cx">     if (style().logicalWidth().isSpecified() || style().logicalWidth().isIntrinsic())
</span><span class="lines">@@ -421,7 +440,7 @@
</span><span class="cx">     computeAspectRatioInformationForRenderBox(contentRenderer, constrainedSize, intrinsicRatio);
</span><span class="cx"> 
</span><span class="cx">     if (style().logicalWidth().isAuto()) {
</span><del>-        bool computedHeightIsAuto = hasAutoHeightOrContainingBlockWithAutoHeight();
</del><ins>+        bool computedHeightIsAuto = style().logicalHeight().isAuto();
</ins><span class="cx">         bool hasIntrinsicWidth = constrainedSize.width() &gt; 0;
</span><span class="cx"> 
</span><span class="cx">         // If 'height' and 'width' both have computed values of 'auto' and the element also has an intrinsic width, then that intrinsic width is the used value of 'width'.
</span><span class="lines">@@ -434,30 +453,21 @@
</span><span class="cx">             // or if 'width' has a computed value of 'auto', 'height' has some other computed value, and the element does have an intrinsic ratio; then the used value
</span><span class="cx">             // of 'width' is: (used height) * (intrinsic ratio)
</span><span class="cx">             if (intrinsicRatio &amp;&amp; ((computedHeightIsAuto &amp;&amp; !hasIntrinsicWidth &amp;&amp; hasIntrinsicHeight) || !computedHeightIsAuto)) {
</span><del>-                LayoutUnit logicalHeight = computeReplacedLogicalHeight();
</del><ins>+                LayoutUnit estimatedUsedWidth = hasIntrinsicWidth ? LayoutUnit(constrainedSize.width()) : computeConstrainedLogicalWidth(shouldComputePreferred);
+                LayoutUnit logicalHeight = computeReplacedLogicalHeight(std::optional&lt;LayoutUnit&gt;(estimatedUsedWidth));
</ins><span class="cx">                 return computeReplacedLogicalWidthRespectingMinMaxWidth(roundToInt(round(logicalHeight * intrinsicRatio)), shouldComputePreferred);
</span><span class="cx">             }
</span><span class="cx"> 
</span><del>-            // If 'height' and 'width' both have computed values of 'auto' and the element has an intrinsic ratio but no intrinsic height or width, then the used value of
-            // 'width' is undefined in CSS 2.1. However, it is suggested that, if the containing block's width does not itself depend on the replaced element's width, then
-            // the used value of 'width' is calculated from the constraint equation used for block-level, non-replaced elements in normal flow.
-            if (computedHeightIsAuto &amp;&amp; !hasIntrinsicWidth &amp;&amp; !hasIntrinsicHeight) {
-                // The aforementioned 'constraint equation' used for block-level, non-replaced elements in normal flow:
-                // 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containing block
-                LayoutUnit logicalWidth;
-                if (auto* blockWithWidth = firstContainingBlockWithLogicalWidth(this)) {
-                    logicalWidth = blockWithWidth-&gt;computeReplacedLogicalWidthUsing(MainOrPreferredSize, blockWithWidth-&gt;style().logicalWidth());
-                    if (!blockWithWidth-&gt;style().logicalMaxWidth().isMaxContent() &amp;&amp; !blockWithWidth-&gt;style().logicalMinWidth().isMinContent())
-                        logicalWidth = blockWithWidth-&gt;computeReplacedLogicalWidthRespectingMinMaxWidth(logicalWidth, shouldComputePreferred);
-                } else
-                    logicalWidth = containingBlock()-&gt;availableLogicalWidth();
-
-                // This solves above equation for 'width' (== logicalWidth).
-                LayoutUnit marginStart = minimumValueForLength(style().marginStart(), logicalWidth);
-                LayoutUnit marginEnd = minimumValueForLength(style().marginEnd(), logicalWidth);
-                logicalWidth = std::max&lt;LayoutUnit&gt;(0, logicalWidth - (marginStart + marginEnd + (width() - clientWidth())));
-                return computeReplacedLogicalWidthRespectingMinMaxWidth(logicalWidth, shouldComputePreferred);
-            }
</del><ins>+            
+            // If 'height' and 'width' both have computed values of 'auto' and the
+            // element has an intrinsic ratio but no intrinsic height or width, then
+            // the used value of 'width' is undefined in CSS 2.1. However, it is
+            // suggested that, if the containing block's width does not itself depend
+            // on the replaced element's width, then the used value of 'width' is
+            // calculated from the constraint equation used for block-level,
+            // non-replaced elements in normal flow.
+            if (computedHeightIsAuto &amp;&amp; !hasIntrinsicWidth &amp;&amp; !hasIntrinsicHeight)
+                return computeConstrainedLogicalWidth(shouldComputePreferred);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Otherwise, if 'width' has a computed value of 'auto', and the element has an intrinsic width, then that intrinsic width is the used value of 'width'.
</span><span class="lines">@@ -474,7 +484,7 @@
</span><span class="cx">     return computeReplacedLogicalWidthRespectingMinMaxWidth(intrinsicLogicalWidth(), shouldComputePreferred);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-LayoutUnit RenderReplaced::computeReplacedLogicalHeight() const
</del><ins>+LayoutUnit RenderReplaced::computeReplacedLogicalHeight(std::optional&lt;LayoutUnit&gt; estimatedUsedWidth) const
</ins><span class="cx"> {
</span><span class="cx">     // 10.5 Content height: the 'height' property: http://www.w3.org/TR/CSS21/visudet.html#propdef-height
</span><span class="cx">     if (hasReplacedLogicalHeight())
</span><span class="lines">@@ -496,8 +506,10 @@
</span><span class="cx"> 
</span><span class="cx">     // Otherwise, if 'height' has a computed value of 'auto', and the element has an intrinsic ratio then the used value of 'height' is:
</span><span class="cx">     // (used width) / (intrinsic ratio)
</span><del>-    if (intrinsicRatio)
-        return computeReplacedLogicalHeightRespectingMinMaxHeight(roundToInt(round(availableLogicalWidth() / intrinsicRatio)));
</del><ins>+    if (intrinsicRatio) {
+        LayoutUnit usedWidth = estimatedUsedWidth ? estimatedUsedWidth.value() : availableLogicalWidth();
+        return computeReplacedLogicalHeightRespectingMinMaxHeight(roundToInt(round(usedWidth / intrinsicRatio)));
+    }
</ins><span class="cx"> 
</span><span class="cx">     // Otherwise, if 'height' has a computed value of 'auto', and the element has an intrinsic height, then that intrinsic height is the used value of 'height'.
</span><span class="cx">     if (hasIntrinsicHeight)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderReplacedh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderReplaced.h (214009 => 214010)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderReplaced.h        2017-03-15 22:04:50 UTC (rev 214009)
+++ trunk/Source/WebCore/rendering/RenderReplaced.h        2017-03-15 22:09:59 UTC (rev 214010)
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx">     virtual ~RenderReplaced();
</span><span class="cx"> 
</span><span class="cx">     LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred = ComputeActual) const override;
</span><del>-    LayoutUnit computeReplacedLogicalHeight() const override;
</del><ins>+    LayoutUnit computeReplacedLogicalHeight(std::optional&lt;LayoutUnit&gt; estimatedUsedWidth = std::nullopt) const override;
</ins><span class="cx"> 
</span><span class="cx">     LayoutRect replacedContentRect(const LayoutSize&amp; intrinsicSize) const;
</span><span class="cx"> 
</span><span class="lines">@@ -69,6 +69,8 @@
</span><span class="cx">     void willBeDestroyed() override;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><ins>+    LayoutUnit computeConstrainedLogicalWidth(ShouldComputePreferred) const;
+
</ins><span class="cx">     virtual RenderBox* embeddedContentBox() const { return 0; }
</span><span class="cx">     const char* renderName() const override { return &quot;RenderReplaced&quot;; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderVideocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderVideo.cpp (214009 => 214010)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderVideo.cpp        2017-03-15 22:04:50 UTC (rev 214009)
+++ trunk/Source/WebCore/rendering/RenderVideo.cpp        2017-03-15 22:09:59 UTC (rev 214010)
</span><span class="lines">@@ -245,11 +245,6 @@
</span><span class="cx">     return RenderReplaced::computeReplacedLogicalWidth(shouldComputePreferred);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-LayoutUnit RenderVideo::computeReplacedLogicalHeight() const
-{
-    return RenderReplaced::computeReplacedLogicalHeight();
-}
-
</del><span class="cx"> LayoutUnit RenderVideo::minimumReplacedHeight() const 
</span><span class="cx"> {
</span><span class="cx">     return RenderReplaced::minimumReplacedHeight(); 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderVideoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderVideo.h (214009 => 214010)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderVideo.h        2017-03-15 22:04:50 UTC (rev 214009)
+++ trunk/Source/WebCore/rendering/RenderVideo.h        2017-03-15 22:09:59 UTC (rev 214010)
</span><span class="lines">@@ -71,7 +71,6 @@
</span><span class="cx">     void layout() final;
</span><span class="cx"> 
</span><span class="cx">     LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred  = ComputeActual) const final;
</span><del>-    LayoutUnit computeReplacedLogicalHeight() const final;
</del><span class="cx">     LayoutUnit minimumReplacedHeight() const final;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgRenderSVGRootcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (214009 => 214010)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp        2017-03-15 22:04:50 UTC (rev 214009)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp        2017-03-15 22:09:59 UTC (rev 214010)
</span><span class="lines">@@ -125,17 +125,11 @@
</span><span class="cx">     if (isEmbeddedThroughFrameContainingSVGDocument())
</span><span class="cx">         return containingBlock()-&gt;availableLogicalWidth();
</span><span class="cx"> 
</span><del>-    if (style().logicalWidth().isSpecified() || style().logicalMaxWidth().isSpecified())
-        return RenderReplaced::computeReplacedLogicalWidth(shouldComputePreferred);
-
-    if (svgSVGElement().hasIntrinsicWidth())
-        return resolveLengthAttributeForSVG(svgSVGElement().intrinsicWidth(), style().effectiveZoom(), containingBlock()-&gt;availableLogicalWidth());
-
</del><span class="cx">     // SVG embedded via SVGImage (background-image/border-image/etc) / Inline SVG.
</span><span class="cx">     return RenderReplaced::computeReplacedLogicalWidth(shouldComputePreferred);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-LayoutUnit RenderSVGRoot::computeReplacedLogicalHeight() const
</del><ins>+LayoutUnit RenderSVGRoot::computeReplacedLogicalHeight(std::optional&lt;LayoutUnit&gt; estimatedUsedWidth) const
</ins><span class="cx"> {
</span><span class="cx">     // When we're embedded through SVGImage (border-image/background-image/&lt;html:img&gt;/...) we're forced to resize to a specific size.
</span><span class="cx">     if (!m_containerSize.isEmpty())
</span><span class="lines">@@ -144,14 +138,8 @@
</span><span class="cx">     if (isEmbeddedThroughFrameContainingSVGDocument())
</span><span class="cx">         return containingBlock()-&gt;availableLogicalHeight(IncludeMarginBorderPadding);
</span><span class="cx"> 
</span><del>-    if (style().logicalHeight().isSpecified() || style().logicalMaxHeight().isSpecified())
-        return RenderReplaced::computeReplacedLogicalHeight();
-
-    if (svgSVGElement().hasIntrinsicHeight())
-        return resolveLengthAttributeForSVG(svgSVGElement().intrinsicHeight(), style().effectiveZoom(), containingBlock()-&gt;availableLogicalHeight(IncludeMarginBorderPadding).toFloat());
-
</del><span class="cx">     // SVG embedded via SVGImage (background-image/border-image/etc) / Inline SVG.
</span><del>-    return RenderReplaced::computeReplacedLogicalHeight();
</del><ins>+    return RenderReplaced::computeReplacedLogicalHeight(estimatedUsedWidth);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderSVGRoot::layout()
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgRenderSVGRooth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h (214009 => 214010)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h        2017-03-15 22:04:50 UTC (rev 214009)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h        2017-03-15 22:09:59 UTC (rev 214010)
</span><span class="lines">@@ -71,7 +71,7 @@
</span><span class="cx">     const char* renderName() const override { return &quot;RenderSVGRoot&quot;; }
</span><span class="cx"> 
</span><span class="cx">     LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred  = ComputeActual) const override;
</span><del>-    LayoutUnit computeReplacedLogicalHeight() const override;
</del><ins>+    LayoutUnit computeReplacedLogicalHeight(std::optional&lt;LayoutUnit&gt; estimatedUsedWidth = std::nullopt) const override;
</ins><span class="cx">     void layout() override;
</span><span class="cx">     void paintReplaced(PaintInfo&amp;, const LayoutPoint&amp;) override;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>