Changeset 273753 in webkit
- Timestamp:
- Mar 2, 2021 12:23:49 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r273745 r273753 1 2021-03-02 Rob Buis <rbuis@igalia.com> 2 3 Take box-sizing into account in replaced element intrinsic sizing 4 https://bugs.webkit.org/show_bug.cgi?id=221671 5 6 Reviewed by Simon Fraser. 7 8 Enable some tests that pass now. 9 10 * TestExpectations: 11 1 12 2021-03-02 Chris Gambrell <cgambrell@apple.com> 2 13 -
trunk/LayoutTests/TestExpectations
r273444 r273753 4572 4572 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/intrinsic-size-014.html [ ImageOnlyFailure ] 4573 4573 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/intrinsic-size-015.html [ ImageOnlyFailure ] 4574 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-031.html [ ImageOnlyFailure ]4575 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-032.html [ ImageOnlyFailure ]4576 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-033.html [ ImageOnlyFailure ]4577 4574 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/table-element-001.html [ ImageOnlyFailure ] 4578 4575 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/contain-intrinsic-size/contain-intrinsic-size-001.html [ ImageOnlyFailure ] -
trunk/LayoutTests/imported/w3c/ChangeLog
r273635 r273753 1 2021-03-02 Rob Buis <rbuis@igalia.com> 2 3 Take box-sizing into account in replaced element intrinsic sizing 4 https://bugs.webkit.org/show_bug.cgi?id=221671 5 6 Reviewed by Simon Fraser. 7 8 Sync test. 9 10 * web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-032.html: 11 1 12 2021-02-28 Antoine Quint <graouts@webkit.org> 2 13 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-032.html
r271893 r273753 24 24 (note: height here is the block size of content-box.) 25 25 26 3rd: A green rect 20x100.27 border-top is 20x40 and the content box is 20x60 because we compute26 3rd: A green rect 10x100. 27 border-top is 10x40 and the content box is 10x60 because we compute 28 28 the inline size by aspect-ratio which works with border-box and so the 29 inline size is 100px / 5 = 20px.29 inline size is 100px / 10 = 10px. 30 30 (note: height here is the block size of border-box.) 31 32 4th: A green rect 10x100. 33 border-top is 10x40 and the content box is 10x60 to add up to 10x100. 31 34 --> 32 35 <img src="support/1x1-green.png" style="height: 100px; aspect-ratio: auto 1/10; box-sizing: border-box;" 33 36 ><img src="support/1x1-green.png" style="height: 60px; aspect-ratio: 1/3; box-sizing: content-box;" 34 ><img src="support/1x1-green.png" style="height: 100px; aspect-ratio: 1/5; box-sizing: border-box;"> 37 ><img src="support/1x1-green.png" style="height: 100px; aspect-ratio: 1/10; box-sizing: border-box;" 38 ><img src="support/1x1-green.png" style="width: 10px; aspect-ratio: 1/6; box-sizing: content-box;"> -
trunk/Source/WebCore/ChangeLog
r273752 r273753 1 2021-03-02 Rob Buis <rbuis@igalia.com> 2 3 Take box-sizing into account in replaced element intrinsic sizing 4 https://bugs.webkit.org/show_bug.cgi?id=221671 5 6 Reviewed by Simon Fraser. 7 8 Take box-sizing into account in replaced element intrinsic sizing when 9 using aspect-ratio, but keep using content-box when resolving 10 width/height when no aspect-ratio is set. 11 12 Tests: imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-031.html 13 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-032.html 14 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-033.html 15 16 * rendering/RenderReplaced.cpp: 17 (WebCore::resolveWidthForRatio): 18 (WebCore::RenderReplaced::computeReplacedLogicalWidth const): 19 (WebCore::resolveHeightForRatio): 20 (WebCore::RenderReplaced::computeReplacedLogicalHeight const): 21 1 22 2021-03-02 Antoine Quint <graouts@webkit.org> 2 23 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r273606 r273753 2490 2490 { 2491 2491 if (boxSizing == BoxSizing::BorderBox) 2492 return blockSize * LayoutUnit(aspectRatio);2493 2494 return ((blockSize - borderPaddingBlockSum) * LayoutUnit(aspectRatio)) + borderPaddingInlineSum;2492 return blockSize * aspectRatio; 2493 2494 return ((blockSize - borderPaddingBlockSum) * aspectRatio) + borderPaddingInlineSum; 2495 2495 } 2496 2496 -
trunk/Source/WebCore/rendering/RenderReplaced.cpp
r272711 r273753 533 533 } 534 534 535 static inline LayoutUnit resolveWidthForRatio(LayoutUnit borderAndPaddingLogicalHeight, LayoutUnit borderAndPaddingLogicalWidth, LayoutUnit logicalHeight, double aspectRatio, BoxSizing boxSizing) 536 { 537 if (boxSizing == BoxSizing::BorderBox) 538 return LayoutUnit(round((logicalHeight + borderAndPaddingLogicalHeight) * aspectRatio)) - borderAndPaddingLogicalWidth; 539 return LayoutUnit(round(logicalHeight * aspectRatio)); 540 } 541 535 542 LayoutUnit RenderReplaced::computeReplacedLogicalWidth(ShouldComputePreferred shouldComputePreferred) const 536 543 { … … 568 575 LayoutUnit estimatedUsedWidth = hasIntrinsicWidth ? LayoutUnit(constrainedSize.width()) : computeConstrainedLogicalWidth(shouldComputePreferred); 569 576 LayoutUnit logicalHeight = computeReplacedLogicalHeight(Optional<LayoutUnit>(estimatedUsedWidth)); 570 return computeReplacedLogicalWidthRespectingMinMaxWidth(roundToInt(round(logicalHeight * intrinsicRatio)), shouldComputePreferred); 577 BoxSizing boxSizing = BoxSizing::ContentBox; 578 if (style().hasAspectRatio()) 579 boxSizing = style().boxSizingForAspectRatio(); 580 return computeReplacedLogicalWidthRespectingMinMaxWidth(resolveWidthForRatio(borderAndPaddingLogicalHeight(), borderAndPaddingLogicalWidth(), logicalHeight, intrinsicRatio, boxSizing), shouldComputePreferred); 571 581 } 572 582 … … 597 607 } 598 608 609 static inline LayoutUnit resolveHeightForRatio(LayoutUnit borderAndPaddingLogicalWidth, LayoutUnit borderAndPaddingLogicalHeight, LayoutUnit logicalWidth, double aspectRatio, BoxSizing boxSizing) 610 { 611 if (boxSizing == BoxSizing::BorderBox) 612 return LayoutUnit(round((logicalWidth + borderAndPaddingLogicalWidth) / aspectRatio)) - borderAndPaddingLogicalHeight; 613 return LayoutUnit(round(logicalWidth / aspectRatio)); 614 } 615 599 616 LayoutUnit RenderReplaced::computeReplacedLogicalHeight(Optional<LayoutUnit> estimatedUsedWidth) const 600 617 { … … 626 643 if (intrinsicRatio) { 627 644 LayoutUnit usedWidth = estimatedUsedWidth ? estimatedUsedWidth.value() : availableLogicalWidth(); 628 return computeReplacedLogicalHeightRespectingMinMaxHeight(roundToInt(round(usedWidth / intrinsicRatio))); 645 BoxSizing boxSizing = BoxSizing::ContentBox; 646 if (style().hasAspectRatio()) 647 boxSizing = style().boxSizingForAspectRatio(); 648 return computeReplacedLogicalHeightRespectingMinMaxHeight(resolveHeightForRatio(borderAndPaddingLogicalWidth(), borderAndPaddingLogicalHeight(), usedWidth, intrinsicRatio, boxSizing)); 629 649 } 630 650
Note: See TracChangeset
for help on using the changeset viewer.