Title: [238668] trunk/Source/WebCore
Revision
238668
Author
za...@apple.com
Date
2018-11-29 07:30:27 -0800 (Thu, 29 Nov 2018)

Log Message

[LFC][BFC][Quirk] Width does not need stretching quirk.
https://bugs.webkit.org/show_bug.cgi?id=192135

Reviewed by Antti Koivisto.

In BFC the block box's width (auto) always streches to the content width of the containing block.

* layout/blockformatting/BlockFormattingContext.h:
* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
* layout/blockformatting/BlockFormattingContextQuirks.cpp:
(WebCore::Layout::BlockFormattingContext::Quirks::needsStretching):
(WebCore::Layout::BlockFormattingContext::Quirks::isStretchedToInitialContainingBlock): Deleted.
(WebCore::Layout::BlockFormattingContext::Quirks::stretchedWidth): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (238667 => 238668)


--- trunk/Source/WebCore/ChangeLog	2018-11-29 15:28:20 UTC (rev 238667)
+++ trunk/Source/WebCore/ChangeLog	2018-11-29 15:30:27 UTC (rev 238668)
@@ -1,5 +1,23 @@
 2018-11-29  Zalan Bujtas  <za...@apple.com>
 
+        [LFC][BFC][Quirk] Width does not need stretching quirk.
+        https://bugs.webkit.org/show_bug.cgi?id=192135
+
+        Reviewed by Antti Koivisto.
+
+        In BFC the block box's width (auto) always streches to the content width of the containing block.
+
+        * layout/blockformatting/BlockFormattingContext.h:
+        * layout/blockformatting/BlockFormattingContextGeometry.cpp:
+        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
+        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
+        * layout/blockformatting/BlockFormattingContextQuirks.cpp:
+        (WebCore::Layout::BlockFormattingContext::Quirks::needsStretching):
+        (WebCore::Layout::BlockFormattingContext::Quirks::isStretchedToInitialContainingBlock): Deleted.
+        (WebCore::Layout::BlockFormattingContext::Quirks::stretchedWidth): Deleted.
+
+2018-11-29  Zalan Bujtas  <za...@apple.com>
+
         [LFC][Quirk] Move quirk functions to dedicated classes.
         https://bugs.webkit.org/show_bug.cgi?id=192133
 

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h (238667 => 238668)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h	2018-11-29 15:28:20 UTC (rev 238667)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h	2018-11-29 15:30:27 UTC (rev 238668)
@@ -112,9 +112,9 @@
 
     class Quirks {
     public:
-        static bool isStretchedToInitialContainingBlock(const LayoutState&, const Box&);
+        static bool needsStretching(const LayoutState&, const Box&);
         static HeightAndMargin stretchedHeight(const LayoutState&, const Box&, HeightAndMargin);
-        static WidthAndMargin stretchedWidth(const LayoutState&, const Box&, WidthAndMargin);
+
         static bool shouldIgnoreMarginTop(const LayoutState&, const Box&);
     };
 };

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp (238667 => 238668)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp	2018-11-29 15:28:20 UTC (rev 238667)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp	2018-11-29 15:30:27 UTC (rev 238668)
@@ -195,14 +195,7 @@
     };
 
     auto widthAndMargin = compute();
-    if (!Quirks::isStretchedToInitialContainingBlock(layoutState, 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;
-    }
-
-    widthAndMargin = Quirks::stretchedWidth(layoutState, layoutBox, widthAndMargin);
-
-    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 << ")");
+    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;
 }
 
@@ -264,7 +257,7 @@
         heightAndMargin = complicatedCases(layoutState, layoutBox, usedHeight);
     }
 
-    if (!Quirks::isStretchedToInitialContainingBlock(layoutState, layoutBox))
+    if (!Quirks::needsStretching(layoutState, layoutBox))
         return heightAndMargin;
 
     heightAndMargin = Quirks::stretchedHeight(layoutState, layoutBox, heightAndMargin);

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp (238667 => 238668)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp	2018-11-29 15:28:20 UTC (rev 238667)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp	2018-11-29 15:30:27 UTC (rev 238668)
@@ -53,10 +53,10 @@
     return layoutBox.style().hasMarginBeforeQuirk();
 }
 
-bool BlockFormattingContext::Quirks::isStretchedToInitialContainingBlock(const LayoutState& layoutState, const Box& layoutBox)
+bool BlockFormattingContext::Quirks::needsStretching(const LayoutState& layoutState, const Box& layoutBox)
 {
     ASSERT(layoutBox.isInFlow());
-    // In quirks mode, body and html stretch to the viewport.
+    // In quirks mode, body stretches to html and html to the initial containing block (height: auto only).
     if (!layoutState.inQuirksMode())
         return false;
 
@@ -81,17 +81,6 @@
     return heightAndMargin;
 }
 
-WidthAndMargin BlockFormattingContext::Quirks::stretchedWidth(const LayoutState& layoutState, const Box& layoutBox, WidthAndMargin widthAndMargin)
-{
-    auto initialContainingBlockWidth = layoutState.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;
-
-    return widthAndMargin;
-}
-
 bool BlockFormattingContext::Quirks::shouldIgnoreMarginTop(const LayoutState& layoutState, const Box& layoutBox)
 {
     if (!layoutBox.parent())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to