WebKit Bugzilla
Attachment 362017 Details for
Bug 194653
: [LFC] Shrink-to-fit-width should be constrained by min/max width
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194653-20190214082116.patch (text/plain), 7.57 KB, created by
zalan
on 2019-02-14 08:21:19 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2019-02-14 08:21:19 PST
Size:
7.57 KB
patch
obsolete
>Subversion Revision: 241515 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index d0130cd4537fc4e23d4bbf4803c171492908d917..3c67adfe190701364f592b76199a0051c27f9b2c 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,20 @@ >+2019-02-14 Zalan Bujtas <zalan@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 NOBODY (OOPS!). >+ >+ 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 <rniwa@webkit.org> > > Crash in DOMTimer::fired >diff --git a/Source/WebCore/layout/FormattingContext.h b/Source/WebCore/layout/FormattingContext.h >index 209962b3587233fff82e6020e2ebef1fb9d26cc1..1c1367241abe22b1acdbef3e1d2098cd07c169c0 100644 >--- a/Source/WebCore/layout/FormattingContext.h >+++ b/Source/WebCore/layout/FormattingContext.h >@@ -104,6 +104,8 @@ protected: > 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); >diff --git a/Source/WebCore/layout/FormattingContextGeometry.cpp b/Source/WebCore/layout/FormattingContextGeometry.cpp >index 0c2d872e97ed2bc2400e5bbce089e24d9f8d59ef..967cfd4998b6a1a0897d062ff0dbab5ed5a173e7 100644 >--- a/Source/WebCore/layout/FormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/FormattingContextGeometry.cpp >@@ -1072,6 +1072,28 @@ ComputedVerticalMargin FormattingContext::Geometry::computedVerticalMargin(const > 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 >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >index 148542b435fac88af97c8f58bccba0ba8060517d..649d5c469becee441f0a1324b01e827ea9c646e5 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >@@ -301,9 +301,7 @@ FormattingContext::IntrinsicWidthConstraints BlockFormattingContext::Geometry::i > 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 @@ FormattingContext::IntrinsicWidthConstraints BlockFormattingContext::Geometry::i > + 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); > } > > } >diff --git a/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp b/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp >index fb982b3d1e68cd2f0127d2ca05f0c550ba256d38..e3c1536dcd32a1efed8128d332b118e28bdd9e72 100644 >--- a/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp >+++ b/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp >@@ -150,7 +150,7 @@ void InlineFormattingContext::computeIntrinsicWidthConstraints() const > 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); > } > >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index e7c8dd845d45c21171a69ac061d08ea71da69cef..72e71bc58bfe5abbe56d5c2ba4f67e1829d5efa1 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,12 @@ >+2019-02-14 Zalan Bujtas <zalan@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 NOBODY (OOPS!). >+ >+ * LayoutReloaded/misc/LFC-passing-tests.txt: >+ > 2019-02-13 Ryosuke Niwa <rniwa@webkit.org> > > Crash in WKBundleFrameGetParentFrame when called inside didRemoveFrameFromHierarchy >diff --git a/Tools/LayoutReloaded/misc/LFC-passing-tests.txt b/Tools/LayoutReloaded/misc/LFC-passing-tests.txt >index 8a95f9e338d6d59680c09ed00b310cc282c1dfcd..a5d59249e0930756a74edd50eb2bff33eef61d75 100644 >--- a/Tools/LayoutReloaded/misc/LFC-passing-tests.txt >+++ b/Tools/LayoutReloaded/misc/LFC-passing-tests.txt >@@ -813,7 +813,11 @@ css2.1/20110323/float-non-replaced-width-003.htm > 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
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
koivisto
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194653
: 362017