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-220977-20210129103931.patch (text/plain), 7.72 KB, created by
Rob Buis
on 2021-01-29 01:39:32 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Rob Buis
Created:
2021-01-29 01:39:32 PST
Size:
7.72 KB
patch
obsolete
>Subversion Revision: 272049 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index ff8248a26968fd3272f630a71f31c531b4335cac..eff36fac8507c490c9580405bb48aaaed340b034 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,19 @@ >+2021-01-29 Rob Buis <rbuis@igalia.com> >+ >+ Support aspect-ratio on grid items >+ https://bugs.webkit.org/show_bug.cgi?id=220977 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Support aspect-ratio for grid items by correcting >+ the auto-size determination for row/columns-axis >+ when the child has aspect-ratio set. >+ >+ * rendering/RenderGrid.cpp: >+ (WebCore::RenderGrid::hasAutoSizeInColumnAxis const): >+ (WebCore::RenderGrid::hasAutoSizeInRowAxis const): >+ * rendering/RenderGrid.h: >+ > 2021-01-29 Rob Buis <rbuis@igalia.com> > > Fix logic error in shouldComputeLogicalHeightFromAspectRatio >diff --git a/Source/WebCore/rendering/RenderGrid.cpp b/Source/WebCore/rendering/RenderGrid.cpp >index a9c8a88de5778e410dc41341a4493920ecc04cde..8ad963721990d2e90ebcb159a4d232eaa52bb08f 100644 >--- a/Source/WebCore/rendering/RenderGrid.cpp >+++ b/Source/WebCore/rendering/RenderGrid.cpp >@@ -191,9 +191,15 @@ void RenderGrid::layoutBlock(bool relayoutChildren, LayoutUnit) > beginUpdateScrollInfoAfterLayoutTransaction(); > > LayoutSize previousSize = size(); >- // FIXME: We should use RenderBlock::hasDefiniteLogicalHeight() but it does not work for positioned stuff. > // FIXME: Consider caching the hasDefiniteLogicalHeight value throughout the layout. >- bool hasDefiniteLogicalHeight = hasOverridingLogicalHeight() || computeContentLogicalHeight(MainOrPreferredSize, style().logicalHeight(), WTF::nullopt); >+ bool hasDefiniteLogicalHeight = hasOverridingLogicalHeight(); >+ if (!hasDefiniteLogicalHeight) { >+ // FIXME: We should use RenderBlock::hasDefiniteLogicalHeight() but it does not work for positioned stuff. >+ if (isOutOfFlowPositioned()) >+ hasDefiniteLogicalHeight = computeContentLogicalHeight(MainOrPreferredSize, style().logicalHeight(), WTF::nullopt) != WTF::nullopt; >+ else >+ hasDefiniteLogicalHeight = RenderBlock::hasDefiniteLogicalHeight(); >+ } > > m_hasAnyOrthogonalItem = false; > for (auto* child = firstChildBox(); child; child = child->nextSiblingBox()) { >@@ -1859,4 +1865,38 @@ const char* RenderGrid::renderName() const > return "RenderGrid"; > } > >+bool RenderGrid::hasAutoSizeInColumnAxis(const RenderBox& child) const >+{ >+ if (child.style().hasAspectRatio()) { >+ if (isHorizontalWritingMode() == child.isHorizontalWritingMode()) { >+ // A non-auto inline size means the same for block size >+ // (column axis size) because of the aspect ratio. >+ if (!child.style().logicalWidth().isAuto()) >+ return false; >+ } else { >+ const Length& logicalHeight = child.style().logicalHeight(); >+ if (logicalHeight.isFixed() || (logicalHeight.isPercentOrCalculated() && child.percentageLogicalHeightIsResolvable())) >+ return false; >+ } >+ } >+ return isHorizontalWritingMode() ? child.style().height().isAuto() : child.style().width().isAuto(); >+} >+ >+bool RenderGrid::hasAutoSizeInRowAxis(const RenderBox& child) const >+{ >+ if (child.style().hasAspectRatio()) { >+ if (isHorizontalWritingMode() == child.isHorizontalWritingMode()) { >+ // A non-auto block size means the same for inline size >+ // (row axis size) because of the aspect ratio. >+ const Length& logicalHeight = child.style().logicalHeight(); >+ if (logicalHeight.isFixed() || (logicalHeight.isPercentOrCalculated() && child.percentageLogicalHeightIsResolvable())) >+ return false; >+ } else { >+ if (!child.style().logicalWidth().isAuto()) >+ return false; >+ } >+ } >+ return isHorizontalWritingMode() ? child.style().width().isAuto() : child.style().height().isAuto(); >+} >+ > } // namespace WebCore >diff --git a/Source/WebCore/rendering/RenderGrid.h b/Source/WebCore/rendering/RenderGrid.h >index 37576efa53580cc0256c6a814bd55f80a17f9b2f..7cbd8dde64fedfe28558a8b33464804fc2a0fa0c 100644 >--- a/Source/WebCore/rendering/RenderGrid.h >+++ b/Source/WebCore/rendering/RenderGrid.h >@@ -159,8 +159,8 @@ private: > StyleSelfAlignmentData justifySelfForChild(const RenderBox&, const RenderStyle* = nullptr) const; > StyleSelfAlignmentData alignSelfForChild(const RenderBox&, const RenderStyle* = nullptr) const; > void applyStretchAlignmentToChildIfNeeded(RenderBox&); >- bool hasAutoSizeInColumnAxis(const RenderBox& child) const { return isHorizontalWritingMode() ? child.style().height().isAuto() : child.style().width().isAuto(); } >- bool hasAutoSizeInRowAxis(const RenderBox& child) const { return isHorizontalWritingMode() ? child.style().width().isAuto() : child.style().height().isAuto(); } >+ bool hasAutoSizeInColumnAxis(const RenderBox& child) const; >+ bool hasAutoSizeInRowAxis(const RenderBox& child) const; > bool allowedToStretchChildAlongColumnAxis(const RenderBox& child) const { return alignSelfForChild(child).position() == ItemPosition::Stretch && hasAutoSizeInColumnAxis(child) && !hasAutoMarginsInColumnAxis(child); } > bool allowedToStretchChildAlongRowAxis(const RenderBox& child) const { return justifySelfForChild(child).position() == ItemPosition::Stretch && hasAutoSizeInRowAxis(child) && !hasAutoMarginsInRowAxis(child); } > bool hasAutoMarginsInColumnAxis(const RenderBox&) const; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 1421cc7f53923640d60775f1fd5b4f8a1a41407d..70777bdaaa321cd1de20ba88299eda080f16c52a 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2021-01-29 Rob Buis <rbuis@igalia.com> >+ >+ Support aspect-ratio on grid items >+ https://bugs.webkit.org/show_bug.cgi?id=220977 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Enable some tests that pass now. >+ >+ * TestExpectations: >+ > 2021-01-29 Rob Buis <rbuis@igalia.com> > > Fix logic error in shouldComputeLogicalHeightFromAspectRatio >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index b7344fc2a1497edd1f75a5bfa5ebbd91f78987db..b4823df5e381f0d59e3a976280c80ab0612d143b 100644 >--- a/LayoutTests/TestExpectations >+++ b/LayoutTests/TestExpectations >@@ -4440,10 +4440,6 @@ 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-007.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/grid-aspect-ratio-009.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/grid-aspect-ratio-011.html [ ImageOnlyFailure ] >-webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/grid-aspect-ratio-012.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 ]
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 220977
:
418408
|
418510
|
418547
|
418712
|
418715
|
418717
|
418972
|
419114
|
419121