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-219741-20201211205907.patch (text/plain), 10.11 KB, created by
Rob Buis
on 2020-12-11 11:59:11 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Rob Buis
Created:
2020-12-11 11:59:11 PST
Size:
10.11 KB
patch
obsolete
>Subversion Revision: 270625 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index bd1b8b78a433cb6bfac028211f432efca827aa24..1fa593fa376e57ec714103a603ff201dba755305 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,21 @@ >+2020-12-11 Rob Buis <rbuis@igalia.com> >+ >+ Support aspect-ratio on positioned elements >+ https://bugs.webkit.org/show_bug.cgi?id=219741 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ WIP. >+ >+ * rendering/RenderBox.cpp: >+ (WebCore::RenderBox::computePositionedLogicalWidthUsing const): >+ (WebCore::RenderBox::computePositionedLogicalHeightUsing const): >+ (WebCore::RenderBox::shouldComputeLogicalHeightFromAspectRatio const): >+ (WebCore::RenderBox::shouldComputeLogicalWidthFromAspectRatio const): >+ (WebCore::RenderBox::shouldComputeLogicalWidthFromAspectRatioAndInsets const): >+ (WebCore::RenderBox::computeLogicalWidthFromAspectRatio const): >+ * rendering/RenderBox.h: >+ > 2020-12-10 Aditya Keerthi <akeerthi@apple.com> > > [iOS][FCR] Add new look for input type=range >diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp >index 8d853aa2c8aa4b70b0b2abb4192ccbb2997cac23..c65b2057ee6b9995141ce0123fabb240665561d8 100644 >--- a/Source/WebCore/rendering/RenderBox.cpp >+++ b/Source/WebCore/rendering/RenderBox.cpp >@@ -3698,7 +3698,11 @@ void RenderBox::computePositionedLogicalWidthUsing(SizeType widthType, Length lo > ASSERT(widthType == MinSize || widthType == MainOrPreferredSize || !logicalWidth.isAuto()); > if (widthType == MinSize && logicalWidth.isAuto()) > logicalWidth = Length(0, Fixed); >- else if (logicalWidth.isIntrinsic()) >+ else if (widthType == MainOrPreferredSize && logicalWidth.isAuto() && shouldComputeLogicalWidthFromAspectRatio()) { >+ LayoutUnit dummy; >+ computeLogicalWidthFromAspectRatio(dummy); >+ logicalWidth = Length(dummy, Fixed); >+ } else if (logicalWidth.isIntrinsic()) > logicalWidth = Length(computeIntrinsicLogicalWidthUsing(logicalWidth, containerLogicalWidth, bordersPlusPadding) - bordersPlusPadding, Fixed); > > // 'left' and 'right' cannot both be 'auto' because one would of been >@@ -3709,7 +3713,7 @@ void RenderBox::computePositionedLogicalWidthUsing(SizeType widthType, Length lo > > const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock, nullptr, false); > >- bool logicalWidthIsAuto = logicalWidth.isIntrinsicOrAuto(); >+ bool logicalWidthIsAuto = logicalWidth.isIntrinsicOrAuto() && !shouldComputeLogicalWidthFromAspectRatio(); > bool logicalLeftIsAuto = logicalLeft.isAuto(); > bool logicalRightIsAuto = logicalRight.isAuto(); > LayoutUnit& marginLogicalLeftValue = style().isLeftToRightDirection() ? computedValues.m_margins.m_start : computedValues.m_margins.m_end; >@@ -4046,7 +4050,8 @@ void RenderBox::computePositionedLogicalHeightUsing(SizeType heightType, Length > > LayoutUnit logicalTopValue; > >- bool logicalHeightIsAuto = logicalHeightLength.isAuto(); >+ bool fromAspectRatio = heightType == MainOrPreferredSize && shouldComputeLogicalHeightFromAspectRatio(); >+ bool logicalHeightIsAuto = logicalHeightLength.isAuto() && !fromAspectRatio; > bool logicalTopIsAuto = logicalTop.isAuto(); > bool logicalBottomIsAuto = logicalBottom.isAuto(); > >@@ -4058,7 +4063,10 @@ void RenderBox::computePositionedLogicalHeightUsing(SizeType heightType, Length > } else { > if (logicalHeightLength.isIntrinsic()) > resolvedLogicalHeight = computeIntrinsicLogicalContentHeightUsing(logicalHeightLength, contentLogicalHeight, bordersPlusPadding).value(); >- else >+ else if (fromAspectRatio) { >+ resolvedLogicalHeight = blockSizeFromAspectRatio(horizontalBorderAndPaddingExtent(), verticalBorderAndPaddingExtent(), style().logicalAspectRatio() , style().boxSizing(), logicalWidth()); >+ resolvedLogicalHeight = std::max(LayoutUnit(), resolvedLogicalHeight - bordersPlusPadding); >+ } else > resolvedLogicalHeight = adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeightLength, containerLogicalHeight)); > } > >@@ -4980,10 +4988,45 @@ bool RenderBox::shouldComputeLogicalHeightFromAspectRatio() const > if (!style().hasAspectRatio()) > return false; > >+ if (shouldComputeLogicalWidthFromAspectRatioAndInsets()) >+ return false; >+ > auto h = style().logicalHeight(); > return h.isAuto() || (!isOutOfFlowPositioned() && h.isPercentOrCalculated() && percentageLogicalHeightIsResolvable()); > } > >+bool RenderBox::shouldComputeLogicalWidthFromAspectRatio() const >+{ >+ if (!style().hasAspectRatio()) >+ return false; >+ >+ if (/*!hasOverridingLogicalHeight() &&*/ !shouldComputeLogicalWidthFromAspectRatioAndInsets() && !style().logicalHeight().isFixed() && !style().logicalHeight().isPercentOrCalculated()) >+ return false; >+ >+ return true; >+} >+ >+bool RenderBox::shouldComputeLogicalWidthFromAspectRatioAndInsets() const >+{ >+ if (!style().hasAspectRatio() || !isOutOfFlowPositioned()) >+ return false; >+ if (style().width().isAuto() && style().height().isAuto() && !style().logicalTop().isAuto() && !style().logicalBottom().isAuto() && (style().logicalLeft().isAuto() || style().logicalRight().isAuto())) >+ return true; >+ return false; >+} >+ >+void RenderBox::computeLogicalWidthFromAspectRatio(LayoutUnit& outLogicalWidth, RenderFragmentContainer* fragment) const >+{ >+ ASSERT(shouldComputeLogicalWidthFromAspectRatio()); >+ auto computedValues = computeLogicalHeight(logicalHeight(), logicalTop()); >+ LayoutUnit logicalHeightforAspectRatio = computedValues.m_extent; >+ >+ auto logicalWidth = inlineSizeFromAspectRatio(horizontalBorderAndPaddingExtent(), verticalBorderAndPaddingExtent(), style().logicalAspectRatio(), style().boxSizing(), logicalHeightforAspectRatio); >+ >+ LayoutUnit containerWidthIninlineDirection = std::max<LayoutUnit>(0, containingBlockLogicalWidthForContentInFragment(fragment)); >+ outLogicalWidth = constrainLogicalWidthInFragmentByMinMax(logicalWidth, containerWidthIninlineDirection, *containingBlock(), fragment); >+} >+ > bool RenderBox::hasRelativeDimensions() const > { > return style().height().isPercentOrCalculated() || style().width().isPercentOrCalculated() >diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h >index 23bb7819c2288626c56c045e12169ad71f8b2cb0..3ac3f5a1ef07086d6da02209c0d55c88231e2906 100644 >--- a/Source/WebCore/rendering/RenderBox.h >+++ b/Source/WebCore/rendering/RenderBox.h >@@ -742,6 +742,9 @@ private: > void applyTopLeftLocationOffsetWithFlipping(LayoutPoint&) const; > > bool shouldComputeLogicalHeightFromAspectRatio() const; >+ bool shouldComputeLogicalWidthFromAspectRatio() const; >+ bool shouldComputeLogicalWidthFromAspectRatioAndInsets() const; >+ void computeLogicalWidthFromAspectRatio(LayoutUnit& logicalWidth, RenderFragmentContainer* = nullptr) const; > > private: > // The width/height of the contents + borders + padding. The x/y location is relative to our container (which is not always our parent). >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index a358d8ff8fbc787024409e283aed98f2795f5f1d..15e2db20197fe172dc2d5cbcd23a860ddbaa23ba 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2020-12-11 Rob Buis <rbuis@igalia.com> >+ >+ Support aspect-ratio on positioned elements >+ https://bugs.webkit.org/show_bug.cgi?id=219741 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Enable some tests that pass now. >+ >+ * TestExpectations: >+ > 2020-12-10 Aditya Keerthi <akeerthi@apple.com> > > [iOS][FCR] Add new look for input type=range >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index a94d012e0cb76a268cb38320d2db00ae5d2c0d8d..0989ab59bc54e62361427635fdc567edb00ff99a 100644 >--- a/LayoutTests/TestExpectations >+++ b/LayoutTests/TestExpectations >@@ -4415,17 +4415,9 @@ 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 ] > >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/abspos-001.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/abspos-002.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/abspos-003.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/abspos-004.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/abspos-005.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/abspos-006.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/abspos-007.html [ ImageOnlyFailure ] > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/abspos-008.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/abspos-009.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/abspos-010.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/abspos-011.html [ ImageOnlyFailure ] >+webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/abspos-012.html [ ImageOnlyFailure ] >+webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/abspos-013.html [ ImageOnlyFailure ] > 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-009.html [ ImageOnlyFailure ] > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-014.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 219741
:
415872
|
415893
|
415994
|
416024
|
416038
|
416678