Title: [234546] trunk
Revision
234546
Author
[email protected]
Date
2018-08-03 08:38:10 -0700 (Fri, 03 Aug 2018)

Log Message

[LFC][Floating] Now that the document renderer belongs to "complicated cases", adjust viewport stretching.
https://bugs.webkit.org/show_bug.cgi?id=188306

Reviewed by Antti Koivisto.

Source/WebCore:

And add passing cases for floats.

* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::initialContainingBlock):
(WebCore::Layout::isStretchedToInitialContainingBlock):
(WebCore::Layout::stretchHeightToInitialContainingBlock):
(WebCore::Layout::stretchWidthToInitialContainingBlock):
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
(WebCore::Layout::isStretchedToViewport): Deleted.

Tools:

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (234545 => 234546)


--- trunk/Source/WebCore/ChangeLog	2018-08-03 15:26:13 UTC (rev 234545)
+++ trunk/Source/WebCore/ChangeLog	2018-08-03 15:38:10 UTC (rev 234546)
@@ -1,5 +1,24 @@
 2018-08-03  Zalan Bujtas  <[email protected]>
 
+        [LFC][Floating] Now that the document renderer belongs to "complicated cases", adjust viewport stretching.
+        https://bugs.webkit.org/show_bug.cgi?id=188306
+
+        Reviewed by Antti Koivisto.
+
+        And add passing cases for floats.
+
+        * layout/blockformatting/BlockFormattingContextGeometry.cpp:
+        (WebCore::Layout::initialContainingBlock):
+        (WebCore::Layout::isStretchedToInitialContainingBlock):
+        (WebCore::Layout::stretchHeightToInitialContainingBlock):
+        (WebCore::Layout::stretchWidthToInitialContainingBlock):
+        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
+        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
+        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
+        (WebCore::Layout::isStretchedToViewport): Deleted.
+
+2018-08-03  Zalan Bujtas  <[email protected]>
+
         [LFC] Do not check margin box while validating geometry.
         https://bugs.webkit.org/show_bug.cgi?id=188297
 

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp (234545 => 234546)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp	2018-08-03 15:26:13 UTC (rev 234545)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp	2018-08-03 15:38:10 UTC (rev 234546)
@@ -36,8 +36,16 @@
 namespace WebCore {
 namespace Layout {
 
-static bool isStretchedToViewport(const LayoutContext& layoutContext, const Box& layoutBox)
+static const Container& initialContainingBlock(const Box& layoutBox)
 {
+    auto* containingBlock = layoutBox.containingBlock();
+    while (containingBlock->containingBlock())
+        containingBlock = containingBlock->containingBlock();
+    return *containingBlock;
+}
+
+static bool isStretchedToInitialContainingBlock(const LayoutContext& layoutContext, const Box& layoutBox)
+{
     ASSERT(layoutBox.isInFlow());
     // In quirks mode, body and html stretch to the viewport.
     if (!layoutContext.inQuirksMode())
@@ -49,14 +57,26 @@
     return layoutBox.style().logicalHeight().isAuto();
 }
 
-static const Container& initialContainingBlock(const Box& layoutBox)
+static HeightAndMargin stretchHeightToInitialContainingBlock(HeightAndMargin heightAndMargin, LayoutUnit initialContainingBlockHeight)
 {
-    auto* containingBlock = layoutBox.containingBlock();
-    while (containingBlock->containingBlock())
-        containingBlock = containingBlock->containingBlock();
-    return *containingBlock;
+    auto verticalMargins = heightAndMargin.margin.top + heightAndMargin.margin.bottom;
+    // Stretch but never overstretch with the margins.
+    if (heightAndMargin.height + verticalMargins < initialContainingBlockHeight)
+        heightAndMargin.height = initialContainingBlockHeight - verticalMargins;
+
+    return heightAndMargin;
 }
 
+static WidthAndMargin stretchWidthToInitialContainingBlock(WidthAndMargin widthAndMargin, LayoutUnit initialContainingBlockWidth)
+{
+    auto horizontalMargins = widthAndMargin.margin.left + widthAndMargin.margin.right;
+    // Stretch but never overstretch with the margins.
+    if (widthAndMargin.width + horizontalMargins < initialContainingBlockWidth)
+        widthAndMargin.width = initialContainingBlockWidth - horizontalMargins;
+
+    return widthAndMargin;
+}
+
 HeightAndMargin BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin(LayoutContext& layoutContext, const Box& layoutBox)
 {
     ASSERT(layoutBox.isInFlow() && !layoutBox.replaced());
@@ -129,17 +149,7 @@
 
     auto heightAndMargin = compute();
 
-    if (!isStretchedToViewport(layoutContext, layoutBox)) {
-        LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> inflow non-replaced -> height(" << heightAndMargin.height << "px) margin(" << heightAndMargin.margin.top << "px, " << heightAndMargin.margin.bottom << "px) -> layoutBox(" << &layoutBox << ")");
-        return heightAndMargin;
-    }
-
-    auto initialContainingBlockHeight = layoutContext.displayBoxForLayoutBox(initialContainingBlock(layoutBox))->contentBoxHeight();
-    // Stretch but never overstretch with the margins.
-    if (heightAndMargin.height + heightAndMargin.margin.top + heightAndMargin.margin.bottom < initialContainingBlockHeight)
-        heightAndMargin.height = initialContainingBlockHeight - heightAndMargin.margin.top - heightAndMargin.margin.bottom;
-
-    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 << ")");
+    LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height][Margin] -> inflow non-replaced -> height(" << heightAndMargin.height << "px) margin(" << heightAndMargin.margin.top << "px, " << heightAndMargin.margin.bottom << "px) -> layoutBox(" << &layoutBox << ")");
     return heightAndMargin;
 }
 
