Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (274476 => 274477)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-03-16 14:22:51 UTC (rev 274476)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-03-16 14:38:53 UTC (rev 274477)
@@ -1,3 +1,14 @@
+2021-03-16 Ziran Sun <[email protected]>
+
+ [css-grid] Replace the use of -1 with WTF::nullopt
+ https://bugs.webkit.org/show_bug.cgi?id=222376
+
+ Reviewed by Javier Fernandez.
+
+ Update failed expectations of the failing test.
+
+ * web-platform-tests/css/css-grid/alignment/grid-self-baseline-not-applied-if-sizing-cyclic-dependency-001-expected.txt:
+
2021-03-15 Said Abou-Hallawa <[email protected]>
Enable the layout test 2d.path.stroke.scale2.html
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-self-baseline-not-applied-if-sizing-cyclic-dependency-001-expected.txt (274476 => 274477)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-self-baseline-not-applied-if-sizing-cyclic-dependency-001-expected.txt 2021-03-16 14:22:51 UTC (rev 274476)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-self-baseline-not-applied-if-sizing-cyclic-dependency-001-expected.txt 2021-03-16 14:38:53 UTC (rev 274477)
@@ -65,5 +65,5 @@
<div class="secondRowFirstColumn verticalRL width200Percent" data-offset-x="-50" data-offset-y="100" data-expected-width="100" data-expected-height="100"></div>
<div class="firstRowSpanning2AutoColumn verticalRL width25" data-offset-x="50" data-offset-y="0" data-expected-width="25" data-expected-height="200"></div>
</div>
-width expected 100 but got 300
+offsetLeft expected 0 but got 100
Modified: trunk/Source/WebCore/ChangeLog (274476 => 274477)
--- trunk/Source/WebCore/ChangeLog 2021-03-16 14:22:51 UTC (rev 274476)
+++ trunk/Source/WebCore/ChangeLog 2021-03-16 14:38:53 UTC (rev 274477)
@@ -1,3 +1,33 @@
+2021-03-16 Ziran Sun <[email protected]>
+
+ [css-grid] Replace the use of -1 with WTF::nullopt
+ https://bugs.webkit.org/show_bug.cgi?id=222376
+
+ Reviewed by Javier Fernandez.
+
+ This change replaces -1 with nullopt in grid to indicate indefinite for funtions that
+ return an Optional type. This change has exposed an issue when resolving replaced element
+ definiteness as a grid-item with respect to aspect-ratio. The fix is that when checking for
+ hasReplacedLogicalHeight(), for fixed item we should just return true while for percent or
+ calculated items we keep the check as it is.
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::replacedMinMaxLogicalHeightComputesAsNone const):
+ * rendering/RenderGrid.cpp:
+ (WebCore::RenderGrid::placeItemsOnGrid const):
+ * rendering/RenderGrid.cpp:
+ (WebCore::RenderGrid::performGridItemsPreLayout const):
+ * rendering/RenderGrid.cpp:
+ (WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded const):
+ * rendering/GridTrackSizingAlgorithm.cpp:
+ (WebCore::GridTrackSizingAlgorithm::estimatedGridAreaBreadthForChild const):
+ * rendering/GridTrackSizingAlgorithm.cpp:
+ (WebCore::GridTrackSizingAlgorithm::gridAreaBreadthForChild const):
+ * rendering/GridTrackSizingAlgorithm.cpp:
+ (WebCore::GridTrackSizingAlgorithm::minSizeForChild const):
+ * rendering/GridTrackSizingAlgorithm.cpp:
+ (WebCore::GridTrackSizingAlgorithmStrategy::minLogicalSizeForChild const):
+
2021-03-16 Aditya Keerthi <[email protected]>
[iOS][FCR] Add pressed state for button-like controls
Modified: trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp (274476 => 274477)
--- trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp 2021-03-16 14:22:51 UTC (rev 274476)
+++ trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp 2021-03-16 14:38:53 UTC (rev 274477)
@@ -551,13 +551,8 @@
track->setPlannedSize(track->plannedSize() == infinity ? track->tempSize() : std::max(track->plannedSize(), track->tempSize()));
}
-LayoutSize GridTrackSizingAlgorithm::estimatedGridAreaBreadthForChild(const RenderBox& child) const
+Optional<LayoutUnit> GridTrackSizingAlgorithm::estimatedGridAreaBreadthForChild(const RenderBox& child, GridTrackSizingDirection direction) const
{
- return {estimatedGridAreaBreadthForChild(child, ForColumns), estimatedGridAreaBreadthForChild(child, ForRows)};
-}
-
-LayoutUnit GridTrackSizingAlgorithm::estimatedGridAreaBreadthForChild(const RenderBox& child, GridTrackSizingDirection direction) const
-{
const GridSpan& span = m_grid.gridItemSpan(child, direction);
LayoutUnit gridAreaSize;
bool gridAreaIsIndefinite = false;
@@ -578,11 +573,11 @@
GridTrackSizingDirection childInlineDirection = GridLayoutFunctions::flowAwareDirectionForChild(*m_renderGrid, child, ForColumns);
if (gridAreaIsIndefinite)
- return direction == childInlineDirection ? std::max(child.maxPreferredLogicalWidth(), gridAreaSize) : -1_lu;
+ return direction == childInlineDirection ? makeOptional(std::max(child.maxPreferredLogicalWidth(), gridAreaSize)) : WTF::nullopt;
return gridAreaSize;
}
-LayoutUnit GridTrackSizingAlgorithm::gridAreaBreadthForChild(const RenderBox& child, GridTrackSizingDirection direction) const
+Optional<LayoutUnit> GridTrackSizingAlgorithm::gridAreaBreadthForChild(const RenderBox& child, GridTrackSizingDirection direction) const
{
bool addContentAlignmentOffset =
direction == ForColumns && m_sizingState == RowSizingFirstIteration;
@@ -755,7 +750,7 @@
{
GridTrackSizingDirection childBlockDirection = GridLayoutFunctions::flowAwareDirectionForChild(*renderGrid(), child, ForRows);
// If |child| has a relative logical height, we shouldn't let it override its intrinsic height, which is
- // what we are interested in here. Thus we need to set the block-axis override size to -1 (no possible resolution).
+ // what we are interested in here. Thus we need to set the block-axis override size to nullopt (no possible resolution).
if (shouldClearOverridingContainingBlockContentSizeForChild(child, ForRows)) {
setOverridingContainingBlockContentSizeForChild(child, childBlockDirection, WTF::nullopt);
child.setNeedsLayout(MarkOnlyThis);
@@ -831,7 +826,7 @@
return minSize;
}
- LayoutUnit gridAreaSize = m_algorithm.gridAreaBreadthForChild(child, childInlineDirection);
+ Optional<LayoutUnit> gridAreaSize = m_algorithm.gridAreaBreadthForChild(child, childInlineDirection);
return minLogicalSizeForChild(child, childMinSize, gridAreaSize) + baselineShim;
}
@@ -914,12 +909,12 @@
return true;
}
-LayoutUnit GridTrackSizingAlgorithmStrategy::minLogicalSizeForChild(RenderBox& child, const Length& childMinSize, LayoutUnit availableSize) const
+LayoutUnit GridTrackSizingAlgorithmStrategy::minLogicalSizeForChild(RenderBox& child, const Length& childMinSize, Optional<LayoutUnit> availableSize) const
{
GridTrackSizingDirection childInlineDirection = GridLayoutFunctions::flowAwareDirectionForChild(*renderGrid(), child, ForColumns);
bool isRowAxis = direction() == childInlineDirection;
if (isRowAxis)
- return child.computeLogicalWidthInFragmentUsing(MinSize, childMinSize, availableSize, *renderGrid(), nullptr) + GridLayoutFunctions::marginLogicalSizeForChild(*renderGrid(), childInlineDirection, child);
+ return child.computeLogicalWidthInFragmentUsing(MinSize, childMinSize, availableSize.valueOr(0), *renderGrid(), nullptr) + GridLayoutFunctions::marginLogicalSizeForChild(*renderGrid(), childInlineDirection, child);
bool overrideSizeHasChanged = updateOverridingContainingBlockContentSizeForChild(child, childInlineDirection, availableSize);
layoutGridItemForMinSizeComputation(child, overrideSizeHasChanged);
GridTrackSizingDirection childBlockDirection = GridLayoutFunctions::flowAwareDirectionForChild(*renderGrid(), child, ForRows);
@@ -1034,7 +1029,7 @@
bool recomputeUsedFlexFractionIfNeeded(double& flexFraction, LayoutUnit& totalGrowth) const override;
LayoutUnit freeSpaceForStretchAutoTracksStep() const override;
LayoutUnit minContentForChild(RenderBox&) const override;
- LayoutUnit minLogicalSizeForChild(RenderBox&, const Length& childMinSize, LayoutUnit availableSize) const override;
+ LayoutUnit minLogicalSizeForChild(RenderBox&, const Length& childMinSize, Optional<LayoutUnit> availableSize) const override;
};
LayoutUnit IndefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep() const
@@ -1049,13 +1044,14 @@
return minSize.value() - computeTrackBasedSize();
}
-LayoutUnit DefiniteSizeStrategy::minLogicalSizeForChild(RenderBox& child, const Length& childMinSize, LayoutUnit availableSize) const
+LayoutUnit DefiniteSizeStrategy::minLogicalSizeForChild(RenderBox& child, const Length& childMinSize, Optional<LayoutUnit> availableSize) const
{
GridTrackSizingDirection childInlineDirection = GridLayoutFunctions::flowAwareDirectionForChild(*renderGrid(), child, ForColumns);
- LayoutUnit indefiniteSize = direction() == childInlineDirection ? LayoutUnit() : LayoutUnit(-1);
GridTrackSizingDirection flowAwareDirection = GridLayoutFunctions::flowAwareDirectionForChild(*renderGrid(), child, direction());
- if (hasRelativeMarginOrPaddingForChild(child, flowAwareDirection) || (direction() != childInlineDirection && hasRelativeOrIntrinsicSizeForChild(child, flowAwareDirection)))
+ if (hasRelativeMarginOrPaddingForChild(child, flowAwareDirection) || (direction() != childInlineDirection && hasRelativeOrIntrinsicSizeForChild(child, flowAwareDirection))) {
+ auto indefiniteSize = direction() == childInlineDirection ? makeOptional(0_lu) : WTF::nullopt;
setOverridingContainingBlockContentSizeForChild(child, direction(), indefiniteSize);
+ }
return GridTrackSizingAlgorithmStrategy::minLogicalSizeForChild(child, childMinSize, availableSize);
}
Modified: trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.h (274476 => 274477)
--- trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.h 2021-03-16 14:22:51 UTC (rev 274476)
+++ trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.h 2021-03-16 14:38:53 UTC (rev 274477)
@@ -118,8 +118,8 @@
LayoutUnit minContentSize() const { return m_minContentSize; };
LayoutUnit maxContentSize() const { return m_maxContentSize; };
- LayoutSize estimatedGridAreaBreadthForChild(const RenderBox&) const;
LayoutUnit baselineOffsetForChild(const RenderBox&, GridAxis) const;
+ Optional<LayoutUnit> estimatedGridAreaBreadthForChild(const RenderBox&, GridTrackSizingDirection) const;
void cacheBaselineAlignedItem(const RenderBox&, GridAxis);
void copyBaselineItemsCache(const GridTrackSizingAlgorithm&, GridAxis);
@@ -159,8 +159,7 @@
template <TrackSizeComputationPhase phase> void increaseSizesToAccommodateSpanningItems(const GridItemsSpanGroupRange& gridItemsWithSpan);
LayoutUnit itemSizeForTrackSizeComputationPhase(TrackSizeComputationPhase, RenderBox&) const;
template <TrackSizeComputationPhase phase> void distributeSpaceToTracks(Vector<GridTrack*>& tracks, Vector<GridTrack*>* growBeyondGrowthLimitsTracks, LayoutUnit& availableLogicalSpace) const;
- LayoutUnit estimatedGridAreaBreadthForChild(const RenderBox&, GridTrackSizingDirection) const;
- LayoutUnit gridAreaBreadthForChild(const RenderBox&, GridTrackSizingDirection) const;
+ Optional<LayoutUnit> gridAreaBreadthForChild(const RenderBox&, GridTrackSizingDirection) const;
void computeBaselineAlignmentContext();
void updateBaselineAlignmentContext(const RenderBox&, GridAxis);
@@ -267,7 +266,7 @@
GridTrackSizingAlgorithmStrategy(GridTrackSizingAlgorithm& algorithm)
: m_algorithm(algorithm) { }
- virtual LayoutUnit minLogicalSizeForChild(RenderBox&, const Length& childMinSize, LayoutUnit availableSize) const;
+ virtual LayoutUnit minLogicalSizeForChild(RenderBox&, const Length& childMinSize, Optional<LayoutUnit> availableSize) const;
virtual void layoutGridItemForMinSizeComputation(RenderBox&, bool overrideSizeHasChanged) const = 0;
LayoutUnit logicalHeightForChild(RenderBox&) const;
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (274476 => 274477)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2021-03-16 14:22:51 UTC (rev 274476)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2021-03-16 14:38:53 UTC (rev 274477)
@@ -3266,7 +3266,7 @@
return true;
if (logicalHeight.isPercentOrCalculated() && hasOverridingContainingBlockContentLogicalHeight())
- return overridingContainingBlockContentLogicalHeight() == LayoutUnit(-1);
+ return overridingContainingBlockContentLogicalHeight() == WTF::nullopt;
// Make sure % min-height and % max-height resolve to none if the containing block has auto height.
// Note that the "height" case for replaced elements was handled by hasReplacedLogicalHeight, which is why
Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (274476 => 274477)
--- trunk/Source/WebCore/rendering/RenderGrid.cpp 2021-03-16 14:22:51 UTC (rev 274476)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp 2021-03-16 14:38:53 UTC (rev 274477)
@@ -613,7 +613,7 @@
if (!child->hasOverridingContainingBlockContentLogicalWidth())
child->setOverridingContainingBlockContentLogicalWidth(LayoutUnit());
if (!child->hasOverridingContainingBlockContentLogicalHeight())
- child->setOverridingContainingBlockContentLogicalHeight(LayoutUnit(-1));
+ child->setOverridingContainingBlockContentLogicalHeight(WTF::nullopt);
GridArea area = grid.gridItemArea(*child);
if (!area.rows.isIndefinite())
@@ -672,7 +672,7 @@
// Orthogonal items should be laid out in order to properly compute content-sized tracks that may depend on item's intrinsic size.
// We also need to properly estimate its grid area size, since it may affect to the baseline shims if such item particiaptes in baseline alignment.
if (GridLayoutFunctions::isOrthogonalChild(*this, *child)) {
- updateGridAreaLogicalSize(*child, algorithm.estimatedGridAreaBreadthForChild(*child));
+ updateGridAreaLogicalSize(*child, algorithm.estimatedGridAreaBreadthForChild(*child, ForColumns), algorithm.estimatedGridAreaBreadthForChild(*child, ForRows));
child->layoutIfNeeded();
continue;
}
@@ -680,7 +680,7 @@
// baseline or not, which may imply a cyclic sizing dependency.
// FIXME: Can we avoid it ?
if (isBaselineAlignmentForChild(*child)) {
- updateGridAreaLogicalSize(*child, algorithm.estimatedGridAreaBreadthForChild(*child));
+ updateGridAreaLogicalSize(*child, algorithm.estimatedGridAreaBreadthForChild(*child, ForColumns), algorithm.estimatedGridAreaBreadthForChild(*child, ForRows));
child->layoutIfNeeded();
}
}
@@ -899,11 +899,11 @@
return normalBehavior;
}
-static bool overrideSizeChanged(const RenderBox& child, GridTrackSizingDirection direction, LayoutSize size)
+static bool overrideSizeChanged(const RenderBox& child, GridTrackSizingDirection direction, Optional<LayoutUnit> width, Optional<LayoutUnit> height)
{
if (direction == ForColumns)
- return !child.hasOverridingContainingBlockContentLogicalWidth() || child.overridingContainingBlockContentLogicalWidth() != size.width();
- return !child.hasOverridingContainingBlockContentLogicalHeight() || child.overridingContainingBlockContentLogicalHeight() != size.height();
+ return !child.hasOverridingContainingBlockContentLogicalWidth() || child.overridingContainingBlockContentLogicalWidth() != width;
+ return !child.hasOverridingContainingBlockContentLogicalHeight() || child.overridingContainingBlockContentLogicalHeight() != height;
}
static bool hasRelativeBlockAxisSize(const RenderGrid& grid, const RenderBox& child)
@@ -911,17 +911,17 @@
return GridLayoutFunctions::isOrthogonalChild(grid, child) ? child.hasRelativeLogicalWidth() || child.style().logicalWidth().isAuto() : child.hasRelativeLogicalHeight();
}
-void RenderGrid::updateGridAreaLogicalSize(RenderBox& child, LayoutSize gridAreaLogicalSize) const
+void RenderGrid::updateGridAreaLogicalSize(RenderBox& child, Optional<LayoutUnit> width, Optional<LayoutUnit> height) const
{
// Because the grid area cannot be styled, we don't need to adjust
// the grid breadth to account for 'box-sizing'.
- bool gridAreaWidthChanged = overrideSizeChanged(child, ForColumns, gridAreaLogicalSize);
- bool gridAreaHeightChanged = overrideSizeChanged(child, ForRows, gridAreaLogicalSize);
+ bool gridAreaWidthChanged = overrideSizeChanged(child, ForColumns, width, height);
+ bool gridAreaHeightChanged = overrideSizeChanged(child, ForRows, width, height);
if (gridAreaWidthChanged || (gridAreaHeightChanged && hasRelativeBlockAxisSize(*this, child)))
child.setNeedsLayout(MarkOnlyThis);
- child.setOverridingContainingBlockContentLogicalWidth(gridAreaLogicalSize.width());
- child.setOverridingContainingBlockContentLogicalHeight(gridAreaLogicalSize.height());
+ child.setOverridingContainingBlockContentLogicalWidth(width);
+ child.setOverridingContainingBlockContentLogicalHeight(height);
}
void RenderGrid::layoutGridItems()
@@ -940,7 +940,7 @@
// Setting the definite grid area's sizes. It may imply that the
// item must perform a layout if its area differs from the one
// used during the track sizing algorithm.
- updateGridAreaLogicalSize(*child, LayoutSize(gridAreaBreadthForChildIncludingAlignmentOffsets(*child, ForColumns), gridAreaBreadthForChildIncludingAlignmentOffsets(*child, ForRows)));
+ updateGridAreaLogicalSize(*child, gridAreaBreadthForChildIncludingAlignmentOffsets(*child, ForColumns), gridAreaBreadthForChildIncludingAlignmentOffsets(*child, ForRows));
LayoutRect oldChildRect = child->frameRect();
@@ -1136,7 +1136,7 @@
bool allowedToStretchChildBlockSize = blockFlowIsColumnAxis ? allowedToStretchChildAlongColumnAxis(child) : allowedToStretchChildAlongRowAxis(child);
if (allowedToStretchChildBlockSize) {
LayoutUnit stretchedLogicalHeight = availableAlignmentSpaceForChildBeforeStretching(GridLayoutFunctions::overridingContainingBlockContentSizeForChild(child, childBlockDirection).value(), child);
- LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinMax(stretchedLogicalHeight, -1_lu);
+ LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinMax(stretchedLogicalHeight, WTF::nullopt);
child.setOverridingLogicalHeight(desiredLogicalHeight);
// Checking the logical-height of a child isn't enough. Setting an override logical-height
Modified: trunk/Source/WebCore/rendering/RenderGrid.h (274476 => 274477)
--- trunk/Source/WebCore/rendering/RenderGrid.h 2021-03-16 14:22:51 UTC (rev 274476)
+++ trunk/Source/WebCore/rendering/RenderGrid.h 2021-03-16 14:38:53 UTC (rev 274477)
@@ -74,7 +74,7 @@
LayoutUnit guttersSize(const Grid&, GridTrackSizingDirection, unsigned startLine, unsigned span, Optional<LayoutUnit> availableSize) const;
LayoutUnit gridItemOffset(GridTrackSizingDirection) const;
- void updateGridAreaLogicalSize(RenderBox&, LayoutSize) const;
+ void updateGridAreaLogicalSize(RenderBox&, Optional<LayoutUnit> width, Optional<LayoutUnit> height) const;
bool isBaselineAlignmentForChild(const RenderBox&) const;
bool isBaselineAlignmentForChild(const RenderBox&, GridAxis) const;
Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (274476 => 274477)
--- trunk/Source/WebCore/rendering/RenderReplaced.cpp 2021-03-16 14:22:51 UTC (rev 274476)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp 2021-03-16 14:38:53 UTC (rev 274477)
@@ -350,12 +350,12 @@
if (style().logicalHeight().isAuto())
return false;
- if (style().logicalHeight().isSpecified()) {
- if (hasAutoHeightOrContainingBlockWithAutoHeight())
- return false;
+ if (style().logicalHeight().isFixed())
return true;
- }
+ if (style().logicalHeight().isPercentOrCalculated())
+ return !hasAutoHeightOrContainingBlockWithAutoHeight();
+
if (style().logicalHeight().isIntrinsic())
return true;