Title: [241664] releases/WebKitGTK/webkit-2.24
Revision
241664
Author
carlo...@webkit.org
Date
2019-02-18 08:12:03 -0800 (Mon, 18 Feb 2019)

Log Message

Merge r241545 - [LFC] Shrink-to-fit-width should be constrained by min/max width
https://bugs.webkit.org/show_bug.cgi?id=194653

Reviewed by Antti Koivisto.

Source/WebCore:

Use the fixed value of min-width/max-width to constrain the computed preferred width.

* layout/FormattingContext.h:
* layout/FormattingContextGeometry.cpp:
(WebCore::Layout::FormattingContext::Geometry::constrainByMinMaxWidth):
* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):

Tools:

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

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog (241663 => 241664)


--- releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog	2019-02-18 16:11:56 UTC (rev 241663)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog	2019-02-18 16:12:03 UTC (rev 241664)
@@ -1,3 +1,20 @@
+2019-02-14  Zalan Bujtas  <za...@apple.com>
+
+        [LFC] Shrink-to-fit-width should be constrained by min/max width
+        https://bugs.webkit.org/show_bug.cgi?id=194653
+
+        Reviewed by Antti Koivisto.
+
+        Use the fixed value of min-width/max-width to constrain the computed preferred width.
+
+        * layout/FormattingContext.h:
+        * layout/FormattingContextGeometry.cpp:
+        (WebCore::Layout::FormattingContext::Geometry::constrainByMinMaxWidth):
+        * layout/blockformatting/BlockFormattingContextGeometry.cpp:
+        (WebCore::Layout::BlockFormattingContext::Geometry::intrinsicWidthConstraints):
+        * layout/inlineformatting/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
+
 2019-02-13  Ryosuke Niwa  <rn...@webkit.org>
 
         Crash in DOMTimer::fired

Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/layout/FormattingContext.h (241663 => 241664)


--- releases/WebKitGTK/webkit-2.24/Source/WebCore/layout/FormattingContext.h	2019-02-18 16:11:56 UTC (rev 241663)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/layout/FormattingContext.h	2019-02-18 16:12:03 UTC (rev 241664)
@@ -104,6 +104,8 @@
         static Optional<LayoutUnit> computedMinHeight(const LayoutState&, const Box&);
         static Optional<LayoutUnit> computedMaxHeight(const LayoutState&, const Box&);
 
+        static FormattingContext::IntrinsicWidthConstraints constrainByMinMaxWidth(const Box&, IntrinsicWidthConstraints);
+
     protected:
         enum class HeightType { Min, Max, Normal };
         static Optional<LayoutUnit> computedHeightValue(const LayoutState&, const Box&, HeightType);

Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/layout/FormattingContextGeometry.cpp (241663 => 241664)


--- releases/WebKitGTK/webkit-2.24/Source/WebCore/layout/FormattingContextGeometry.cpp	2019-02-18 16:11:56 UTC (rev 241663)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/layout/FormattingContextGeometry.cpp	2019-02-18 16:12:03 UTC (rev 241664)
@@ -1072,6 +1072,28 @@
     return { computedValueIfNotAuto(style.marginBefore(), containingBlockWidth), computedValueIfNotAuto(style.marginAfter(), containingBlockWidth) };
 }
 
+FormattingContext::IntrinsicWidthConstraints FormattingContext::Geometry::constrainByMinMaxWidth(const Box& layoutBox, IntrinsicWidthConstraints intrinsicWidth)
+{
+    auto& style = layoutBox.style();
+    auto minWidth = fixedValue(style.logicalMinWidth());
+    auto maxWidth = fixedValue(style.logicalMaxWidth());
+    if (!minWidth && !maxWidth)
+        return intrinsicWidth;
+
+    if (maxWidth) {
+        intrinsicWidth.minimum = std::min(*maxWidth, intrinsicWidth.minimum);
+        intrinsicWidth.maximum = std::min(*maxWidth, intrinsicWidth.maximum);
+    }
+
+    if (minWidth) {
+        intrinsicWidth.minimum = std::max(*minWidth, intrinsicWidth.minimum);
+        intrinsicWidth.maximum = std::max(*minWidth, intrinsicWidth.maximum);
+    }
+
+    ASSERT(intrinsicWidth.minimum <= intrinsicWidth.maximum);
+    return intrinsicWidth;
 }
+
 }
+}
 #endif

Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp (241663 => 241664)


--- releases/WebKitGTK/webkit-2.24/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp	2019-02-18 16:11:56 UTC (rev 241663)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp	2019-02-18 16:12:03 UTC (rev 241664)
@@ -301,9 +301,7 @@
     if (!is<Container>(layoutBox))
         return { };
 
