Title: [217943] trunk
Revision
217943
Author
[email protected]
Date
2017-06-08 13:06:44 -0700 (Thu, 08 Jun 2017)

Log Message

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:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (217942 => 217943)


--- trunk/LayoutTests/ChangeLog	2017-06-08 19:13:53 UTC (rev 217942)
+++ trunk/LayoutTests/ChangeLog	2017-06-08 20:06:44 UTC (rev 217943)
@@ -1,3 +1,18 @@
+2017-06-07  Dave Hyatt  <[email protected]>
+
+        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:
+
 2017-06-08  Antoine Quint  <[email protected]>
 
         Rebaseline and enable media/modern-media-controls/fullscreen-button

Modified: trunk/LayoutTests/fast/hidpi/percent-height-image-nested-expected.html (217942 => 217943)


--- 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)
@@ -5,7 +5,7 @@
         img {  max-width:100%; }
         body, html { height:100% }
         html { overflow:hidden }
-        div { width:16.6% }
+        div { width:20.4% }
         </style>
 </head>
 <body>

Modified: trunk/LayoutTests/fast/hidpi/percent-height-image-nested.html (217942 => 217943)


--- 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)
@@ -2,7 +2,7 @@
 <head>
 <style>
 .flex { display: flex }
-img { max-height:80%; max-width:100%; }
+img { max-height:100%; max-width:100%; }
 body, html { height:100% }
 html { overflow:hidden }
 </style>

Added: trunk/LayoutTests/fast/multicol/pagination/RightToLeft-max-width-expected.html (0 => 217943)


--- 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)
@@ -0,0 +1,33 @@
+<!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>

Modified: trunk/LayoutTests/fast/multicol/pagination/RightToLeft-max-width.html (217942 => 217943)


--- 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)
@@ -3,8 +3,9 @@
 <html>
 <head>
     <style>
-        body {
+        html, body {
             -webkit-writing-mode: vertical-rl;
+            width:100%;
         }
         .box {
             height: 50px;

Added: trunk/LayoutTests/fast/replaced/max-height-percent-inside-auto-block-expected.html (0 => 217943)


--- 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)
@@ -0,0 +1,2 @@
+<!doctype html>
+<iframe style="height:4000px;border:5px solid black; box-sizing:border-box"></iframe>

Added: trunk/LayoutTests/fast/replaced/max-height-percent-inside-auto-block.html (0 => 217943)


--- 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)
@@ -0,0 +1,2 @@
+<!doctype html>
+<iframe style="height:4000px;max-height:50%;border:5px solid black; box-sizing:border-box"></iframe>
\ No newline at end of file

Deleted: trunk/LayoutTests/platform/ios/fast/multicol/pagination/RightToLeft-max-width-expected.txt (217942 => 217943)


--- 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)
@@ -1,26 +0,0 @@
-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."

Deleted: trunk/LayoutTests/platform/mac/fast/multicol/pagination/RightToLeft-max-width-expected.png


(Binary files differ)

Deleted: trunk/LayoutTests/platform/mac/fast/multicol/pagination/RightToLeft-max-width-expected.txt (217942 => 217943)


--- 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)
@@ -1,26 +0,0 @@
-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."

Modified: trunk/Source/WebCore/ChangeLog (217942 => 217943)


--- 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)
@@ -1,3 +1,33 @@
+2017-06-07  Dave Hyatt  <[email protected]>
+
+        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.
+
 2017-06-08  Tim Horton  <[email protected]>
 
         Add a borderless mode to <attachment>, and make it respect its layout size

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (217942 => 217943)


--- 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)
@@ -65,6 +65,7 @@
 #include "RenderTableCell.h"
 #include "RenderTheme.h"
 #include "RenderView.h"
+#include "RuntimeApplicationChecks.h"
 #include "ScrollAnimator.h"
 #include "ScrollbarTheme.h"
 #include "StyleScrollSnapPoints.h"
@@ -3126,10 +3127,44 @@
     return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(MainOrPreferredSize, style().logicalHeight()));
 }
 
+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;
+}
+
 LayoutUnit RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit logicalHeight) const
 {
-    LayoutUnit minLogicalHeight = computeReplacedLogicalHeightUsing(MinSize, style().logicalMinHeight());
-    LayoutUnit maxLogicalHeight = style().logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing(MaxSize, style().logicalMaxHeight());
+    LayoutUnit minLogicalHeight;
+    if (!replacedMinMaxLogicalHeightComputesAsNone(MinSize))
+        minLogicalHeight = computeReplacedLogicalHeightUsing(MinSize, style().logicalMinHeight());
+    LayoutUnit maxLogicalHeight = logicalHeight;
+    if (!replacedMinMaxLogicalHeightComputesAsNone(MaxSize))
+        maxLogicalHeight = computeReplacedLogicalHeightUsing(MaxSize, style().logicalMaxHeight());
     return std::max(minLogicalHeight, std::min(logicalHeight, maxLogicalHeight));
 }
 

Modified: trunk/Source/WebCore/rendering/RenderBox.h (217942 => 217943)


--- 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)
@@ -668,6 +668,8 @@
     bool skipContainingBlockForPercentHeightCalculation(const RenderBox& containingBlock, bool isPerpendicularWritingMode) const;
 
 private:
+    bool replacedMinMaxLogicalHeightComputesAsNone(SizeType) const;
+
     void updateShapeOutsideInfoAfterStyleChange(const RenderStyle&, const RenderStyle* oldStyle);
 
     void updateGridPositionAfterStyleChange(const RenderStyle&, const RenderStyle* oldStyle);

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (217942 => 217943)


--- 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)
@@ -298,6 +298,8 @@
     enum ScaleByEffectiveZoomOrNot { ScaleByEffectiveZoom, DoNotScaleByEffectiveZoom };
     LayoutSize calculateImageIntrinsicDimensions(StyleImage*, const LayoutSize& scaledPositioningAreaSize, ScaleByEffectiveZoomOrNot) const;
 
+    RenderBlock* containingBlockForAutoHeightDetection(Length logicalHeight) const;
+
 private:
     LayoutUnit computedCSSPadding(const Length&) const;
     
@@ -325,8 +327,6 @@
         float thickness, float drawThickness, BoxSide, const RenderStyle&,
         Color, EBorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
     void paintMaskForTextFillBox(ImageBuffer*, const IntRect&, InlineFlowBox*, const LayoutRect&);
-    
-    RenderBlock* containingBlockForAutoHeightDetection(Length logicalHeight) const;
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to