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-221671-20210223123400.patch (text/plain), 10.73 KB, created by
Rob Buis
on 2021-02-23 03:34:01 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Rob Buis
Created:
2021-02-23 03:34:01 PST
Size:
10.73 KB
patch
obsolete
>Subversion Revision: 273245 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index a6ca132469c527e60eb2c36f6a34770847d67cff..db66556310b2315459e18b0938c8bf88078f516a 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,24 @@ >+2021-02-22 Rob Buis <rbuis@igalia.com> >+ >+ Take box-sizing into account in replaced element intrinsic sizing >+ https://bugs.webkit.org/show_bug.cgi?id=221671 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Take box-sizing into account in replaced element intrinsic sizing when >+ using aspect-ratio, but keep using content-box when resolving >+ width/height when no aspect-ratio is set. >+ >+ Tests: imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-031.html >+ imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-032.html >+ imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-033.html >+ >+ * rendering/RenderReplaced.cpp: >+ (WebCore::resolveWidthForRatio): >+ (WebCore::RenderReplaced::computeReplacedLogicalWidth const): >+ (WebCore::resolveHeightForRatio): >+ (WebCore::RenderReplaced::computeReplacedLogicalHeight const): >+ > 2021-02-22 Sam Weinig <weinig@apple.com> > > Add experimental support for CSS Color 5 color-mix() >diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp >index 53fd0f0f38ca5afd1079fdc340748b14c9c29000..66ae35642626bb92a1c344bab1f68da32324b33a 100644 >--- a/Source/WebCore/rendering/RenderBox.cpp >+++ b/Source/WebCore/rendering/RenderBox.cpp >@@ -2489,9 +2489,9 @@ void RenderBox::updateLogicalWidth() > static LayoutUnit inlineSizeFromAspectRatio(LayoutUnit borderPaddingInlineSum, LayoutUnit borderPaddingBlockSum, LayoutUnit aspectRatio, BoxSizing boxSizing, LayoutUnit blockSize) > { > if (boxSizing == BoxSizing::BorderBox) >- return blockSize * LayoutUnit(aspectRatio); >+ return blockSize * aspectRatio; > >- return ((blockSize - borderPaddingBlockSum) * LayoutUnit(aspectRatio)) + borderPaddingInlineSum; >+ return ((blockSize - borderPaddingBlockSum) * aspectRatio) + borderPaddingInlineSum; > } > > void RenderBox::computeLogicalWidthInFragment(LogicalExtentComputedValues& computedValues, RenderFragmentContainer* fragment) const >diff --git a/Source/WebCore/rendering/RenderReplaced.cpp b/Source/WebCore/rendering/RenderReplaced.cpp >index 0cf967255aabe350d443a46938f953c2fa7507dc..aef8f6eda72dad149d1ec08082f2062674d39b7e 100644 >--- a/Source/WebCore/rendering/RenderReplaced.cpp >+++ b/Source/WebCore/rendering/RenderReplaced.cpp >@@ -532,6 +532,13 @@ LayoutUnit RenderReplaced::computeConstrainedLogicalWidth(ShouldComputePreferred > return computeReplacedLogicalWidthRespectingMinMaxWidth(logicalWidth, shouldComputePreferred); > } > >+static inline LayoutUnit resolveWidthForRatio(LayoutUnit borderAndPaddingLogicalHeight, LayoutUnit borderAndPaddingLogicalWidth, LayoutUnit logicalHeight, double aspectRatio, BoxSizing boxSizing) >+{ >+ if (boxSizing == BoxSizing::BorderBox) >+ return roundToInt(round((logicalHeight + borderAndPaddingLogicalHeight) * aspectRatio)) - borderAndPaddingLogicalWidth; >+ return roundToInt(round(logicalHeight * aspectRatio)); >+} >+ > LayoutUnit RenderReplaced::computeReplacedLogicalWidth(ShouldComputePreferred shouldComputePreferred) const > { > if (style().logicalWidth().isSpecified() || style().logicalWidth().isIntrinsic()) >@@ -567,7 +574,10 @@ LayoutUnit RenderReplaced::computeReplacedLogicalWidth(ShouldComputePreferred sh > if (intrinsicRatio && ((computedHeightIsAuto && !hasIntrinsicWidth && hasIntrinsicHeight) || !computedHeightIsAuto)) { > LayoutUnit estimatedUsedWidth = hasIntrinsicWidth ? LayoutUnit(constrainedSize.width()) : computeConstrainedLogicalWidth(shouldComputePreferred); > LayoutUnit logicalHeight = computeReplacedLogicalHeight(Optional<LayoutUnit>(estimatedUsedWidth)); >- return computeReplacedLogicalWidthRespectingMinMaxWidth(roundToInt(round(logicalHeight * intrinsicRatio)), shouldComputePreferred); >+ BoxSizing boxSizing = BoxSizing::ContentBox; >+ if (style().hasAspectRatio()) >+ boxSizing = style().boxSizingForAspectRatio(); >+ return computeReplacedLogicalWidthRespectingMinMaxWidth(resolveWidthForRatio(borderAndPaddingLogicalHeight(), borderAndPaddingLogicalWidth(), logicalHeight, intrinsicRatio, boxSizing), shouldComputePreferred); > } > > >@@ -596,6 +606,13 @@ LayoutUnit RenderReplaced::computeReplacedLogicalWidth(ShouldComputePreferred sh > return computeReplacedLogicalWidthRespectingMinMaxWidth(intrinsicLogicalWidth(), shouldComputePreferred); > } > >+static inline LayoutUnit resolveHeightForRatio(LayoutUnit borderAndPaddingLogicalWidth, LayoutUnit borderAndPaddingLogicalHeight, LayoutUnit logicalWidth, double aspectRatio, BoxSizing boxSizing) >+{ >+ if (boxSizing == BoxSizing::BorderBox) >+ return roundToInt(round((logicalWidth + borderAndPaddingLogicalWidth) / aspectRatio)) - borderAndPaddingLogicalHeight; >+ return roundToInt(round(logicalWidth / aspectRatio)); >+} >+ > LayoutUnit RenderReplaced::computeReplacedLogicalHeight(Optional<LayoutUnit> estimatedUsedWidth) const > { > // 10.5 Content height: the 'height' property: http://www.w3.org/TR/CSS21/visudet.html#propdef-height >@@ -625,7 +642,10 @@ LayoutUnit RenderReplaced::computeReplacedLogicalHeight(Optional<LayoutUnit> est > // (used width) / (intrinsic ratio) > if (intrinsicRatio) { > LayoutUnit usedWidth = estimatedUsedWidth ? estimatedUsedWidth.value() : availableLogicalWidth(); >- return computeReplacedLogicalHeightRespectingMinMaxHeight(roundToInt(round(usedWidth / intrinsicRatio))); >+ BoxSizing boxSizing = BoxSizing::ContentBox; >+ if (style().hasAspectRatio()) >+ boxSizing = style().boxSizingForAspectRatio(); >+ return computeReplacedLogicalHeightRespectingMinMaxHeight(resolveHeightForRatio(borderAndPaddingLogicalWidth(), borderAndPaddingLogicalHeight(), usedWidth, intrinsicRatio, boxSizing)); > } > > // Otherwise, if 'height' has a computed value of 'auto', and the element has an intrinsic height, then that intrinsic height is the used value of 'height'. >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index d1bbc4ba2fc7de673510952bca5e9e57135044f6..816c1162bff964bbd39436203629dfb9bbcf8597 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2021-02-22 Rob Buis <rbuis@igalia.com> >+ >+ Take box-sizing into account in replaced element intrinsic sizing >+ https://bugs.webkit.org/show_bug.cgi?id=221671 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Enable some tests that pass now. >+ >+ * TestExpectations: >+ > 2021-02-22 Rob Buis <rbuis@igalia.com> > > Resync web-platform-tests/css/css-sizing/aspect-ratio from upstream >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index 345cd02cb8ab64243d73c9e84ccc8106590dd8f6..cd2153788c467cf74bbb6bec01038c59fc783874 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,14 @@ >+2021-02-22 Rob Buis <rbuis@igalia.com> >+ >+ Take box-sizing into account in replaced element intrinsic sizing >+ https://bugs.webkit.org/show_bug.cgi?id=221671 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Sync test. >+ >+ * web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-032.html: >+ > 2021-02-22 Rob Buis <rbuis@igalia.com> > > Resync web-platform-tests/css/css-sizing/aspect-ratio from upstream >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index 9ab16b28427756739b7995edc6aecd85522c1fdb..8ee95c4ef138732469589a90f08c7730afba2b46 100644 >--- a/LayoutTests/TestExpectations >+++ b/LayoutTests/TestExpectations >@@ -4570,9 +4570,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/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 ] > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/table-element-001.html [ ImageOnlyFailure ] > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/contain-intrinsic-size/contain-intrinsic-size-001.html [ ImageOnlyFailure ] > webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/contain-intrinsic-size/contain-intrinsic-size-002.html [ ImageOnlyFailure ] >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-032.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-032.html >index afa483dd3158910136392e405e363294033e02d6..022a2d797b1bb6ad9cde6c383ad054f1bd835400 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-032.html >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-032.html >@@ -23,12 +23,16 @@ img { > border-top is 20x40 and the content box is 20x60. > (note: height here is the block size of content-box.) > >- 3rd: A green rect 20x100. >- border-top is 20x40 and the content box is 20x60 because we compute >+ 3rd: A green rect 10x100. >+ border-top is 10x40 and the content box is 10x60 because we compute > the inline size by aspect-ratio which works with border-box and so the >- inline size is 100px / 5 = 20px. >+ inline size is 100px / 10 = 10px. > (note: height here is the block size of border-box.) >+ >+ 4th: A green rect 10x100. >+ border-top is 10x40 and the content box is 10x60 to add up to 10x100. > --> > <img src="support/1x1-green.png" style="height: 100px; aspect-ratio: auto 1/10; box-sizing: border-box;" > ><img src="support/1x1-green.png" style="height: 60px; aspect-ratio: 1/3; box-sizing: content-box;" >-><img src="support/1x1-green.png" style="height: 100px; aspect-ratio: 1/5; box-sizing: border-box;"> >+><img src="support/1x1-green.png" style="height: 100px; aspect-ratio: 1/10; box-sizing: border-box;" >+><img src="support/1x1-green.png" style="width: 10px; aspect-ratio: 1/6; box-sizing: content-box;">
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 221671
:
419838
|
419854
|
420278
|
420441
|
420643
|
421212
|
421298
|
421613
|
421906
|
421932