-    LayoutUnit minimumIntrinsicWidth;
-    LayoutUnit maximumIntrinsicWidth;
-
+    auto intrinsicWidthConstraints = IntrinsicWidthConstraints { };
     for (auto& child : childrenOfType<Box>(downcast<Container>(layoutBox))) {
         if (child.isOutOfFlowPositioned())
             continue;
@@ -320,11 +318,11 @@
             + LayoutUnit { style.borderRightWidth() }
             + fixedValue(style.marginEnd()).valueOr(0);
 
-        minimumIntrinsicWidth = std::max(minimumIntrinsicWidth, childIntrinsicWidthConstraints->minimum + horizontalMarginBorderAndPadding); 
-        maximumIntrinsicWidth = std::max(maximumIntrinsicWidth, childIntrinsicWidthConstraints->maximum + horizontalMarginBorderAndPadding); 
+        intrinsicWidthConstraints.minimum = std::max(intrinsicWidthConstraints.minimum, childIntrinsicWidthConstraints->minimum + horizontalMarginBorderAndPadding);
+        intrinsicWidthConstraints.maximum = std::max(intrinsicWidthConstraints.maximum, childIntrinsicWidthConstraints->maximum + horizontalMarginBorderAndPadding);
     }
 
-    return { minimumIntrinsicWidth, maximumIntrinsicWidth };
+    return constrainByMinMaxWidth(layoutBox, intrinsicWidthConstraints);
 }
 
 }

Modified: releases/WebKitGTK/webkit-2.24/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (241663 => 241664)


--- releases/WebKitGTK/webkit-2.24/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2019-02-18 16:11:56 UTC (rev 241663)
+++ releases/WebKitGTK/webkit-2.24/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2019-02-18 16:12:03 UTC (rev 241664)
@@ -150,7 +150,7 @@
         return maxContentLogicalRight;
     };
 
-    auto intrinsicWidthConstraints = FormattingContext::IntrinsicWidthConstraints { maximumLineWidth(0), maximumLineWidth(LayoutUnit::max()) };
+    auto intrinsicWidthConstraints = Geometry::constrainByMinMaxWidth(root, { maximumLineWidth(0), maximumLineWidth(LayoutUnit::max()) });
     layoutState.formattingStateForBox(root).setIntrinsicWidthConstraints(root, intrinsicWidthConstraints);
 }
 

Modified: releases/WebKitGTK/webkit-2.24/Tools/ChangeLog (241663 => 241664)


--- releases/WebKitGTK/webkit-2.24/Tools/ChangeLog	2019-02-18 16:11:56 UTC (rev 241663)
+++ releases/WebKitGTK/webkit-2.24/Tools/ChangeLog	2019-02-18 16:12:03 UTC (rev 241664)
@@ -1,3 +1,12 @@
+2019-02-14  Zalan Bujtas  <za...@apple.com>
+
+        [LFC] Shrink-to-fit-width should be constrained by min/max width
+        https://bugs.webkit.org/show_bug.cgi?id=194653
+
+        Reviewed by Antti Koivisto.
+
+        * LayoutReloaded/misc/LFC-passing-tests.txt:
+
 2019-02-13  Ryosuke Niwa  <rn...@webkit.org>
 
         Crash in WKBundleFrameGetParentFrame when called inside didRemoveFrameFromHierarchy

Modified: releases/WebKitGTK/webkit-2.24/Tools/LayoutReloaded/misc/LFC-passing-tests.txt (241663 => 241664)


--- releases/WebKitGTK/webkit-2.24/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2019-02-18 16:11:56 UTC (rev 241663)
+++ releases/WebKitGTK/webkit-2.24/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2019-02-18 16:12:03 UTC (rev 241664)
@@ -753,7 +753,11 @@
 css2.1/20110323/float-non-replaced-width-004.htm
 css2.1/20110323/float-non-replaced-width-005.htm
 css2.1/20110323/float-non-replaced-width-006.htm
+css2.1/20110323/float-non-replaced-width-007.htm
+css2.1/20110323/float-non-replaced-width-008.htm
+css2.1/20110323/float-non-replaced-width-009.htm
 css2.1/20110323/float-non-replaced-width-010.htm
+css2.1/20110323/float-non-replaced-width-011.htm
 css2.1/20110323/float-non-replaced-width-012.htm
 css2.1/20110323/float-replaced-height-001.htm
 css2.1/20110323/float-replaced-height-004.htm
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to