Title: [238613] trunk
- Revision
- 238613
- Author
- [email protected]
- Date
- 2018-11-28 09:17:28 -0800 (Wed, 28 Nov 2018)
Log Message
[LFC][Quirk] Use non-collapsed vertical margin values when the container is stretched to the size of the ICB.
https://bugs.webkit.org/show_bug.cgi?id=192078
Reviewed by Antti Koivisto.
Source/WebCore:
This quirk happens when the body height is 0 which means its vertical margins collapse through (top and bottom margins are adjoining).
However now that we stretch the body they don't collapse through anymore, so we need to use the non-collapsed values instead.
* layout/LayoutUnits.h:
(WebCore::Layout::HeightAndMargin::usedMarginValues const):
* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::stretchHeightToInitialContainingBlock):
Tools:
* LayoutReloaded/misc/LFC-passing-tests.txt:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (238612 => 238613)
--- trunk/Source/WebCore/ChangeLog 2018-11-28 16:50:40 UTC (rev 238612)
+++ trunk/Source/WebCore/ChangeLog 2018-11-28 17:17:28 UTC (rev 238613)
@@ -1,5 +1,20 @@
2018-11-28 Zalan Bujtas <[email protected]>
+ [LFC][Quirk] Use non-collapsed vertical margin values when the container is stretched to the size of the ICB.
+ https://bugs.webkit.org/show_bug.cgi?id=192078
+
+ Reviewed by Antti Koivisto.
+
+ This quirk happens when the body height is 0 which means its vertical margins collapse through (top and bottom margins are adjoining).
+ However now that we stretch the body they don't collapse through anymore, so we need to use the non-collapsed values instead.
+
+ * layout/LayoutUnits.h:
+ (WebCore::Layout::HeightAndMargin::usedMarginValues const):
+ * layout/blockformatting/BlockFormattingContextGeometry.cpp:
+ (WebCore::Layout::stretchHeightToInitialContainingBlock):
+
+2018-11-28 Zalan Bujtas <[email protected]>
+
[LFC] Add support for quirk container's collapsing top margin in quirks mode.
https://bugs.webkit.org/show_bug.cgi?id=192070
Modified: trunk/Source/WebCore/layout/LayoutUnits.h (238612 => 238613)
--- trunk/Source/WebCore/layout/LayoutUnits.h 2018-11-28 16:50:40 UTC (rev 238612)
+++ trunk/Source/WebCore/layout/LayoutUnits.h 2018-11-28 17:17:28 UTC (rev 238613)
@@ -106,6 +106,8 @@
};
struct HeightAndMargin {
+ VerticalEdges usedMarginValues() const { return collapsedMargin.value_or(margin); }
+
LayoutUnit height;
VerticalEdges margin;
std::optional<VerticalEdges> collapsedMargin;
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp (238612 => 238613)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp 2018-11-28 16:50:40 UTC (rev 238612)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp 2018-11-28 17:17:28 UTC (rev 238613)
@@ -58,12 +58,16 @@
return layoutBox.style().logicalHeight().isAuto();
}
-static HeightAndMargin stretchHeightToInitialContainingBlock(HeightAndMargin heightAndMargin, LayoutUnit initialContainingBlockHeight)
+static HeightAndMargin stretchHeightToInitialContainingBlockQuirk(HeightAndMargin heightAndMargin, LayoutUnit initialContainingBlockHeight)
{
- auto verticalMargins = heightAndMargin.margin.top + heightAndMargin.margin.bottom;
+ // This quirk happens when the body height is 0 which means its vertical margins collapse through (top and bottom margins are adjoining).
+ // However now that we stretch the body they don't collapse through anymore, so we need to use the non-collapsed values instead.
+ ASSERT(initialContainingBlockHeight);
+ auto verticalMargins = heightAndMargin.height ? heightAndMargin.usedMarginValues() : heightAndMargin.margin;
+ auto totalVerticalMargins = verticalMargins.top + verticalMargins.bottom;
// Stretch but never overstretch with the margins.
- if (heightAndMargin.height + verticalMargins < initialContainingBlockHeight)
- heightAndMargin.height = initialContainingBlockHeight - verticalMargins;
+ if (heightAndMargin.height + totalVerticalMargins < initialContainingBlockHeight)
+ heightAndMargin.height = initialContainingBlockHeight - totalVerticalMargins;
return heightAndMargin;
}
@@ -310,7 +314,7 @@
return heightAndMargin;
auto initialContainingBlockHeight = layoutState.displayBoxForLayoutBox(initialContainingBlock(layoutBox)).contentBoxHeight();
- heightAndMargin = stretchHeightToInitialContainingBlock(heightAndMargin, initialContainingBlockHeight);
+ heightAndMargin = stretchHeightToInitialContainingBlockQuirk(heightAndMargin, initialContainingBlockHeight);
LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> inflow non-replaced -> streched to viewport -> height(" << heightAndMargin.height << "px) margin(" << heightAndMargin.margin.top << "px, " << heightAndMargin.margin.bottom << "px) -> layoutBox(" << &layoutBox << ")");
return heightAndMargin;
Modified: trunk/Tools/ChangeLog (238612 => 238613)
--- trunk/Tools/ChangeLog 2018-11-28 16:50:40 UTC (rev 238612)
+++ trunk/Tools/ChangeLog 2018-11-28 17:17:28 UTC (rev 238613)
@@ -1,5 +1,14 @@
2018-11-28 Zalan Bujtas <[email protected]>
+ [LFC][Quirk] Use non-collapsed vertical margin values when the container is stretched to the size of the ICB.
+ https://bugs.webkit.org/show_bug.cgi?id=192078
+
+ Reviewed by Antti Koivisto.
+
+ * LayoutReloaded/misc/LFC-passing-tests.txt:
+
+2018-11-28 Zalan Bujtas <[email protected]>
+
[LFC] Add support for quirk container's collapsing top margin in quirks mode.
https://bugs.webkit.org/show_bug.cgi?id=192070
Modified: trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt (238612 => 238613)
--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt 2018-11-28 16:50:40 UTC (rev 238612)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt 2018-11-28 17:17:28 UTC (rev 238613)
@@ -96,3 +96,43 @@
fast/block/basic/012.html
fast/block/margin-collapse/002.html
fast/block/margin-collapse/003.html
+fast/block/positioning/004.html
+fast/block/positioning/005.html
+fast/block/positioning/006.html
+fast/block/positioning/007.html
+fast/block/positioning/008.html
+fast/block/positioning/009.html
+fast/block/positioning/010.html
+fast/block/positioning/011.html
+fast/block/positioning/012.html
+fast/block/positioning/013.html
+fast/block/positioning/014.html
+fast/block/positioning/015.html
+fast/block/positioning/016.html
+fast/block/positioning/017.html
+fast/block/positioning/018.html
+fast/block/positioning/019.html
+fast/block/positioning/020.html
+fast/block/positioning/021.html
+fast/block/positioning/022.html
+fast/block/positioning/023.html
+fast/block/positioning/024.html
+fast/block/positioning/025.html
+fast/block/positioning/032.html
+fast/block/positioning/033.html
+fast/block/positioning/034.html
+fast/block/positioning/035.html
+fast/block/positioning/036.html
+fast/block/positioning/037.html
+fast/block/positioning/038.html
+fast/block/positioning/039.html
+fast/block/positioning/040.html
+fast/block/positioning/041.html
+fast/block/positioning/042.html
+fast/block/positioning/043.html
+fast/block/positioning/044.html
+fast/block/positioning/045.html
+fast/block/positioning/046.html
+fast/block/positioning/049.html
+fast/block/positioning/052.html
+fast/block/positioning/054.html
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes