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-223570-20210413000804.patch (text/plain), 61.80 KB, created by
cathiechen
on 2021-04-12 09:08:06 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
cathiechen
Created:
2021-04-12 09:08:06 PDT
Size:
61.80 KB
patch
obsolete
>Subversion Revision: 275823 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c8824665294073e003d66f61e8f08c2c0ad8274b..d47168af939a14309f07d8c3917926985fbe4f46 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,73 @@ >+2021-04-12 Cathie Chen <cathiechen@igalia.com> >+ >+ [CSS contain] Support contain:size >+ https://bugs.webkit.org/show_bug.cgi?id=223570 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch brings initial support of CSS contain:size. According to https://www.w3.org/TR/css-contain-2/#containment-size, >+ the intrinsic sizes of size containment box are determined as if it had no content. >+ When calculating the widths, size containment boxes skip computing min/max widths in computeIntrinsicLogicalWidths(). >+ For children layout changes the box's logical height so at the beginning of calculating logical height, >+ size containment boxes reset the height to the empty content height. >+ >+ * rendering/GridTrackSizingAlgorithm.cpp: >+ (WebCore::GridTrackSizingAlgorithm::computeGridContainerIntrinsicSizes): >+ (WebCore::GridTrackSizingAlgorithm::resolveIntrinsicTrackSizes): >+ (WebCore::GridTrackSizingAlgorithm::advanceNextState): >+ (WebCore::GridTrackSizingAlgorithm::run): >+ * rendering/GridTrackSizingAlgorithm.h: >+ * rendering/RenderBlock.cpp: >+ (WebCore::RenderBlock::layoutPositionedObject): >+ (WebCore::RenderBlock::computeIntrinsicLogicalWidths const): >+ * rendering/RenderBlockFlow.cpp: >+ (WebCore::RenderBlockFlow::computeIntrinsicLogicalWidths const): >+ (WebCore::RenderBlockFlow::adjustBlockChildForPagination): >+ (WebCore::RenderBlockFlow::adjustSizeContainmentChildForPagination): >+ * rendering/RenderBlockFlow.h: >+ * rendering/RenderBox.cpp: >+ (WebCore::RenderBox::updateLogicalHeight): >+ (WebCore::RenderBox::isUnsplittableForPagination const): >+ * rendering/RenderDeprecatedFlexibleBox.cpp: >+ (WebCore::RenderDeprecatedFlexibleBox::computeIntrinsicLogicalWidths const): >+ * rendering/RenderFileUploadControl.cpp: >+ (WebCore::RenderFileUploadControl::computeIntrinsicLogicalWidths const): >+ * rendering/RenderFlexibleBox.cpp: >+ (WebCore::RenderFlexibleBox::computeIntrinsicLogicalWidths const): >+ * rendering/RenderFragmentedFlow.h: >+ * rendering/RenderGrid.cpp: >+ (WebCore::RenderGrid::layoutBlock): >+ (WebCore::RenderGrid::computeAutoRepeatTracksCount const): >+ * rendering/RenderImage.cpp: >+ (WebCore::RenderImage::computeIntrinsicRatioInformation const): >+ * rendering/RenderListBox.cpp: >+ (WebCore::RenderListBox::computeIntrinsicLogicalWidths const): >+ * rendering/RenderMenuList.cpp: >+ (RenderMenuList::computeIntrinsicLogicalWidths const): >+ * rendering/RenderMultiColumnFlow.cpp: >+ (WebCore::RenderMultiColumnFlow::updateSpaceShortageForSizeContainment): >+ * rendering/RenderMultiColumnFlow.h: >+ * rendering/RenderMultiColumnSet.cpp: >+ (WebCore::RenderMultiColumnSet::RenderMultiColumnSet): >+ (WebCore::RenderMultiColumnSet::calculateBalancedHeight const): >+ (WebCore::RenderMultiColumnSet::prepareForLayout): >+ * rendering/RenderMultiColumnSet.h: >+ * rendering/RenderObject.h: >+ (WebCore::RenderObject::isAtomicInlineLevelBox const): >+ (WebCore::RenderObject::shouldApplySizeContainment const): >+ * rendering/RenderReplaced.cpp: >+ (WebCore::RenderReplaced::computeAspectRatioInformationForRenderBox const): >+ (WebCore::RenderReplaced::computeIntrinsicRatioInformation const): >+ * rendering/RenderReplaced.h: >+ * rendering/RenderSlider.cpp: >+ (WebCore::RenderSlider::computeIntrinsicLogicalWidths const): >+ * rendering/RenderTextControl.cpp: >+ (WebCore::RenderTextControl::computeIntrinsicLogicalWidths const): >+ * rendering/RenderVideo.cpp: >+ (WebCore::RenderVideo::calculateIntrinsicSize): >+ * rendering/svg/RenderSVGRoot.cpp: >+ (WebCore::RenderSVGRoot::computeIntrinsicRatioInformation const): >+ > 2021-04-12 Rob Buis <rbuis@igalia.com> > > Clamp overridingContentLogicalWidth/Height to zero >diff --git a/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp b/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp >index 3a1479eea81af6f77607343657caff44fde49055..44a172df067fbdc7daac5f4997c71c1fd4c92309 100644 >--- a/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp >+++ b/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp >@@ -736,9 +736,9 @@ void GridTrackSizingAlgorithm::computeGridContainerIntrinsicSizes() > > Vector<GridTrack>& allTracks = tracks(m_direction); > for (auto& track : allTracks) { >- ASSERT(!track.infiniteGrowthPotential()); >+ ASSERT(m_strategy->isComputingSizeContainment() || !track.infiniteGrowthPotential()); > m_minContentSize += track.baseSize(); >- m_maxContentSize += track.growthLimit(); >+ m_maxContentSize += track.growthLimitIsInfinite() ? track.baseSize() : track.growthLimit(); > // The growth limit caps must be cleared now in order to properly sort > // tracks by growth potential on an eventual "Maximize Tracks". > track.setGrowthLimitCap(WTF::nullopt); >@@ -932,6 +932,7 @@ private: > double findUsedFlexFraction(Vector<unsigned>& flexibleSizedTracksIndex, GridTrackSizingDirection, Optional<LayoutUnit> freeSpace) const override; > bool recomputeUsedFlexFractionIfNeeded(double& flexFraction, LayoutUnit& totalGrowth) const override; > LayoutUnit freeSpaceForStretchAutoTracksStep() const override; >+ bool isComputingSizeContainment() const override { return renderGrid()->shouldApplySizeContainment(); } > }; > > void IndefiniteSizeStrategy::layoutGridItemForMinSizeComputation(RenderBox& child, bool overrideSizeHasChanged) const >@@ -1030,6 +1031,7 @@ private: > LayoutUnit freeSpaceForStretchAutoTracksStep() const override; > LayoutUnit minContentForChild(RenderBox&) const override; > LayoutUnit minLogicalSizeForChild(RenderBox&, const Length& childMinSize, Optional<LayoutUnit> availableSize) const override; >+ bool isComputingSizeContainment() const override { return false; } > }; > > LayoutUnit IndefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep() const >@@ -1146,37 +1148,39 @@ void GridTrackSizingAlgorithm::initializeTrackSizes() > > void GridTrackSizingAlgorithm::resolveIntrinsicTrackSizes() > { >- Vector<GridItemWithSpan> itemsSortedByIncreasingSpan; >- HashSet<RenderBox*> itemsSet; > Vector<GridTrack>& allTracks = tracks(m_direction); >- if (m_grid.hasGridItems()) { >- for (auto trackIndex : m_contentSizedTracksIndex) { >- GridIterator iterator(m_grid, m_direction, trackIndex); >- GridTrack& track = allTracks[trackIndex]; >- >- while (auto* gridItem = iterator.nextGridItem()) { >- if (itemsSet.add(gridItem).isNewEntry) { >- const GridSpan& span = m_grid.gridItemSpan(*gridItem, m_direction); >- if (span.integerSpan() == 1) >- sizeTrackToFitNonSpanningItem(span, *gridItem, track); >- else if (!spanningItemCrossesFlexibleSizedTracks(span)) >- itemsSortedByIncreasingSpan.append(GridItemWithSpan(*gridItem, span)); >+ if (!m_strategy->isComputingSizeContainment()) { >+ Vector<GridItemWithSpan> itemsSortedByIncreasingSpan; >+ HashSet<RenderBox*> itemsSet; >+ if (m_grid.hasGridItems()) { >+ for (auto trackIndex : m_contentSizedTracksIndex) { >+ GridIterator iterator(m_grid, m_direction, trackIndex); >+ GridTrack& track = allTracks[trackIndex]; >+ >+ while (auto* gridItem = iterator.nextGridItem()) { >+ if (itemsSet.add(gridItem).isNewEntry) { >+ const GridSpan& span = m_grid.gridItemSpan(*gridItem, m_direction); >+ if (span.integerSpan() == 1) >+ sizeTrackToFitNonSpanningItem(span, *gridItem, track); >+ else if (!spanningItemCrossesFlexibleSizedTracks(span)) >+ itemsSortedByIncreasingSpan.append(GridItemWithSpan(*gridItem, span)); >+ } > } > } >+ std::sort(itemsSortedByIncreasingSpan.begin(), itemsSortedByIncreasingSpan.end()); > } >- std::sort(itemsSortedByIncreasingSpan.begin(), itemsSortedByIncreasingSpan.end()); >- } > >- auto it = itemsSortedByIncreasingSpan.begin(); >- auto end = itemsSortedByIncreasingSpan.end(); >- while (it != end) { >- GridItemsSpanGroupRange spanGroupRange = { it, std::upper_bound(it, end, *it) }; >- increaseSizesToAccommodateSpanningItems<ResolveIntrinsicMinimums>(spanGroupRange); >- increaseSizesToAccommodateSpanningItems<ResolveContentBasedMinimums>(spanGroupRange); >- increaseSizesToAccommodateSpanningItems<ResolveMaxContentMinimums>(spanGroupRange); >- increaseSizesToAccommodateSpanningItems<ResolveIntrinsicMaximums>(spanGroupRange); >- increaseSizesToAccommodateSpanningItems<ResolveMaxContentMaximums>(spanGroupRange); >- it = spanGroupRange.rangeEnd; >+ auto it = itemsSortedByIncreasingSpan.begin(); >+ auto end = itemsSortedByIncreasingSpan.end(); >+ while (it != end) { >+ GridItemsSpanGroupRange spanGroupRange = { it, std::upper_bound(it, end, *it) }; >+ increaseSizesToAccommodateSpanningItems<ResolveIntrinsicMinimums>(spanGroupRange); >+ increaseSizesToAccommodateSpanningItems<ResolveContentBasedMinimums>(spanGroupRange); >+ increaseSizesToAccommodateSpanningItems<ResolveMaxContentMinimums>(spanGroupRange); >+ increaseSizesToAccommodateSpanningItems<ResolveIntrinsicMaximums>(spanGroupRange); >+ increaseSizesToAccommodateSpanningItems<ResolveMaxContentMaximums>(spanGroupRange); >+ it = spanGroupRange.rangeEnd; >+ } > } > > for (auto trackIndex : m_contentSizedTracksIndex) { >@@ -1239,7 +1243,8 @@ void GridTrackSizingAlgorithm::advanceNextState() > m_sizingState = RowSizingFirstIteration; > return; > case RowSizingFirstIteration: >- m_sizingState = ColumnSizingSecondIteration; >+ if (!m_strategy->isComputingSizeContainment()) >+ m_sizingState = ColumnSizingSecondIteration; > return; > case ColumnSizingSecondIteration: > m_sizingState = RowSizingSecondIteration; >@@ -1346,6 +1351,8 @@ void GridTrackSizingAlgorithm::run() > > // Step 3. > m_strategy->maximizeTracks(tracks(m_direction), m_direction == ForColumns ? m_freeSpaceColumns : m_freeSpaceRows); >+ if (m_strategy->isComputingSizeContainment()) >+ return; > > // Step 4. > stretchFlexibleTracks(initialFreeSpace); >diff --git a/Source/WebCore/rendering/GridTrackSizingAlgorithm.h b/Source/WebCore/rendering/GridTrackSizingAlgorithm.h >index 031125da9bfdb588a9a91961a3b1528e987f4162..29733324b4899705982ee00da8bf66df32e47c7d 100644 >--- a/Source/WebCore/rendering/GridTrackSizingAlgorithm.h >+++ b/Source/WebCore/rendering/GridTrackSizingAlgorithm.h >@@ -261,6 +261,7 @@ public: > virtual double findUsedFlexFraction(Vector<unsigned>& flexibleSizedTracksIndex, GridTrackSizingDirection, Optional<LayoutUnit> initialFreeSpace) const = 0; > virtual bool recomputeUsedFlexFractionIfNeeded(double& flexFraction, LayoutUnit& totalGrowth) const = 0; > virtual LayoutUnit freeSpaceForStretchAutoTracksStep() const = 0; >+ virtual bool isComputingSizeContainment() const = 0; > > protected: > GridTrackSizingAlgorithmStrategy(GridTrackSizingAlgorithm& algorithm) >diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp >index bb4df7cc878d1adf6ee4591f9fd5f3ff4344dc0a..8ea53a5592ee97f19c5656f4126b122efd6dbfa6 100644 >--- a/Source/WebCore/rendering/RenderBlock.cpp >+++ b/Source/WebCore/rendering/RenderBlock.cpp >@@ -1073,6 +1073,9 @@ void RenderBlock::layoutPositionedObject(RenderBox& r, bool relayoutChildren, bo > r.setNeedsLayout(MarkOnlyThis); > r.layoutIfNeeded(); > } >+ >+ if (view().frameView().layoutContext().layoutState()->isPaginated() && is<RenderBlockFlow>(*this)) >+ downcast<RenderBlockFlow>(*this).adjustSizeContainmentChildForPagination(r, r.logicalTop()); > } > > void RenderBlock::layoutPositionedObjects(bool relayoutChildren, bool fixedPositionObjectsOnly) >@@ -2282,8 +2285,8 @@ void RenderBlock::offsetForContents(LayoutPoint& offset) const > void RenderBlock::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const > { > ASSERT(!childrenInline()); >- >- computeBlockPreferredLogicalWidths(minLogicalWidth, maxLogicalWidth); >+ if (!shouldApplySizeContainment()) >+ computeBlockPreferredLogicalWidths(minLogicalWidth, maxLogicalWidth); > > maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth); > >diff --git a/Source/WebCore/rendering/RenderBlockFlow.cpp b/Source/WebCore/rendering/RenderBlockFlow.cpp >index 22f3fa06e5d4b38f442ec284057d7171ca6b553c..29471e49f361f08699e58ebd42ef04361010b89d 100644 >--- a/Source/WebCore/rendering/RenderBlockFlow.cpp >+++ b/Source/WebCore/rendering/RenderBlockFlow.cpp >@@ -339,10 +339,12 @@ void RenderBlockFlow::adjustIntrinsicLogicalWidthsForColumns(LayoutUnit& minLogi > > void RenderBlockFlow::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const > { >- if (childrenInline()) >- computeInlinePreferredLogicalWidths(minLogicalWidth, maxLogicalWidth); >- else >- computeBlockPreferredLogicalWidths(minLogicalWidth, maxLogicalWidth); >+ if (!shouldApplySizeContainment()) { >+ if (childrenInline()) >+ computeInlinePreferredLogicalWidths(minLogicalWidth, maxLogicalWidth); >+ else >+ computeBlockPreferredLogicalWidths(minLogicalWidth, maxLogicalWidth); >+ } > > maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth); > >@@ -1662,6 +1664,9 @@ LayoutUnit RenderBlockFlow::adjustBlockChildForPagination(LayoutUnit logicalTopA > } > } > >+ if (child.shouldApplySizeContainment()) >+ adjustSizeContainmentChildForPagination(child, result); >+ > // For replaced elements and scrolled elements, we want to shift them to the next page if they don't fit on the current one. > LayoutUnit logicalTopBeforeUnsplittableAdjustment = result; > LayoutUnit logicalTopAfterUnsplittableAdjustment = adjustForUnsplittableChild(child, result); >@@ -2047,6 +2052,24 @@ LayoutUnit RenderBlockFlow::logicalHeightForChildForFragmentation(const RenderBo > return logicalHeightForChild(child); > } > >+void RenderBlockFlow::adjustSizeContainmentChildForPagination(RenderBox& child, LayoutUnit offset) >+{ >+ if (!child.shouldApplySizeContainment()) >+ return; >+ >+ LayoutUnit childOverflowHeight = child.isHorizontalWritingMode() ? child.layoutOverflowRect().maxY() : child.layoutOverflowRect().maxX(); >+ LayoutUnit childLogicalHeight = std::max(child.logicalHeight(), childOverflowHeight); >+ >+ LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(offset, ExcludePageBoundary); >+ >+ LayoutUnit spaceShortage = childLogicalHeight - remainingLogicalHeight; >+ if (spaceShortage <= 0) >+ return; >+ >+ if (RenderFragmentedFlow* fragmentedFlow = enclosingFragmentedFlow()) >+ fragmentedFlow->updateSpaceShortageForSizeContainment(this, offsetFromLogicalTopOfFirstPage() + offset, spaceShortage); >+} >+ > void RenderBlockFlow::layoutLineGridBox() > { > if (style().lineGrid() == RenderStyle::initialLineGrid()) { >diff --git a/Source/WebCore/rendering/RenderBlockFlow.h b/Source/WebCore/rendering/RenderBlockFlow.h >index f6a7649e9262a81ddc43bcb0f0de4598aeb00180..5b575dfc1ff861e2075f7df0c6bb91b3553e3124 100644 >--- a/Source/WebCore/rendering/RenderBlockFlow.h >+++ b/Source/WebCore/rendering/RenderBlockFlow.h >@@ -398,6 +398,8 @@ public: > // column balancer to help set a good minimum column height. > void updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeight); > >+ void adjustSizeContainmentChildForPagination(RenderBox& child, LayoutUnit offset); >+ > void addFloatsToNewParent(RenderBlockFlow& toBlockFlow) const; > > LayoutUnit endPaddingWidthForCaret() const; >diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp >index 576ee5dcc9a3e6df7e51be9e2b262f2b200732b4..5adba040038014d0521d2ffbc0205e8d5597e3c0 100644 >--- a/Source/WebCore/rendering/RenderBox.cpp >+++ b/Source/WebCore/rendering/RenderBox.cpp >@@ -2876,6 +2876,11 @@ void RenderBox::cacheIntrinsicContentLogicalHeightForFlexItem(LayoutUnit height) > > void RenderBox::updateLogicalHeight() > { >+ if (shouldApplySizeContainment() && !isRenderGrid()) { >+ auto borderAndPading = RenderBox::borderBefore() + RenderBox::paddingBefore() + RenderBox::borderAfter() + RenderBox::paddingAfter(); >+ setLogicalHeight(borderAndPading + scrollbarLogicalHeight()); >+ } >+ > cacheIntrinsicContentLogicalHeightForFlexItem(contentLogicalHeight()); > auto computedValues = computeLogicalHeight(logicalHeight(), logicalTop()); > setLogicalHeight(computedValues.m_extent); >@@ -4856,7 +4861,8 @@ bool RenderBox::isUnsplittableForPagination() const > return isReplaced() > || hasUnsplittableScrollingOverflow() > || (parent() && isWritingModeRoot()) >- || (isFloating() && style().styleType() == PseudoId::FirstLetter && style().initialLetterDrop() > 0); >+ || (isFloating() && style().styleType() == PseudoId::FirstLetter && style().initialLetterDrop() > 0) >+ || shouldApplySizeContainment(); > } > > LayoutUnit RenderBox::lineHeight(bool /*firstLine*/, LineDirectionMode direction, LinePositionMode /*linePositionMode*/) const >diff --git a/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp b/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp >index 4f2d1f3db1b790354ffc6859fc3bd727762fe18e..cf88075a97d2840a28888707f29e2323ee0c203a 100644 >--- a/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp >+++ b/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp >@@ -187,26 +187,28 @@ void RenderDeprecatedFlexibleBox::styleWillChange(StyleDifference diff, const Re > > void RenderDeprecatedFlexibleBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const > { >- if (hasMultipleLines() || isVertical()) { >- for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { >- if (childDoesNotAffectWidthOrFlexing(child)) >- continue; >+ if (!shouldApplySizeContainment()) { >+ if (hasMultipleLines() || isVertical()) { >+ for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { >+ if (childDoesNotAffectWidthOrFlexing(child)) >+ continue; > >- LayoutUnit margin = marginWidthForChild(child); >- LayoutUnit width = child->minPreferredLogicalWidth() + margin; >- minLogicalWidth = std::max(width, minLogicalWidth); >+ LayoutUnit margin = marginWidthForChild(child); >+ LayoutUnit width = child->minPreferredLogicalWidth() + margin; >+ minLogicalWidth = std::max(width, minLogicalWidth); > >- width = child->maxPreferredLogicalWidth() + margin; >- maxLogicalWidth = std::max(width, maxLogicalWidth); >- } >- } else { >- for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { >- if (childDoesNotAffectWidthOrFlexing(child)) >- continue; >+ width = child->maxPreferredLogicalWidth() + margin; >+ maxLogicalWidth = std::max(width, maxLogicalWidth); >+ } >+ } else { >+ for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { >+ if (childDoesNotAffectWidthOrFlexing(child)) >+ continue; > >- LayoutUnit margin = marginWidthForChild(child); >- minLogicalWidth += child->minPreferredLogicalWidth() + margin; >- maxLogicalWidth += child->maxPreferredLogicalWidth() + margin; >+ LayoutUnit margin = marginWidthForChild(child); >+ minLogicalWidth += child->minPreferredLogicalWidth() + margin; >+ maxLogicalWidth += child->maxPreferredLogicalWidth() + margin; >+ } > } > } > >diff --git a/Source/WebCore/rendering/RenderFileUploadControl.cpp b/Source/WebCore/rendering/RenderFileUploadControl.cpp >index 3d123c54b564da50417b4c0789729f39e33b15da..04f70574bfc8a397c8c890cd6782416aef5cf697 100644 >--- a/Source/WebCore/rendering/RenderFileUploadControl.cpp >+++ b/Source/WebCore/rendering/RenderFileUploadControl.cpp >@@ -197,6 +197,8 @@ void RenderFileUploadControl::paintObject(PaintInfo& paintInfo, const LayoutPoin > > void RenderFileUploadControl::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const > { >+ if (shouldApplySizeContainment()) >+ return; > // Figure out how big the filename space needs to be for a given number of characters > // (using "0" as the nominal character). > const UChar character = '0'; >diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp >index c6791fc6378edb3e5aaa8b1edbe99b58ee44d3be..34858bc926aad04f6841fe6e0d6e2403ccd3ddc4 100644 >--- a/Source/WebCore/rendering/RenderFlexibleBox.cpp >+++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp >@@ -83,60 +83,62 @@ const char* RenderFlexibleBox::renderName() const > > void RenderFlexibleBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const > { >- LayoutUnit childMinWidth; >- LayoutUnit childMaxWidth; >- bool hadExcludedChildren = computePreferredWidthsForExcludedChildren(childMinWidth, childMaxWidth); >- >- // FIXME: We're ignoring flex-basis here and we shouldn't. We can't start >- // honoring it though until the flex shorthand stops setting it to 0. See >- // https://bugs.webkit.org/show_bug.cgi?id=116117 and >- // https://crbug.com/240765. >- size_t numItemsWithNormalLayout = 0; >- for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { >- if (child->isOutOfFlowPositioned() || child->isExcludedFromNormalLayout()) >- continue; >- ++numItemsWithNormalLayout; >+ if (!shouldApplySizeContainment()) { >+ LayoutUnit childMinWidth; >+ LayoutUnit childMaxWidth; >+ bool hadExcludedChildren = computePreferredWidthsForExcludedChildren(childMinWidth, childMaxWidth); >+ >+ // FIXME: We're ignoring flex-basis here and we shouldn't. We can't start >+ // honoring it though until the flex shorthand stops setting it to 0. See >+ // https://bugs.webkit.org/show_bug.cgi?id=116117 and >+ // https://crbug.com/240765. >+ size_t numItemsWithNormalLayout = 0; >+ for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { >+ if (child->isOutOfFlowPositioned() || child->isExcludedFromNormalLayout()) >+ continue; >+ ++numItemsWithNormalLayout; > >- LayoutUnit margin = marginIntrinsicLogicalWidthForChild(*child); >- >- LayoutUnit minPreferredLogicalWidth; >- LayoutUnit maxPreferredLogicalWidth; >- computeChildPreferredLogicalWidths(*child, minPreferredLogicalWidth, maxPreferredLogicalWidth); >- >- minPreferredLogicalWidth += margin; >- maxPreferredLogicalWidth += margin; >- >- if (!isColumnFlow()) { >- maxLogicalWidth += maxPreferredLogicalWidth; >- if (isMultiline()) { >- // For multiline, the min preferred width is if you put a break between >- // each item. >- minLogicalWidth = std::max(minLogicalWidth, minPreferredLogicalWidth); >- } else >- minLogicalWidth += minPreferredLogicalWidth; >- } else { >- minLogicalWidth = std::max(minPreferredLogicalWidth, minLogicalWidth); >- maxLogicalWidth = std::max(maxPreferredLogicalWidth, maxLogicalWidth); >+ LayoutUnit margin = marginIntrinsicLogicalWidthForChild(*child); >+ >+ LayoutUnit minPreferredLogicalWidth; >+ LayoutUnit maxPreferredLogicalWidth; >+ computeChildPreferredLogicalWidths(*child, minPreferredLogicalWidth, maxPreferredLogicalWidth); >+ >+ minPreferredLogicalWidth += margin; >+ maxPreferredLogicalWidth += margin; >+ >+ if (!isColumnFlow()) { >+ maxLogicalWidth += maxPreferredLogicalWidth; >+ if (isMultiline()) { >+ // For multiline, the min preferred width is if you put a break between >+ // each item. >+ minLogicalWidth = std::max(minLogicalWidth, minPreferredLogicalWidth); >+ } else >+ minLogicalWidth += minPreferredLogicalWidth; >+ } else { >+ minLogicalWidth = std::max(minPreferredLogicalWidth, minLogicalWidth); >+ maxLogicalWidth = std::max(maxPreferredLogicalWidth, maxLogicalWidth); >+ } > } >- } > >- if (!isColumnFlow() && numItemsWithNormalLayout > 1) { >- LayoutUnit inlineGapSize = (numItemsWithNormalLayout - 1) * computeGap(GapType::BetweenItems); >- maxLogicalWidth += inlineGapSize; >- if (!isMultiline()) >- minLogicalWidth += inlineGapSize; >- } >+ if (!isColumnFlow() && numItemsWithNormalLayout > 1) { >+ LayoutUnit inlineGapSize = (numItemsWithNormalLayout - 1) * computeGap(GapType::BetweenItems); >+ maxLogicalWidth += inlineGapSize; >+ if (!isMultiline()) >+ minLogicalWidth += inlineGapSize; >+ } > >- maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth); >- >- // Due to negative margins, it is possible that we calculated a negative >- // intrinsic width. Make sure that we never return a negative width. >- minLogicalWidth = std::max(0_lu, minLogicalWidth); >- maxLogicalWidth = std::max(0_lu, maxLogicalWidth); >- >- if (hadExcludedChildren) { >- minLogicalWidth = std::max(minLogicalWidth, childMinWidth); >- maxLogicalWidth = std::max(maxLogicalWidth, childMaxWidth); >+ maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth); >+ >+ // Due to negative margins, it is possible that we calculated a negative >+ // intrinsic width. Make sure that we never return a negative width. >+ minLogicalWidth = std::max(0_lu, minLogicalWidth); >+ maxLogicalWidth = std::max(0_lu, maxLogicalWidth); >+ >+ if (hadExcludedChildren) { >+ minLogicalWidth = std::max(minLogicalWidth, childMinWidth); >+ maxLogicalWidth = std::max(maxLogicalWidth, childMaxWidth); >+ } > } > > LayoutUnit scrollbarWidth(scrollbarLogicalWidth()); >diff --git a/Source/WebCore/rendering/RenderFragmentedFlow.h b/Source/WebCore/rendering/RenderFragmentedFlow.h >index faceb196d9bf77cd628554e3351000e99893ad63..b73be2b1b0e4827edae6027aa6e35fcb171d6361 100644 >--- a/Source/WebCore/rendering/RenderFragmentedFlow.h >+++ b/Source/WebCore/rendering/RenderFragmentedFlow.h >@@ -102,6 +102,8 @@ public: > virtual void setPageBreak(const RenderBlock*, LayoutUnit /*offset*/, LayoutUnit /*spaceShortage*/) { } > virtual void updateMinimumPageHeight(const RenderBlock*, LayoutUnit /*offset*/, LayoutUnit /*minHeight*/) { } > >+ virtual void updateSpaceShortageForSizeContainment(const RenderBlock*, LayoutUnit /*offset*/, LayoutUnit /*shortage*/) { } >+ > virtual RenderFragmentContainer* fragmentAtBlockOffset(const RenderBox*, LayoutUnit, bool extendLastFragment = false) const; > > bool fragmentsHaveUniformLogicalWidth() const { return m_fragmentsHaveUniformLogicalWidth; } >diff --git a/Source/WebCore/rendering/RenderGrid.cpp b/Source/WebCore/rendering/RenderGrid.cpp >index ef50768557ddb4698548335b472dd06ae8eb9b1c..ed83e1beb47828ac622d0480e70336f214f450c9 100644 >--- a/Source/WebCore/rendering/RenderGrid.cpp >+++ b/Source/WebCore/rendering/RenderGrid.cpp >@@ -250,11 +250,17 @@ void RenderGrid::layoutBlock(bool relayoutChildren, LayoutUnit) > > // 2- Next, the track sizing algorithm resolves the sizes of the grid rows, > // using the grid column sizes calculated in the previous step. >- if (!hasDefiniteLogicalHeight) >+ bool shouldRecomputeHeight = false; >+ if (!hasDefiniteLogicalHeight) { > computeTrackSizesForIndefiniteSize(m_trackSizingAlgorithm, ForRows); >- else >+ if (shouldApplySizeContainment()) >+ shouldRecomputeHeight = true; >+ } else > computeTrackSizesForDefiniteSize(ForRows, availableLogicalHeight(ExcludeMarginBorderPadding)); > LayoutUnit trackBasedLogicalHeight = m_trackSizingAlgorithm.computeTrackBasedSize() + borderAndPaddingLogicalHeight() + scrollbarLogicalHeight(); >+ if (shouldRecomputeHeight) >+ computeTrackSizesForDefiniteSize(ForRows, trackBasedLogicalHeight); >+ > setLogicalHeight(trackBasedLogicalHeight); > > LayoutUnit oldClientAfterEdge = clientLogicalBottom(); >@@ -455,6 +461,11 @@ unsigned RenderGrid::computeAutoRepeatTracksCount(GridTrackSizingDirection direc > { > ASSERT(!availableSize || availableSize.value() != -1); > bool isRowAxis = direction == ForColumns; >+ if (shouldApplySizeContainment() >+ && ((isRowAxis && style().gridAutoRepeatColumnsType() == AutoRepeatType::Fit) >+ || (!isRowAxis && style().gridAutoRepeatRowsType() == AutoRepeatType::Fit))) >+ return 0; >+ > const auto& autoRepeatTracks = isRowAxis ? style().gridAutoRepeatColumns() : style().gridAutoRepeatRows(); > unsigned autoRepeatTrackListLength = autoRepeatTracks.size(); > >diff --git a/Source/WebCore/rendering/RenderImage.cpp b/Source/WebCore/rendering/RenderImage.cpp >index 78301e60c91517e747b9c8f18d8bbbd478a57491..a8c8f5404f4ff971211a371515d6788146cb0334 100644 >--- a/Source/WebCore/rendering/RenderImage.cpp >+++ b/Source/WebCore/rendering/RenderImage.cpp >@@ -844,6 +844,7 @@ void RenderImage::layoutShadowContent(const LayoutSize& oldSize) > > void RenderImage::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio) const > { >+ ASSERT(!shouldApplySizeContainment()); > RenderReplaced::computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio); > > // Our intrinsicSize is empty if we're rendering generated images with relative width/height. Figure out the right intrinsic size to use. >diff --git a/Source/WebCore/rendering/RenderListBox.cpp b/Source/WebCore/rendering/RenderListBox.cpp >index 950b1d7e31d2c0cd8477dd1ab6a38c50f572df9f..c2e6b461cce5c07218752d654a4efec21e07ead7 100644 >--- a/Source/WebCore/rendering/RenderListBox.cpp >+++ b/Source/WebCore/rendering/RenderListBox.cpp >@@ -211,7 +211,7 @@ void RenderListBox::scrollToRevealSelection() > > void RenderListBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const > { >- maxLogicalWidth = m_optionsWidth + 2 * optionsSpacingHorizontal; >+ maxLogicalWidth = shouldApplySizeContainment() ? 2 * optionsSpacingHorizontal : m_optionsWidth + 2 * optionsSpacingHorizontal; > if (m_vBar) > maxLogicalWidth += m_vBar->width(); > if (!style().width().isPercentOrCalculated()) >diff --git a/Source/WebCore/rendering/RenderMenuList.cpp b/Source/WebCore/rendering/RenderMenuList.cpp >index f394bd6336e4448227f16ae9996de55f24ccf8ed..00d3137b814506216f0e43cdbe1e6e4045a94b5c 100644 >--- a/Source/WebCore/rendering/RenderMenuList.cpp >+++ b/Source/WebCore/rendering/RenderMenuList.cpp >@@ -315,7 +315,8 @@ LayoutRect RenderMenuList::controlClipRect(const LayoutPoint& additionalOffset) > > void RenderMenuList::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const > { >- maxLogicalWidth = std::max(m_optionsWidth, theme().minimumMenuListSize(style())) + m_innerBlock->paddingLeft() + m_innerBlock->paddingRight(); >+ maxLogicalWidth = shouldApplySizeContainment() ? theme().minimumMenuListSize(style()) : std::max(m_optionsWidth, theme().minimumMenuListSize(style())); >+ maxLogicalWidth += m_innerBlock->paddingLeft() + m_innerBlock->paddingRight(); > if (!style().width().isPercentOrCalculated()) > minLogicalWidth = maxLogicalWidth; > } >diff --git a/Source/WebCore/rendering/RenderMultiColumnFlow.cpp b/Source/WebCore/rendering/RenderMultiColumnFlow.cpp >index 6185e472638bd79eed10a5097ba655b0826c836a..bdbe4a714d0c6c7a63dccc83572bb1f8708e6a0d 100644 >--- a/Source/WebCore/rendering/RenderMultiColumnFlow.cpp >+++ b/Source/WebCore/rendering/RenderMultiColumnFlow.cpp >@@ -203,6 +203,12 @@ void RenderMultiColumnFlow::updateMinimumPageHeight(const RenderBlock* block, La > multicolSet->updateMinimumColumnHeight(minHeight); > } > >+void RenderMultiColumnFlow::updateSpaceShortageForSizeContainment(const RenderBlock* block, LayoutUnit offset, LayoutUnit shortage) >+{ >+ if (auto* multicolSet = downcast<RenderMultiColumnSet>(fragmentAtBlockOffset(block, offset))) >+ multicolSet->updateSpaceShortageForSizeContainment(shortage); >+} >+ > RenderFragmentContainer* RenderMultiColumnFlow::fragmentAtBlockOffset(const RenderBox* box, LayoutUnit offset, bool extendLastFragment) const > { > if (!m_inLayout) >diff --git a/Source/WebCore/rendering/RenderMultiColumnFlow.h b/Source/WebCore/rendering/RenderMultiColumnFlow.h >index 0c83918f8edb6d201258f900a2be18d39f13e76d..eb6f088794585e8255db7c0c8588d02dc1a5ef96 100644 >--- a/Source/WebCore/rendering/RenderMultiColumnFlow.h >+++ b/Source/WebCore/rendering/RenderMultiColumnFlow.h >@@ -108,6 +108,7 @@ private: > LayoutUnit initialLogicalWidth() const override; > void setPageBreak(const RenderBlock*, LayoutUnit offset, LayoutUnit spaceShortage) override; > void updateMinimumPageHeight(const RenderBlock*, LayoutUnit offset, LayoutUnit minHeight) override; >+ void updateSpaceShortageForSizeContainment(const RenderBlock*, LayoutUnit offset, LayoutUnit shortage) override; > RenderFragmentContainer* fragmentAtBlockOffset(const RenderBox*, LayoutUnit, bool extendLastFragment = false) const override; > void setFragmentRangeForBox(const RenderBox&, RenderFragmentContainer*, RenderFragmentContainer*) override; > bool addForcedFragmentBreak(const RenderBlock*, LayoutUnit, RenderBox* breakChild, bool isBefore, LayoutUnit* offsetBreakAdjustment = 0) override; >diff --git a/Source/WebCore/rendering/RenderMultiColumnSet.cpp b/Source/WebCore/rendering/RenderMultiColumnSet.cpp >index d556f7d0ee1a2353c563b3267915698ee4bac1e9..7e6b38e434627d797deeae8bb576c6fed9e3d034 100644 >--- a/Source/WebCore/rendering/RenderMultiColumnSet.cpp >+++ b/Source/WebCore/rendering/RenderMultiColumnSet.cpp >@@ -50,6 +50,7 @@ RenderMultiColumnSet::RenderMultiColumnSet(RenderFragmentedFlow& fragmentedFlow, > , m_maxColumnHeight(RenderFragmentedFlow::maxLogicalHeight()) > , m_minSpaceShortage(RenderFragmentedFlow::maxLogicalHeight()) > , m_minimumColumnHeight(0) >+ , m_spaceShortageForSizeContainment(0) > { > } > >@@ -235,15 +236,16 @@ LayoutUnit RenderMultiColumnSet::calculateBalancedHeight(bool initial) const > return std::max<LayoutUnit>(m_contentRuns[index].columnLogicalHeight(startOffset), m_minimumColumnHeight); > } > >- if (columnCount() <= computedColumnCount()) { >+ LayoutUnit sizeContainmentShortage = std::max<LayoutUnit>(LayoutUnit(), m_spaceShortageForSizeContainment); >+ if (columnCount() <= computedColumnCount() /*&& m_minSpaceShortage <= 0*/) { > // With the current column height, the content fits without creating overflowing columns. We're done. >- return m_computedColumnHeight; >+ return m_computedColumnHeight + sizeContainmentShortage; > } > >- if (forcedBreaksCount() >= computedColumnCount()) { >+ if (forcedBreaksCount() >= computedColumnCount() /*&& m_minSpaceShortage <= 0*/) { > // Too many forced breaks to allow any implicit breaks. Initial balancing should already > // have set a good height. There's nothing more we should do. >- return m_computedColumnHeight; >+ return m_computedColumnHeight + sizeContainmentShortage; > } > > // If the initial guessed column height wasn't enough, stretch it now. Stretch by the lowest >@@ -252,9 +254,10 @@ LayoutUnit RenderMultiColumnSet::calculateBalancedHeight(bool initial) const > ASSERT(m_minSpaceShortage > 0); // We should never _shrink_ the height! > // ASSERT(m_minSpaceShortage != RenderFragmentedFlow::maxLogicalHeight()); // If this happens, we probably have a bug. > if (m_minSpaceShortage == RenderFragmentedFlow::maxLogicalHeight()) >- return m_computedColumnHeight; // So bail out rather than looping infinitely. >+ return m_computedColumnHeight + sizeContainmentShortage; // So bail out rather than looping infinitely. > >- return m_computedColumnHeight + m_minSpaceShortage; >+ auto toAdd = std::max<LayoutUnit>(sizeContainmentShortage, m_minSpaceShortage); >+ return m_computedColumnHeight + toAdd; > } > > void RenderMultiColumnSet::clearForcedBreaks() >@@ -365,6 +368,8 @@ void RenderMultiColumnSet::prepareForLayout(bool initial) > // Nuke previously stored minimum column height. Contents may have changed for all we know. > m_minimumColumnHeight = 0; > >+ m_spaceShortageForSizeContainment = 0; >+ > // Start with "infinite" flow thread portion height until height is known. > setLogicalBottomInFragmentedFlow(RenderFragmentedFlow::maxLogicalHeight()); > >diff --git a/Source/WebCore/rendering/RenderMultiColumnSet.h b/Source/WebCore/rendering/RenderMultiColumnSet.h >index f73bf90a316e38ea825a69e86427376f60e54a59..c48ae0a4c75865a53fa55bfbef72d1bb92273d77 100644 >--- a/Source/WebCore/rendering/RenderMultiColumnSet.h >+++ b/Source/WebCore/rendering/RenderMultiColumnSet.h >@@ -83,6 +83,15 @@ public: > void updateMinimumColumnHeight(LayoutUnit height) { m_minimumColumnHeight = std::max(height, m_minimumColumnHeight); } > LayoutUnit minimumColumnHeight() const { return m_minimumColumnHeight; } > >+ void updateSpaceShortageForSizeContainment(LayoutUnit shortage) >+ { >+ if (m_spaceShortageForSizeContainment <= 0) { >+ m_spaceShortageForSizeContainment = shortage; >+ return; >+ } >+ m_spaceShortageForSizeContainment = std::min(shortage, m_spaceShortageForSizeContainment); >+ } >+ > unsigned forcedBreaksCount() const { return m_contentRuns.size(); } > void clearForcedBreaks(); > void addForcedBreak(LayoutUnit offsetFromFirstPage); >@@ -198,6 +207,7 @@ private: > LayoutUnit m_maxColumnHeight; // Maximum column height allowed. > LayoutUnit m_minSpaceShortage; // The smallest amout of space shortage that caused a column break. > LayoutUnit m_minimumColumnHeight; >+ LayoutUnit m_spaceShortageForSizeContainment; // The shortage space that keeps size containment monolithic. > > // A run of content without explicit (forced) breaks; i.e. a flow thread portion between two > // explicit breaks, between flow thread start and an explicit break, between an explicit break >diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h >index 1dc744461f1c4a29f227b2783fdad87f92d3a4c2..7327d46bd22c9b1e3c899f7f90e926178773c624 100644 >--- a/Source/WebCore/rendering/RenderObject.h >+++ b/Source/WebCore/rendering/RenderObject.h >@@ -730,6 +730,17 @@ public: > > virtual String debugDescription() const; > >+ bool isAtomicInlineLevelBox() const >+ { >+ return style().isDisplayInlineType() && !(style().display() == DisplayType::Inline && !isReplaced()); >+ } >+ >+ bool shouldApplySizeContainment() const >+ { >+ return style().contain().contains(Containment::Size) && (!isInline() || isAtomicInlineLevelBox()) >+ && !isRubyText() && (!isTablePart() || isTableCaption()) && !isTable(); >+ } >+ > protected: > ////////////////////////////////////////// > // Helper functions. Dangerous to use! >diff --git a/Source/WebCore/rendering/RenderReplaced.cpp b/Source/WebCore/rendering/RenderReplaced.cpp >index b9e400ea270da312b5b9d8998c9974bce115fa82..b158df243414ea1c8636cb2cdcebea3854a40202 100644 >--- a/Source/WebCore/rendering/RenderReplaced.cpp >+++ b/Source/WebCore/rendering/RenderReplaced.cpp >@@ -389,7 +389,9 @@ bool RenderReplaced::setNeedsLayoutIfNeededAfterIntrinsicSizeChange() > void RenderReplaced::computeAspectRatioInformationForRenderBox(RenderBox* contentRenderer, FloatSize& constrainedSize, double& intrinsicRatio) const > { > FloatSize intrinsicSize; >- if (contentRenderer) { >+ if (shouldApplySizeContainment()) >+ RenderReplaced::computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio); >+ else if (contentRenderer) { > contentRenderer->computeIntrinsicRatioInformation(intrinsicSize, intrinsicRatio); > > if (style().aspectRatioType() == AspectRatioType::Ratio || (style().aspectRatioType() == AspectRatioType::AutoAndRatio && !intrinsicRatio)) >@@ -477,7 +479,7 @@ RoundedRect RenderReplaced::roundedContentBoxRect() const > void RenderReplaced::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio) const > { > // If there's an embeddedContentBox() of a remote, referenced document available, this code-path should never be used. >- ASSERT(!embeddedContentBox()); >+ ASSERT(!embeddedContentBox() || shouldApplySizeContainment()); > intrinsicSize = FloatSize(intrinsicLogicalWidth(), intrinsicLogicalHeight()); > > if (style().hasAspectRatio()) { >diff --git a/Source/WebCore/rendering/RenderReplaced.h b/Source/WebCore/rendering/RenderReplaced.h >index c2e0695c0393809265ec177047f13cb7223ff3f7..653058f1c9d3e26a6d290ff2fe8faf5a39b2a460 100644 >--- a/Source/WebCore/rendering/RenderReplaced.h >+++ b/Source/WebCore/rendering/RenderReplaced.h >@@ -40,7 +40,12 @@ public: > bool hasReplacedLogicalHeight() const; > bool setNeedsLayoutIfNeededAfterIntrinsicSizeChange(); > >- LayoutSize intrinsicSize() const final { return m_intrinsicSize; } >+ LayoutSize intrinsicSize() const final >+ { >+ if (shouldApplySizeContainment()) >+ return LayoutSize(); >+ return m_intrinsicSize; >+ } > > RoundedRect roundedContentBoxRect() const; > >diff --git a/Source/WebCore/rendering/RenderSlider.cpp b/Source/WebCore/rendering/RenderSlider.cpp >index 47169edf98e1428c4a0770f2f4efc0b58d813c7b..2165b29d998e304cda91ecd2ba364005dfbe8506 100644 >--- a/Source/WebCore/rendering/RenderSlider.cpp >+++ b/Source/WebCore/rendering/RenderSlider.cpp >@@ -69,6 +69,8 @@ LayoutUnit RenderSlider::baselinePosition(FontBaseline, bool /*firstLine*/, Line > > void RenderSlider::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const > { >+ if (shouldApplySizeContainment()) >+ return; > maxLogicalWidth = defaultTrackLength * style().effectiveZoom(); > if (!style().width().isPercentOrCalculated()) > minLogicalWidth = maxLogicalWidth; >diff --git a/Source/WebCore/rendering/RenderTextControl.cpp b/Source/WebCore/rendering/RenderTextControl.cpp >index dc058d53467aa3cfabf852f331ef01f3155321f4..191e3c900a45a9dcaa608e4188f7f44041ca255f 100644 >--- a/Source/WebCore/rendering/RenderTextControl.cpp >+++ b/Source/WebCore/rendering/RenderTextControl.cpp >@@ -156,6 +156,8 @@ float RenderTextControl::scaleEmToUnits(int x) const > > void RenderTextControl::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const > { >+ if (shouldApplySizeContainment()) >+ return; > // Use average character width. Matches IE. > maxLogicalWidth = preferredContentLogicalWidth(const_cast<RenderTextControl*>(this)->getAverageCharWidth()); > if (RenderBox* innerTextRenderBox = innerTextElement()->renderBox()) >diff --git a/Source/WebCore/rendering/RenderVideo.cpp b/Source/WebCore/rendering/RenderVideo.cpp >index c6d044166ccfd5bc7c8f19e0aabc21c5803821f9..2388a18dc68530db6a3267c8830876b0a589381c 100644 >--- a/Source/WebCore/rendering/RenderVideo.cpp >+++ b/Source/WebCore/rendering/RenderVideo.cpp >@@ -123,6 +123,9 @@ bool RenderVideo::updateIntrinsicSize() > > LayoutSize RenderVideo::calculateIntrinsicSize() > { >+ if (shouldApplySizeContainment()) >+ return LayoutSize(); >+ > // Spec text from 4.8.6 > // > // The intrinsic width of a video element's playback area is the intrinsic width >diff --git a/Source/WebCore/rendering/svg/RenderSVGRoot.cpp b/Source/WebCore/rendering/svg/RenderSVGRoot.cpp >index 14223504609e3b15b5bc368a4780700709562085..9174a906f689452485c859eb652956decfda6085 100644 >--- a/Source/WebCore/rendering/svg/RenderSVGRoot.cpp >+++ b/Source/WebCore/rendering/svg/RenderSVGRoot.cpp >@@ -70,6 +70,8 @@ SVGSVGElement& RenderSVGRoot::svgSVGElement() const > > void RenderSVGRoot::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio) const > { >+ ASSERT(!shouldApplySizeContainment()); >+ > // Spec: http://www.w3.org/TR/SVG/coords.html#IntrinsicSizing > // SVG needs to specify how to calculate some intrinsic sizing properties to enable inclusion within other languages. > >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 10d080da24f108aa1bb7ef29fb73dc39a208f84e..fe750076e5c078a9dcbd5a7373c99f1a85aa8c38 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,12 @@ >+2021-04-12 Cathie Chen <cathiechen@igalia.com> >+ >+ [CSS contain] Support contain:size >+ https://bugs.webkit.org/show_bug.cgi?id=223570 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * TestExpectations: >+ > 2021-04-12 Rob Buis <rbuis@igalia.com> > > Clamp overridingContentLogicalWidth/Height to zero >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index 203dc629926c0b1c22a8908703b8e6500549b44c..3601229aff0252e266f124125ba7c6bac094dcee 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1,3 +1,15 @@ >+2021-04-12 Cathie Chen <cathiechen@igalia.com> >+ >+ [CSS contain] Support contain:size >+ https://bugs.webkit.org/show_bug.cgi?id=223570 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * web-platform-tests/css/css-contain/contain-size-grid-003-expected.txt: >+ * web-platform-tests/css/css-contain/contain-size-grid-004-expected.txt: >+ * web-platform-tests/css/css-contain/contain-size-multicol-as-flex-item-expected.txt: >+ * web-platform-tests/css/css-flexbox/flex-item-contains-strict-expected.txt: >+ > 2021-04-11 Sam Weinig <weinig@apple.com> > > Reduce compile time and binary size cost of enabling proper CSSStyleDeclaration property access behavior >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index 0674239e413a271e4a017d329d411ae8a6bd07f8..da19f8eb6988d017849521a356c077982c28d54d 100644 >--- a/LayoutTests/TestExpectations >+++ b/LayoutTests/TestExpectations >@@ -4777,65 +4777,16 @@ imported/w3c/web-platform-tests/css/css-contain/contain-paint-stacking-context-0 > imported/w3c/web-platform-tests/css/css-contain/contain-paint-stacking-context-001b.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/contain-paint-table-001.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/contain-paint-table-002.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-011.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-013.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-021.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-023.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-025.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-027.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-041.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-042.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-056.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-061.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-062.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-063.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-064.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-block-001.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-block-002.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/contain-size-block-003.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-block-004.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-borders.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-breaks-001.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/contain-size-button-001.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/contain-size-button-002.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-fieldset-001.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-fieldset-002.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-fieldset-003.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-fieldset-004.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-flex-001.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-flexbox-001.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-grid-001.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-grid-002.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-grid-005.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-inline-block-001.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-inline-block-002.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/contain-size-inline-block-003.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-inline-block-004.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-inline-flex-001.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-monolithic-001.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/contain-size-monolithic-002.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-multicol-001.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-multicol-002.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-multicol-003.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-replaced-001.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/contain-size-replaced-002.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-replaced-003a.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-replaced-003b.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-replaced-003c.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-replaced-004.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-replaced-005.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-replaced-006.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-scrollbars-001.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-scrollbars-002.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-scrollbars-003.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/contain-size-select-001.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/contain-size-select-002.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/contain-size-select-elem-001.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/contain-size-select-elem-002.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-select-elem-003.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-select-elem-004.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-select-elem-005.html [ ImageOnlyFailure ] >-imported/w3c/web-platform-tests/css/css-contain/contain-size-table-caption-001.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/contain-strict-001.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/contain-strict-002.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/contain-strict-003.html [ ImageOnlyFailure ] >@@ -4870,6 +4821,8 @@ imported/w3c/web-platform-tests/css/css-contain/quote-scoping-002.html [ ImageOn > imported/w3c/web-platform-tests/css/css-contain/quote-scoping-003.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-contain/quote-scoping-004.html [ ImageOnlyFailure ] > >+webkit.org/b/217529 imported/w3c/web-platform-tests/css/css-flexbox/canvas-contain-size.html [ Skip ] >+ > # @counter-style ref tests that currently fail > imported/w3c/web-platform-tests/css/css-counter-styles/armenian/css3-counter-styles-006.html [ ImageOnlyFailure ] > imported/w3c/web-platform-tests/css/css-counter-styles/armenian/css3-counter-styles-007.html [ ImageOnlyFailure ] >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-size-grid-003-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-size-grid-003-expected.txt >index e16d67dbf7d4524af7f3110309f978299041c2d2..51e8e2002ff7ca742c95e3946fd1cc8bff7b11f4 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-size-grid-003-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-size-grid-003-expected.txt >@@ -36,19 +36,8 @@ PASS .grid 34 > PASS .grid 35 > PASS .grid 36 > PASS .grid 37 >-FAIL .grid 38 assert_equals: >-<div class="grid" style="grid: repeat(auto-fit, 75px) / repeat(auto-fit, 100px);" data-expected-width="0" data-expected-height="0"> >- <div></div> >- </div> >-width expected 0 but got 100 >-FAIL .grid 39 assert_equals: >-<div class="grid" style="grid: auto 50px / 100px auto;" data-expected-width="100" data-expected-height="50"> >- <div data-expected-width="100" data-expected-height="10" data-offset-x="0" data-offset-y="0">X</div> >- <div data-expected-width="40" data-expected-height="10" data-offset-x="100" data-offset-y="0">XX</div> >- <div data-expected-width="100" data-expected-height="50" data-offset-x="0" data-offset-y="10">XXX</div> >- <div data-expected-width="40" data-expected-height="50" data-offset-x="100" data-offset-y="10">XXXX</div> >-</div> >-width expected 100 but got 140 >+PASS .grid 38 >+PASS .grid 39 > > X > XX >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-size-grid-004-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-size-grid-004-expected.txt >index 70cd7e6191d0ffdba52264246b8a81cf3483df38..e0a1c9d51fbf4b6a5624df41b9fb221c45ef6bc2 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-size-grid-004-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-size-grid-004-expected.txt >@@ -1,38 +1,18 @@ > > PASS .grid 1 >-FAIL .grid 2 assert_equals: >-<div class="grid percent min-content" data-expected-height="0" data-expected-width="0"> >- <div data-expected-height="0" data-expected-width="0">XXXX</div> >-</div> >-width expected 0 but got 300 >+PASS .grid 2 > PASS .grid 3 >-FAIL .grid 4 assert_equals: >-<div class="grid percent max-content" data-expected-height="0" data-expected-width="0"> >- <div data-expected-height="0" data-expected-width="0">XXXX</div> >-</div> >-width expected 0 but got 300 >+PASS .grid 4 > PASS .grid 5 > PASS .grid 6 > PASS .grid 7 >-FAIL .grid 8 assert_equals: >-<div class="grid calc min-content" data-expected-height="0" data-expected-width="0"> >- <div data-expected-height="100" data-expected-width="100">XXXX</div> >-</div> >-width expected 0 but got 300 >+PASS .grid 8 > PASS .grid 9 >-FAIL .grid 10 assert_equals: >-<div class="grid calc max-content" data-expected-height="0" data-expected-width="0"> >- <div data-expected-height="100" data-expected-width="100">XXXX</div> >-</div> >-width expected 0 but got 300 >+PASS .grid 10 > PASS .grid 11 > PASS .grid 12 > PASS .grid 13 >-FAIL .grid 14 assert_equals: >-<div class="grid minmax-percent-fixed min-content" data-expected-height="100" data-expected-width="0"> >- <div data-expected-height="100" data-expected-width="0">XXXX</div> >-</div> >-width expected 0 but got 100 >+PASS .grid 14 > PASS .grid 15 > PASS .grid 16 > PASS .grid 17 >@@ -40,67 +20,31 @@ PASS .grid 18 > PASS .grid 19 > PASS .grid 20 > PASS .grid 21 >-FAIL .grid 22 assert_equals: >-<div class="grid minmax-fixed-percent max-content" data-expected-height="100" data-expected-width="100"> >- <div data-expected-height="100" data-expected-width="100">XXXX</div> >-</div> >-width expected 100 but got 300 >+PASS .grid 22 > PASS .grid 23 > PASS .grid 24 > PASS .grid 25 >-FAIL .grid 26 assert_equals: >-<div class="grid minmax-percent-flex min-content" data-expected-height="0" data-expected-width="0"> >- <div data-expected-height="0" data-expected-width="0">XXXX</div> >-</div> >-width expected 0 but got 300 >+PASS .grid 26 > PASS .grid 27 >-FAIL .grid 28 assert_equals: >-<div class="grid minmax-percent-flex max-content" data-expected-height="0" data-expected-width="0"> >- <div data-expected-height="0" data-expected-width="0">XXXX</div> >-</div> >-width expected 0 but got 300 >+PASS .grid 28 > PASS .grid 29 > PASS .grid 30 > PASS .grid 31 >-FAIL .grid 32 assert_equals: >-<div class="grid minmax-intrinsic-percent min-content" data-expected-height="0" data-expected-width="0"> >- <div data-expected-height="75" data-expected-width="300">XXXX</div> >-</div> >-width expected 0 but got 300 >+PASS .grid 32 > PASS .grid 33 >-FAIL .grid 34 assert_equals: >-<div class="grid minmax-intrinsic-percent max-content" data-expected-height="0" data-expected-width="0"> >- <div data-expected-height="75" data-expected-width="300">XXXX</div> >-</div> >-width expected 0 but got 300 >+PASS .grid 34 > PASS .grid 35 > PASS .grid 36 > PASS .grid 37 >-FAIL .grid 38 assert_equals: >-<div class="grid minmax-percent-intrinsic min-content" data-expected-height="0" data-expected-width="0"> >- <div data-expected-height="0" data-expected-width="0">XXXX</div> >-</div> >-width expected 0 but got 300 >+PASS .grid 38 > PASS .grid 39 >-FAIL .grid 40 assert_equals: >-<div class="grid minmax-percent-intrinsic max-content" data-expected-height="0" data-expected-width="0"> >- <div data-expected-height="0" data-expected-width="0">XXXX</div> >-</div> >-width expected 0 but got 300 >+PASS .grid 40 > PASS .grid 41 > PASS .grid 42 > PASS .grid 43 >-FAIL .grid 44 assert_equals: >-<div class="grid fit-content min-content" data-expected-height="0" data-expected-width="0"> >- <div data-expected-height="75" data-expected-width="300">XXXX</div> >-</div> >-width expected 0 but got 300 >+PASS .grid 44 > PASS .grid 45 >-FAIL .grid 46 assert_equals: >-<div class="grid fit-content max-content" data-expected-height="0" data-expected-width="0"> >- <div data-expected-height="75" data-expected-width="300">XXXX</div> >-</div> >-width expected 0 but got 300 >+PASS .grid 46 > PASS .grid 47 > PASS .grid 48 > XXXX >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-size-multicol-as-flex-item-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-size-multicol-as-flex-item-expected.txt >index 3e140867b7e7214611cc529abb485fd2f8e1b947..3e7991c1c051a77663dd7571229a03ca71e326b2 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-size-multicol-as-flex-item-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/contain-size-multicol-as-flex-item-expected.txt >@@ -1,11 +1,5 @@ > There should be a green square below. > > >-FAIL #flex 1 assert_equals: >-<div id="flex"> >- <div id="multicol" data-expected-width="100" data-expected-height="100"> >- <div style="width:1000px; height:1px;"></div> >- </div> >-</div> >-width expected 100 but got 784 >+PASS #flex 1 > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-item-contains-strict-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-item-contains-strict-expected.txt >index 744dc4f62af10233895ffc8ab6ffd43dedd9b870..cc0bac758a866d4aeec75ace8ee7d833bf1dc1ee 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-item-contains-strict-expected.txt >+++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-item-contains-strict-expected.txt >@@ -17,28 +17,12 @@ Column > > Row > >-FAIL .inline-flex 1 assert_equals: >-<div class="inline-flex" style="display: inline-flex; flex-direction: column;" data-expected-width="0" data-expected-height="0"> >- <div style="contain: strict;" data-expected-width="0" data-expected-height="0">Column</div> >-</div> >-width expected 0 but got 52 >-FAIL .inline-flex 2 assert_equals: >-<div class="inline-flex" data-expected-width="0" data-expected-height="0"> >- <div style="contain: strict;" data-expected-width="0" data-expected-height="0">Row</div> >-</div> >-width expected 0 but got 30 >+PASS .inline-flex 1 >+PASS .inline-flex 2 > PASS .inline-flex 3 > PASS .inline-flex 4 >-FAIL .inline-flex 5 assert_equals: >-<div class="inline-flex" style="flex-direction: column; align-items: flex-start;" data-expected-width="0" data-expected-height="0"> >- <div style="contain: strict;" data-expected-width="0" data-expected-height="0">Column</div> >-</div> >-width expected 0 but got 52 >-FAIL .inline-flex 6 assert_equals: >-<div class="inline-flex" style="align-items: flex-start;" data-expected-width="0" data-expected-height="0"> >- <div style="contain: strict;" data-expected-width="0" data-expected-height="0">Row</div> >-</div> >-width expected 0 but got 30 >+PASS .inline-flex 5 >+PASS .inline-flex 6 > PASS .inline-flex 7 > PASS .inline-flex 8 >
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 223570
:
424901
|
424903
|
425756
|
425987
|
426439
|
426537
|
426543
|
427668
|
427740
|
427744
|
428256
|
428264