Title: [237782] trunk
Revision
237782
Author
za...@apple.com
Date
2018-11-04 07:44:57 -0800 (Sun, 04 Nov 2018)

Log Message

[LFC][BCF] Add support for block level non-replaced inflow height percentage
https://bugs.webkit.org/show_bug.cgi?id=191229

Reviewed by Antti Koivisto.

Source/WebCore:

Test: fast/block/basic/child-block-level-box-with-height-percent.html

* layout/FormattingContext.h:
* layout/FormattingContextGeometry.cpp:
(WebCore::Layout::FormattingContext::Geometry::computedHeightValue):
(WebCore::Layout::computedHeightValue): Deleted.
* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):

Tools:

* LayoutReloaded/misc/LFC-passing-tests.txt:

LayoutTests:

* fast/block/basic/child-block-level-box-with-height-percent-expected.txt: Added.
* fast/block/basic/child-block-level-box-with-height-percent.html: Added.
* platform/ios/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (237781 => 237782)


--- trunk/LayoutTests/ChangeLog	2018-11-04 15:30:31 UTC (rev 237781)
+++ trunk/LayoutTests/ChangeLog	2018-11-04 15:44:57 UTC (rev 237782)
@@ -1,3 +1,14 @@
+2018-11-04  Zalan Bujtas  <za...@apple.com>
+
+        [LFC][BCF] Add support for block level non-replaced inflow height percentage
+        https://bugs.webkit.org/show_bug.cgi?id=191229
+
+        Reviewed by Antti Koivisto.
+
+        * fast/block/basic/child-block-level-box-with-height-percent-expected.txt: Added.
+        * fast/block/basic/child-block-level-box-with-height-percent.html: Added.
+        * platform/ios/TestExpectations:
+
 2018-11-03  Devin Rousso  <drou...@apple.com>
 
         Web Inspector: Canvas: capture changes to <canvas> that would affect the recorded context

Added: trunk/LayoutTests/fast/block/basic/child-block-level-box-with-height-percent-expected.txt (0 => 237782)


