<!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>[217943] 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/217943">217943</a></dd>
<dt>Author</dt> <dd>hyatt@apple.com</dd>
<dt>Date</dt> <dd>2017-06-08 13:06:44 -0700 (Thu, 08 Jun 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Laili restaurant menu page does not display full menu
https://bugs.webkit.org/show_bug.cgi?id=173062
rdar://problem/32436486

Reviewed by Simon Fraser.

Source/WebCore:

Percentage heights inside auto containing blocks were handled correctly by
hasReplacedLogicalHeight, which checked hasAutoHeightOrContainingBlockWithAutoHeight
properly. min-max-height were not handled properly though and need to do the same check.
        
There is also now a quirk for iBooks to preserve the old behavior, since they depend
on the old behavior to constrain the height of images to a page.

Test: fast/replaced/max-height-percent-inside-auto-block.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::replacedMinMaxLogicalHeightComputesAsNone):
Add a new helper that resolves min and max logical height values to none for
replaced elements with percentage min/max heights inside auto containing blocks.

(WebCore::RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight):
Change the min/max-height constraint function for replaced elements to call the
new helper function.

* rendering/RenderBox.h:
* rendering/RenderBoxModelObject.h:
Move a function from private to protected so that RenderBox can access it.

LayoutTests:

* fast/hidpi/percent-height-image-nested-expected.html:
* fast/hidpi/percent-height-image-nested.html:
* fast/multicol/pagination/RightToLeft-max-width.html:
* fast/replaced/max-height-percent-inside-auto-block-expected.html: Added.
* fast/replaced/max-height-percent-inside-auto-block.html: Added.
* platform/mac/fast/multicol/pagination/RightToLeft-max-width-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfasthidpipercentheightimagenestedexpectedhtml">trunk/LayoutTests/fast/hidpi/percent-height-image-nested-expected.html</a></li>
<li><a href="#trunkLayoutTestsfasthidpipercentheightimagenestedhtml">trunk/LayoutTests/fast/hidpi/percent-height-image-nested.html</a></li>
<li><a href="#trunkLayoutTestsfastmulticolpaginationRightToLeftmaxwidthhtml">trunk/LayoutTests/fast/multicol/pagination/RightToLeft-max-width.html</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="#trunkSourceWebCorerenderingRenderBoxModelObjecth">trunk/Source/WebCore/rendering/RenderBoxModelObject.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastmulticolpaginationRightToLeftmaxwidthexpectedhtml">trunk/LayoutTests/fast/multicol/pagination/RightToLeft-max-width-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastreplacedmaxheightpercentinsideautoblockexpectedhtml">trunk/LayoutTests/fast/replaced/max-height-percent-inside-auto-block-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastreplacedmaxheightpercentinsideautoblockhtml">trunk/LayoutTests/fast/replaced/max-height-percent-inside-auto-block.html</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsplatformiosfastmulticolpaginationRightToLeftmaxwidthexpectedtxt">trunk/LayoutTests/platform/ios/fast/multicol/pagination/RightToLeft-max-width-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastmulticolpaginationRightToLeftmaxwidthexpectedpng">trunk/LayoutTests/platform/mac/fast/multicol/pagination/RightToLeft-max-width-expected.png</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastmulticolpaginationRightToLeftmaxwidthexpectedtxt">trunk/LayoutTests/platform/mac/fast/multicol/pagination/RightToLeft-max-width-expected.txt</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (217942 => 217943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2017-06-08 19:13:53 UTC (rev 217942)
+++ trunk/LayoutTests/ChangeLog 2017-06-08 20:06:44 UTC (rev 217943)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2017-06-07  Dave Hyatt  <hyatt@apple.com>
+
+        Laili restaurant menu page does not display full menu
+        https://bugs.webkit.org/show_bug.cgi?id=173062
+        rdar://problem/32436486
+
+        Reviewed by Simon Fraser.
+
+        * fast/hidpi/percent-height-image-nested-expected.html:
+        * fast/hidpi/percent-height-image-nested.html:
+        * fast/multicol/pagination/RightToLeft-max-width.html:
+        * fast/replaced/max-height-percent-inside-auto-block-expected.html: Added.
+        * fast/replaced/max-height-percent-inside-auto-block.html: Added.
+        * platform/mac/fast/multicol/pagination/RightToLeft-max-width-expected.txt:
+
</ins><span class="cx"> 2017-06-08  Antoine Quint  <graouts@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Rebaseline and enable media/modern-media-controls/fullscreen-button
</span></span></pre></div>
<a id="trunkLayoutTestsfasthidpipercentheightimagenestedexpectedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/hidpi/percent-height-image-nested-expected.html (217942 => 217943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/hidpi/percent-height-image-nested-expected.html   2017-06-08 19:13:53 UTC (rev 217942)
+++ trunk/LayoutTests/fast/hidpi/percent-height-image-nested-expected.html      2017-06-08 20:06:44 UTC (rev 217943)
</span><span class="lines">@@ -5,7 +5,7 @@
</span><span class="cx">         img {  max-width:100%; }
</span><span class="cx">         body, html { height:100% }
</span><span class="cx">         html { overflow:hidden }
</span><del>-        div { width:16.6% }
</del><ins>+        div { width:20.4% }
</ins><span class="cx">         </style>
</span><span class="cx"> </head>
</span><span class="cx"> <body>
</span></span></pre></div>
<a id="trunkLayoutTestsfasthidpipercentheightimagenestedhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/hidpi/percent-height-image-nested.html (217942 => 217943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/hidpi/percent-height-image-nested.html    2017-06-08 19:13:53 UTC (rev 217942)
+++ trunk/LayoutTests/fast/hidpi/percent-height-image-nested.html       2017-06-08 20:06:44 UTC (rev 217943)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx"> <head>
</span><span class="cx"> <style>
</span><span class="cx"> .flex { display: flex }
</span><del>-img { max-height:80%; max-width:100%; }
</del><ins>+img { max-height:100%; max-width:100%; }
</ins><span class="cx"> body, html { height:100% }
</span><span class="cx"> html { overflow:hidden }
</span><span class="cx"> </style>
</span></span></pre></div>
<a id="trunkLayoutTestsfastmulticolpaginationRightToLeftmaxwidthexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/multicol/pagination/RightToLeft-max-width-expected.html (0 => 217943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/multicol/pagination/RightToLeft-max-width-expected.html                           (rev 0)
+++ trunk/LayoutTests/fast/multicol/pagination/RightToLeft-max-width-expected.html      2017-06-08 20:06:44 UTC (rev 217943)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        html, body {
+            -webkit-writing-mode: vertical-rl;
+            width:100%;
+        }
+        .box {
+            height: 50px;
+            width: 50px;
+            background-color: blue;
+        }
+        .box.changed {
+            background-color: green;
+        }
+    </style>
+    <script>
+        if (window.internals)
+            internals.setPagination("RightToLeftPaginated", 20, 180);
+    </script>
+</head>
+<body>
+
+<p>1 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p>
+
+<img style="display:block; width:100%; height:100px;background-color:lime">
+<div class="box" onclick="this.classList.toggle('changed')"></div>
+<p>2 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </p>
+</div>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastmulticolpaginationRightToLeftmaxwidthhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/multicol/pagination/RightToLeft-max-width.html (217942 => 217943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/multicol/pagination/RightToLeft-max-width.html    2017-06-08 19:13:53 UTC (rev 217942)
+++ trunk/LayoutTests/fast/multicol/pagination/RightToLeft-max-width.html       2017-06-08 20:06:44 UTC (rev 217943)
</span><span class="lines">@@ -3,8 +3,9 @@
</span><span class="cx"> <html>
</span><span class="cx"> <head>
</span><span class="cx">     <style>
</span><del>-        body {
</del><ins>+        html, body {
</ins><span class="cx">             -webkit-writing-mode: vertical-rl;
</span><ins>+            width:100%;
</ins><span class="cx">         }
</span><span class="cx">         .box {
</span><span class="cx">             height: 50px;
</span></span></pre></div>
<a id="trunkLayoutTestsfastreplacedmaxheightpercentinsideautoblockexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/replaced/max-height-percent-inside-auto-block-expected.html (0 => 217943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/replaced/max-height-percent-inside-auto-block-expected.html                               (rev 0)
+++ trunk/LayoutTests/fast/replaced/max-height-percent-inside-auto-block-expected.html  2017-06-08 20:06:44 UTC (rev 217943)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+<!doctype html>
+<iframe style="height:4000px;border:5px solid black; box-sizing:border-box"></iframe>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastreplacedmaxheightpercentinsideautoblockhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/replaced/max-height-percent-inside-auto-block.html (0 => 217943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/replaced/max-height-percent-inside-auto-block.html                                (rev 0)
+++ trunk/LayoutTests/fast/replaced/max-height-percent-inside-auto-block.html   2017-06-08 20:06:44 UTC (rev 217943)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+<!doctype html>
+<iframe style="height:4000px;max-height:50%;border:5px solid black; box-sizing:border-box"></iframe>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiosfastmulticolpaginationRightToLeftmaxwidthexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/platform/ios/fast/multicol/pagination/RightToLeft-max-width-expected.txt (217942 => 217943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios/fast/multicol/pagination/RightToLeft-max-width-expected.txt       2017-06-08 19:13:53 UTC (rev 217942)
+++ trunk/LayoutTests/platform/ios/fast/multicol/pagination/RightToLeft-max-width-expected.txt  2017-06-08 20:06:44 UTC (rev 217943)
</span><span class="lines">@@ -1,26 +0,0 @@
</span><del>-layer at (0,0) size 800x600
-  RenderView at (0,0) size 800x600
-    RenderMultiColumnSet at (0,0) size 800x600
-layer at (224,0) size 576x600
-  RenderMultiColumnFlowThread at (0,0) size 576x600
-layer at (224,0) size 576x600
-  RenderBlock {HTML} at (0,0) size 576x600
-    RenderBody {BODY} at (16,8) size 544x584
-      RenderBlock {P} at (0,0) size 120x584
-        RenderText {#text} at (0,0) size 119x560
-          text run at (0,0) width 527: "1 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor"
-          text run at (20,0) width 539: "incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud"
-          text run at (40,0) width 547: "exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure"
-          text run at (60,0) width 526: "dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."
-          text run at (80,0) width 560: "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit"
-          text run at (100,0) width 132: "anim id est laborum."
-      RenderImage {IMG} at (164,0) size 180x100 [bgcolor=#00FF00]
-      RenderBlock {DIV} at (344,0) size 50x50 [bgcolor=#0000FF]
-      RenderBlock {P} at (410,0) size 134x584
-        RenderText {#text} at (0,0) size 133x560
-          text run at (0,0) width 527: "2 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor"
-          text run at (20,0) width 539: "incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud"
-          text run at (40,0) width 547: "exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure"
-          text run at (60,0) width 526: "dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."
-          text run at (80,0) width 560: "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit"
-          text run at (114,0) width 132: "anim id est laborum."
</del></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastmulticolpaginationRightToLeftmaxwidthexpectedpng"></a>
<div class="binary"><h4>Deleted: trunk/LayoutTests/platform/mac/fast/multicol/pagination/RightToLeft-max-width-expected.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastmulticolpaginationRightToLeftmaxwidthexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/platform/mac/fast/multicol/pagination/RightToLeft-max-width-expected.txt (217942 => 217943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/multicol/pagination/RightToLeft-max-width-expected.txt       2017-06-08 19:13:53 UTC (rev 217942)
+++ trunk/LayoutTests/platform/mac/fast/multicol/pagination/RightToLeft-max-width-expected.txt  2017-06-08 20:06:44 UTC (rev 217943)
</span><span class="lines">@@ -1,26 +0,0 @@
</span><del>-layer at (0,0) size 800x600
-  RenderView at (0,0) size 800x600
-    RenderMultiColumnSet at (0,0) size 800x600
-layer at (250,0) size 550x600
-  RenderMultiColumnFlowThread at (0,0) size 550x600
-layer at (250,0) size 550x600
-  RenderBlock {HTML} at (0,0) size 550x600
-    RenderBody {BODY} at (16,8) size 518x584
-      RenderBlock {P} at (0,0) size 108x584
-        RenderText {#text} at (0,0) size 108x559
-          text run at (0,0) width 527: "1 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor"
-          text run at (18,0) width 539: "incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud"
-          text run at (36,0) width 547: "exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure"
-          text run at (54,0) width 526: "dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."
-          text run at (72,0) width 559: "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit"
-          text run at (90,0) width 132: "anim id est laborum."
-      RenderImage {IMG} at (164,0) size 180x100 [bgcolor=#00FF00]
-      RenderBlock {DIV} at (344,0) size 50x50 [bgcolor=#0000FF]
-      RenderBlock {P} at (410,0) size 108x584
-        RenderText {#text} at (0,0) size 108x559
-          text run at (0,0) width 527: "2 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor"
-          text run at (18,0) width 539: "incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud"
-          text run at (36,0) width 547: "exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure"
-          text run at (54,0) width 526: "dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."
-          text run at (72,0) width 559: "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit"
-          text run at (90,0) width 132: "anim id est laborum."
</del></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (217942 => 217943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2017-06-08 19:13:53 UTC (rev 217942)
+++ trunk/Source/WebCore/ChangeLog      2017-06-08 20:06:44 UTC (rev 217943)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2017-06-07  Dave Hyatt  <hyatt@apple.com>
+
+        Laili restaurant menu page does not display full menu
+        https://bugs.webkit.org/show_bug.cgi?id=173062
+        rdar://problem/32436486
+
+        Reviewed by Simon Fraser.
+
+        Percentage heights inside auto containing blocks were handled correctly by
+        hasReplacedLogicalHeight, which checked hasAutoHeightOrContainingBlockWithAutoHeight
+        properly. min-max-height were not handled properly though and need to do the same check.
+        
+        There is also now a quirk for iBooks to preserve the old behavior, since they depend
+        on the old behavior to constrain the height of images to a page.
+
+        Test: fast/replaced/max-height-percent-inside-auto-block.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::replacedMinMaxLogicalHeightComputesAsNone):
+        Add a new helper that resolves min and max logical height values to none for
+        replaced elements with percentage min/max heights inside auto containing blocks.
+
+        (WebCore::RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight):
+        Change the min/max-height constraint function for replaced elements to call the
+        new helper function.
+
+        * rendering/RenderBox.h:
+        * rendering/RenderBoxModelObject.h:
+        Move a function from private to protected so that RenderBox can access it.
+
</ins><span class="cx"> 2017-06-08  Tim Horton  <timothy_horton@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Add a borderless mode to <attachment>, and make it respect its layout size
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (217942 => 217943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.cpp     2017-06-08 19:13:53 UTC (rev 217942)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp        2017-06-08 20:06:44 UTC (rev 217943)
</span><span class="lines">@@ -65,6 +65,7 @@
</span><span class="cx"> #include "RenderTableCell.h"
</span><span class="cx"> #include "RenderTheme.h"
</span><span class="cx"> #include "RenderView.h"
</span><ins>+#include "RuntimeApplicationChecks.h"
</ins><span class="cx"> #include "ScrollAnimator.h"
</span><span class="cx"> #include "ScrollbarTheme.h"
</span><span class="cx"> #include "StyleScrollSnapPoints.h"
</span><span class="lines">@@ -3126,10 +3127,44 @@
</span><span class="cx">     return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(MainOrPreferredSize, style().logicalHeight()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static bool allowMinMaxPercentagesInAutoHeightBlocksQuirk()
+{
+#if PLATFORM(MAC)
+    return MacApplication::isIBooks();
+#elif PLATFORM(IOS)
+    return IOSApplication::isIBooks();
+#endif
+    return false;
+}
+
+bool RenderBox::replacedMinMaxLogicalHeightComputesAsNone(SizeType sizeType) const
+{
+    ASSERT(sizeType == MinSize || sizeType == MaxSize);
+    
+    auto logicalHeight = sizeType == MinSize ? style().logicalMinHeight() : style().logicalMaxHeight();
+    auto initialLogicalHeight = sizeType == MinSize ? RenderStyle::initialMinSize() : RenderStyle::initialMaxSize();
+    
+    if (logicalHeight == initialLogicalHeight)
+        return true;
+    
+    // Make sure % min-height and % max-height resolve to none if the containing block has auto height.
+    // Note that the "height" case for replaced elements was handled by hasReplacedLogicalHeight, which is why
+    // min and max-height are the only ones handled here.
+    // FIXME: For now we put in a quirk for iBooks until we can move them to viewport units.
+    if (auto* cb = containingBlockForAutoHeightDetection(logicalHeight))
+        return allowMinMaxPercentagesInAutoHeightBlocksQuirk() ? false : cb->hasAutoHeightOrContainingBlockWithAutoHeight();
+
+    return false;
+}
+
</ins><span class="cx"> LayoutUnit RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit logicalHeight) const
</span><span class="cx"> {
</span><del>-    LayoutUnit minLogicalHeight = computeReplacedLogicalHeightUsing(MinSize, style().logicalMinHeight());
-    LayoutUnit maxLogicalHeight = style().logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing(MaxSize, style().logicalMaxHeight());
</del><ins>+    LayoutUnit minLogicalHeight;
+    if (!replacedMinMaxLogicalHeightComputesAsNone(MinSize))
+        minLogicalHeight = computeReplacedLogicalHeightUsing(MinSize, style().logicalMinHeight());
+    LayoutUnit maxLogicalHeight = logicalHeight;
+    if (!replacedMinMaxLogicalHeightComputesAsNone(MaxSize))
+        maxLogicalHeight = computeReplacedLogicalHeightUsing(MaxSize, style().logicalMaxHeight());
</ins><span class="cx">     return std::max(minLogicalHeight, std::min(logicalHeight, maxLogicalHeight));
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.h (217942 => 217943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.h       2017-06-08 19:13:53 UTC (rev 217942)
+++ trunk/Source/WebCore/rendering/RenderBox.h  2017-06-08 20:06:44 UTC (rev 217943)
</span><span class="lines">@@ -668,6 +668,8 @@
</span><span class="cx">     bool skipContainingBlockForPercentHeightCalculation(const RenderBox& containingBlock, bool isPerpendicularWritingMode) const;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><ins>+    bool replacedMinMaxLogicalHeightComputesAsNone(SizeType) const;
+
</ins><span class="cx">     void updateShapeOutsideInfoAfterStyleChange(const RenderStyle&, const RenderStyle* oldStyle);
</span><span class="cx"> 
</span><span class="cx">     void updateGridPositionAfterStyleChange(const RenderStyle&, const RenderStyle* oldStyle);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxModelObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (217942 => 217943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h    2017-06-08 19:13:53 UTC (rev 217942)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h       2017-06-08 20:06:44 UTC (rev 217943)
</span><span class="lines">@@ -298,6 +298,8 @@
</span><span class="cx">     enum ScaleByEffectiveZoomOrNot { ScaleByEffectiveZoom, DoNotScaleByEffectiveZoom };
</span><span class="cx">     LayoutSize calculateImageIntrinsicDimensions(StyleImage*, const LayoutSize& scaledPositioningAreaSize, ScaleByEffectiveZoomOrNot) const;
</span><span class="cx"> 
</span><ins>+    RenderBlock* containingBlockForAutoHeightDetection(Length logicalHeight) const;
+
</ins><span class="cx"> private:
</span><span class="cx">     LayoutUnit computedCSSPadding(const Length&) const;
</span><span class="cx">     
</span><span class="lines">@@ -325,8 +327,6 @@
</span><span class="cx">         float thickness, float drawThickness, BoxSide, const RenderStyle&,
</span><span class="cx">         Color, EBorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
</span><span class="cx">     void paintMaskForTextFillBox(ImageBuffer*, const IntRect&, InlineFlowBox*, const LayoutRect&);
</span><del>-    
-    RenderBlock* containingBlockForAutoHeightDetection(Length logicalHeight) const;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre>
</div>
</div>

</body>
</html>