Changeset 224546 in webkit
- Timestamp:
- Nov 7, 2017 1:36:07 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r224544 r224546 1 2017-11-07 Zalan Bujtas <zalan@apple.com> 2 3 [LayoutState cleanup] Remove explicit LayoutStateMaintainer::pop calls. 4 https://bugs.webkit.org/show_bug.cgi?id=179380 5 <rdar://problem/35392161> 6 7 Reviewed by Antti Koivisto. 8 9 Besides the pagination related explicit pops (FIXME), all LayoutStateMaintainer pops are 10 now in LayoutStateMaintainer's d'tor. 11 12 Covered by existing tests. 13 14 * rendering/LayoutState.cpp: 15 (WebCore::LayoutStateMaintainer::~LayoutStateMaintainer): 16 * rendering/RenderBlock.cpp: 17 (WebCore::RenderBlock::simplifiedLayout): 18 * rendering/RenderBlockFlow.cpp: 19 (WebCore::RenderBlockFlow::layoutBlock): 20 * rendering/RenderBox.cpp: 21 (WebCore::RenderBox::layout): 22 * rendering/RenderDeprecatedFlexibleBox.cpp: 23 (WebCore::RenderDeprecatedFlexibleBox::layoutBlock): 24 * rendering/RenderEmbeddedObject.cpp: 25 (WebCore::RenderEmbeddedObject::layout): 26 * rendering/RenderFlexibleBox.cpp: 27 (WebCore::RenderFlexibleBox::layoutBlock): 28 * rendering/RenderGrid.cpp: 29 (WebCore::RenderGrid::layoutBlock): 30 * rendering/RenderImage.cpp: 31 (WebCore::RenderImage::layoutShadowControls): 32 * rendering/RenderTable.cpp: 33 (WebCore::RenderTable::layout): 34 * rendering/RenderTableRow.cpp: 35 (WebCore::RenderTableRow::layout): 36 * rendering/RenderTableSection.cpp: 37 (WebCore::RenderTableSection::calcRowLogicalHeight): 38 (WebCore::RenderTableSection::layout): 39 (WebCore::RenderTableSection::layoutRows): 40 * rendering/RenderVTTCue.cpp: 41 (WebCore::RenderVTTCue::layout): 42 * rendering/RenderView.cpp: 43 (WebCore::RenderView::layout): 44 1 45 2017-11-07 Commit Queue <commit-queue@webkit.org> 2 46 -
trunk/Source/WebCore/rendering/LayoutState.cpp
r224529 r224546 233 233 LayoutStateMaintainer::~LayoutStateMaintainer() 234 234 { 235 // FIXME: Remove conditional push/pop. 236 if (m_didCallPush && !m_didCallPop) 237 pop(); 235 238 ASSERT(!m_didCallPush || m_didCallPush == m_didCallPop); 236 239 } -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r224537 r224546 1322 1322 1323 1323 LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode()); 1324 if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovementOnly()) { 1325 statePusher.pop(); 1324 if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovementOnly()) 1326 1325 return false; 1327 }1328 1326 1329 1327 // Lay out positioned descendants or objects that just need to recompute overflow. … … 1355 1353 computeOverflow(oldClientAfterEdge, true); 1356 1354 1357 statePusher.pop();1358 1359 1355 updateLayerTransform(); 1360 1356 -
trunk/Source/WebCore/rendering/RenderBlockFlow.cpp
r224537 r224546 476 476 checkForPaginationLogicalHeightChange(relayoutChildren, pageLogicalHeight, pageLogicalHeightChanged); 477 477 478 const RenderStyle& styleToUse = style();479 LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || styleToUse.isFlippedBlocksWritingMode(), pageLogicalHeight, pageLogicalHeightChanged);480 481 preparePaginationBeforeBlockLayout(relayoutChildren);482 483 // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg, to track484 // our current maximal positive and negative margins. These values are used when we485 // are collapsed with adjacent blocks, so for example, if you have block A and B486 // collapsing together, then you'd take the maximal positive margin from both A and B487 // and subtract it from the maximal negative margin from both A and B to get the488 // true collapsed margin. This algorithm is recursive, so when we finish layout()489 // our block knows its current maximal positive/negative values.490 //491 // Start out by setting our margin values to our current margins. Table cells have492 // no margins, so we don't fill in the values for table cells.493 bool isCell = isTableCell();494 if (!isCell) {495 initMaxMarginValues();496 497 setHasMarginBeforeQuirk(styleToUse.hasMarginBeforeQuirk());498 setHasMarginAfterQuirk(styleToUse.hasMarginAfterQuirk());499 setPaginationStrut(0);500 }501 502 478 LayoutUnit repaintLogicalTop = 0; 503 479 LayoutUnit repaintLogicalBottom = 0; 504 LayoutUnit maxFloatLogicalBottom = 0; 505 if (!firstChild() && !isAnonymousBlock()) 506 setChildrenInline(true); 507 if (childrenInline()) 508 layoutInlineChildren(relayoutChildren, repaintLogicalTop, repaintLogicalBottom); 509 else 510 layoutBlockChildren(relayoutChildren, maxFloatLogicalBottom); 511 512 // Expand our intrinsic height to encompass floats. 513 LayoutUnit toAdd = borderAndPaddingAfter() + scrollbarLogicalHeight(); 514 if (lowestFloatLogicalBottom() > (logicalHeight() - toAdd) && createsNewFormattingContext()) 515 setLogicalHeight(lowestFloatLogicalBottom() + toAdd); 516 517 if (relayoutForPagination(statePusher) || relayoutToAvoidWidows(statePusher)) { 518 ASSERT(!shouldBreakAtLineToAvoidWidow()); 519 return; 520 } 521 522 // Calculate our new height. 523 LayoutUnit oldHeight = logicalHeight(); 524 LayoutUnit oldClientAfterEdge = clientLogicalBottom(); 525 526 // Before updating the final size of the flow thread make sure a forced break is applied after the content. 527 // This ensures the size information is correctly computed for the last auto-height fragment receiving content. 528 if (is<RenderFragmentedFlow>(*this)) 529 downcast<RenderFragmentedFlow>(*this).applyBreakAfterContent(oldClientAfterEdge); 530 531 updateLogicalHeight(); 532 LayoutUnit newHeight = logicalHeight(); 533 if (oldHeight != newHeight) { 534 if (oldHeight > newHeight && maxFloatLogicalBottom > newHeight && !childrenInline()) { 535 // One of our children's floats may have become an overhanging float for us. We need to look for it. 536 for (auto& blockFlow : childrenOfType<RenderBlockFlow>(*this)) { 537 if (blockFlow.isFloatingOrOutOfFlowPositioned()) 538 continue; 539 if (blockFlow.lowestFloatLogicalBottom() + blockFlow.logicalTop() > newHeight) 540 addOverhangingFloats(blockFlow, false); 480 const RenderStyle& styleToUse = style(); 481 { 482 LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || styleToUse.isFlippedBlocksWritingMode(), pageLogicalHeight, pageLogicalHeightChanged); 483 484 preparePaginationBeforeBlockLayout(relayoutChildren); 485 486 // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg, to track 487 // our current maximal positive and negative margins. These values are used when we 488 // are collapsed with adjacent blocks, so for example, if you have block A and B 489 // collapsing together, then you'd take the maximal positive margin from both A and B 490 // and subtract it from the maximal negative margin from both A and B to get the 491 // true collapsed margin. This algorithm is recursive, so when we finish layout() 492 // our block knows its current maximal positive/negative values. 493 // 494 // Start out by setting our margin values to our current margins. Table cells have 495 // no margins, so we don't fill in the values for table cells. 496 bool isCell = isTableCell(); 497 if (!isCell) { 498 initMaxMarginValues(); 499 500 setHasMarginBeforeQuirk(styleToUse.hasMarginBeforeQuirk()); 501 setHasMarginAfterQuirk(styleToUse.hasMarginAfterQuirk()); 502 setPaginationStrut(0); 503 } 504 505 LayoutUnit maxFloatLogicalBottom = 0; 506 if (!firstChild() && !isAnonymousBlock()) 507 setChildrenInline(true); 508 if (childrenInline()) 509 layoutInlineChildren(relayoutChildren, repaintLogicalTop, repaintLogicalBottom); 510 else 511 layoutBlockChildren(relayoutChildren, maxFloatLogicalBottom); 512 513 // Expand our intrinsic height to encompass floats. 514 LayoutUnit toAdd = borderAndPaddingAfter() + scrollbarLogicalHeight(); 515 if (lowestFloatLogicalBottom() > (logicalHeight() - toAdd) && createsNewFormattingContext()) 516 setLogicalHeight(lowestFloatLogicalBottom() + toAdd); 517 518 if (relayoutForPagination(statePusher) || relayoutToAvoidWidows(statePusher)) { 519 ASSERT(!shouldBreakAtLineToAvoidWidow()); 520 return; 521 } 522 523 // Calculate our new height. 524 LayoutUnit oldHeight = logicalHeight(); 525 LayoutUnit oldClientAfterEdge = clientLogicalBottom(); 526 527 // Before updating the final size of the flow thread make sure a forced break is applied after the content. 528 // This ensures the size information is correctly computed for the last auto-height fragment receiving content. 529 if (is<RenderFragmentedFlow>(*this)) 530 downcast<RenderFragmentedFlow>(*this).applyBreakAfterContent(oldClientAfterEdge); 531 532 updateLogicalHeight(); 533 LayoutUnit newHeight = logicalHeight(); 534 if (oldHeight != newHeight) { 535 if (oldHeight > newHeight && maxFloatLogicalBottom > newHeight && !childrenInline()) { 536 // One of our children's floats may have become an overhanging float for us. We need to look for it. 537 for (auto& blockFlow : childrenOfType<RenderBlockFlow>(*this)) { 538 if (blockFlow.isFloatingOrOutOfFlowPositioned()) 539 continue; 540 if (blockFlow.lowestFloatLogicalBottom() + blockFlow.logicalTop() > newHeight) 541 addOverhangingFloats(blockFlow, false); 542 } 541 543 } 542 544 } 543 } 544 545 bool heightChanged = (previousHeight != newHeight); 546 if (heightChanged) 547 relayoutChildren = true; 548 549 layoutPositionedObjects(relayoutChildren || isDocumentElementRenderer()); 550 551 // Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway). 552 computeOverflow(oldClientAfterEdge); 553 554 statePusher.pop(); 555 556 fitBorderToLinesIfNeeded(); 557 558 if (view().frameView().layoutContext().layoutState()->m_pageLogicalHeight) 559 setPageLogicalOffset(view().frameView().layoutContext().layoutState()->pageLogicalOffset(this, logicalTop())); 545 546 bool heightChanged = (previousHeight != newHeight); 547 if (heightChanged) 548 relayoutChildren = true; 549 550 layoutPositionedObjects(relayoutChildren || isDocumentElementRenderer()); 551 552 // Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway). 553 computeOverflow(oldClientAfterEdge); 554 555 fitBorderToLinesIfNeeded(); 556 } 557 558 auto* state = view().frameView().layoutContext().layoutState(); 559 if (state && state->m_pageLogicalHeight) 560 setPageLogicalOffset(state->pageLogicalOffset(this, logicalTop())); 560 561 561 562 updateLayerTransform(); -
trunk/Source/WebCore/rendering/RenderBox.cpp
r224537 r224546 519 519 child = child->nextSibling(); 520 520 } 521 statePusher.pop();522 521 invalidateBackgroundObscurationStatus(); 523 522 clearNeedsLayout(); -
trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
r224537 r224546 282 282 283 283 LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); 284 LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode()); 285 286 preparePaginationBeforeBlockLayout(relayoutChildren); 287 288 LayoutSize previousSize = size(); 289 290 updateLogicalWidth(); 291 updateLogicalHeight(); 292 293 if (previousSize != size() 294 || (parent()->isDeprecatedFlexibleBox() && parent()->style().boxOrient() == HORIZONTAL 295 && parent()->style().boxAlign() == BSTRETCH)) 296 relayoutChildren = true; 297 298 setHeight(0); 299 300 m_stretchingChildren = false; 284 { 285 LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode()); 286 287 preparePaginationBeforeBlockLayout(relayoutChildren); 288 289 LayoutSize previousSize = size(); 290 291 updateLogicalWidth(); 292 updateLogicalHeight(); 293 294 if (previousSize != size() 295 || (parent()->isDeprecatedFlexibleBox() && parent()->style().boxOrient() == HORIZONTAL 296 && parent()->style().boxAlign() == BSTRETCH)) 297 relayoutChildren = true; 298 299 setHeight(0); 300 301 m_stretchingChildren = false; 301 302 302 303 #if !ASSERT_DISABLED 303 LayoutSize oldLayoutDelta = view().frameView().layoutContext().layoutDelta();304 LayoutSize oldLayoutDelta = view().frameView().layoutContext().layoutDelta(); 304 305 #endif 305 306 306 // Fieldsets need to find their legend and position it inside the border of the object. 307 // The legend then gets skipped during normal layout. The same is true for ruby text. 308 // It doesn't get included in the normal layout process but is instead skipped. 309 layoutExcludedChildren(relayoutChildren); 310 311 ChildFrameRects oldChildRects; 312 appendChildFrameRects(this, oldChildRects); 313 314 if (isHorizontal()) 315 layoutHorizontalBox(relayoutChildren); 316 else 317 layoutVerticalBox(relayoutChildren); 318 319 repaintChildrenDuringLayoutIfMoved(this, oldChildRects); 320 ASSERT(view().frameView().layoutContext().layoutDeltaMatches(oldLayoutDelta)); 321 322 LayoutUnit oldClientAfterEdge = clientLogicalBottom(); 323 updateLogicalHeight(); 324 325 if (previousSize.height() != height()) 326 relayoutChildren = true; 327 328 layoutPositionedObjects(relayoutChildren || isDocumentElementRenderer()); 329 330 computeOverflow(oldClientAfterEdge); 331 332 statePusher.pop(); 307 // Fieldsets need to find their legend and position it inside the border of the object. 308 // The legend then gets skipped during normal layout. The same is true for ruby text. 309 // It doesn't get included in the normal layout process but is instead skipped. 310 layoutExcludedChildren(relayoutChildren); 311 312 ChildFrameRects oldChildRects; 313 appendChildFrameRects(this, oldChildRects); 314 315 if (isHorizontal()) 316 layoutHorizontalBox(relayoutChildren); 317 else 318 layoutVerticalBox(relayoutChildren); 319 320 repaintChildrenDuringLayoutIfMoved(this, oldChildRects); 321 ASSERT(view().frameView().layoutContext().layoutDeltaMatches(oldLayoutDelta)); 322 323 LayoutUnit oldClientAfterEdge = clientLogicalBottom(); 324 updateLogicalHeight(); 325 326 if (previousSize.height() != height()) 327 relayoutChildren = true; 328 329 layoutPositionedObjects(relayoutChildren || isDocumentElementRenderer()); 330 331 computeOverflow(oldClientAfterEdge); 332 } 333 333 334 334 updateLayerTransform(); 335 335 336 if (view().frameView().layoutContext().layoutState()->pageLogicalHeight()) 337 setPageLogicalOffset(view().frameView().layoutContext().layoutState()->pageLogicalOffset(this, logicalTop())); 336 auto* layoutState = view().frameView().layoutContext().layoutState(); 337 if (layoutState && layoutState->pageLogicalHeight()) 338 setPageLogicalOffset(layoutState->pageLogicalOffset(this, logicalTop())); 338 339 339 340 // Update our scrollbars if we're overflow:auto/scroll/hidden now that we know if -
trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp
r224537 r224546 465 465 childBox.layout(); 466 466 clearChildNeedsLayout(); 467 468 statePusher.pop();469 467 } 470 468 -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r224537 r224546 276 276 LayoutUnit previousHeight = logicalHeight(); 277 277 setLogicalHeight(borderAndPaddingLogicalHeight() + scrollbarLogicalHeight()); 278 279 LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode()); 280 281 preparePaginationBeforeBlockLayout(relayoutChildren); 282 283 m_numberOfInFlowChildrenOnFirstLine = -1; 284 285 beginUpdateScrollInfoAfterLayoutTransaction(); 286 287 prepareOrderIteratorAndMargins(); 288 289 // Fieldsets need to find their legend and position it inside the border of the object. 290 // The legend then gets skipped during normal layout. The same is true for ruby text. 291 // It doesn't get included in the normal layout process but is instead skipped. 292 layoutExcludedChildren(relayoutChildren); 293 294 ChildFrameRects oldChildRects; 295 appendChildFrameRects(oldChildRects); 296 297 layoutFlexItems(relayoutChildren); 298 299 endAndCommitUpdateScrollInfoAfterLayoutTransaction(); 300 301 if (logicalHeight() != previousHeight) 302 relayoutChildren = true; 303 304 layoutPositionedObjects(relayoutChildren || isDocumentElementRenderer()); 305 306 repaintChildrenDuringLayoutIfMoved(oldChildRects); 307 // FIXME: css3/flexbox/repaint-rtl-column.html seems to repaint more overflow than it needs to. 308 computeOverflow(clientLogicalBottomAfterRepositioning()); 309 statePusher.pop(); 310 278 { 279 LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode()); 280 281 preparePaginationBeforeBlockLayout(relayoutChildren); 282 283 m_numberOfInFlowChildrenOnFirstLine = -1; 284 285 beginUpdateScrollInfoAfterLayoutTransaction(); 286 287 prepareOrderIteratorAndMargins(); 288 289 // Fieldsets need to find their legend and position it inside the border of the object. 290 // The legend then gets skipped during normal layout. The same is true for ruby text. 291 // It doesn't get included in the normal layout process but is instead skipped. 292 layoutExcludedChildren(relayoutChildren); 293 294 ChildFrameRects oldChildRects; 295 appendChildFrameRects(oldChildRects); 296 297 layoutFlexItems(relayoutChildren); 298 299 endAndCommitUpdateScrollInfoAfterLayoutTransaction(); 300 301 if (logicalHeight() != previousHeight) 302 relayoutChildren = true; 303 304 layoutPositionedObjects(relayoutChildren || isDocumentElementRenderer()); 305 306 repaintChildrenDuringLayoutIfMoved(oldChildRects); 307 // FIXME: css3/flexbox/repaint-rtl-column.html seems to repaint more overflow than it needs to. 308 computeOverflow(clientLogicalBottomAfterRepositioning()); 309 } 311 310 updateLayerTransform(); 312 311 313 312 // We have to reset this, because changes to our ancestors' style can affect 314 313 // this value. Also, this needs to be before we call updateAfterLayout, as … … 316 315 m_hasDefiniteHeight = SizeDefiniteness::Unknown; 317 316 318 // Update our scroll information if we're overflow:auto/scroll/hidden now that we know if 319 // we overflow or not. 317 // Update our scroll information if we're overflow:auto/scroll/hidden now that we know if we overflow or not. 320 318 updateScrollInfoAfterLayout(); 321 319 -
trunk/Source/WebCore/rendering/RenderGrid.cpp
r224537 r224546 234 234 235 235 LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); 236 LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode()); 237 238 preparePaginationBeforeBlockLayout(relayoutChildren); 239 240 LayoutSize previousSize = size(); 241 // FIXME: We should use RenderBlock::hasDefiniteLogicalHeight() but it does not work for positioned stuff. 242 // FIXME: Consider caching the hasDefiniteLogicalHeight value throughout the layout. 243 bool hasDefiniteLogicalHeight = hasOverrideLogicalContentHeight() || computeContentLogicalHeight(MainOrPreferredSize, style().logicalHeight(), std::nullopt); 244 245 // We need to clear both own and containingBlock override sizes of orthogonal items to ensure we get the 246 // same result when grid's intrinsic size is computed again in the updateLogicalWidth call bellow. 247 if (sizesLogicalWidthToFitContent(MaxSize) || style().logicalWidth().isIntrinsicOrAuto()) { 248 for (auto* child = firstChildBox(); child; child = child->nextSiblingBox()) { 249 if (child->isOutOfFlowPositioned() || !isOrthogonalChild(*child)) 250 continue; 251 child->clearOverrideSize(); 252 child->clearContainingBlockOverrideSize(); 253 child->setNeedsLayout(); 254 child->layoutIfNeeded(); 255 } 256 } 257 258 setLogicalHeight(0); 259 updateLogicalWidth(); 260 261 // Fieldsets need to find their legend and position it inside the border of the object. 262 // The legend then gets skipped during normal layout. The same is true for ruby text. 263 // It doesn't get included in the normal layout process but is instead skipped. 264 layoutExcludedChildren(relayoutChildren); 265 266 LayoutUnit availableSpaceForColumns = availableLogicalWidth(); 267 placeItemsOnGrid(m_grid, availableSpaceForColumns); 268 269 // At this point the logical width is always definite as the above call to updateLogicalWidth() 270 // properly resolves intrinsic sizes. We cannot do the same for heights though because many code 271 // paths inside updateLogicalHeight() require a previous call to setLogicalHeight() to resolve 272 // heights properly (like for positioned items for example). 273 computeTrackSizesForDefiniteSize(ForColumns, availableSpaceForColumns); 274 275 if (!hasDefiniteLogicalHeight) { 276 m_minContentHeight = LayoutUnit(); 277 m_maxContentHeight = LayoutUnit(); 278 computeTrackSizesForIndefiniteSize(m_trackSizingAlgorithm, ForRows, m_grid, *m_minContentHeight, *m_maxContentHeight); 279 // FIXME: This should be really added to the intrinsic height in RenderBox::computeContentAndScrollbarLogicalHeightUsing(). 280 // Remove this when that is fixed. 281 ASSERT(m_minContentHeight); 282 ASSERT(m_maxContentHeight); 283 LayoutUnit scrollbarHeight = scrollbarLogicalHeight(); 284 *m_minContentHeight += scrollbarHeight; 285 *m_maxContentHeight += scrollbarHeight; 286 } else 287 computeTrackSizesForDefiniteSize(ForRows, availableLogicalHeight(ExcludeMarginBorderPadding)); 288 LayoutUnit trackBasedLogicalHeight = computeTrackBasedLogicalHeight() + borderAndPaddingLogicalHeight() + scrollbarLogicalHeight(); 289 setLogicalHeight(trackBasedLogicalHeight); 290 291 LayoutUnit oldClientAfterEdge = clientLogicalBottom(); 292 updateLogicalHeight(); 293 294 // Once grid's indefinite height is resolved, we can compute the 295 // available free space for Content Alignment. 296 if (!hasDefiniteLogicalHeight) 297 m_trackSizingAlgorithm.setFreeSpace(ForRows, logicalHeight() - trackBasedLogicalHeight); 298 299 // 3- If the min-content contribution of any grid items have changed based on the row 300 // sizes calculated in step 2, steps 1 and 2 are repeated with the new min-content 301 // contribution (once only). 302 repeatTracksSizingIfNeeded(availableSpaceForColumns, contentLogicalHeight()); 303 304 // Grid container should have the minimum height of a line if it's editable. That does not affect track sizing though. 305 if (hasLineIfEmpty()) { 306 LayoutUnit minHeightForEmptyLine = borderAndPaddingLogicalHeight() 307 + lineHeight(true, isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes) 308 + scrollbarLogicalHeight(); 309 setLogicalHeight(std::max(logicalHeight(), minHeightForEmptyLine)); 310 } 311 312 layoutGridItems(); 313 m_trackSizingAlgorithm.reset(); 314 315 if (size() != previousSize) 316 relayoutChildren = true; 317 318 layoutPositionedObjects(relayoutChildren || isDocumentElementRenderer()); 319 320 computeOverflow(oldClientAfterEdge); 321 statePusher.pop(); 236 { 237 LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode()); 238 239 preparePaginationBeforeBlockLayout(relayoutChildren); 240 241 LayoutSize previousSize = size(); 242 // FIXME: We should use RenderBlock::hasDefiniteLogicalHeight() but it does not work for positioned stuff. 243 // FIXME: Consider caching the hasDefiniteLogicalHeight value throughout the layout. 244 bool hasDefiniteLogicalHeight = hasOverrideLogicalContentHeight() || computeContentLogicalHeight(MainOrPreferredSize, style().logicalHeight(), std::nullopt); 245 246 // We need to clear both own and containingBlock override sizes of orthogonal items to ensure we get the 247 // same result when grid's intrinsic size is computed again in the updateLogicalWidth call bellow. 248 if (sizesLogicalWidthToFitContent(MaxSize) || style().logicalWidth().isIntrinsicOrAuto()) { 249 for (auto* child = firstChildBox(); child; child = child->nextSiblingBox()) { 250 if (child->isOutOfFlowPositioned() || !isOrthogonalChild(*child)) 251 continue; 252 child->clearOverrideSize(); 253 child->clearContainingBlockOverrideSize(); 254 child->setNeedsLayout(); 255 child->layoutIfNeeded(); 256 } 257 } 258 259 setLogicalHeight(0); 260 updateLogicalWidth(); 261 262 // Fieldsets need to find their legend and position it inside the border of the object. 263 // The legend then gets skipped during normal layout. The same is true for ruby text. 264 // It doesn't get included in the normal layout process but is instead skipped. 265 layoutExcludedChildren(relayoutChildren); 266 267 LayoutUnit availableSpaceForColumns = availableLogicalWidth(); 268 placeItemsOnGrid(m_grid, availableSpaceForColumns); 269 270 // At this point the logical width is always definite as the above call to updateLogicalWidth() 271 // properly resolves intrinsic sizes. We cannot do the same for heights though because many code 272 // paths inside updateLogicalHeight() require a previous call to setLogicalHeight() to resolve 273 // heights properly (like for positioned items for example). 274 computeTrackSizesForDefiniteSize(ForColumns, availableSpaceForColumns); 275 276 if (!hasDefiniteLogicalHeight) { 277 m_minContentHeight = LayoutUnit(); 278 m_maxContentHeight = LayoutUnit(); 279 computeTrackSizesForIndefiniteSize(m_trackSizingAlgorithm, ForRows, m_grid, *m_minContentHeight, *m_maxContentHeight); 280 // FIXME: This should be really added to the intrinsic height in RenderBox::computeContentAndScrollbarLogicalHeightUsing(). 281 // Remove this when that is fixed. 282 ASSERT(m_minContentHeight); 283 ASSERT(m_maxContentHeight); 284 LayoutUnit scrollbarHeight = scrollbarLogicalHeight(); 285 *m_minContentHeight += scrollbarHeight; 286 *m_maxContentHeight += scrollbarHeight; 287 } else 288 computeTrackSizesForDefiniteSize(ForRows, availableLogicalHeight(ExcludeMarginBorderPadding)); 289 LayoutUnit trackBasedLogicalHeight = computeTrackBasedLogicalHeight() + borderAndPaddingLogicalHeight() + scrollbarLogicalHeight(); 290 setLogicalHeight(trackBasedLogicalHeight); 291 292 LayoutUnit oldClientAfterEdge = clientLogicalBottom(); 293 updateLogicalHeight(); 294 295 // Once grid's indefinite height is resolved, we can compute the 296 // available free space for Content Alignment. 297 if (!hasDefiniteLogicalHeight) 298 m_trackSizingAlgorithm.setFreeSpace(ForRows, logicalHeight() - trackBasedLogicalHeight); 299 300 // 3- If the min-content contribution of any grid items have changed based on the row 301 // sizes calculated in step 2, steps 1 and 2 are repeated with the new min-content 302 // contribution (once only). 303 repeatTracksSizingIfNeeded(availableSpaceForColumns, contentLogicalHeight()); 304 305 // Grid container should have the minimum height of a line if it's editable. That does not affect track sizing though. 306 if (hasLineIfEmpty()) { 307 LayoutUnit minHeightForEmptyLine = borderAndPaddingLogicalHeight() 308 + lineHeight(true, isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes) 309 + scrollbarLogicalHeight(); 310 setLogicalHeight(std::max(logicalHeight(), minHeightForEmptyLine)); 311 } 312 313 layoutGridItems(); 314 m_trackSizingAlgorithm.reset(); 315 316 if (size() != previousSize) 317 relayoutChildren = true; 318 319 layoutPositionedObjects(relayoutChildren || isDocumentElementRenderer()); 320 321 computeOverflow(oldClientAfterEdge); 322 } 322 323 323 324 updateLayerTransform(); -
trunk/Source/WebCore/rendering/RenderImage.cpp
r224537 r224546 747 747 controlsRenderer->layout(); 748 748 clearChildNeedsLayout(); 749 750 statePusher.pop();751 749 } 752 750 -
trunk/Source/WebCore/rendering/RenderTable.cpp
r224537 r224546 450 450 // to call this before we call borderStart/borderEnd to avoid getting a stale value. 451 451 recalcBordersInRowDirection(); 452 453 LayoutRepainter repainter(*this, checkForRepaintDuringLayout());454 LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode());455 456 LayoutUnit oldLogicalWidth = logicalWidth();457 LayoutUnit oldLogicalHeight = logicalHeight();458 setLogicalHeight(0);459 updateLogicalWidth();460 461 if (logicalWidth() != oldLogicalWidth) {462 for (unsigned i = 0; i < m_captions.size(); i++)463 m_captions[i]->setNeedsLayout(MarkOnlyThis);464 }465 // FIXME: The optimisation below doesn't work since the internal table466 // layout could have changed. we need to add a flag to the table467 // layout that tells us if something has changed in the min max468 // calculations to do it correctly.469 // if ( oldWidth != width() || columns.size() + 1 != columnPos.size() )470 m_tableLayout->layout();471 472 LayoutUnit totalSectionLogicalHeight = 0;473 LayoutUnit oldTableLogicalTop = 0;474 for (unsigned i = 0; i < m_captions.size(); i++) {475 if (m_captions[i]->style().captionSide() == CAPBOTTOM)476 continue;477 oldTableLogicalTop += m_captions[i]->logicalHeight() + m_captions[i]->marginBefore() + m_captions[i]->marginAfter();478 }479 480 bool collapsing = collapseBorders();481 482 for (auto& child : childrenOfType<RenderElement>(*this)) {483 if (is<RenderTableSection>(child)) {484 RenderTableSection& section = downcast<RenderTableSection>(child);485 if (m_columnLogicalWidthChanged)486 section.setChildNeedsLayout(MarkOnlyThis);487 section.layoutIfNeeded();488 totalSectionLogicalHeight += section.calcRowLogicalHeight();489 if (collapsing)490 section.recalcOuterBorder();491 ASSERT(!section.needsLayout());492 } else if (is<RenderTableCol>(child)) {493 downcast<RenderTableCol>(child).layoutIfNeeded();494 ASSERT(!child.needsLayout());495 }496 }497 498 // If any table section moved vertically, we will just repaint everything from that499 // section down (it is quite unlikely that any of the following sections500 // did not shift).501 452 bool sectionMoved = false; 502 453 LayoutUnit movedSectionLogicalTop = 0; 503 454 504 layoutCaptions(); 505 if (!m_captions.isEmpty() && logicalHeight() != oldTableLogicalTop) { 506 sectionMoved = true; 507 movedSectionLogicalTop = std::min(logicalHeight(), oldTableLogicalTop); 508 } 509 510 LayoutUnit borderAndPaddingBefore = borderBefore() + (collapsing ? LayoutUnit() : paddingBefore()); 511 LayoutUnit borderAndPaddingAfter = borderAfter() + (collapsing ? LayoutUnit() : paddingAfter()); 512 513 setLogicalHeight(logicalHeight() + borderAndPaddingBefore); 514 515 if (!isOutOfFlowPositioned()) 516 updateLogicalHeight(); 517 518 LayoutUnit computedLogicalHeight = 0; 455 LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); 456 { 457 LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode()); 458 459 LayoutUnit oldLogicalWidth = logicalWidth(); 460 LayoutUnit oldLogicalHeight = logicalHeight(); 461 setLogicalHeight(0); 462 updateLogicalWidth(); 463 464 if (logicalWidth() != oldLogicalWidth) { 465 for (unsigned i = 0; i < m_captions.size(); i++) 466 m_captions[i]->setNeedsLayout(MarkOnlyThis); 467 } 468 // FIXME: The optimisation below doesn't work since the internal table 469 // layout could have changed. We need to add a flag to the table 470 // layout that tells us if something has changed in the min max 471 // calculations to do it correctly. 472 // if ( oldWidth != width() || columns.size() + 1 != columnPos.size() ) 473 m_tableLayout->layout(); 474 475 LayoutUnit totalSectionLogicalHeight = 0; 476 LayoutUnit oldTableLogicalTop = 0; 477 for (unsigned i = 0; i < m_captions.size(); i++) { 478 if (m_captions[i]->style().captionSide() == CAPBOTTOM) 479 continue; 480 oldTableLogicalTop += m_captions[i]->logicalHeight() + m_captions[i]->marginBefore() + m_captions[i]->marginAfter(); 481 } 482 483 bool collapsing = collapseBorders(); 484 485 for (auto& child : childrenOfType<RenderElement>(*this)) { 486 if (is<RenderTableSection>(child)) { 487 RenderTableSection& section = downcast<RenderTableSection>(child); 488 if (m_columnLogicalWidthChanged) 489 section.setChildNeedsLayout(MarkOnlyThis); 490 section.layoutIfNeeded(); 491 totalSectionLogicalHeight += section.calcRowLogicalHeight(); 492 if (collapsing) 493 section.recalcOuterBorder(); 494 ASSERT(!section.needsLayout()); 495 } else if (is<RenderTableCol>(child)) { 496 downcast<RenderTableCol>(child).layoutIfNeeded(); 497 ASSERT(!child.needsLayout()); 498 } 499 } 500 501 // If any table section moved vertically, we will just repaint everything from that 502 // section down (it is quite unlikely that any of the following sections 503 // did not shift). 504 layoutCaptions(); 505 if (!m_captions.isEmpty() && logicalHeight() != oldTableLogicalTop) { 506 sectionMoved = true; 507 movedSectionLogicalTop = std::min(logicalHeight(), oldTableLogicalTop); 508 } 509 510 LayoutUnit borderAndPaddingBefore = borderBefore() + (collapsing ? LayoutUnit() : paddingBefore()); 511 LayoutUnit borderAndPaddingAfter = borderAfter() + (collapsing ? LayoutUnit() : paddingAfter()); 512 513 setLogicalHeight(logicalHeight() + borderAndPaddingBefore); 514 515 if (!isOutOfFlowPositioned()) 516 updateLogicalHeight(); 517 518 LayoutUnit computedLogicalHeight = 0; 519 519 520 Length logicalHeightLength = style().logicalHeight(); 521 if (logicalHeightLength.isIntrinsic() || (logicalHeightLength.isSpecified() && logicalHeightLength.isPositive())) 522 computedLogicalHeight = convertStyleLogicalHeightToComputedHeight(logicalHeightLength); 523 524 Length logicalMaxHeightLength = style().logicalMaxHeight(); 525 if (logicalMaxHeightLength.isIntrinsic() || (logicalMaxHeightLength.isSpecified() && !logicalMaxHeightLength.isNegative())) { 526 LayoutUnit computedMaxLogicalHeight = convertStyleLogicalHeightToComputedHeight(logicalMaxHeightLength); 527 computedLogicalHeight = std::min(computedLogicalHeight, computedMaxLogicalHeight); 528 } 529 530 Length logicalMinHeightLength = style().logicalMinHeight(); 531 if (logicalMinHeightLength.isIntrinsic() || (logicalMinHeightLength.isSpecified() && !logicalMinHeightLength.isNegative())) { 532 LayoutUnit computedMinLogicalHeight = convertStyleLogicalHeightToComputedHeight(logicalMinHeightLength); 533 computedLogicalHeight = std::max(computedLogicalHeight, computedMinLogicalHeight); 534 } 535 536 distributeExtraLogicalHeight(computedLogicalHeight - totalSectionLogicalHeight); 537 538 for (RenderTableSection* section = topSection(); section; section = sectionBelow(section)) 539 section->layoutRows(); 540 541 if (!topSection() && computedLogicalHeight > totalSectionLogicalHeight && !document().inQuirksMode()) { 542 // Completely empty tables (with no sections or anything) should at least honor specified height 543 // in strict mode. 544 setLogicalHeight(logicalHeight() + computedLogicalHeight); 545 } 546 547 LayoutUnit sectionLogicalLeft = style().isLeftToRightDirection() ? borderStart() : borderEnd(); 548 if (!collapsing) 549 sectionLogicalLeft += style().isLeftToRightDirection() ? paddingStart() : paddingEnd(); 550 551 // position the table sections 552 RenderTableSection* section = topSection(); 553 while (section) { 554 if (!sectionMoved && section->logicalTop() != logicalHeight()) { 555 sectionMoved = true; 556 movedSectionLogicalTop = std::min(logicalHeight(), section->logicalTop()) + (style().isHorizontalWritingMode() ? section->visualOverflowRect().y() : section->visualOverflowRect().x()); 557 } 558 section->setLogicalLocation(LayoutPoint(sectionLogicalLeft, logicalHeight())); 559 560 setLogicalHeight(logicalHeight() + section->logicalHeight()); 561 section = sectionBelow(section); 562 } 563 564 setLogicalHeight(logicalHeight() + borderAndPaddingAfter); 565 566 layoutCaptions(BottomCaptionLayoutPhase::Yes); 567 568 if (isOutOfFlowPositioned()) 569 updateLogicalHeight(); 570 571 // table can be containing block of positioned elements. 572 bool dimensionChanged = oldLogicalWidth != logicalWidth() || oldLogicalHeight != logicalHeight(); 573 layoutPositionedObjects(dimensionChanged); 574 575 updateLayerTransform(); 576 577 // Layout was changed, so probably borders too. 578 invalidateCollapsedBorders(); 579 580 // The location or height of one or more sections may have changed. 581 invalidateCachedColumnOffsets(); 582 583 computeOverflow(clientLogicalBottom()); 584 585 statePusher.pop(); 520 Length logicalHeightLength = style().logicalHeight(); 521 if (logicalHeightLength.isIntrinsic() || (logicalHeightLength.isSpecified() && logicalHeightLength.isPositive())) 522 computedLogicalHeight = convertStyleLogicalHeightToComputedHeight(logicalHeightLength); 523 524 Length logicalMaxHeightLength = style().logicalMaxHeight(); 525 if (logicalMaxHeightLength.isIntrinsic() || (logicalMaxHeightLength.isSpecified() && !logicalMaxHeightLength.isNegative())) { 526 LayoutUnit computedMaxLogicalHeight = convertStyleLogicalHeightToComputedHeight(logicalMaxHeightLength); 527 computedLogicalHeight = std::min(computedLogicalHeight, computedMaxLogicalHeight); 528 } 529 530 Length logicalMinHeightLength = style().logicalMinHeight(); 531 if (logicalMinHeightLength.isIntrinsic() || (logicalMinHeightLength.isSpecified() && !logicalMinHeightLength.isNegative())) { 532 LayoutUnit computedMinLogicalHeight = convertStyleLogicalHeightToComputedHeight(logicalMinHeightLength); 533 computedLogicalHeight = std::max(computedLogicalHeight, computedMinLogicalHeight); 534 } 535 536 distributeExtraLogicalHeight(computedLogicalHeight - totalSectionLogicalHeight); 537 538 for (RenderTableSection* section = topSection(); section; section = sectionBelow(section)) 539 section->layoutRows(); 540 541 if (!topSection() && computedLogicalHeight > totalSectionLogicalHeight && !document().inQuirksMode()) { 542 // Completely empty tables (with no sections or anything) should at least honor specified height 543 // in strict mode. 544 setLogicalHeight(logicalHeight() + computedLogicalHeight); 545 } 546 547 LayoutUnit sectionLogicalLeft = style().isLeftToRightDirection() ? borderStart() : borderEnd(); 548 if (!collapsing) 549 sectionLogicalLeft += style().isLeftToRightDirection() ? paddingStart() : paddingEnd(); 550 551 // position the table sections 552 RenderTableSection* section = topSection(); 553 while (section) { 554 if (!sectionMoved && section->logicalTop() != logicalHeight()) { 555 sectionMoved = true; 556 movedSectionLogicalTop = std::min(logicalHeight(), section->logicalTop()) + (style().isHorizontalWritingMode() ? section->visualOverflowRect().y() : section->visualOverflowRect().x()); 557 } 558 section->setLogicalLocation(LayoutPoint(sectionLogicalLeft, logicalHeight())); 559 560 setLogicalHeight(logicalHeight() + section->logicalHeight()); 561 section = sectionBelow(section); 562 } 563 564 setLogicalHeight(logicalHeight() + borderAndPaddingAfter); 565 566 layoutCaptions(BottomCaptionLayoutPhase::Yes); 567 568 if (isOutOfFlowPositioned()) 569 updateLogicalHeight(); 570 571 // table can be containing block of positioned elements. 572 bool dimensionChanged = oldLogicalWidth != logicalWidth() || oldLogicalHeight != logicalHeight(); 573 layoutPositionedObjects(dimensionChanged); 574 575 updateLayerTransform(); 576 577 // Layout was changed, so probably borders too. 578 invalidateCollapsedBorders(); 579 580 // The location or height of one or more sections may have changed. 581 invalidateCachedColumnOffsets(); 582 583 computeOverflow(clientLogicalBottom()); 584 } 586 585 587 586 auto* layoutState = view().frameView().layoutContext().layoutState(); -
trunk/Source/WebCore/rendering/RenderTableRow.cpp
r224537 r224546 208 208 } 209 209 210 statePusher.pop();211 210 // RenderTableSection::layoutRows will set our logical height and width later, so it calls updateLayerTransform(). 212 211 clearNeedsLayout(); -
trunk/Source/WebCore/rendering/RenderTableSection.cpp
r224537 r224546 373 373 ASSERT(!needsLayout()); 374 374 375 statePusher.pop();376 377 375 return m_rowPos[m_grid.size()]; 378 376 } … … 424 422 } 425 423 } 426 427 statePusher.pop();428 424 clearNeedsLayout(); 429 425 } … … 684 680 685 681 computeOverflowFromCells(totalRows, nEffCols); 686 687 statePusher.pop();688 682 } 689 683 -
trunk/Source/WebCore/rendering/RenderVTTCue.cpp
r224537 r224546 69 69 } else 70 70 repositionGenericCue(); 71 72 statePusher.pop();73 71 } 74 72 -
trunk/Source/WebCore/rendering/RenderView.cpp
r224537 r224546 240 240 frameView().layoutContext().checkLayoutState(); 241 241 #endif 242 statePusher.pop();243 242 clearNeedsLayout(); 244 243 }
Note: See TracChangeset
for help on using the changeset viewer.