Diff
Modified: trunk/LayoutTests/ChangeLog (237782 => 237783)
--- trunk/LayoutTests/ChangeLog 2018-11-04 15:44:57 UTC (rev 237782)
+++ trunk/LayoutTests/ChangeLog 2018-11-04 15:46:38 UTC (rev 237783)
@@ -1,5 +1,16 @@
2018-11-04 Zalan Bujtas <za...@apple.com>
+ [LFC][BFC] Add support for percentage height in quirks mode.
+ https://bugs.webkit.org/show_bug.cgi?id=191232
+
+ Reviewed by Antti Koivisto.
+
+ * fast/block/basic/quirk-mode-percent-height-expected.txt: Added.
+ * fast/block/basic/quirk-mode-percent-height.html: Added.
+ * platform/ios/TestExpectations:
+
+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
Added: trunk/LayoutTests/fast/block/basic/quirk-mode-percent-height-expected.txt (0 => 237783)
--- trunk/LayoutTests/fast/block/basic/quirk-mode-percent-height-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/block/basic/quirk-mode-percent-height-expected.txt 2018-11-04 15:46:38 UTC (rev 237783)
@@ -0,0 +1,24 @@
+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
+layer at (8,8) size 202x296 clip at (9,9) size 200x294 scrollWidth 300
+ RenderBlock {DIV} at (0,0) size 202x296 [border: (1px solid #008000)]
+ RenderBlock {DIV} at (1,1) size 300x294
+ RenderBlock {DIV} at (0,0) size 202x294 [border: (1px solid #FF0000)]
+ RenderText {#text} at (1,1) size 182x72
+ text run at (1,1) width 175: "This nested div has percent"
+ text run at (1,19) width 177: "height value and the closest"
+ text run at (1,37) width 182: "block level containing block"
+ text run at (1,55) width 97: "box is the ICB."
+layer at (8,304) size 202x202 clip at (9,305) size 200x200 scrollWidth 300
+ RenderBlock {DIV} at (0,296) size 202x202 [border: (1px solid #008000)]
+ RenderBlock {DIV} at (1,1) size 300x102
+ RenderBlock {DIV} at (0,0) size 202x102 [border: (1px solid #FF0000)]
+ RenderText {#text} at (1,1) size 182x90
+ text run at (1,1) width 175: "This nested div has percent"
+ text run at (1,19) width 177: "height value and the closest"
+ text run at (1,37) width 182: "block level containing block"
+ text run at (1,55) width 168: "box is 2 containing blocks"
+ text run at (1,73) width 37: "away."
Added: trunk/LayoutTests/fast/block/basic/quirk-mode-percent-height.html (0 => 237783)
--- trunk/LayoutTests/fast/block/basic/quirk-mode-percent-height.html (rev 0)
+++ trunk/LayoutTests/fast/block/basic/quirk-mode-percent-height.html 2018-11-04 15:46:38 UTC (rev 237783)
@@ -0,0 +1,23 @@
+<style>
+.top {
+ border: 1px solid green;
+ width: 200px;
+ overflow: hidden;
+}
+
+.main {
+ width: 300px;
+}
+
+.nested {
+ border: 1px solid red;
+ display: block;
+ height: 50%;
+ width: 200px;
+}
+
+</style>
+
+<div class=top><div class=main><div class=nested>This nested div has percent height value and the closest block level containing block box is the ICB.</div></div></div>
+
+<div class=top style="height: 200px"><div class=main><div class=nested>This nested div has percent height value and the closest block level containing block box is 2 containing blocks away.</div></div></div>
Modified: trunk/LayoutTests/platform/ios/TestExpectations (237782 => 237783)
--- trunk/LayoutTests/platform/ios/TestExpectations 2018-11-04 15:44:57 UTC (rev 237782)
+++ trunk/LayoutTests/platform/ios/TestExpectations 2018-11-04 15:46:38 UTC (rev 237783)
@@ -3117,6 +3117,7 @@
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 ]
+fast/block/basic/quirk-mode-percent-height.html [ Failure ]
# Datalist
webkit.org/b/186714 fast/forms/datalist/datalist-textinput-keydown.html [ Skip ]
Modified: trunk/Source/WebCore/ChangeLog (237782 => 237783)
--- trunk/Source/WebCore/ChangeLog 2018-11-04 15:44:57 UTC (rev 237782)
+++ trunk/Source/WebCore/ChangeLog 2018-11-04 15:46:38 UTC (rev 237783)
@@ -1,5 +1,22 @@
2018-11-04 Zalan Bujtas <za...@apple.com>
+ [LFC][BFC] Add support for percentage height in quirks mode.
+ https://bugs.webkit.org/show_bug.cgi?id=191232
+
+ Reviewed by Antti Koivisto.
+
+ In quirks mode, we go and travers the containing block chain to find a block level
+ box with fixed height value to resolve the percentage value.
+
+ Test: fast/block/basic/quirk-mode-percent-height.html
+
+ * layout/FormattingContextGeometry.cpp:
+ (WebCore::Layout::FormattingContext::Geometry::computedHeightValue):
+ * layout/Verification.cpp:
+ (WebCore::Layout::LayoutState::verifyAndOutputMismatchingLayoutTree const):
+
+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
Modified: trunk/Source/WebCore/layout/FormattingContextGeometry.cpp (237782 => 237783)
--- trunk/Source/WebCore/layout/FormattingContextGeometry.cpp 2018-11-04 15:44:57 UTC (rev 237782)
+++ trunk/Source/WebCore/layout/FormattingContextGeometry.cpp 2018-11-04 15:46:38 UTC (rev 237783)
@@ -68,12 +68,44 @@
return { height.value() };
std::optional<LayoutUnit> containingBlockHeightValue;
- auto containingBlockHeight = layoutBox.containingBlock()->style().logicalHeight();
- if (containingBlockHeight.isFixed())
- containingBlockHeightValue = { containingBlockHeight.value() };
- else if (layoutBox.isOutOfFlowPositioned()) {
- // Containing block's height is already computed.
+ if (layoutBox.isOutOfFlowPositioned()) {
+ // Containing block's height is already computed since we layout the out-of-flow boxes as the last step.
containingBlockHeightValue = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock()).height();
+ } else {
+ auto computedHeightValueForQuirksMode = [&]() -> LayoutUnit {
+ // In quirks mode, we go and travers the containing block chain to find a block level box with fixed height value, even if it means leaving
+ // the current formatting context. FIXME: surely we need to do some tricks here when block direction support is added.
+ auto* containingBlock = layoutBox.containingBlock();
+ LayoutUnit bodyAndDocumentVerticalMarginsPaddingsAndBorders;
+ while (containingBlock) {
+ auto containingBlockHeight = containingBlock->style().logicalHeight();
+ if (containingBlockHeight.isFixed())
+ return containingBlockHeight.value() - bodyAndDocumentVerticalMarginsPaddingsAndBorders;
+
+ // If the only fixed value box we find is the ICB, then ignore the body and the document (vertical) margin, padding and border. So much quirkiness.
+ // -and it's totally insane because now we freely travel across formatting context boundaries and computed margins are nonexistent.
+ if (containingBlock->isBodyBox() || containingBlock->isDocumentBox()) {
+ auto& displayBox = layoutState.displayBoxForLayoutBox(*containingBlock);
+
+ auto verticalMargins = computedNonCollapsedVerticalMarginValue(layoutState, *containingBlock);
+ auto verticalPaddings = displayBox.paddingTop().value_or(0) + displayBox.paddingBottom().value_or(0);
+ auto verticalBorders = displayBox.borderTop() + displayBox.borderBottom();
+ bodyAndDocumentVerticalMarginsPaddingsAndBorders += verticalMargins.top + verticalMargins.bottom + verticalPaddings + verticalBorders;
+ }
+
+ containingBlock = containingBlock->containingBlock();
+ }
+ // Initial containing block has to have a height.
+ return layoutState.displayBoxForLayoutBox(layoutBox.initialContainingBlock()).contentBox().height() - bodyAndDocumentVerticalMarginsPaddingsAndBorders;
+ };
+
+ if (layoutState.inQuirksMode())
+ containingBlockHeightValue = computedHeightValueForQuirksMode();
+ else {
+ auto containingBlockHeight = layoutBox.containingBlock()->style().logicalHeight();
+ if (containingBlockHeight.isFixed())
+ containingBlockHeightValue = { containingBlockHeight.value() };
+ }
}
if (!containingBlockHeightValue)
Modified: trunk/Tools/ChangeLog (237782 => 237783)
--- trunk/Tools/ChangeLog 2018-11-04 15:44:57 UTC (rev 237782)
+++ trunk/Tools/ChangeLog 2018-11-04 15:46:38 UTC (rev 237783)
@@ -1,5 +1,14 @@
2018-11-04 Zalan Bujtas <za...@apple.com>
+ [LFC][BFC] Add support for percentage height in quirks mode.
+ https://bugs.webkit.org/show_bug.cgi?id=191232
+
+ Reviewed by Antti Koivisto.
+
+ * LayoutReloaded/misc/LFC-passing-tests.txt:
+
+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
Modified: trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt (237782 => 237783)
--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt 2018-11-04 15:44:57 UTC (rev 237782)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt 2018-11-04 15:46:38 UTC (rev 237783)
@@ -71,3 +71,4 @@
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
+fast/block/basic/quirk-mode-percent-height.html