--- trunk/LayoutTests/fast/block/basic/child-block-level-box-with-height-percent-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/block/basic/child-block-level-box-with-height-percent-expected.txt	2018-11-04 15:44:57 UTC (rev 237782)
@@ -0,0 +1,16 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {DIV} at (0,0) size 300x300
+        RenderBlock (anonymous) at (0,0) size 300x18
+          RenderText {#text} at (0,0) size 132x18
+            text run at (0,0) width 132: "block level box with"
+        RenderBlock {DIV} at (0,18) size 152x152 [border: (1px solid #FF0000)]
+          RenderText {#text} at (1,1) size 40x18
+            text run at (1,1) width 40: "height"
+        RenderBlock (anonymous) at (0,170) size 300x36
+          RenderText {#text} at (0,0) size 259x36
+            text run at (0,0) width 259: "percent when containing block has fixed"
+            text run at (0,18) width 44: "height."

Added: trunk/LayoutTests/fast/block/basic/child-block-level-box-with-height-percent.html (0 => 237782)


--- trunk/LayoutTests/fast/block/basic/child-block-level-box-with-height-percent.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/basic/child-block-level-box-with-height-percent.html	2018-11-04 15:44:57 UTC (rev 237782)
@@ -0,0 +1,16 @@
+<style>
+#main {
+	width: 300px;
+	height: 300px;
+}
+
+#nested {
+	border: 1px solid red;
+	display: block;
+	height: 50%;
+	width: 50%;
+}
+
+</style>
+
+<div id=main>block level box with<div id=nested>height </div>percent when containing block has fixed height.</div>

Modified: trunk/LayoutTests/platform/ios/TestExpectations (237781 => 237782)


--- trunk/LayoutTests/platform/ios/TestExpectations	2018-11-04 15:30:31 UTC (rev 237781)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2018-11-04 15:44:57 UTC (rev 237782)
@@ -3116,6 +3116,7 @@
 fast/inline/simple-inline-block.html [ Failure ]
 fast/inline/simple-shrink-to-fit-inline-block.html [ Failure ]
 fast/block/basic/height-percentage-simple.html [ Failure ]
+fast/block/basic/child-block-level-box-with-height-percent.html [ Failure ]
 
 # Datalist
 webkit.org/b/186714 fast/forms/datalist/datalist-textinput-keydown.html [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (237781 => 237782)


--- trunk/Source/WebCore/ChangeLog	2018-11-04 15:30:31 UTC (rev 237781)
+++ trunk/Source/WebCore/ChangeLog	2018-11-04 15:44:57 UTC (rev 237782)
@@ -1,3 +1,19 @@
+2018-11-04  Zalan Bujtas  <za...@apple.com>
+
+        [LFC][BCF] Add support for block level non-replaced inflow height percentage
+        https://bugs.webkit.org/show_bug.cgi?id=191229
+
+        Reviewed by Antti Koivisto.
+
+        Test: fast/block/basic/child-block-level-box-with-height-percent.html
+
+        * layout/FormattingContext.h:
+        * layout/FormattingContextGeometry.cpp:
+        (WebCore::Layout::FormattingContext::Geometry::computedHeightValue):
+        (WebCore::Layout::computedHeightValue): Deleted.
+        * layout/blockformatting/BlockFormattingContextGeometry.cpp:
+        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
+
 2018-11-04  Youenn Fablet  <you...@apple.com>
 
         RealtimeOutgoingAudioSource should use DestructionThread::Main

Modified: trunk/Source/WebCore/layout/FormattingContext.h (237781 => 237782)


--- trunk/Source/WebCore/layout/FormattingContext.h	2018-11-04 15:30:31 UTC (rev 237781)
+++ trunk/Source/WebCore/layout/FormattingContext.h	2018-11-04 15:44:57 UTC (rev 237782)
@@ -108,6 +108,10 @@
         static std::optional<LayoutUnit> computedMinHeight(const LayoutState&, const Box&);
         static std::optional<LayoutUnit> computedMaxHeight(const LayoutState&, const Box&);
 
+    protected:
+        enum class HeightType { Min, Max, Normal };
+        static std::optional<LayoutUnit> computedHeightValue(const LayoutState&, const Box&, HeightType);
+
     private:
         static VerticalGeometry outOfFlowReplacedVerticalGeometry(const LayoutState&, const Box&, std::optional<LayoutUnit> usedHeight = { });
         static HorizontalGeometry outOfFlowReplacedHorizontalGeometry(const LayoutState&, const Box&, std::optional<LayoutUnit> usedWidth = { });

Modified: trunk/Source/WebCore/layout/FormattingContextGeometry.cpp (237781 => 237782)


--- trunk/Source/WebCore/layout/FormattingContextGeometry.cpp	2018-11-04 15:30:31 UTC (rev 237781)
+++ trunk/Source/WebCore/layout/FormattingContextGeometry.cpp	2018-11-04 15:44:57 UTC (rev 237782)
@@ -57,8 +57,7 @@
     return false;
 }
 
-enum class HeightType { Min, Max, Normal };
-static inline std::optional<LayoutUnit> computedHeightValue(const LayoutState& layoutState, const Box& layoutBox, HeightType heightType)
+std::optional<LayoutUnit> FormattingContext::Geometry::computedHeightValue(const LayoutState& layoutState, const Box& layoutBox, HeightType heightType)
 {
     auto& style = layoutBox.style();
     auto height = heightType == HeightType::Normal ? style.logicalHeight() : heightType == HeightType::Min ? style.logicalMinHeight() : style.logicalMaxHeight();

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp (237781 => 237782)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp	2018-11-04 15:30:31 UTC (rev 237781)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp	2018-11-04 15:44:57 UTC (rev 237782)
@@ -107,15 +107,10 @@
         VerticalEdges collapsedMargin = { MarginCollapse::marginTop(layoutState, layoutBox), MarginCollapse::marginBottom(layoutState, layoutBox) };
         auto borderAndPaddingTop = displayBox.borderTop() + displayBox.paddingTop().value_or(0);
         
-        auto height = usedHeight ? Length { usedHeight.value(), Fixed } : style.logicalHeight();
-        if (!height.isAuto()) {
-            if (height.isFixed())
-                return { height.value(), nonCollapsedMargin, collapsedMargin };
+        auto height = usedHeight ? usedHeight.value() : computedHeightValue(layoutState, layoutBox, HeightType::Normal);
+        if (height)
+            return { height.value(), nonCollapsedMargin, collapsedMargin };
 
-            // Most notably height percentage.
-            ASSERT_NOT_IMPLEMENTED_YET();
-        }
-
         if (!is<Container>(layoutBox) || !downcast<Container>(layoutBox).hasInFlowChild())
             return { 0, nonCollapsedMargin, collapsedMargin };
 

Modified: trunk/Tools/ChangeLog (237781 => 237782)


--- trunk/Tools/ChangeLog	2018-11-04 15:30:31 UTC (rev 237781)
+++ trunk/Tools/ChangeLog	2018-11-04 15:44:57 UTC (rev 237782)
@@ -1,3 +1,12 @@
+2018-11-04  Zalan Bujtas  <za...@apple.com>
+
+        [LFC][BCF] Add support for block level non-replaced inflow height percentage
+        https://bugs.webkit.org/show_bug.cgi?id=191229
+
+        Reviewed by Antti Koivisto.
+
+        * LayoutReloaded/misc/LFC-passing-tests.txt:
+
 2018-11-02  Zalan Bujtas  <za...@apple.com>
 
         [LFC][BFC] Resolve percentage height values.

Modified: trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt (237781 => 237782)


--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2018-11-04 15:30:31 UTC (rev 237781)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2018-11-04 15:44:57 UTC (rev 237782)
@@ -70,3 +70,4 @@
 fast/inline/simple-inline-block.html
 fast/inline/simple-shrink-to-fit-inline-block.html
 fast/block/basic/height-percentage-simple.html
+fast/block/basic/child-block-level-box-with-height-percent.html
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to