@@ -230,16 +240,13 @@
     };
 
     auto widthAndMargin = compute();
-    if (!isStretchedToViewport(layoutContext, layoutBox)) {
+    if (!isStretchedToInitialContainingBlock(layoutContext, layoutBox)) {
         LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> inflow non-replaced -> width(" << widthAndMargin.width << "px) margin(" << widthAndMargin.margin.left << "px, " << widthAndMargin.margin.right << "px) -> layoutBox(" << &layoutBox << ")");
         return widthAndMargin;
     }
 
     auto initialContainingBlockWidth = layoutContext.displayBoxForLayoutBox(initialContainingBlock(layoutBox))->contentBoxWidth();
-    auto horizontalMargins = widthAndMargin.margin.left + widthAndMargin.margin.right;
-    // Stretch but never overstretch with the margins.
-    if (widthAndMargin.width + horizontalMargins < initialContainingBlockWidth)
-        widthAndMargin.width = initialContainingBlockWidth - horizontalMargins;
+    widthAndMargin = stretchWidthToInitialContainingBlock(widthAndMargin, initialContainingBlockWidth);
 
     LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> inflow non-replaced -> streched to viewport-> width(" << widthAndMargin.width << "px) margin(" << widthAndMargin.margin.left << "px, " << widthAndMargin.margin.right << "px) -> layoutBox(" << &layoutBox << ")");
     return widthAndMargin;
@@ -370,13 +377,24 @@
     if (layoutBox.replaced())
         return FormattingContext::Geometry::inlineReplacedHeightAndMargin(layoutContext, layoutBox);
 
+    HeightAndMargin heightAndMargin;
     // TODO: Figure out the case for the document element. Let's just complicated-case it for now.
     if (layoutBox.isOverflowVisible() && !layoutBox.isDocumentBox())
-        return inFlowNonReplacedHeightAndMargin(layoutContext, layoutBox);
+        heightAndMargin = inFlowNonReplacedHeightAndMargin(layoutContext, layoutBox);
+    else {
+        // 10.6.6 Complicated cases
+        // Block-level, non-replaced elements in normal flow when 'overflow' does not compute to 'visible' (except if the 'overflow' property's value has been propagated to the viewport).
+        heightAndMargin = FormattingContext::Geometry::complicatedCases(layoutContext, layoutBox);
+    }
 
-    // 10.6.6 Complicated cases
-    // Block-level, non-replaced elements in normal flow when 'overflow' does not compute to 'visible' (except if the 'overflow' property's value has been propagated to the viewport).
-    return FormattingContext::Geometry::complicatedCases(layoutContext, layoutBox);
+    if (!isStretchedToInitialContainingBlock(layoutContext, layoutBox))
+        return heightAndMargin;
+
+    auto initialContainingBlockHeight = layoutContext.displayBoxForLayoutBox(initialContainingBlock(layoutBox))->contentBoxHeight();
+    heightAndMargin = stretchHeightToInitialContainingBlock(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;
 }
 
 WidthAndMargin BlockFormattingContext::Geometry::inFlowWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox)

Modified: trunk/Tools/ChangeLog (234545 => 234546)


--- trunk/Tools/ChangeLog	2018-08-03 15:26:13 UTC (rev 234545)
+++ trunk/Tools/ChangeLog	2018-08-03 15:38:10 UTC (rev 234546)
@@ -1,3 +1,12 @@
+2018-08-03  Zalan Bujtas  <[email protected]>
+
+        [LFC][Floating] Now that the document renderer belongs to "complicated cases", adjust viewport stretching.
+        https://bugs.webkit.org/show_bug.cgi?id=188306
+
+        Reviewed by Antti Koivisto.
+
+        * LayoutReloaded/misc/LFC-passing-tests.txt:
+
 2018-08-03  Carlos Garcia Campos  <[email protected]>
 
         [WPE] Use the new key mapper API from WPEBackend

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


--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2018-08-03 15:26:13 UTC (rev 234545)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2018-08-03 15:38:10 UTC (rev 234546)
@@ -33,4 +33,16 @@
 fast/block/block-only/relative-simple.html
 fast/block/block-only/absolute-position-when-containing-block-is-not-in-the-formatting-context2.html
 fast/block/block-only/margin-collapse-with-block-formatting-context.html
-fast/block/block-only/margin-collapse-with-block-formatting-context2.html
\ No newline at end of file
+fast/block/block-only/margin-collapse-with-block-formatting-context2.html
+fast/block/block-only/float-left-when-container-has-padding-margin.html
+fast/block/block-only/floating-box-left-and-right-multiple-with-top-offset.html
+fast/block/block-only/floating-box-left-and-right-multiple.html
+fast/block/block-only/floating-box-right-simple.html
+fast/block/block-only/floating-box-with-new-formatting-context.html
+fast/block/block-only/floating-box-with-relative-positioned-sibling.html
+fast/block/block-only/floating-left-right-simple.html
+fast/block/block-only/floating-left-right-with-all-margins.html
+fast/block/block-only/floating-lefts-and-rights-simple.html
+fast/block/block-only/floating-multiple-lefts-in-body.html
+fast/block/block-only/floating-multiple-lefts-multiple-lines.html
+fast/block/block-only/floating-multiple-lefts.html
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to