WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-220861-20210228220138.patch (text/plain), 12.37 KB, created by
Rob Buis
on 2021-02-28 13:01:41 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Rob Buis
Created:
2021-02-28 13:01:41 PST
Size:
12.37 KB
patch
obsolete
>Subversion Revision: 273639 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 6a50452096fa608cb8187432ae29a950ae2e92ca..0fe5ae5f09b22b33c3ed7157c0542c2c7d1b9d5d 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,26 @@ >+2021-02-28 Rob Buis <rbuis@igalia.com> >+ >+ Support aspect-ratio in intrinsic sizing >+ https://bugs.webkit.org/show_bug.cgi?id=220861 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Support aspect-ratio in intrinsic sizing calculations. >+ >+ * rendering/RenderBlock.cpp: >+ (WebCore::RenderBlock::computePreferredLogicalWidths): >+ * rendering/RenderBox.cpp: >+ (WebCore::RenderBox::constrainLogicalWidthInFragmentByMinMax const): >+ Add an allowIntrinsic parameter to prevent recursion. >+ (WebCore::RenderBox::computeIntrinsicLogicalWidthUsing const): >+ Compute intrinsic logical width from aspect ratio if possible. >+ (WebCore::RenderBox::computeLogicalWidthInFragmentUsing const): >+ (WebCore::RenderBox::shouldComputeLogicalHeightFromAspectRatio const): >+ min/max/fit-content in the block axis is treated as auto. >+ (WebCore::RenderBox::computeLogicalWidthFromAspectRatio const): >+ Prevent recursion by passing false for allowIntrinsic. >+ * rendering/RenderBox.h: >+ > 2021-02-28 Darin Adler <darin@apple.com> > > [iOS] Reduce use of retain/release in WAKWindow and remove unneeded methods from that class >diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp >index 1bf9694ccb06ba6fd5706206be9d92621eeec732..148714cb9cc5e3bb78b84875371bda4c40bb0a3e 100644 >--- a/Source/WebCore/rendering/RenderBlock.cpp >+++ b/Source/WebCore/rendering/RenderBlock.cpp >@@ -2282,6 +2282,8 @@ void RenderBlock::computePreferredLogicalWidths() > if (!isTableCell() && styleToUse.logicalWidth().isFixed() && styleToUse.logicalWidth().value() >= 0 > && !(isDeprecatedFlexItem() && !styleToUse.logicalWidth().intValue())) > m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = adjustContentBoxLogicalWidthForBoxSizing(styleToUse.logicalWidth()); >+ else if (shouldComputeLogicalWidthFromAspectRatio()) >+ m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeLogicalWidthFromAspectRatio(); > else > computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferredLogicalWidth); > >diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp >index 53fd0f0f38ca5afd1079fdc340748b14c9c29000..390e179f65e59cb5b405bcb477e70fdcb28e23e0 100644 >--- a/Source/WebCore/rendering/RenderBox.cpp >+++ b/Source/WebCore/rendering/RenderBox.cpp >@@ -651,7 +651,7 @@ void RenderBox::updateLayerTransform() > layer()->updateTransform(); > } > >-LayoutUnit RenderBox::constrainLogicalWidthInFragmentByMinMax(LayoutUnit logicalWidth, LayoutUnit availableWidth, RenderBlock& cb, RenderFragmentContainer* fragment) const >+LayoutUnit RenderBox::constrainLogicalWidthInFragmentByMinMax(LayoutUnit logicalWidth, LayoutUnit availableWidth, RenderBlock& cb, RenderFragmentContainer* fragment, bool allowIntrinsic) const > { > const RenderStyle& styleToUse = style(); > >@@ -660,13 +660,15 @@ LayoutUnit RenderBox::constrainLogicalWidthInFragmentByMinMax(LayoutUnit logical > logicalWidth = std::clamp(logicalWidth, logicalMinWidth, logicalMaxWidth); > } > >- if (!styleToUse.logicalMaxWidth().isUndefined()) >+ if (!styleToUse.logicalMaxWidth().isUndefined() && (allowIntrinsic || !styleToUse.logicalMaxWidth().isIntrinsic())) > logicalWidth = std::min(logicalWidth, computeLogicalWidthInFragmentUsing(MaxSize, styleToUse.logicalMaxWidth(), availableWidth, cb, fragment)); >+ if (!allowIntrinsic && styleToUse.logicalMinWidth().isIntrinsic()) >+ return logicalWidth; > auto minLength = styleToUse.logicalMinWidth(); >- if (styleToUse.hasAspectRatio() && styleToUse.logicalWidth().isAuto() && minLength.isAuto() && styleToUse.overflowInlineDirection() == Overflow::Visible) { >+ if (styleToUse.hasAspectRatio() && minLength.isAuto() && (styleToUse.logicalWidth().isAuto() || styleToUse.logicalWidth().isMinContent() || styleToUse.logicalWidth().isMaxContent()) && styleToUse.overflowInlineDirection() == Overflow::Visible) { > // Make sure we actually used the aspect ratio. > if (shouldComputeLogicalWidthFromAspectRatio()) >- minLength = Length(LengthType::MinContent); >+ minLength = Length(LengthType::MinIntrinsic); > } > return std::max(logicalWidth, computeLogicalWidthInFragmentUsing(MinSize, minLength, availableWidth, cb, fragment)); > } >@@ -2612,9 +2614,12 @@ LayoutUnit RenderBox::computeIntrinsicLogicalWidthUsing(Length logicalWidthLengt > > LayoutUnit minLogicalWidth; > LayoutUnit maxLogicalWidth; >- computeIntrinsicLogicalWidths(minLogicalWidth, maxLogicalWidth); >+ if (!logicalWidthLength.isMinIntrinsic() && shouldComputeLogicalWidthFromAspectRatio()) >+ minLogicalWidth = maxLogicalWidth = computeLogicalWidthFromAspectRatio(); >+ else >+ computeIntrinsicLogicalWidths(minLogicalWidth, maxLogicalWidth); > >- if (logicalWidthLength.isMinContent()) >+ if (logicalWidthLength.isMinContent() || logicalWidthLength.isMinIntrinsic()) > return minLogicalWidth + borderAndPadding; > > if (logicalWidthLength.isMaxContent()) >@@ -2642,7 +2647,7 @@ LayoutUnit RenderBox::computeLogicalWidthInFragmentUsing(SizeType widthType, Len > return adjustBorderBoxLogicalWidthForBoxSizing(valueForLength(logicalWidth, availableLogicalWidth), logicalWidth.type()); > } > >- if (logicalWidth.isIntrinsic()) >+ if (logicalWidth.isIntrinsic() || logicalWidth.isMinIntrinsic()) > return computeIntrinsicLogicalWidthUsing(logicalWidth, availableLogicalWidth, borderAndPaddingLogicalWidth()); > > LayoutUnit marginStart; >@@ -5098,7 +5103,7 @@ bool RenderBox::shouldComputeLogicalHeightFromAspectRatio() const > return false; > > auto h = style().logicalHeight(); >- return h.isAuto() || (!isOutOfFlowPositioned() && h.isPercentOrCalculated() && !percentageLogicalHeightIsResolvable()); >+ return h.isAuto() || h.isIntrinsic() || (!isOutOfFlowPositioned() && h.isPercentOrCalculated() && !percentageLogicalHeightIsResolvable()); > } > > bool RenderBox::shouldComputeLogicalWidthFromAspectRatio() const >@@ -5134,7 +5139,7 @@ LayoutUnit RenderBox::computeLogicalWidthFromAspectRatio(RenderFragmentContainer > auto logicalWidth = inlineSizeFromAspectRatio(horizontalBorderAndPaddingExtent(), verticalBorderAndPaddingExtent(), LayoutUnit(style().logicalAspectRatio()), style().boxSizingForAspectRatio(), logicalHeightforAspectRatio); > > LayoutUnit containerWidthInInlineDirection = std::max<LayoutUnit>(0, containingBlockLogicalWidthForContentInFragment(fragment)); >- return constrainLogicalWidthInFragmentByMinMax(logicalWidth, containerWidthInInlineDirection, *containingBlock(), fragment); >+ return constrainLogicalWidthInFragmentByMinMax(logicalWidth, containerWidthInInlineDirection, *containingBlock(), fragment, false); > } > > std::pair<LayoutUnit, LayoutUnit> RenderBox::computeMinMaxLogicalWidthFromAspectRatio() const >diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h >index 6de6ed6ac6b9688fcb3648dbb4b2ec9a09bb1424..80a3b8931be34bb1015012c53cda7d94338c1327 100644 >--- a/Source/WebCore/rendering/RenderBox.h >+++ b/Source/WebCore/rendering/RenderBox.h >@@ -85,7 +85,7 @@ public: > LayoutUnit logicalWidth() const { return style().isHorizontalWritingMode() ? width() : height(); } > LayoutUnit logicalHeight() const { return style().isHorizontalWritingMode() ? height() : width(); } > >- LayoutUnit constrainLogicalWidthInFragmentByMinMax(LayoutUnit, LayoutUnit, RenderBlock&, RenderFragmentContainer* = nullptr) const; >+ LayoutUnit constrainLogicalWidthInFragmentByMinMax(LayoutUnit, LayoutUnit, RenderBlock&, RenderFragmentContainer*, bool allowIntrinsic = true) const; > LayoutUnit constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, Optional<LayoutUnit> intrinsicContentHeight) const; > LayoutUnit constrainContentBoxLogicalHeightByMinMax(LayoutUnit logicalHeight, Optional<LayoutUnit> intrinsicContentHeight) const; > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 4609407dbf3ccdf6facb0d81617452ccca0cad2b..cbb0b532a1eaa3283148134d91dc6608417607ad 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2021-02-28 Rob Buis <rbuis@igalia.com> >+ >+ Support aspect-ratio in intrinsic sizing >+ https://bugs.webkit.org/show_bug.cgi?id=220861 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Enable tests that pass now. >+ >+ * TestExpectations: >+ > 2021-02-27 Sam Weinig <weinig@apple.com> > > Remove support for 'pixel' and 'pos' CSSOM prefixes >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index d95d40f613cf7781e41cef03df79e7b6364694f3..45373037d427065711f768b999c229cc0572818a 100644 >--- a/LayoutTests/TestExpectations >+++ b/LayoutTests/TestExpectations >@@ -4547,6 +4547,7 @@ webkit.org/b/214462 imported/w3c/web-platform-tests/css/css-scoping/shadow-direc > webkit.org/b/214462 imported/w3c/web-platform-tests/css/css-scoping/shadow-directionality-002.tentative.html [ ImageOnlyFailure ] > webkit.org/b/214462 imported/w3c/web-platform-tests/css/css-scoping/slotted-placeholder.html [ ImageOnlyFailure ] > >+# contain-intrinsic-size > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/abspos-014.html [ ImageOnlyFailure ] > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-024.html [ ImageOnlyFailure ] > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-028.html [ ImageOnlyFailure ] >@@ -4556,21 +4557,8 @@ webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/ > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-022.html [ ImageOnlyFailure ] > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-025.html [ ImageOnlyFailure ] > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-026.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/grid-aspect-ratio-015.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/grid-aspect-ratio-016.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/grid-aspect-ratio-017.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/intrinsic-size-001.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/intrinsic-size-002.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/intrinsic-size-004.html [ ImageOnlyFailure ] > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/intrinsic-size-005.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/intrinsic-size-006.html [ ImageOnlyFailure ] > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/intrinsic-size-008.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/intrinsic-size-010.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/intrinsic-size-011.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/intrinsic-size-012.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/intrinsic-size-013.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/intrinsic-size-014.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/intrinsic-size-015.html [ ImageOnlyFailure ] > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-031.html [ ImageOnlyFailure ] > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-032.html [ ImageOnlyFailure ] > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-033.html [ ImageOnlyFailure ]
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
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 220861
:
418150
|
418632
|
419498
|
420826
|
420831
|
420944
|
421135
|
421148
|
421210
|
421228
|
421393
|
421744
|
421751
|
421754
|
421779
|
422053
|
422528
|
422552