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-219679-20201209145231.patch (text/plain), 8.52 KB, created by
Rob Buis
on 2020-12-09 05:52:33 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Rob Buis
Created:
2020-12-09 05:52:33 PST
Size:
8.52 KB
patch
obsolete
>Subversion Revision: 270573 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c4361259025587e3fe91f50689222ac1b0fe8cbc..3c8da3a0f3dbeb403cfa94048d0c1bf9b2b3c35d 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,20 @@ >+2020-12-09 Rob Buis <rbuis@igalia.com> >+ >+ Support aspect-ratio on flexbox children >+ https://bugs.webkit.org/show_bug.cgi?id=219679 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ WIP. >+ >+ * rendering/RenderFlexibleBox.cpp: >+ (WebCore::childHasAspectRatio): >+ (WebCore::RenderFlexibleBox::computeMainAxisExtentForChild): >+ (WebCore::RenderFlexibleBox::useChildAspectRatio const): >+ (WebCore::RenderFlexibleBox::computeMainSizeFromAspectRatioUsing const): >+ (WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax): >+ (WebCore::RenderFlexibleBox::needToStretchChildLogicalHeight const): >+ > 2020-12-08 Rob Buis <rbuis@igalia.com> > > Dirty line boxes when RenderMenuList text changes >diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp >index 2e7f44bbad7bf012907a19dc56f7254a74fa8566..6d719d348fc5d80609af607e6ebad8b30b341cb0 100644 >--- a/Source/WebCore/rendering/RenderFlexibleBox.cpp >+++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp >@@ -543,6 +543,11 @@ LayoutUnit RenderFlexibleBox::mainAxisContentExtent(LayoutUnit contentLogicalHei > return std::max(0_lu, computedValues.m_extent - borderPaddingAndScrollbar); > } > >+static bool childHasAspectRatio(const RenderBox& child) >+{ >+ return child.hasAspectRatio() || child.style().hasAspectRatio(); >+} >+ > Optional<LayoutUnit> RenderFlexibleBox::computeMainAxisExtentForChild(const RenderBox& child, SizeType sizeType, const Length& size) > { > // If we have a horizontal flow, that means the main size is the width. >@@ -569,7 +574,7 @@ Optional<LayoutUnit> RenderFlexibleBox::computeMainAxisExtentForChild(const Rend > // our logical width is auto, we can just use our cached value. So let's do > // that here. (Compare code in LayoutBlock::computePreferredLogicalWidths) > LayoutUnit borderAndPadding = child.borderAndPaddingLogicalWidth(); >- if (child.style().logicalWidth().isAuto() && !child.hasAspectRatio()) { >+ if (child.style().logicalWidth().isAuto() && !childHasAspectRatio(child)) { > if (size.type() == MinContent) > return child.minPreferredLogicalWidth() - borderAndPadding; > if (size.type() == MaxContent) >@@ -739,9 +744,9 @@ LayoutPoint RenderFlexibleBox::flowAwareLocationForChild(const RenderBox& child) > > bool RenderFlexibleBox::useChildAspectRatio(const RenderBox& child) const > { >- if (!child.hasAspectRatio()) >+ if (!childHasAspectRatio(child)) > return false; >- if (!child.intrinsicSize().height()) { >+ if (!child.intrinsicSize().height() && child.style().aspectRatioType() == AspectRatioType::Auto) { > // We can't compute a ratio in this case. > return false; > } >@@ -756,7 +761,7 @@ bool RenderFlexibleBox::useChildAspectRatio(const RenderBox& child) const > > LayoutUnit RenderFlexibleBox::computeMainSizeFromAspectRatioUsing(const RenderBox& child, Length crossSizeLength) const > { >- ASSERT(child.hasAspectRatio()); >+ ASSERT(childHasAspectRatio(child)); > ASSERT(child.intrinsicSize().height()); > > Optional<LayoutUnit> crossSize; >@@ -771,6 +776,8 @@ LayoutUnit RenderFlexibleBox::computeMainSizeFromAspectRatioUsing(const RenderBo > > const LayoutSize& childIntrinsicSize = child.intrinsicSize(); > double ratio = childIntrinsicSize.width().toFloat() / childIntrinsicSize.height().toFloat(); >+ if (child.style().aspectRatioType() == AspectRatioType::Ratio || (child.style().aspectRatioType() == AspectRatioType::AutoAndRatio && childIntrinsicSize.isEmpty())) >+ ratio = child.style().aspectRatioWidth() / child.style().aspectRatioHeight(); > if (isHorizontalFlow()) > return LayoutUnit(crossSize.value() * ratio); > return LayoutUnit(crossSize.value() / ratio); >@@ -1141,7 +1148,7 @@ LayoutUnit RenderFlexibleBox::adjustChildSizeForMinAndMax(const RenderBox& child > // ensure it's valid through the virtual calls of computeIntrinsicLogicalContentHeightUsing. > LayoutUnit contentSize = computeMainAxisExtentForChild(child, MinSize, Length(MinContent)).valueOr(0); > ASSERT(contentSize >= 0); >- if (child.hasAspectRatio() && child.intrinsicSize().height() > 0) >+ if (childHasAspectRatio(child) && child.intrinsicSize().height() > 0) > contentSize = adjustChildSizeForAspectRatioCrossAxisMinAndMax(child, contentSize); > contentSize = std::min(contentSize, maxExtent.valueOr(contentSize)); > >@@ -1556,7 +1563,7 @@ bool RenderFlexibleBox::needToStretchChildLogicalHeight(const RenderBox& child) > return false; > > // Aspect ratio is properly handled by RenderReplaced during layout. >- if (child.isRenderReplaced() && child.hasAspectRatio()) >+ if (child.isRenderReplaced() && childHasAspectRatio(child)) > return false; > > return child.style().logicalHeight().isAuto(); >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 184017e361dc56380118245b0ed3b99bcbadd1a7..d65372a2a6b160302a447984c64eee2ead741816 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2020-12-09 Rob Buis <rbuis@igalia.com> >+ >+ Support aspect-ratio on flexbox children >+ https://bugs.webkit.org/show_bug.cgi?id=219679 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Unskip some tests that pass now. >+ >+ * TestExpectations: >+ > 2020-12-08 Diego Pino Garcia <dpino@igalia.com> > > [GLIB] REGRESSION(r270526): Several URL related tests are failing >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index c5a9d6d383872f09c81082392c7a0e8086fe1d87..668de91f5bbd5353707e22e3dbd29a5a7c11f29b 100644 >--- a/LayoutTests/TestExpectations >+++ b/LayoutTests/TestExpectations >@@ -4441,20 +4441,11 @@ 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/block-aspect-ratio-026.html [ ImageOnlyFailure ] > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-027.html [ ImageOnlyFailure ] > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-028.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-001.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-002.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-004.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-005.html [ ImageOnlyFailure ] > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-009.html [ ImageOnlyFailure ] > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-011.html [ ImageOnlyFailure ] > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-012.html [ ImageOnlyFailure ] > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-013.html [ ImageOnlyFailure ] > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-014.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-015.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-016.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-017.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-018.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-019.html [ ImageOnlyFailure ] > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-021.html [ ImageOnlyFailure ] > 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-023.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 219679
:
415748
|
415761
|
417080
|
417261
|
417841
|
417966
|
417971
|
418553
|
418734
|
420005
|
420456
|
420624
|
420628
|
420814
|
420937
|
420958
|
420979