Diff
Modified: trunk/Source/WebCore/ChangeLog (224545 => 224546)
--- trunk/Source/WebCore/ChangeLog 2017-11-07 21:19:33 UTC (rev 224545)
+++ trunk/Source/WebCore/ChangeLog 2017-11-07 21:36:07 UTC (rev 224546)
@@ -1,3 +1,47 @@
+2017-11-07 Zalan Bujtas <[email protected]>
+
+ [LayoutState cleanup] Remove explicit LayoutStateMaintainer::pop calls.
+ https://bugs.webkit.org/show_bug.cgi?id=179380
+ <rdar://problem/35392161>
+
+ Reviewed by Antti Koivisto.
+
+ Besides the pagination related explicit pops (FIXME), all LayoutStateMaintainer pops are
+ now in LayoutStateMaintainer's d'tor.
+
+ Covered by existing tests.
+
+ * rendering/LayoutState.cpp:
+ (WebCore::LayoutStateMaintainer::~LayoutStateMaintainer):
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::simplifiedLayout):
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::layoutBlock):
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::layout):
+ * rendering/RenderDeprecatedFlexibleBox.cpp:
+ (WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
+ * rendering/RenderEmbeddedObject.cpp:
+ (WebCore::RenderEmbeddedObject::layout):
+ * rendering/RenderFlexibleBox.cpp:
+ (WebCore::RenderFlexibleBox::layoutBlock):
+ * rendering/RenderGrid.cpp:
+ (WebCore::RenderGrid::layoutBlock):
+ * rendering/RenderImage.cpp:
+ (WebCore::RenderImage::layoutShadowControls):
+ * rendering/RenderTable.cpp:
+ (WebCore::RenderTable::layout):
+ * rendering/RenderTableRow.cpp:
+ (WebCore::RenderTableRow::layout):
+ * rendering/RenderTableSection.cpp:
+ (WebCore::RenderTableSection::calcRowLogicalHeight):
+ (WebCore::RenderTableSection::layout):
+ (WebCore::RenderTableSection::layoutRows):
+ * rendering/RenderVTTCue.cpp:
+ (WebCore::RenderVTTCue::layout):
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::layout):
+
2017-11-07 Commit Queue <[email protected]>
Unreviewed, rolling out r224512 and r224521.
Modified: trunk/Source/WebCore/rendering/LayoutState.cpp (224545 => 224546)
--- trunk/Source/WebCore/rendering/LayoutState.cpp 2017-11-07 21:19:33 UTC (rev 224545)
+++ trunk/Source/WebCore/rendering/LayoutState.cpp 2017-11-07 21:36:07 UTC (rev 224546)
@@ -232,6 +232,9 @@
LayoutStateMaintainer::~LayoutStateMaintainer()
{
+ // FIXME: Remove conditional push/pop.
+ if (m_didCallPush && !m_didCallPop)
+ pop();
ASSERT(!m_didCallPush || m_didCallPush == m_didCallPop);
}
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (224545 => 224546)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2017-11-07 21:19:33 UTC (rev 224545)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2017-11-07 21:36:07 UTC (rev 224546)
@@ -1321,10 +1321,8 @@
return false;
LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode());
- if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovementOnly()) {
- statePusher.pop();
+ if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovementOnly())
return false;
- }
// Lay out positioned descendants or objects that just need to recompute overflow.
if (needsSimplifiedNormalFlowLayout())
@@ -1354,8 +1352,6 @@
LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layoutClientAfterEdge() : clientLogicalBottom();
computeOverflow(oldClientAfterEdge, true);
- statePusher.pop();
-
updateLayerTransform();
updateScrollInfoAfterLayout();
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (224545 => 224546)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2017-11-07 21:19:33 UTC (rev 224545)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2017-11-07 21:36:07 UTC (rev 224546)
@@ -475,88 +475,89 @@
bool pageLogicalHeightChanged = false;
checkForPaginationLogicalHeightChange(relayoutChildren, pageLogicalHeight, pageLogicalHeightChanged);
+ LayoutUnit repaintLogicalTop = 0;
+ LayoutUnit repaintLogicalBottom = 0;
const RenderStyle& styleToUse = style();
- LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || styleToUse.isFlippedBlocksWritingMode(), pageLogicalHeight, pageLogicalHeightChanged);
+ {
+ LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || styleToUse.isFlippedBlocksWritingMode(), pageLogicalHeight, pageLogicalHeightChanged);
- preparePaginationBeforeBlockLayout(relayoutChildren);
+ preparePaginationBeforeBlockLayout(relayoutChildren);
- // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg, to track
- // our current maximal positive and negative margins. These values are used when we
- // are collapsed with adjacent blocks, so for example, if you have block A and B
- // collapsing together, then you'd take the maximal positive margin from both A and B
- // and subtract it from the maximal negative margin from both A and B to get the
- // true collapsed margin. This algorithm is recursive, so when we finish layout()
- // our block knows its current maximal positive/negative values.
- //
- // Start out by setting our margin values to our current margins. Table cells have
- // no margins, so we don't fill in the values for table cells.
- bool isCell = isTableCell();
- if (!isCell) {
- initMaxMarginValues();
-
- setHasMarginBeforeQuirk(styleToUse.hasMarginBeforeQuirk());
- setHasMarginAfterQuirk(styleToUse.hasMarginAfterQuirk());
- setPaginationStrut(0);
- }
+ // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg, to track
+ // our current maximal positive and negative margins. These values are used when we
+ // are collapsed with adjacent blocks, so for example, if you have block A and B
+ // collapsing together, then you'd take the maximal positive margin from both A and B
+ // and subtract it from the maximal negative margin from both A and B to get the
+ // true collapsed margin. This algorithm is recursive, so when we finish layout()
+ // our block knows its current maximal positive/negative values.
+ //
+ // Start out by setting our margin values to our current margins. Table cells have
+ // no margins, so we don't fill in the values for table cells.
+ bool isCell = isTableCell();
+ if (!isCell) {
+ initMaxMarginValues();
- LayoutUnit repaintLogicalTop = 0;
- LayoutUnit repaintLogicalBottom = 0;
- LayoutUnit maxFloatLogicalBottom = 0;
- if (!firstChild() && !isAnonymousBlock())
- setChildrenInline(true);
- if (childrenInline())
- layoutInlineChildren(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
- else
- layoutBlockChildren(relayoutChildren, maxFloatLogicalBottom);
+ setHasMarginBeforeQuirk(styleToUse.hasMarginBeforeQuirk());
+ setHasMarginAfterQuirk(styleToUse.hasMarginAfterQuirk());
+ setPaginationStrut(0);
+ }
- // Expand our intrinsic height to encompass floats.
- LayoutUnit toAdd = borderAndPaddingAfter() + scrollbarLogicalHeight();
- if (lowestFloatLogicalBottom() > (logicalHeight() - toAdd) && createsNewFormattingContext())
- setLogicalHeight(lowestFloatLogicalBottom() + toAdd);
-
- if (relayoutForPagination(statePusher) || relayoutToAvoidWidows(statePusher)) {
- ASSERT(!shouldBreakAtLineToAvoidWidow());
- return;
- }
+ LayoutUnit maxFloatLogicalBottom = 0;
+ if (!firstChild() && !isAnonymousBlock())
+ setChildrenInline(true);
+ if (childrenInline())
+ layoutInlineChildren(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
+ else
+ layoutBlockChildren(relayoutChildren, maxFloatLogicalBottom);
- // Calculate our new height.
- LayoutUnit oldHeight = logicalHeight();
- LayoutUnit oldClientAfterEdge = clientLogicalBottom();
+ // Expand our intrinsic height to encompass floats.
+ LayoutUnit toAdd = borderAndPaddingAfter() + scrollbarLogicalHeight();
+ if (lowestFloatLogicalBottom() > (logicalHeight() - toAdd) && createsNewFormattingContext())
+ setLogicalHeight(lowestFloatLogicalBottom() + toAdd);
- // Before updating the final size of the flow thread make sure a forced break is applied after the content.
- // This ensures the size information is correctly computed for the last auto-height fragment receiving content.
- if (is<RenderFragmentedFlow>(*this))
- downcast<RenderFragmentedFlow>(*this).applyBreakAfterContent(oldClientAfterEdge);
+ if (relayoutForPagination(statePusher) || relayoutToAvoidWidows(statePusher)) {
+ ASSERT(!shouldBreakAtLineToAvoidWidow());
+ return;
+ }
- updateLogicalHeight();
- LayoutUnit newHeight = logicalHeight();
- if (oldHeight != newHeight) {
- if (oldHeight > newHeight && maxFloatLogicalBottom > newHeight && !childrenInline()) {
- // One of our children's floats may have become an overhanging float for us. We need to look for it.
- for (auto& blockFlow : childrenOfType<RenderBlockFlow>(*this)) {
- if (blockFlow.isFloatingOrOutOfFlowPositioned())
- continue;
- if (blockFlow.lowestFloatLogicalBottom() + blockFlow.logicalTop() > newHeight)
- addOverhangingFloats(blockFlow, false);
+ // Calculate our new height.
+ LayoutUnit oldHeight = logicalHeight();
+ LayoutUnit oldClientAfterEdge = clientLogicalBottom();
+
+ // Before updating the final size of the flow thread make sure a forced break is applied after the content.
+ // This ensures the size information is correctly computed for the last auto-height fragment receiving content.
+ if (is<RenderFragmentedFlow>(*this))
+ downcast<RenderFragmentedFlow>(*this).applyBreakAfterContent(oldClientAfterEdge);
+
+ updateLogicalHeight();
+ LayoutUnit newHeight = logicalHeight();
+ if (oldHeight != newHeight) {
+ if (oldHeight > newHeight && maxFloatLogicalBottom > newHeight && !childrenInline()) {
+ // One of our children's floats may have become an overhanging float for us. We need to look for it.
+ for (auto& blockFlow : childrenOfType<RenderBlockFlow>(*this)) {
+ if (blockFlow.isFloatingOrOutOfFlowPositioned())
+ continue;
+ if (blockFlow.lowestFloatLogicalBottom() + blockFlow.logicalTop() > newHeight)
+ addOverhangingFloats(blockFlow, false);
+ }
}
}
- }
- bool heightChanged = (previousHeight != newHeight);
- if (heightChanged)
- relayoutChildren = true;
+ bool heightChanged = (previousHeight != newHeight);
+ if (heightChanged)
+ relayoutChildren = true;
- layoutPositionedObjects(relayoutChildren || isDocumentElementRenderer());
+ layoutPositionedObjects(relayoutChildren || isDocumentElementRenderer());
- // Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway).
- computeOverflow(oldClientAfterEdge);
-
- statePusher.pop();
+ // Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway).
+ computeOverflow(oldClientAfterEdge);
- fitBorderToLinesIfNeeded();
+ fitBorderToLinesIfNeeded();
+ }
- if (view().frameView().layoutContext().layoutState()->m_pageLogicalHeight)
- setPageLogicalOffset(view().frameView().layoutContext().layoutState()->pageLogicalOffset(this, logicalTop()));
+ auto* state = view().frameView().layoutContext().layoutState();
+ if (state && state->m_pageLogicalHeight)
+ setPageLogicalOffset(state->pageLogicalOffset(this, logicalTop()));
updateLayerTransform();
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (224545 => 224546)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2017-11-07 21:19:33 UTC (rev 224545)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2017-11-07 21:36:07 UTC (rev 224546)
@@ -518,7 +518,6 @@
ASSERT(!child->needsLayout());
child = child->nextSibling();
}
- statePusher.pop();
invalidateBackgroundObscurationStatus();
clearNeedsLayout();
}
Modified: trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (224545 => 224546)
--- trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp 2017-11-07 21:19:33 UTC (rev 224545)
+++ trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp 2017-11-07 21:36:07 UTC (rev 224546)
@@ -281,60 +281,61 @@
return;
LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
- LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode());
+ {
+ LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode());
- preparePaginationBeforeBlockLayout(relayoutChildren);
+ preparePaginationBeforeBlockLayout(relayoutChildren);
- LayoutSize previousSize = size();
+ LayoutSize previousSize = size();
- updateLogicalWidth();
- updateLogicalHeight();
+ updateLogicalWidth();
+ updateLogicalHeight();
- if (previousSize != size()
- || (parent()->isDeprecatedFlexibleBox() && parent()->style().boxOrient() == HORIZONTAL
- && parent()->style().boxAlign() == BSTRETCH))
- relayoutChildren = true;
+ if (previousSize != size()
+ || (parent()->isDeprecatedFlexibleBox() && parent()->style().boxOrient() == HORIZONTAL
+ && parent()->style().boxAlign() == BSTRETCH))
+ relayoutChildren = true;
- setHeight(0);
+ setHeight(0);
- m_stretchingChildren = false;
+ m_stretchingChildren = false;
#if !ASSERT_DISABLED
- LayoutSize oldLayoutDelta = view().frameView().layoutContext().layoutDelta();
+ LayoutSize oldLayoutDelta = view().frameView().layoutContext().layoutDelta();
#endif
- // Fieldsets need to find their legend and position it inside the border of the object.
- // The legend then gets skipped during normal layout. The same is true for ruby text.
- // It doesn't get included in the normal layout process but is instead skipped.
- layoutExcludedChildren(relayoutChildren);
+ // Fieldsets need to find their legend and position it inside the border of the object.
+ // The legend then gets skipped during normal layout. The same is true for ruby text.
+ // It doesn't get included in the normal layout process but is instead skipped.
+ layoutExcludedChildren(relayoutChildren);
- ChildFrameRects oldChildRects;
- appendChildFrameRects(this, oldChildRects);
+ ChildFrameRects oldChildRects;
+ appendChildFrameRects(this, oldChildRects);
- if (isHorizontal())
- layoutHorizontalBox(relayoutChildren);
- else
- layoutVerticalBox(relayoutChildren);
+ if (isHorizontal())
+ layoutHorizontalBox(relayoutChildren);
+ else
+ layoutVerticalBox(relayoutChildren);
- repaintChildrenDuringLayoutIfMoved(this, oldChildRects);
- ASSERT(view().frameView().layoutContext().layoutDeltaMatches(oldLayoutDelta));
+ repaintChildrenDuringLayoutIfMoved(this, oldChildRects);
+ ASSERT(view().frameView().layoutContext().layoutDeltaMatches(oldLayoutDelta));
- LayoutUnit oldClientAfterEdge = clientLogicalBottom();
- updateLogicalHeight();
+ LayoutUnit oldClientAfterEdge = clientLogicalBottom();
+ updateLogicalHeight();
- if (previousSize.height() != height())
- relayoutChildren = true;
+ if (previousSize.height() != height())
+ relayoutChildren = true;
- layoutPositionedObjects(relayoutChildren || isDocumentElementRenderer());
+ layoutPositionedObjects(relayoutChildren || isDocumentElementRenderer());
- computeOverflow(oldClientAfterEdge);
+ computeOverflow(oldClientAfterEdge);
+ }
- statePusher.pop();
-
updateLayerTransform();
- if (view().frameView().layoutContext().layoutState()->pageLogicalHeight())
- setPageLogicalOffset(view().frameView().layoutContext().layoutState()->pageLogicalOffset(this, logicalTop()));
+ auto* layoutState = view().frameView().layoutContext().layoutState();
+ if (layoutState && layoutState->pageLogicalHeight())
+ setPageLogicalOffset(layoutState->pageLogicalOffset(this, logicalTop()));
// Update our scrollbars if we're overflow:auto/scroll/hidden now that we know if
// we overflow or not.
Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp (224545 => 224546)
--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp 2017-11-07 21:19:33 UTC (rev 224545)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp 2017-11-07 21:36:07 UTC (rev 224546)
@@ -464,8 +464,6 @@
childBox.setNeedsLayout(MarkOnlyThis);
childBox.layout();
clearChildNeedsLayout();
-
- statePusher.pop();
}
bool RenderEmbeddedObject::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction)
Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (224545 => 224546)
--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2017-11-07 21:19:33 UTC (rev 224545)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2017-11-07 21:36:07 UTC (rev 224546)
@@ -275,48 +275,46 @@
LayoutUnit previousHeight = logicalHeight();
setLogicalHeight(borderAndPaddingLogicalHeight() + scrollbarLogicalHeight());
+ {
+ LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode());
- LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode());
+ preparePaginationBeforeBlockLayout(relayoutChildren);
- preparePaginationBeforeBlockLayout(relayoutChildren);
+ m_numberOfInFlowChildrenOnFirstLine = -1;
- m_numberOfInFlowChildrenOnFirstLine = -1;
+ beginUpdateScrollInfoAfterLayoutTransaction();
- beginUpdateScrollInfoAfterLayoutTransaction();
+ prepareOrderIteratorAndMargins();
- prepareOrderIteratorAndMargins();
+ // Fieldsets need to find their legend and position it inside the border of the object.
+ // The legend then gets skipped during normal layout. The same is true for ruby text.
+ // It doesn't get included in the normal layout process but is instead skipped.
+ layoutExcludedChildren(relayoutChildren);
- // Fieldsets need to find their legend and position it inside the border of the object.
- // The legend then gets skipped during normal layout. The same is true for ruby text.
- // It doesn't get included in the normal layout process but is instead skipped.
- layoutExcludedChildren(relayoutChildren);
+ ChildFrameRects oldChildRects;
+ appendChildFrameRects(oldChildRects);
- ChildFrameRects oldChildRects;
- appendChildFrameRects(oldChildRects);
+ layoutFlexItems(relayoutChildren);
- layoutFlexItems(relayoutChildren);
+ endAndCommitUpdateScrollInfoAfterLayoutTransaction();
- endAndCommitUpdateScrollInfoAfterLayoutTransaction();
+ if (logicalHeight() != previousHeight)
+ relayoutChildren = true;
- if (logicalHeight() != previousHeight)
- relayoutChildren = true;
+ layoutPositionedObjects(relayoutChildren || isDocumentElementRenderer());
- layoutPositionedObjects(relayoutChildren || isDocumentElementRenderer());
+ repaintChildrenDuringLayoutIfMoved(oldChildRects);
+ // FIXME: css3/flexbox/repaint-rtl-column.html seems to repaint more overflow than it needs to.
+ computeOverflow(clientLogicalBottomAfterRepositioning());
+ }
+ updateLayerTransform();
- repaintChildrenDuringLayoutIfMoved(oldChildRects);
- // FIXME: css3/flexbox/repaint-rtl-column.html seems to repaint more overflow than it needs to.
- computeOverflow(clientLogicalBottomAfterRepositioning());
- statePusher.pop();
-
- updateLayerTransform();
-
// We have to reset this, because changes to our ancestors' style can affect
// this value. Also, this needs to be before we call updateAfterLayout, as
// that function may re-enter this one.
m_hasDefiniteHeight = SizeDefiniteness::Unknown;
- // Update our scroll information if we're overflow:auto/scroll/hidden now that we know if
- // we overflow or not.
+ // Update our scroll information if we're overflow:auto/scroll/hidden now that we know if we overflow or not.
updateScrollInfoAfterLayout();
repainter.repaintAfterLayout();
Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (224545 => 224546)
--- trunk/Source/WebCore/rendering/RenderGrid.cpp 2017-11-07 21:19:33 UTC (rev 224545)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp 2017-11-07 21:36:07 UTC (rev 224546)
@@ -233,92 +233,93 @@
return;
LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
- LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode());
+ {
+ LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode());
- preparePaginationBeforeBlockLayout(relayoutChildren);
+ preparePaginationBeforeBlockLayout(relayoutChildren);
- LayoutSize previousSize = size();
- // FIXME: We should use RenderBlock::hasDefiniteLogicalHeight() but it does not work for positioned stuff.
- // FIXME: Consider caching the hasDefiniteLogicalHeight value throughout the layout.
- bool hasDefiniteLogicalHeight = hasOverrideLogicalContentHeight() || computeContentLogicalHeight(MainOrPreferredSize, style().logicalHeight(), std::nullopt);
+ LayoutSize previousSize = size();
+ // FIXME: We should use RenderBlock::hasDefiniteLogicalHeight() but it does not work for positioned stuff.
+ // FIXME: Consider caching the hasDefiniteLogicalHeight value throughout the layout.
+ bool hasDefiniteLogicalHeight = hasOverrideLogicalContentHeight() || computeContentLogicalHeight(MainOrPreferredSize, style().logicalHeight(), std::nullopt);
- // We need to clear both own and containingBlock override sizes of orthogonal items to ensure we get the
- // same result when grid's intrinsic size is computed again in the updateLogicalWidth call bellow.
- if (sizesLogicalWidthToFitContent(MaxSize) || style().logicalWidth().isIntrinsicOrAuto()) {
- for (auto* child = firstChildBox(); child; child = child->nextSiblingBox()) {
- if (child->isOutOfFlowPositioned() || !isOrthogonalChild(*child))
- continue;
- child->clearOverrideSize();
- child->clearContainingBlockOverrideSize();
- child->setNeedsLayout();
- child->layoutIfNeeded();
+ // We need to clear both own and containingBlock override sizes of orthogonal items to ensure we get the
+ // same result when grid's intrinsic size is computed again in the updateLogicalWidth call bellow.
+ if (sizesLogicalWidthToFitContent(MaxSize) || style().logicalWidth().isIntrinsicOrAuto()) {
+ for (auto* child = firstChildBox(); child; child = child->nextSiblingBox()) {
+ if (child->isOutOfFlowPositioned() || !isOrthogonalChild(*child))
+ continue;
+ child->clearOverrideSize();
+ child->clearContainingBlockOverrideSize();
+ child->setNeedsLayout();
+ child->layoutIfNeeded();
+ }
}
- }
- setLogicalHeight(0);
- updateLogicalWidth();
+ setLogicalHeight(0);
+ updateLogicalWidth();
- // Fieldsets need to find their legend and position it inside the border of the object.
- // The legend then gets skipped during normal layout. The same is true for ruby text.
- // It doesn't get included in the normal layout process but is instead skipped.
- layoutExcludedChildren(relayoutChildren);
+ // Fieldsets need to find their legend and position it inside the border of the object.
+ // The legend then gets skipped during normal layout. The same is true for ruby text.
+ // It doesn't get included in the normal layout process but is instead skipped.
+ layoutExcludedChildren(relayoutChildren);
- LayoutUnit availableSpaceForColumns = availableLogicalWidth();
- placeItemsOnGrid(m_grid, availableSpaceForColumns);
+ LayoutUnit availableSpaceForColumns = availableLogicalWidth();
+ placeItemsOnGrid(m_grid, availableSpaceForColumns);
- // At this point the logical width is always definite as the above call to updateLogicalWidth()
- // properly resolves intrinsic sizes. We cannot do the same for heights though because many code
- // paths inside updateLogicalHeight() require a previous call to setLogicalHeight() to resolve
- // heights properly (like for positioned items for example).
- computeTrackSizesForDefiniteSize(ForColumns, availableSpaceForColumns);
+ // At this point the logical width is always definite as the above call to updateLogicalWidth()
+ // properly resolves intrinsic sizes. We cannot do the same for heights though because many code
+ // paths inside updateLogicalHeight() require a previous call to setLogicalHeight() to resolve
+ // heights properly (like for positioned items for example).
+ computeTrackSizesForDefiniteSize(ForColumns, availableSpaceForColumns);
- if (!hasDefiniteLogicalHeight) {
- m_minContentHeight = LayoutUnit();
- m_maxContentHeight = LayoutUnit();
- computeTrackSizesForIndefiniteSize(m_trackSizingAlgorithm, ForRows, m_grid, *m_minContentHeight, *m_maxContentHeight);
- // FIXME: This should be really added to the intrinsic height in RenderBox::computeContentAndScrollbarLogicalHeightUsing().
- // Remove this when that is fixed.
- ASSERT(m_minContentHeight);
- ASSERT(m_maxContentHeight);
- LayoutUnit scrollbarHeight = scrollbarLogicalHeight();
- *m_minContentHeight += scrollbarHeight;
- *m_maxContentHeight += scrollbarHeight;
- } else
- computeTrackSizesForDefiniteSize(ForRows, availableLogicalHeight(ExcludeMarginBorderPadding));
- LayoutUnit trackBasedLogicalHeight = computeTrackBasedLogicalHeight() + borderAndPaddingLogicalHeight() + scrollbarLogicalHeight();
- setLogicalHeight(trackBasedLogicalHeight);
+ if (!hasDefiniteLogicalHeight) {
+ m_minContentHeight = LayoutUnit();
+ m_maxContentHeight = LayoutUnit();
+ computeTrackSizesForIndefiniteSize(m_trackSizingAlgorithm, ForRows, m_grid, *m_minContentHeight, *m_maxContentHeight);
+ // FIXME: This should be really added to the intrinsic height in RenderBox::computeContentAndScrollbarLogicalHeightUsing().
+ // Remove this when that is fixed.
+ ASSERT(m_minContentHeight);
+ ASSERT(m_maxContentHeight);
+ LayoutUnit scrollbarHeight = scrollbarLogicalHeight();
+ *m_minContentHeight += scrollbarHeight;
+ *m_maxContentHeight += scrollbarHeight;
+ } else
+ computeTrackSizesForDefiniteSize(ForRows, availableLogicalHeight(ExcludeMarginBorderPadding));
+ LayoutUnit trackBasedLogicalHeight = computeTrackBasedLogicalHeight() + borderAndPaddingLogicalHeight() + scrollbarLogicalHeight();
+ setLogicalHeight(trackBasedLogicalHeight);
- LayoutUnit oldClientAfterEdge = clientLogicalBottom();
- updateLogicalHeight();
+ LayoutUnit oldClientAfterEdge = clientLogicalBottom();
+ updateLogicalHeight();
- // Once grid's indefinite height is resolved, we can compute the
- // available free space for Content Alignment.
- if (!hasDefiniteLogicalHeight)
- m_trackSizingAlgorithm.setFreeSpace(ForRows, logicalHeight() - trackBasedLogicalHeight);
+ // Once grid's indefinite height is resolved, we can compute the
+ // available free space for Content Alignment.
+ if (!hasDefiniteLogicalHeight)
+ m_trackSizingAlgorithm.setFreeSpace(ForRows, logicalHeight() - trackBasedLogicalHeight);
- // 3- If the min-content contribution of any grid items have changed based on the row
- // sizes calculated in step 2, steps 1 and 2 are repeated with the new min-content
- // contribution (once only).
- repeatTracksSizingIfNeeded(availableSpaceForColumns, contentLogicalHeight());
+ // 3- If the min-content contribution of any grid items have changed based on the row
+ // sizes calculated in step 2, steps 1 and 2 are repeated with the new min-content
+ // contribution (once only).
+ repeatTracksSizingIfNeeded(availableSpaceForColumns, contentLogicalHeight());
- // Grid container should have the minimum height of a line if it's editable. That does not affect track sizing though.
- if (hasLineIfEmpty()) {
- LayoutUnit minHeightForEmptyLine = borderAndPaddingLogicalHeight()
- + lineHeight(true, isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes)
- + scrollbarLogicalHeight();
- setLogicalHeight(std::max(logicalHeight(), minHeightForEmptyLine));
- }
+ // Grid container should have the minimum height of a line if it's editable. That does not affect track sizing though.
+ if (hasLineIfEmpty()) {
+ LayoutUnit minHeightForEmptyLine = borderAndPaddingLogicalHeight()
+ + lineHeight(true, isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes)
+ + scrollbarLogicalHeight();
+ setLogicalHeight(std::max(logicalHeight(), minHeightForEmptyLine));
+ }
- layoutGridItems();
- m_trackSizingAlgorithm.reset();
+ layoutGridItems();
+ m_trackSizingAlgorithm.reset();
- if (size() != previousSize)
- relayoutChildren = true;
+ if (size() != previousSize)
+ relayoutChildren = true;
- layoutPositionedObjects(relayoutChildren || isDocumentElementRenderer());
+ layoutPositionedObjects(relayoutChildren || isDocumentElementRenderer());
- computeOverflow(oldClientAfterEdge);
- statePusher.pop();
+ computeOverflow(oldClientAfterEdge);
+ }
updateLayerTransform();
Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (224545 => 224546)
--- trunk/Source/WebCore/rendering/RenderImage.cpp 2017-11-07 21:19:33 UTC (rev 224545)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp 2017-11-07 21:36:07 UTC (rev 224546)
@@ -746,8 +746,6 @@
controlsRenderer->setNeedsLayout(MarkOnlyThis);
controlsRenderer->layout();
clearChildNeedsLayout();
-
- statePusher.pop();
}
void RenderImage::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio) const
Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (224545 => 224546)
--- trunk/Source/WebCore/rendering/RenderTable.cpp 2017-11-07 21:19:33 UTC (rev 224545)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp 2017-11-07 21:36:07 UTC (rev 224546)
@@ -449,141 +449,140 @@
// FIXME: We should do this recalc lazily in borderStart/borderEnd so that we don't have to make sure
// to call this before we call borderStart/borderEnd to avoid getting a stale value.
recalcBordersInRowDirection();
+ bool sectionMoved = false;
+ LayoutUnit movedSectionLogicalTop = 0;
LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
- LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode());
+ {
+ LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode());
- LayoutUnit oldLogicalWidth = logicalWidth();
- LayoutUnit oldLogicalHeight = logicalHeight();
- setLogicalHeight(0);
- updateLogicalWidth();
+ LayoutUnit oldLogicalWidth = logicalWidth();
+ LayoutUnit oldLogicalHeight = logicalHeight();
+ setLogicalHeight(0);
+ updateLogicalWidth();
- if (logicalWidth() != oldLogicalWidth) {
- for (unsigned i = 0; i < m_captions.size(); i++)
- m_captions[i]->setNeedsLayout(MarkOnlyThis);
- }
- // FIXME: The optimisation below doesn't work since the internal table
- // layout could have changed. we need to add a flag to the table
- // layout that tells us if something has changed in the min max
- // calculations to do it correctly.
-// if ( oldWidth != width() || columns.size() + 1 != columnPos.size() )
- m_tableLayout->layout();
+ if (logicalWidth() != oldLogicalWidth) {
+ for (unsigned i = 0; i < m_captions.size(); i++)
+ m_captions[i]->setNeedsLayout(MarkOnlyThis);
+ }
+ // FIXME: The optimisation below doesn't work since the internal table
+ // layout could have changed. We need to add a flag to the table
+ // layout that tells us if something has changed in the min max
+ // calculations to do it correctly.
+ // if ( oldWidth != width() || columns.size() + 1 != columnPos.size() )
+ m_tableLayout->layout();
- LayoutUnit totalSectionLogicalHeight = 0;
- LayoutUnit oldTableLogicalTop = 0;
- for (unsigned i = 0; i < m_captions.size(); i++) {
- if (m_captions[i]->style().captionSide() == CAPBOTTOM)
- continue;
- oldTableLogicalTop += m_captions[i]->logicalHeight() + m_captions[i]->marginBefore() + m_captions[i]->marginAfter();
- }
+ LayoutUnit totalSectionLogicalHeight = 0;
+ LayoutUnit oldTableLogicalTop = 0;
+ for (unsigned i = 0; i < m_captions.size(); i++) {
+ if (m_captions[i]->style().captionSide() == CAPBOTTOM)
+ continue;
+ oldTableLogicalTop += m_captions[i]->logicalHeight() + m_captions[i]->marginBefore() + m_captions[i]->marginAfter();
+ }
- bool collapsing = collapseBorders();
+ bool collapsing = collapseBorders();
- for (auto& child : childrenOfType<RenderElement>(*this)) {
- if (is<RenderTableSection>(child)) {
- RenderTableSection& section = downcast<RenderTableSection>(child);
- if (m_columnLogicalWidthChanged)
- section.setChildNeedsLayout(MarkOnlyThis);
- section.layoutIfNeeded();
- totalSectionLogicalHeight += section.calcRowLogicalHeight();
- if (collapsing)
- section.recalcOuterBorder();
- ASSERT(!section.needsLayout());
- } else if (is<RenderTableCol>(child)) {
- downcast<RenderTableCol>(child).layoutIfNeeded();
- ASSERT(!child.needsLayout());
+ for (auto& child : childrenOfType<RenderElement>(*this)) {
+ if (is<RenderTableSection>(child)) {
+ RenderTableSection& section = downcast<RenderTableSection>(child);
+ if (m_columnLogicalWidthChanged)
+ section.setChildNeedsLayout(MarkOnlyThis);
+ section.layoutIfNeeded();
+ totalSectionLogicalHeight += section.calcRowLogicalHeight();
+ if (collapsing)
+ section.recalcOuterBorder();
+ ASSERT(!section.needsLayout());
+ } else if (is<RenderTableCol>(child)) {
+ downcast<RenderTableCol>(child).layoutIfNeeded();
+ ASSERT(!child.needsLayout());
+ }
}
- }
- // If any table section moved vertically, we will just repaint everything from that
- // section down (it is quite unlikely that any of the following sections
- // did not shift).
- bool sectionMoved = false;
- LayoutUnit movedSectionLogicalTop = 0;
+ // If any table section moved vertically, we will just repaint everything from that
+ // section down (it is quite unlikely that any of the following sections
+ // did not shift).
+ layoutCaptions();
+ if (!m_captions.isEmpty() && logicalHeight() != oldTableLogicalTop) {
+ sectionMoved = true;
+ movedSectionLogicalTop = std::min(logicalHeight(), oldTableLogicalTop);
+ }
- layoutCaptions();
- if (!m_captions.isEmpty() && logicalHeight() != oldTableLogicalTop) {
- sectionMoved = true;
- movedSectionLogicalTop = std::min(logicalHeight(), oldTableLogicalTop);
- }
+ LayoutUnit borderAndPaddingBefore = borderBefore() + (collapsing ? LayoutUnit() : paddingBefore());
+ LayoutUnit borderAndPaddingAfter = borderAfter() + (collapsing ? LayoutUnit() : paddingAfter());
- LayoutUnit borderAndPaddingBefore = borderBefore() + (collapsing ? LayoutUnit() : paddingBefore());
- LayoutUnit borderAndPaddingAfter = borderAfter() + (collapsing ? LayoutUnit() : paddingAfter());
+ setLogicalHeight(logicalHeight() + borderAndPaddingBefore);
- setLogicalHeight(logicalHeight() + borderAndPaddingBefore);
+ if (!isOutOfFlowPositioned())
+ updateLogicalHeight();
- if (!isOutOfFlowPositioned())
- updateLogicalHeight();
-
- LayoutUnit computedLogicalHeight = 0;
+ LayoutUnit computedLogicalHeight = 0;
- Length logicalHeightLength = style().logicalHeight();
- if (logicalHeightLength.isIntrinsic() || (logicalHeightLength.isSpecified() && logicalHeightLength.isPositive()))
- computedLogicalHeight = convertStyleLogicalHeightToComputedHeight(logicalHeightLength);
-
- Length logicalMaxHeightLength = style().logicalMaxHeight();
- if (logicalMaxHeightLength.isIntrinsic() || (logicalMaxHeightLength.isSpecified() && !logicalMaxHeightLength.isNegative())) {
- LayoutUnit computedMaxLogicalHeight = convertStyleLogicalHeightToComputedHeight(logicalMaxHeightLength);
- computedLogicalHeight = std::min(computedLogicalHeight, computedMaxLogicalHeight);
- }
+ Length logicalHeightLength = style().logicalHeight();
+ if (logicalHeightLength.isIntrinsic() || (logicalHeightLength.isSpecified() && logicalHeightLength.isPositive()))
+ computedLogicalHeight = convertStyleLogicalHeightToComputedHeight(logicalHeightLength);
- Length logicalMinHeightLength = style().logicalMinHeight();
- if (logicalMinHeightLength.isIntrinsic() || (logicalMinHeightLength.isSpecified() && !logicalMinHeightLength.isNegative())) {
- LayoutUnit computedMinLogicalHeight = convertStyleLogicalHeightToComputedHeight(logicalMinHeightLength);
- computedLogicalHeight = std::max(computedLogicalHeight, computedMinLogicalHeight);
- }
+ Length logicalMaxHeightLength = style().logicalMaxHeight();
+ if (logicalMaxHeightLength.isIntrinsic() || (logicalMaxHeightLength.isSpecified() && !logicalMaxHeightLength.isNegative())) {
+ LayoutUnit computedMaxLogicalHeight = convertStyleLogicalHeightToComputedHeight(logicalMaxHeightLength);
+ computedLogicalHeight = std::min(computedLogicalHeight, computedMaxLogicalHeight);
+ }
- distributeExtraLogicalHeight(computedLogicalHeight - totalSectionLogicalHeight);
+ Length logicalMinHeightLength = style().logicalMinHeight();
+ if (logicalMinHeightLength.isIntrinsic() || (logicalMinHeightLength.isSpecified() && !logicalMinHeightLength.isNegative())) {
+ LayoutUnit computedMinLogicalHeight = convertStyleLogicalHeightToComputedHeight(logicalMinHeightLength);
+ computedLogicalHeight = std::max(computedLogicalHeight, computedMinLogicalHeight);
+ }
- for (RenderTableSection* section = topSection(); section; section = sectionBelow(section))
- section->layoutRows();
+ distributeExtraLogicalHeight(computedLogicalHeight - totalSectionLogicalHeight);
- if (!topSection() && computedLogicalHeight > totalSectionLogicalHeight && !document().inQuirksMode()) {
- // Completely empty tables (with no sections or anything) should at least honor specified height
- // in strict mode.
- setLogicalHeight(logicalHeight() + computedLogicalHeight);
- }
+ for (RenderTableSection* section = topSection(); section; section = sectionBelow(section))
+ section->layoutRows();
- LayoutUnit sectionLogicalLeft = style().isLeftToRightDirection() ? borderStart() : borderEnd();
- if (!collapsing)
- sectionLogicalLeft += style().isLeftToRightDirection() ? paddingStart() : paddingEnd();
-
- // position the table sections
- RenderTableSection* section = topSection();
- while (section) {
- if (!sectionMoved && section->logicalTop() != logicalHeight()) {
- sectionMoved = true;
- movedSectionLogicalTop = std::min(logicalHeight(), section->logicalTop()) + (style().isHorizontalWritingMode() ? section->visualOverflowRect().y() : section->visualOverflowRect().x());
+ if (!topSection() && computedLogicalHeight > totalSectionLogicalHeight && !document().inQuirksMode()) {
+ // Completely empty tables (with no sections or anything) should at least honor specified height
+ // in strict mode.
+ setLogicalHeight(logicalHeight() + computedLogicalHeight);
}
- section->setLogicalLocation(LayoutPoint(sectionLogicalLeft, logicalHeight()));
- setLogicalHeight(logicalHeight() + section->logicalHeight());
- section = sectionBelow(section);
- }
+ LayoutUnit sectionLogicalLeft = style().isLeftToRightDirection() ? borderStart() : borderEnd();
+ if (!collapsing)
+ sectionLogicalLeft += style().isLeftToRightDirection() ? paddingStart() : paddingEnd();
- setLogicalHeight(logicalHeight() + borderAndPaddingAfter);
+ // position the table sections
+ RenderTableSection* section = topSection();
+ while (section) {
+ if (!sectionMoved && section->logicalTop() != logicalHeight()) {
+ sectionMoved = true;
+ movedSectionLogicalTop = std::min(logicalHeight(), section->logicalTop()) + (style().isHorizontalWritingMode() ? section->visualOverflowRect().y() : section->visualOverflowRect().x());
+ }
+ section->setLogicalLocation(LayoutPoint(sectionLogicalLeft, logicalHeight()));
- layoutCaptions(BottomCaptionLayoutPhase::Yes);
+ setLogicalHeight(logicalHeight() + section->logicalHeight());
+ section = sectionBelow(section);
+ }
- if (isOutOfFlowPositioned())
- updateLogicalHeight();
+ setLogicalHeight(logicalHeight() + borderAndPaddingAfter);
- // table can be containing block of positioned elements.
- bool dimensionChanged = oldLogicalWidth != logicalWidth() || oldLogicalHeight != logicalHeight();
- layoutPositionedObjects(dimensionChanged);
+ layoutCaptions(BottomCaptionLayoutPhase::Yes);
- updateLayerTransform();
+ if (isOutOfFlowPositioned())
+ updateLogicalHeight();
- // Layout was changed, so probably borders too.
- invalidateCollapsedBorders();
+ // table can be containing block of positioned elements.
+ bool dimensionChanged = oldLogicalWidth != logicalWidth() || oldLogicalHeight != logicalHeight();
+ layoutPositionedObjects(dimensionChanged);
- // The location or height of one or more sections may have changed.
- invalidateCachedColumnOffsets();
+ updateLayerTransform();
- computeOverflow(clientLogicalBottom());
+ // Layout was changed, so probably borders too.
+ invalidateCollapsedBorders();
- statePusher.pop();
+ // The location or height of one or more sections may have changed.
+ invalidateCachedColumnOffsets();
+ computeOverflow(clientLogicalBottom());
+ }
+
auto* layoutState = view().frameView().layoutContext().layoutState();
if (layoutState->pageLogicalHeight())
setPageLogicalOffset(layoutState->pageLogicalOffset(this, logicalTop()));
Modified: trunk/Source/WebCore/rendering/RenderTableRow.cpp (224545 => 224546)
--- trunk/Source/WebCore/rendering/RenderTableRow.cpp 2017-11-07 21:19:33 UTC (rev 224545)
+++ trunk/Source/WebCore/rendering/RenderTableRow.cpp 2017-11-07 21:36:07 UTC (rev 224546)
@@ -207,7 +207,6 @@
cell->repaint();
}
- statePusher.pop();
// RenderTableSection::layoutRows will set our logical height and width later, so it calls updateLayerTransform().
clearNeedsLayout();
}
Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (224545 => 224546)
--- trunk/Source/WebCore/rendering/RenderTableSection.cpp 2017-11-07 21:19:33 UTC (rev 224545)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp 2017-11-07 21:36:07 UTC (rev 224546)
@@ -372,8 +372,6 @@
ASSERT(!needsLayout());
- statePusher.pop();
-
return m_rowPos[m_grid.size()];
}
@@ -423,8 +421,6 @@
rowRenderer->layoutIfNeeded();
}
}
-
- statePusher.pop();
clearNeedsLayout();
}
@@ -683,8 +679,6 @@
setLogicalHeight(m_rowPos[totalRows]);
computeOverflowFromCells(totalRows, nEffCols);
-
- statePusher.pop();
}
void RenderTableSection::computeOverflowFromCells()
Modified: trunk/Source/WebCore/rendering/RenderVTTCue.cpp (224545 => 224546)
--- trunk/Source/WebCore/rendering/RenderVTTCue.cpp 2017-11-07 21:19:33 UTC (rev 224545)
+++ trunk/Source/WebCore/rendering/RenderVTTCue.cpp 2017-11-07 21:36:07 UTC (rev 224546)
@@ -68,8 +68,6 @@
repositionCueSnapToLinesNotSet();
} else
repositionGenericCue();
-
- statePusher.pop();
}
bool RenderVTTCue::initializeLayoutParameters(InlineFlowBox*& firstLineBox, LayoutUnit& step, LayoutUnit& position)
Modified: trunk/Source/WebCore/rendering/RenderView.cpp (224545 => 224546)
--- trunk/Source/WebCore/rendering/RenderView.cpp 2017-11-07 21:19:33 UTC (rev 224545)
+++ trunk/Source/WebCore/rendering/RenderView.cpp 2017-11-07 21:36:07 UTC (rev 224546)
@@ -239,7 +239,6 @@
#ifndef NDEBUG
frameView().layoutContext().checkLayoutState();
#endif
- statePusher.pop();
clearNeedsLayout();
}