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-20210221215652.patch (text/plain), 14.41 KB, created by
Rob Buis
on 2021-02-21 12:56:53 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Rob Buis
Created:
2021-02-21 12:56:53 PST
Size:
14.41 KB
patch
obsolete
>Subversion Revision: 273221 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 6f04810968dc1c599627cf23e8dd6564b9337953..c5b9edfdff38cde094affee600b9e455ba6882b5 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,22 @@ >+2021-02-21 Rob Buis <rbuis@igalia.com> >+ >+ Support aspect-ratio in intrinsic sizing >+ https://bugs.webkit.org/show_bug.cgi?id=220861 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ WIP. >+ >+ * rendering/RenderBlock.cpp: >+ (WebCore::RenderBlock::computeChildPreferredLogicalWidths const): >+ * rendering/RenderBox.cpp: >+ (WebCore::RenderBox::constrainLogicalWidthInFragmentByMinMax const): >+ (WebCore::RenderBox::computeIntrinsicLogicalWidths const): >+ (WebCore::RenderBox::computeIntrinsicLogicalWidthUsing const): >+ (WebCore::RenderBox::shouldComputeLogicalHeightFromAspectRatio const): >+ (WebCore::RenderBox::computeLogicalWidthFromAspectRatio const): >+ * rendering/RenderBox.h: >+ > 2021-02-21 Noam Rosenthal <noam@webkit.org> > > [Paint Timing] Return early from contentful paint check when no contentful pixels/characters at all >diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp >index 1bf9694ccb06ba6fd5706206be9d92621eeec732..1a190489fef5d86a345a96f672fbc88c9e4aa319 100644 >--- a/Source/WebCore/rendering/RenderBlock.cpp >+++ b/Source/WebCore/rendering/RenderBlock.cpp >@@ -2426,6 +2426,8 @@ void RenderBlock::computeChildPreferredLogicalWidths(RenderObject& child, Layout > > if (child.isBox()) { > auto& box = downcast<RenderBox>(child); >+ if (box.shouldComputeLogicalWidthFromAspectRatio()) >+ minPreferredLogicalWidth = maxPreferredLogicalWidth = box.computeLogicalWidthFromAspectRatio(); > if (overridingHeight) > box.setOverridingLogicalHeight(overridingHeight.value()); > if (overridingWidth) >diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp >index 53fd0f0f38ca5afd1079fdc340748b14c9c29000..c19e80c42c74268debcc340f104017dc238879ba 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.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)); > } >@@ -681,7 +683,7 @@ LayoutUnit RenderBox::constrainLogicalHeightByMinMax(LayoutUnit logicalHeight, O > auto logicalMinHeight = styleToUse.logicalMinHeight(); > if (logicalMinHeight.isAuto() && shouldComputeLogicalHeightFromAspectRatio() && intrinsicContentHeight && styleToUse.overflowBlockDirection() == Overflow::Visible) > logicalMinHeight = Length(*intrinsicContentHeight, LengthType::Fixed); >- if (logicalMinHeight.isMinContent() || logicalMinHeight.isMaxContent()) >+ if (logicalMinHeight.isMinContent() || logicalMinHeight.isMaxContent() || logicalMinHeight.isMinIntrinsic()) > logicalMinHeight = Length(); > if (Optional<LayoutUnit> computedLogicalHeight = computeLogicalHeightUsing(MinSize, logicalMinHeight, intrinsicContentHeight)) > return std::max(logicalHeight, computedLogicalHeight.value()); >@@ -2605,6 +2607,15 @@ LayoutUnit RenderBox::fillAvailableMeasure(LayoutUnit availableLogicalWidth, Lay > return availableLogicalWidth - marginStart - marginEnd; > } > >+void RenderBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth, bool allowIntrinsic) const >+{ >+ if (allowIntrinsic && shouldComputeLogicalWidthFromAspectRatio()) { >+ minLogicalWidth = maxLogicalWidth = computeLogicalWidthFromAspectRatio(); >+ return; >+ } >+ computeIntrinsicLogicalWidths(minLogicalWidth, maxLogicalWidth); >+} >+ > LayoutUnit RenderBox::computeIntrinsicLogicalWidthUsing(Length logicalWidthLength, LayoutUnit availableLogicalWidth, LayoutUnit borderAndPadding) const > { > if (logicalWidthLength.isFillAvailable()) >@@ -2612,9 +2623,9 @@ LayoutUnit RenderBox::computeIntrinsicLogicalWidthUsing(Length logicalWidthLengt > > LayoutUnit minLogicalWidth; > LayoutUnit maxLogicalWidth; >- computeIntrinsicLogicalWidths(minLogicalWidth, maxLogicalWidth); >+ computeIntrinsicLogicalWidths(minLogicalWidth, maxLogicalWidth, !logicalWidthLength.isMinIntrinsic()); > >- if (logicalWidthLength.isMinContent()) >+ if (logicalWidthLength.isMinContent() || logicalWidthLength.isMinIntrinsic()) > return minLogicalWidth + borderAndPadding; > > if (logicalWidthLength.isMaxContent()) >@@ -2637,12 +2648,12 @@ LayoutUnit RenderBox::computeLogicalWidthInFragmentUsing(SizeType widthType, Len > if (widthType == MinSize && logicalWidth.isAuto()) > return adjustBorderBoxLogicalWidthForBoxSizing(0, logicalWidth.type()); > >- if (!logicalWidth.isIntrinsicOrAuto()) { >+ if (!logicalWidth.isIntrinsicOrAuto() && !logicalWidth.isMinIntrinsic()) { > // FIXME: If the containing block flow is perpendicular to our direction we need to use the available logical height instead. > return adjustBorderBoxLogicalWidthForBoxSizing(valueForLength(logicalWidth, availableLogicalWidth), logicalWidth.type()); > } > >- if (logicalWidth.isIntrinsic()) >+ if (logicalWidth.isIntrinsic() || logicalWidth.isMinIntrinsic()) > return computeIntrinsicLogicalWidthUsing(logicalWidth, availableLogicalWidth, borderAndPaddingLogicalWidth()); > > LayoutUnit marginStart; >@@ -5098,7 +5109,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 +5145,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..cebdd91e35a6fe37409d6dd90ca073a99fa1dc46 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; > >@@ -649,6 +649,10 @@ override; > > LayoutRect absoluteAnchorRectWithScrollMargin(bool* insideFixed = nullptr) const override; > >+ bool shouldComputeLogicalHeightFromAspectRatio() const; >+ bool shouldComputeLogicalWidthFromAspectRatio() const; >+ LayoutUnit computeLogicalWidthFromAspectRatio(RenderFragmentContainer* = nullptr) const; >+ > protected: > RenderBox(Element&, RenderStyle&&, BaseTypeFlags); > RenderBox(Document&, RenderStyle&&, BaseTypeFlags); >@@ -698,10 +702,7 @@ protected: > > void incrementVisuallyNonEmptyPixelCountIfNeeded(const IntSize&); > >- bool shouldComputeLogicalHeightFromAspectRatio() const; >- bool shouldComputeLogicalWidthFromAspectRatio() const; > bool shouldComputeLogicalWidthFromAspectRatioAndInsets() const; >- LayoutUnit computeLogicalWidthFromAspectRatio(RenderFragmentContainer* = nullptr) const; > std::pair<LayoutUnit, LayoutUnit> computeMinMaxLogicalWidthFromAspectRatio() const; > > static LayoutUnit blockSizeFromAspectRatio(LayoutUnit borderPaddingInlineSum, LayoutUnit borderPaddingBlockSum, LayoutUnit aspectRatio, BoxSizing boxSizing, LayoutUnit inlineSize) >@@ -749,6 +750,7 @@ private: > LayoutUnit fillAvailableMeasure(LayoutUnit availableLogicalWidth, LayoutUnit& marginStart, LayoutUnit& marginEnd) const; > > virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const; >+ void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth, bool allowIntrinsic) const; > > // This function calculates the minimum and maximum preferred widths for an object. > // These values are used in shrink-to-fit layout systems. >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index f7152c70b23b825bd28d577dfd6e319b596fe18b..3412ddb7e472678e29dc60ea486f00e465cf2072 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2021-02-21 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 some tests that pass now. >+ >+ * TestExpectations: >+ > 2021-02-20 Chris Fleizach <cfleizach@apple.com> > > AX: Image should report the embedded accessibility description if available >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index 857c52083a50973e837f6b6467dc422c4b3cf16a..b1000ecd3670121f32d122bd74d8400c22e70c90 100644 >--- a/LayoutTests/TestExpectations >+++ b/LayoutTests/TestExpectations >@@ -4546,6 +4546,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 ] >@@ -4555,14 +4556,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/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/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/table-element-001.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