Changeset 150743 in webkit
- Timestamp:
- May 27, 2013 2:41:47 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r150741 r150743 1 2013-05-27 Andrei Bucur <abucur@adobe.com> 2 3 [CSS Regions] Remove the offsetFromLogicalTopOfFirstPage parameter from layout functions 4 https://bugs.webkit.org/show_bug.cgi?id=116441 5 6 Reviewed by David Hyatt. 7 8 The patch changes the following things: 9 - exposes offsetFromLogicalTopOfFirstPage() to all the RenderBoxes; 10 - offsetFromLogicalTopOfFirstPage() is now safe to call from any box inside a flow thread, not only the 11 currently being laid out; 12 - removes the offsetFromLogicalTopOfFirstPage parameter from all the layout functions 13 that didn't actually required it; when the value is necessary, the offsetFromLogicalTopOfFirstPage 14 function is called instead; 15 - RenderFlowThread now handles its own logic for obtaining the offset from logical top of the first 16 region for a box, based on the layout states pushed on RenderView; it provides a better caching mechanism 17 that can be used for all the ancestor containing blocks of the current box being laid out. 18 19 The RenderBoxRegionInfo structures are cached only based on the box and the region. This means that 20 passing around a value for offsetFromLogicalTopOfFirstPage different in some cases than others was 21 risky. If there is a possibility of having a different box info result for a different offset 22 then the cache is not working correctly. 23 24 Tests: No function change, no tests. 25 26 * rendering/RenderBlock.cpp: 27 (WebCore::RenderBlock::computeStartPositionDeltaForChildAvoidingFloats): 28 (WebCore::RenderBlock::logicalLeftOffsetForContent): 29 (WebCore::RenderBlock::logicalRightOffsetForContent): 30 (WebCore::RenderBlock::getClearDelta): 31 (WebCore::RenderBlock::lineWidthForPaginatedLineChanged): 32 (WebCore::RenderBlock::offsetFromLogicalTopOfFirstPage): 33 (WebCore::RenderBlock::logicalWidthChangedInRegions): 34 * rendering/RenderBlock.h: 35 (WebCore::RenderBlock::availableLogicalWidthForLine): 36 (WebCore::RenderBlock::logicalRightOffsetForLine): 37 (WebCore::RenderBlock::logicalLeftOffsetForLine): 38 (WebCore::RenderBlock::startOffsetForLine): 39 (WebCore::RenderBlock::endOffsetForLine): 40 (WebCore::RenderBlock::availableLogicalWidthForContent): 41 (WebCore::RenderBlock::startOffsetForContent): 42 (WebCore::RenderBlock::endOffsetForContent): 43 (WebCore::RenderBlock::logicalLeftOffsetForContent): 44 (WebCore::RenderBlock::logicalRightOffsetForContent): 45 * rendering/RenderBox.cpp: 46 (WebCore::RenderBox::borderBoxRectInRegion): 47 (WebCore::RenderBox::constrainLogicalWidthInRegionByMinMax): 48 (WebCore::RenderBox::shrinkLogicalWidthToAvoidFloats): 49 (WebCore::RenderBox::containingBlockLogicalWidthForContentInRegion): 50 (WebCore::RenderBox::containingBlockAvailableLineWidthInRegion): 51 (WebCore::RenderBox::computeLogicalWidthInRegion): 52 (WebCore::RenderBox::computeLogicalWidthInRegionUsing): 53 (WebCore::RenderBox::renderBoxRegionInfo): 54 (WebCore::RenderBox::containingBlockLogicalWidthForPositioned): 55 (WebCore::RenderBox::containingBlockLogicalHeightForPositioned): 56 (WebCore::computeInlineStaticDistance): 57 (WebCore::RenderBox::computePositionedLogicalWidth): 58 (WebCore::RenderBox::computePositionedLogicalWidthUsing): 59 (WebCore::RenderBox::computePositionedLogicalHeight): 60 (WebCore::RenderBox::computePositionedLogicalHeightUsing): 61 (WebCore::RenderBox::computePositionedLogicalWidthReplaced): 62 (WebCore::RenderBox::computePositionedLogicalHeightReplaced): 63 (WebCore::RenderBox::offsetFromLogicalTopOfFirstPage): 64 * rendering/RenderBox.h: 65 * rendering/RenderFlexibleBox.cpp: 66 (WebCore::RenderFlexibleBox::computeMainAxisExtentForChild): 67 * rendering/RenderFlowThread.cpp: 68 (WebCore::RenderFlowThread::logicalWidthChangedInRegionsForBlock): 69 (WebCore::RenderFlowThread::hasCachedOffsetFromLogicalTopOfFirstRegion): 70 (WebCore::RenderFlowThread::cachedOffsetFromLogicalTopOfFirstRegion): 71 (WebCore::RenderFlowThread::setOffsetFromLogicalTopOfFirstRegion): 72 (WebCore::RenderFlowThread::clearOffsetFromLogicalTopOfFirstRegion): 73 (WebCore::RenderFlowThread::currentActiveRenderBox): 74 (WebCore::RenderFlowThread::pushFlowThreadLayoutState): 75 (WebCore::RenderFlowThread::popFlowThreadLayoutState): 76 (WebCore::RenderFlowThread::offsetFromLogicalTopOfFirstRegion): 77 (WebCore::RenderFlowThread::adjustedPositionRelativeToOffsetParent): 78 * rendering/RenderFlowThread.h: 79 * rendering/RenderTable.cpp: 80 (WebCore::RenderTable::updateLogicalWidth): 81 * rendering/RenderView.cpp: 82 (WebCore::RenderView::pushLayoutState): 83 (WebCore::RenderView::pushLayoutStateForCurrentFlowThread): 84 (WebCore::RenderView::popLayoutStateForCurrentFlowThread): 85 * rendering/RenderView.h: 86 (WebCore::RenderView::pushLayoutState): 87 (WebCore::RenderView::popLayoutState): 88 1 89 2013-05-27 Allan Sandfeld Jensen <allan.jensen@digia.com> 2 90 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r150611 r150743 2372 2372 } 2373 2373 2374 LayoutUnit RenderBlock::computeStartPositionDeltaForChildAvoidingFloats(const RenderBox* child, LayoutUnit childMarginStart, 2375 RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage) 2376 { 2377 LayoutUnit startPosition = startOffsetForContent(region, offsetFromLogicalTopOfFirstPage); 2374 LayoutUnit RenderBlock::computeStartPositionDeltaForChildAvoidingFloats(const RenderBox* child, LayoutUnit childMarginStart, RenderRegion* region) 2375 { 2376 LayoutUnit startPosition = startOffsetForContent(region); 2378 2377 2379 2378 // Add in our start margin. … … 2383 2382 LayoutUnit blockOffset = logicalTopForChild(child); 2384 2383 if (region) 2385 blockOffset = max(blockOffset, blockOffset + (region->logicalTopForFlowThreadContent() - offsetFromLogicalTopOfFirstPage ));2386 2387 LayoutUnit startOff = startOffsetForLine(blockOffset, false, region, offsetFromLogicalTopOfFirstPage,logicalHeightForChild(child));2384 blockOffset = max(blockOffset, blockOffset + (region->logicalTopForFlowThreadContent() - offsetFromLogicalTopOfFirstPage())); 2385 2386 LayoutUnit startOff = startOffsetForLine(blockOffset, false, region, logicalHeightForChild(child)); 2388 2387 2389 2388 if (style()->textAlign() != WEBKIT_CENTER && !child->style()->marginStartUsing(style()).isAuto()) { … … 4392 4391 } 4393 4392 4394 LayoutUnit RenderBlock::logicalLeftOffsetForContent(RenderRegion* region , LayoutUnit offsetFromLogicalTopOfFirstPage) const4393 LayoutUnit RenderBlock::logicalLeftOffsetForContent(RenderRegion* region) const 4395 4394 { 4396 4395 LayoutUnit logicalLeftOffset = style()->isHorizontalWritingMode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); 4397 4396 if (!region) 4398 4397 return logicalLeftOffset; 4399 LayoutRect boxRect = borderBoxRectInRegion(region , offsetFromLogicalTopOfFirstPage);4398 LayoutRect boxRect = borderBoxRectInRegion(region); 4400 4399 return logicalLeftOffset + (isHorizontalWritingMode() ? boxRect.x() : boxRect.y()); 4401 4400 } 4402 4401 4403 LayoutUnit RenderBlock::logicalRightOffsetForContent(RenderRegion* region , LayoutUnit offsetFromLogicalTopOfFirstPage) const4402 LayoutUnit RenderBlock::logicalRightOffsetForContent(RenderRegion* region) const 4404 4403 { 4405 4404 LayoutUnit logicalRightOffset = style()->isHorizontalWritingMode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); … … 4407 4406 if (!region) 4408 4407 return logicalRightOffset; 4409 LayoutRect boxRect = borderBoxRectInRegion(region , offsetFromLogicalTopOfFirstPage);4408 LayoutRect boxRect = borderBoxRectInRegion(region); 4410 4409 return logicalRightOffset - (logicalWidth() - (isHorizontalWritingMode() ? boxRect.maxX() : boxRect.maxY())); 4411 4410 } … … 4934 4933 4935 4934 RenderRegion* region = regionAtBlockOffset(logicalTopForChild(child)); 4936 LayoutRect borderBox = child->borderBoxRectInRegion(region, offsetFromLogicalTopOfFirstPage() + logicalTopForChild(child),DoNotCacheRenderBoxRegionInfo);4935 LayoutRect borderBox = child->borderBoxRectInRegion(region, DoNotCacheRenderBoxRegionInfo); 4937 4936 LayoutUnit childLogicalWidthAtOldLogicalTopOffset = isHorizontalWritingMode() ? borderBox.width() : borderBox.height(); 4938 4937 … … 4946 4945 child->updateLogicalWidth(); 4947 4946 region = regionAtBlockOffset(logicalTopForChild(child)); 4948 borderBox = child->borderBoxRectInRegion(region, offsetFromLogicalTopOfFirstPage() + logicalTopForChild(child),DoNotCacheRenderBoxRegionInfo);4947 borderBox = child->borderBoxRectInRegion(region, DoNotCacheRenderBoxRegionInfo); 4949 4948 LayoutUnit childLogicalWidthAtNewLogicalTopOffset = isHorizontalWritingMode() ? borderBox.width() : borderBox.height(); 4950 4949 … … 7671 7670 if (rootBox->containingRegion() == currentRegion) 7672 7671 return false; 7673 return rootBox->paginatedLineWidth() != availableLogicalWidthForContent(currentRegion , offsetFromLogicalTopOfFirstPage());7672 return rootBox->paginatedLineWidth() != availableLogicalWidthForContent(currentRegion); 7674 7673 } 7675 7674 … … 7679 7678 if (layoutState && !layoutState->isPaginated()) 7680 7679 return 0; 7680 7681 RenderFlowThread* flowThread = flowThreadContainingBlock(); 7682 if (flowThread) 7683 return flowThread->offsetFromLogicalTopOfFirstRegion(this); 7684 7681 7685 if (layoutState) { 7682 // FIXME: Sanity check that the renderer in the layout state is ours, since otherwise the computation will be off. 7683 // Right now this assert gets hit inside computeLogicalHeight for percentage margins, since they're computed using 7684 // widths which can vary in each region. Until we patch that, we can't have this assert. 7685 // ASSERT(layoutState->m_renderer == this); 7686 ASSERT(layoutState->m_renderer == this); 7686 7687 7687 7688 LayoutSize offsetDelta = layoutState->m_layoutOffset - layoutState->m_pageOffset; 7688 7689 return isHorizontalWritingMode() ? offsetDelta.height() : offsetDelta.width(); 7689 7690 } 7690 // FIXME: Right now, this assert is hit outside layout, from logicalLeftSelectionOffset in selectionGapRectsForRepaint (called from FrameSelection::selectAll). 7691 // ASSERT(inRenderFlowThread()); 7692 7693 // FIXME: This is a slower path that doesn't use layout state and relies on getting your logical top inside the enclosing flow thread. It doesn't 7694 // work with columns or pages currently, but it should once they have been switched over to using flow threads. 7695 RenderFlowThread* flowThread = flowThreadContainingBlock(); 7696 if (!flowThread) 7697 return 0; 7698 7699 const RenderBlock* currentBlock = this; 7700 LayoutRect blockRect(0, 0, width(), height()); 7701 7702 while (currentBlock && !currentBlock->isRenderFlowThread()) { 7703 RenderBlock* containerBlock = currentBlock->containingBlock(); 7704 ASSERT(containerBlock); 7705 if (!containerBlock) 7706 return 0; 7707 LayoutPoint currentBlockLocation = currentBlock->location(); 7708 7709 if (containerBlock->style()->writingMode() != currentBlock->style()->writingMode()) { 7710 // We have to put the block rect in container coordinates 7711 // and we have to take into account both the container and current block flipping modes 7712 if (containerBlock->style()->isFlippedBlocksWritingMode()) { 7713 if (containerBlock->isHorizontalWritingMode()) 7714 blockRect.setY(currentBlock->height() - blockRect.maxY()); 7715 else 7716 blockRect.setX(currentBlock->width() - blockRect.maxX()); 7717 } 7718 currentBlock->flipForWritingMode(blockRect); 7719 } 7720 blockRect.moveBy(currentBlockLocation); 7721 currentBlock = containerBlock; 7722 }; 7723 return currentBlock->isHorizontalWritingMode() ? blockRect.y() : blockRect.x(); 7691 7692 ASSERT_NOT_REACHED(); 7693 return 0; 7724 7694 } 7725 7695 … … 7755 7725 return false; 7756 7726 7757 return flowThread->logicalWidthChangedInRegions (this, offsetFromLogicalTopOfFirstPage());7727 return flowThread->logicalWidthChangedInRegionsForBlock(this); 7758 7728 } 7759 7729 -
trunk/Source/WebCore/rendering/RenderBlock.h
r150527 r150743 168 168 // Versions that can compute line offsets with the region and page offset passed in. Used for speed to avoid having to 169 169 // compute the region all over again when you already know it. 170 LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool shouldIndentText, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnitlogicalHeight = 0) const171 { 172 return max<LayoutUnit>(0, logicalRightOffsetForLine(position, shouldIndentText, region, offsetFromLogicalTopOfFirstPage,logicalHeight)173 - logicalLeftOffsetForLine(position, shouldIndentText, region, offsetFromLogicalTopOfFirstPage,logicalHeight));174 } 175 LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool shouldIndentText, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnitlogicalHeight = 0, ShapeOutsideFloatOffsetMode offsetMode = ShapeOutsideFloatShapeOffset) const176 { 177 return logicalRightOffsetForLine(position, logicalRightOffsetForContent(region , offsetFromLogicalTopOfFirstPage), shouldIndentText, 0, logicalHeight, offsetMode);178 } 179 LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, bool shouldIndentText, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnitlogicalHeight = 0, ShapeOutsideFloatOffsetMode offsetMode = ShapeOutsideFloatShapeOffset) const180 { 181 return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(region , offsetFromLogicalTopOfFirstPage), shouldIndentText, 0, logicalHeight, offsetMode);182 } 183 LayoutUnit startOffsetForLine(LayoutUnit position, bool shouldIndentText, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnitlogicalHeight = 0) const184 { 185 return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, shouldIndentText, region, offsetFromLogicalTopOfFirstPage,logicalHeight)186 : logicalWidth() - logicalRightOffsetForLine(position, shouldIndentText, region, offsetFromLogicalTopOfFirstPage,logicalHeight);187 } 188 LayoutUnit endOffsetForLine(LayoutUnit position, bool shouldIndentText, RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage, LayoutUnitlogicalHeight = 0) const189 { 190 return !style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, shouldIndentText, region, offsetFromLogicalTopOfFirstPage,logicalHeight)191 : logicalWidth() - logicalRightOffsetForLine(position, shouldIndentText, region, offsetFromLogicalTopOfFirstPage,logicalHeight);170 LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool shouldIndentText, RenderRegion* region, LayoutUnit logicalHeight = 0) const 171 { 172 return max<LayoutUnit>(0, logicalRightOffsetForLine(position, shouldIndentText, region, logicalHeight) 173 - logicalLeftOffsetForLine(position, shouldIndentText, region, logicalHeight)); 174 } 175 LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool shouldIndentText, RenderRegion* region, LayoutUnit logicalHeight = 0, ShapeOutsideFloatOffsetMode offsetMode = ShapeOutsideFloatShapeOffset) const 176 { 177 return logicalRightOffsetForLine(position, logicalRightOffsetForContent(region), shouldIndentText, 0, logicalHeight, offsetMode); 178 } 179 LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, bool shouldIndentText, RenderRegion* region, LayoutUnit logicalHeight = 0, ShapeOutsideFloatOffsetMode offsetMode = ShapeOutsideFloatShapeOffset) const 180 { 181 return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(region), shouldIndentText, 0, logicalHeight, offsetMode); 182 } 183 LayoutUnit startOffsetForLine(LayoutUnit position, bool shouldIndentText, RenderRegion* region, LayoutUnit logicalHeight = 0) const 184 { 185 return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, shouldIndentText, region, logicalHeight) 186 : logicalWidth() - logicalRightOffsetForLine(position, shouldIndentText, region, logicalHeight); 187 } 188 LayoutUnit endOffsetForLine(LayoutUnit position, bool shouldIndentText, RenderRegion* region, LayoutUnit logicalHeight = 0) const 189 { 190 return !style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, shouldIndentText, region, logicalHeight) 191 : logicalWidth() - logicalRightOffsetForLine(position, shouldIndentText, region, logicalHeight); 192 192 } 193 193 194 194 LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool shouldIndentText, LayoutUnit logicalHeight = 0) const 195 195 { 196 return availableLogicalWidthForLine(position, shouldIndentText, regionAtBlockOffset(position), offsetFromLogicalTopOfFirstPage(),logicalHeight);196 return availableLogicalWidthForLine(position, shouldIndentText, regionAtBlockOffset(position), logicalHeight); 197 197 } 198 198 LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool shouldIndentText, LayoutUnit logicalHeight = 0, ShapeOutsideFloatOffsetMode offsetMode = ShapeOutsideFloatShapeOffset) const … … 395 395 virtual void scrollbarsChanged(bool /*horizontalScrollbarChanged*/, bool /*verticalScrollbarChanged*/) { }; 396 396 397 LayoutUnit logicalLeftOffsetForContent(RenderRegion* , LayoutUnit offsetFromLogicalTopOfFirstPage) const;398 LayoutUnit logicalRightOffsetForContent(RenderRegion* , LayoutUnit offsetFromLogicalTopOfFirstPage) const;399 LayoutUnit availableLogicalWidthForContent(RenderRegion* region , LayoutUnit offsetFromLogicalTopOfFirstPage) const397 LayoutUnit logicalLeftOffsetForContent(RenderRegion*) const; 398 LayoutUnit logicalRightOffsetForContent(RenderRegion*) const; 399 LayoutUnit availableLogicalWidthForContent(RenderRegion* region) const 400 400 { 401 return max<LayoutUnit>(0, logicalRightOffsetForContent(region, offsetFromLogicalTopOfFirstPage) - 402 logicalLeftOffsetForContent(region, offsetFromLogicalTopOfFirstPage)); } 403 LayoutUnit startOffsetForContent(RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage) const 404 { 405 return style()->isLeftToRightDirection() ? logicalLeftOffsetForContent(region, offsetFromLogicalTopOfFirstPage) 406 : logicalWidth() - logicalRightOffsetForContent(region, offsetFromLogicalTopOfFirstPage); 407 } 408 LayoutUnit endOffsetForContent(RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage) const 409 { 410 return !style()->isLeftToRightDirection() ? logicalLeftOffsetForContent(region, offsetFromLogicalTopOfFirstPage) 411 : logicalWidth() - logicalRightOffsetForContent(region, offsetFromLogicalTopOfFirstPage); 401 return max<LayoutUnit>(0, logicalRightOffsetForContent(region) - logicalLeftOffsetForContent(region)); } 402 LayoutUnit startOffsetForContent(RenderRegion* region) const 403 { 404 return style()->isLeftToRightDirection() ? logicalLeftOffsetForContent(region) : logicalWidth() - logicalRightOffsetForContent(region); 405 } 406 LayoutUnit endOffsetForContent(RenderRegion* region) const 407 { 408 return !style()->isLeftToRightDirection() ? logicalLeftOffsetForContent(region) : logicalWidth() - logicalRightOffsetForContent(region); 412 409 } 413 410 LayoutUnit logicalLeftOffsetForContent(LayoutUnit blockOffset) const 414 411 { 415 return logicalLeftOffsetForContent(regionAtBlockOffset(blockOffset) , offsetFromLogicalTopOfFirstPage());412 return logicalLeftOffsetForContent(regionAtBlockOffset(blockOffset)); 416 413 } 417 414 LayoutUnit logicalRightOffsetForContent(LayoutUnit blockOffset) const 418 415 { 419 return logicalRightOffsetForContent(regionAtBlockOffset(blockOffset) , offsetFromLogicalTopOfFirstPage());416 return logicalRightOffsetForContent(regionAtBlockOffset(blockOffset)); 420 417 } 421 418 LayoutUnit availableLogicalWidthForContent(LayoutUnit blockOffset) const 422 419 { 423 return availableLogicalWidthForContent(regionAtBlockOffset(blockOffset) , offsetFromLogicalTopOfFirstPage());420 return availableLogicalWidthForContent(regionAtBlockOffset(blockOffset)); 424 421 } 425 422 LayoutUnit startOffsetForContent(LayoutUnit blockOffset) const 426 423 { 427 return startOffsetForContent(regionAtBlockOffset(blockOffset) , offsetFromLogicalTopOfFirstPage());424 return startOffsetForContent(regionAtBlockOffset(blockOffset)); 428 425 } 429 426 LayoutUnit endOffsetForContent(LayoutUnit blockOffset) const 430 427 { 431 return endOffsetForContent(regionAtBlockOffset(blockOffset) , offsetFromLogicalTopOfFirstPage());428 return endOffsetForContent(regionAtBlockOffset(blockOffset)); 432 429 } 433 430 LayoutUnit logicalLeftOffsetForContent() const { return isHorizontalWritingMode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); } … … 439 436 void updateStaticInlinePositionForChild(RenderBox*, LayoutUnit logicalTop); 440 437 441 LayoutUnit computeStartPositionDeltaForChildAvoidingFloats(const RenderBox* child, LayoutUnit childMarginStart, RenderRegion* = 0 , LayoutUnit offsetFromLogicalTopOfFirstPage = 0);438 LayoutUnit computeStartPositionDeltaForChildAvoidingFloats(const RenderBox* child, LayoutUnit childMarginStart, RenderRegion* = 0); 442 439 443 440 void placeRunInIfNeeded(RenderObject* newChild); … … 1144 1141 1145 1142 public: 1146 LayoutUnit offsetFromLogicalTopOfFirstPage() const;1143 virtual LayoutUnit offsetFromLogicalTopOfFirstPage() const; 1147 1144 RenderRegion* regionAtBlockOffset(LayoutUnit) const; 1148 1145 RenderRegion* clampToStartAndEndRegions(RenderRegion*) const; -
trunk/Source/WebCore/rendering/RenderBox.cpp
r150503 r150743 110 110 } 111 111 112 LayoutRect RenderBox::borderBoxRectInRegion(RenderRegion* region, LayoutUnit offsetFromTopOfFirstPage,RenderBoxRegionInfoFlags cacheFlag) const112 LayoutRect RenderBox::borderBoxRectInRegion(RenderRegion* region, RenderBoxRegionInfoFlags cacheFlag) const 113 113 { 114 114 if (!region) … … 116 116 117 117 // Compute the logical width and placement in this region. 118 RenderBoxRegionInfo* boxInfo = renderBoxRegionInfo(region, offsetFromTopOfFirstPage,cacheFlag);118 RenderBoxRegionInfo* boxInfo = renderBoxRegionInfo(region, cacheFlag); 119 119 if (!boxInfo) 120 120 return borderBoxRect(); … … 127 127 // FIXME: Doesn't work right with perpendicular writing modes. 128 128 const RenderBlock* currentBox = containingBlock(); 129 offsetFromTopOfFirstPage -= logicalTop(); 130 RenderBoxRegionInfo* currentBoxInfo = currentBox->renderBoxRegionInfo(region, offsetFromTopOfFirstPage); 129 RenderBoxRegionInfo* currentBoxInfo = currentBox->renderBoxRegionInfo(region); 131 130 while (currentBoxInfo && currentBoxInfo->isShifted()) { 132 131 if (currentBox->style()->direction() == LTR) … … 134 133 else 135 134 logicalLeft -= (currentBox->logicalWidth() - currentBoxInfo->logicalWidth()) - currentBoxInfo->logicalLeft(); 136 offsetFromTopOfFirstPage -= logicalTop();137 135 currentBox = currentBox->containingBlock(); 138 136 region = currentBox->clampToStartAndEndRegions(region); 139 currentBoxInfo = currentBox->renderBoxRegionInfo(region , offsetFromTopOfFirstPage);137 currentBoxInfo = currentBox->renderBoxRegionInfo(region); 140 138 } 141 139 … … 492 490 } 493 491 494 LayoutUnit RenderBox::constrainLogicalWidthInRegionByMinMax(LayoutUnit logicalWidth, LayoutUnit availableWidth, RenderBlock* cb, RenderRegion* region , LayoutUnit offsetFromLogicalTopOfFirstPage) const492 LayoutUnit RenderBox::constrainLogicalWidthInRegionByMinMax(LayoutUnit logicalWidth, LayoutUnit availableWidth, RenderBlock* cb, RenderRegion* region) const 495 493 { 496 494 RenderStyle* styleToUse = style(); 497 495 if (!styleToUse->logicalMaxWidth().isUndefined()) 498 logicalWidth = min(logicalWidth, computeLogicalWidthInRegionUsing(MaxSize, styleToUse->logicalMaxWidth(), availableWidth, cb, region , offsetFromLogicalTopOfFirstPage));499 return max(logicalWidth, computeLogicalWidthInRegionUsing(MinSize, styleToUse->logicalMinWidth(), availableWidth, cb, region , offsetFromLogicalTopOfFirstPage));496 logicalWidth = min(logicalWidth, computeLogicalWidthInRegionUsing(MaxSize, styleToUse->logicalMaxWidth(), availableWidth, cb, region)); 497 return max(logicalWidth, computeLogicalWidthInRegionUsing(MinSize, styleToUse->logicalMinWidth(), availableWidth, cb, region)); 500 498 } 501 499 … … 1600 1598 } 1601 1599 1602 LayoutUnit RenderBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStart, LayoutUnit childMarginEnd, const RenderBlock* cb, RenderRegion* region , LayoutUnit offsetFromLogicalTopOfFirstPage) const1600 LayoutUnit RenderBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStart, LayoutUnit childMarginEnd, const RenderBlock* cb, RenderRegion* region) const 1603 1601 { 1604 1602 RenderRegion* containingBlockRegion = 0; 1605 1603 LayoutUnit logicalTopPosition = logicalTop(); 1606 LayoutUnit adjustedPageOffsetForContainingBlock = offsetFromLogicalTopOfFirstPage - logicalTop();1607 1604 if (region) { 1608 LayoutUnit offsetFromLogicalTopOfRegion = region ? region->logicalTopForFlowThreadContent() - offsetFromLogicalTopOfFirstPage : LayoutUnit();1605 LayoutUnit offsetFromLogicalTopOfRegion = region ? region->logicalTopForFlowThreadContent() - offsetFromLogicalTopOfFirstPage() : LayoutUnit(); 1609 1606 logicalTopPosition = max(logicalTopPosition, logicalTopPosition + offsetFromLogicalTopOfRegion); 1610 1607 containingBlockRegion = cb->clampToStartAndEndRegions(region); 1611 1608 } 1612 1609 1613 LayoutUnit result = cb->availableLogicalWidthForLine(logicalTopPosition, false, containingBlockRegion , adjustedPageOffsetForContainingBlock) - childMarginStart - childMarginEnd;1610 LayoutUnit result = cb->availableLogicalWidthForLine(logicalTopPosition, false, containingBlockRegion) - childMarginStart - childMarginEnd; 1614 1611 1615 1612 // We need to see if margins on either the start side or the end side can contain the floats in question. If they can, … … 1619 1616 // "consumed" by the float. Negative margins aren't consumed by the float, and so we ignore them. 1620 1617 if (childMarginStart > 0) { 1621 LayoutUnit startContentSide = cb->startOffsetForContent(containingBlockRegion , adjustedPageOffsetForContainingBlock);1618 LayoutUnit startContentSide = cb->startOffsetForContent(containingBlockRegion); 1622 1619 LayoutUnit startContentSideWithMargin = startContentSide + childMarginStart; 1623 LayoutUnit startOffset = cb->startOffsetForLine(logicalTopPosition, false, containingBlockRegion , adjustedPageOffsetForContainingBlock);1620 LayoutUnit startOffset = cb->startOffsetForLine(logicalTopPosition, false, containingBlockRegion); 1624 1621 if (startOffset > startContentSideWithMargin) 1625 1622 result += childMarginStart; … … 1629 1626 1630 1627 if (childMarginEnd > 0) { 1631 LayoutUnit endContentSide = cb->endOffsetForContent(containingBlockRegion , adjustedPageOffsetForContainingBlock);1628 LayoutUnit endContentSide = cb->endOffsetForContent(containingBlockRegion); 1632 1629 LayoutUnit endContentSideWithMargin = endContentSide + childMarginEnd; 1633 LayoutUnit endOffset = cb->endOffsetForLine(logicalTopPosition, false, containingBlockRegion , adjustedPageOffsetForContainingBlock);1630 LayoutUnit endOffset = cb->endOffsetForLine(logicalTopPosition, false, containingBlockRegion); 1634 1631 if (endOffset > endContentSideWithMargin) 1635 1632 result += childMarginEnd; … … 1659 1656 } 1660 1657 1661 LayoutUnit RenderBox::containingBlockLogicalWidthForContentInRegion(RenderRegion* region , LayoutUnit offsetFromLogicalTopOfFirstPage) const1658 LayoutUnit RenderBox::containingBlockLogicalWidthForContentInRegion(RenderRegion* region) const 1662 1659 { 1663 1660 if (!region) … … 1669 1666 // If it should, the following line should call containingBlockLogicalWidthForContent. 1670 1667 LayoutUnit result = cb->availableLogicalWidth(); 1671 RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(containingBlockRegion , offsetFromLogicalTopOfFirstPage - logicalTop());1668 RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(containingBlockRegion); 1672 1669 if (!boxInfo) 1673 1670 return result; … … 1675 1672 } 1676 1673 1677 LayoutUnit RenderBox::containingBlockAvailableLineWidthInRegion(RenderRegion* region , LayoutUnit offsetFromLogicalTopOfFirstPage) const1674 LayoutUnit RenderBox::containingBlockAvailableLineWidthInRegion(RenderRegion* region) const 1678 1675 { 1679 1676 RenderBlock* cb = containingBlock(); 1680 1677 RenderRegion* containingBlockRegion = 0; 1681 1678 LayoutUnit logicalTopPosition = logicalTop(); 1682 LayoutUnit adjustedPageOffsetForContainingBlock = offsetFromLogicalTopOfFirstPage - logicalTop();1683 1679 if (region) { 1684 LayoutUnit offsetFromLogicalTopOfRegion = region ? region->logicalTopForFlowThreadContent() - offsetFromLogicalTopOfFirstPage : LayoutUnit();1680 LayoutUnit offsetFromLogicalTopOfRegion = region ? region->logicalTopForFlowThreadContent() - offsetFromLogicalTopOfFirstPage() : LayoutUnit(); 1685 1681 logicalTopPosition = max(logicalTopPosition, logicalTopPosition + offsetFromLogicalTopOfRegion); 1686 1682 containingBlockRegion = cb->clampToStartAndEndRegions(region); 1687 1683 } 1688 return cb->availableLogicalWidthForLine(logicalTopPosition, false, containingBlockRegion, a djustedPageOffsetForContainingBlock, availableLogicalHeight(IncludeMarginBorderPadding));1684 return cb->availableLogicalWidthForLine(logicalTopPosition, false, containingBlockRegion, availableLogicalHeight(IncludeMarginBorderPadding)); 1689 1685 } 1690 1686 … … 2082 2078 } 2083 2079 2084 void RenderBox::computeLogicalWidthInRegion(LogicalExtentComputedValues& computedValues, RenderRegion* region , LayoutUnit offsetFromLogicalTopOfFirstPage) const2080 void RenderBox::computeLogicalWidthInRegion(LogicalExtentComputedValues& computedValues, RenderRegion* region) const 2085 2081 { 2086 2082 computedValues.m_extent = logicalWidth(); … … 2092 2088 // FIXME: This calculation is not patched for block-flow yet. 2093 2089 // https://bugs.webkit.org/show_bug.cgi?id=46500 2094 computePositionedLogicalWidth(computedValues, region , offsetFromLogicalTopOfFirstPage);2090 computePositionedLogicalWidth(computedValues, region); 2095 2091 return; 2096 2092 } … … 2119 2115 2120 2116 RenderBlock* cb = containingBlock(); 2121 LayoutUnit containerLogicalWidth = max<LayoutUnit>(0, containingBlockLogicalWidthForContentInRegion(region , offsetFromLogicalTopOfFirstPage));2117 LayoutUnit containerLogicalWidth = max<LayoutUnit>(0, containingBlockLogicalWidthForContentInRegion(region)); 2122 2118 bool hasPerpendicularContainingBlock = cb->isHorizontalWritingMode() != isHorizontalWritingMode(); 2123 2119 … … 2139 2135 if (hasPerpendicularContainingBlock) 2140 2136 containerWidthInInlineDirection = perpendicularContainingBlockLogicalHeight(); 2141 LayoutUnit preferredWidth = computeLogicalWidthInRegionUsing(MainOrPreferredSize, styleToUse->logicalWidth(), containerWidthInInlineDirection, cb, region , offsetFromLogicalTopOfFirstPage);2142 computedValues.m_extent = constrainLogicalWidthInRegionByMinMax(preferredWidth, containerWidthInInlineDirection, cb, region , offsetFromLogicalTopOfFirstPage);2137 LayoutUnit preferredWidth = computeLogicalWidthInRegionUsing(MainOrPreferredSize, styleToUse->logicalWidth(), containerWidthInInlineDirection, cb, region); 2138 computedValues.m_extent = constrainLogicalWidthInRegionByMinMax(preferredWidth, containerWidthInInlineDirection, cb, region); 2143 2139 } 2144 2140 … … 2151 2147 LayoutUnit containerLogicalWidthForAutoMargins = containerLogicalWidth; 2152 2148 if (avoidsFloats() && cb->containsFloats()) 2153 containerLogicalWidthForAutoMargins = containingBlockAvailableLineWidthInRegion(region , offsetFromLogicalTopOfFirstPage);2149 containerLogicalWidthForAutoMargins = containingBlockAvailableLineWidthInRegion(region); 2154 2150 bool hasInvertedDirection = cb->style()->isLeftToRightDirection() != style()->isLeftToRightDirection(); 2155 2151 computeInlineDirectionMargins(cb, containerLogicalWidthForAutoMargins, computedValues.m_extent, … … 2210 2206 2211 2207 LayoutUnit RenderBox::computeLogicalWidthInRegionUsing(SizeType widthType, Length logicalWidth, LayoutUnit availableLogicalWidth, 2212 const RenderBlock* cb, RenderRegion* region , LayoutUnit offsetFromLogicalTopOfFirstPage) const2208 const RenderBlock* cb, RenderRegion* region) const 2213 2209 { 2214 2210 if (!logicalWidth.isIntrinsicOrAuto()) { … … 2225 2221 2226 2222 if (shrinkToAvoidFloats() && cb->containsFloats()) 2227 logicalWidthResult = min(logicalWidthResult, shrinkLogicalWidthToAvoidFloats(marginStart, marginEnd, cb, region , offsetFromLogicalTopOfFirstPage));2223 logicalWidthResult = min(logicalWidthResult, shrinkLogicalWidthToAvoidFloats(marginStart, marginEnd, cb, region)); 2228 2224 2229 2225 if (widthType == MainOrPreferredSize && sizesLogicalWidthToFitContent(widthType)) … … 2353 2349 } 2354 2350 2355 RenderBoxRegionInfo* RenderBox::renderBoxRegionInfo(RenderRegion* region, LayoutUnit offsetFromLogicalTopOfFirstPage,RenderBoxRegionInfoFlags cacheFlag) const2351 RenderBoxRegionInfo* RenderBox::renderBoxRegionInfo(RenderRegion* region, RenderBoxRegionInfoFlags cacheFlag) const 2356 2352 { 2357 2353 // Make sure nobody is trying to call this with a null region. … … 2373 2369 2374 2370 LogicalExtentComputedValues computedValues; 2375 computeLogicalWidthInRegion(computedValues, region , offsetFromLogicalTopOfFirstPage);2371 computeLogicalWidthInRegion(computedValues, region); 2376 2372 2377 2373 // Now determine the insets based off where this object is supposed to be positioned. 2378 2374 RenderBlock* cb = containingBlock(); 2379 2375 RenderRegion* clampedContainingBlockRegion = cb->clampToStartAndEndRegions(region); 2380 RenderBoxRegionInfo* containingBlockInfo = cb->renderBoxRegionInfo(clampedContainingBlockRegion, 2381 offsetFromLogicalTopOfFirstPage - logicalTop()); 2376 RenderBoxRegionInfo* containingBlockInfo = cb->renderBoxRegionInfo(clampedContainingBlockRegion); 2382 2377 LayoutUnit containingBlockLogicalWidth = cb->logicalWidth(); 2383 2378 LayoutUnit containingBlockLogicalWidthInRegion = containingBlockInfo ? containingBlockInfo->logicalWidth() : containingBlockLogicalWidth; … … 2396 2391 2397 2392 if (!isOutOfFlowPositioned() && avoidsFloats() && cb->containsFloats()) { 2398 LayoutUnit startPositionDelta = cb->computeStartPositionDeltaForChildAvoidingFloats(this, marginStartInRegion, region , offsetFromLogicalTopOfFirstPage);2393 LayoutUnit startPositionDelta = cb->computeStartPositionDeltaForChildAvoidingFloats(this, marginStartInRegion, region); 2399 2394 if (cb->style()->isLeftToRightDirection()) 2400 2395 logicalLeftDelta += startPositionDelta; … … 2902 2897 } 2903 2898 2904 LayoutUnit RenderBox::containingBlockLogicalWidthForPositioned(const RenderBoxModelObject* containingBlock, RenderRegion* region, 2905 LayoutUnit offsetFromLogicalTopOfFirstPage, bool checkForPerpendicularWritingMode) const 2899 LayoutUnit RenderBox::containingBlockLogicalWidthForPositioned(const RenderBoxModelObject* containingBlock, RenderRegion* region, bool checkForPerpendicularWritingMode) const 2906 2900 { 2907 2901 // Container for position:fixed is the frame. … … 2925 2919 return toRenderFlowThread(containingBlock)->contentLogicalWidthOfFirstRegion(); 2926 2920 if (isWritingModeRoot()) { 2927 LayoutUnit cbPageOffset = offsetFromLogicalTopOfFirstPage - logicalTop();2921 LayoutUnit cbPageOffset = cb->offsetFromLogicalTopOfFirstPage(); 2928 2922 RenderRegion* cbRegion = cb->regionAtBlockOffset(cbPageOffset); 2929 2923 if (cbRegion) { 2930 2924 cbRegion = cb->clampToStartAndEndRegions(cbRegion); 2931 boxInfo = cb->renderBoxRegionInfo(cbRegion , cbPageOffset);2925 boxInfo = cb->renderBoxRegionInfo(cbRegion); 2932 2926 } 2933 2927 } 2934 2928 } else if (region && flowThread->isHorizontalWritingMode() == containingBlock->isHorizontalWritingMode()) { 2935 2929 RenderRegion* containingBlockRegion = cb->clampToStartAndEndRegions(region); 2936 boxInfo = cb->renderBoxRegionInfo(containingBlockRegion , offsetFromLogicalTopOfFirstPage - logicalTop());2930 boxInfo = cb->renderBoxRegionInfo(containingBlockRegion); 2937 2931 } 2938 2932 return (boxInfo) ? max<LayoutUnit>(0, cb->clientLogicalWidth() - (cb->logicalWidth() - boxInfo->logicalWidth())) : cb->clientLogicalWidth(); … … 2970 2964 2971 2965 if (checkForPerpendicularWritingMode && containingBlock->isHorizontalWritingMode() != isHorizontalWritingMode()) 2972 return containingBlockLogicalWidthForPositioned(containingBlock, 0, 0,false);2966 return containingBlockLogicalWidthForPositioned(containingBlock, 0, false); 2973 2967 2974 2968 if (containingBlock->isBox()) { … … 3015 3009 const RenderBlock* cb = toRenderBlock(curr); 3016 3010 region = cb->clampToStartAndEndRegions(region); 3017 RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(region , region->logicalTopForFlowThreadContent());3011 RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(region); 3018 3012 if (boxInfo) 3019 3013 staticPosition += boxInfo->logicalLeft(); … … 3032 3026 staticPosition -= enclosingBox->logicalWidth(); 3033 3027 if (region && curr->isRenderBlock()) { 3034 3035 3036 RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(region, region->logicalTopForFlowThreadContent());3037 3028 const RenderBlock* cb = toRenderBlock(curr); 3029 region = cb->clampToStartAndEndRegions(region); 3030 RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(region); 3031 if (boxInfo) { 3038 3032 if (curr != containerBlock) 3039 3033 staticPosition -= cb->logicalWidth() - (boxInfo->logicalLeft() + boxInfo->logicalWidth()); … … 3050 3044 } 3051 3045 3052 void RenderBox::computePositionedLogicalWidth(LogicalExtentComputedValues& computedValues, RenderRegion* region , LayoutUnit offsetFromLogicalTopOfFirstPage) const3046 void RenderBox::computePositionedLogicalWidth(LogicalExtentComputedValues& computedValues, RenderRegion* region) const 3053 3047 { 3054 3048 if (isReplaced()) { … … 3079 3073 const RenderBoxModelObject* containerBlock = toRenderBoxModelObject(container()); 3080 3074 3081 const LayoutUnit containerLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock, region , offsetFromLogicalTopOfFirstPage);3075 const LayoutUnit containerLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock, region); 3082 3076 3083 3077 // Use the container block's direction except when calculating the static distance … … 3171 3165 LayoutUnit logicalLeftPos = computedValues.m_position; 3172 3166 const RenderBlock* cb = toRenderBlock(containerBlock); 3173 LayoutUnit cbPageOffset = offsetFromLogicalTopOfFirstPage - logicalTop();3167 LayoutUnit cbPageOffset = cb->offsetFromLogicalTopOfFirstPage(); 3174 3168 RenderRegion* cbRegion = cb->regionAtBlockOffset(cbPageOffset); 3175 3169 if (cbRegion) { 3176 3170 cbRegion = cb->clampToStartAndEndRegions(cbRegion); 3177 RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(cbRegion , cbPageOffset);3171 RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(cbRegion); 3178 3172 if (boxInfo) { 3179 3173 logicalLeftPos += boxInfo->logicalLeft(); … … 3209 3203 LayoutUnit logicalLeftValue = 0; 3210 3204 3211 const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock, 0, 0,false);3205 const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock, 0, false); 3212 3206 3213 3207 bool logicalWidthIsAuto = logicalWidth.isIntrinsicOrAuto(); … … 3494 3488 if (cbRegion) { 3495 3489 cbRegion = cb->clampToStartAndEndRegions(cbRegion); 3496 RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(cbRegion , cbPageOffset);3490 RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(cbRegion); 3497 3491 if (boxInfo) { 3498 3492 logicalTopPos += boxInfo->logicalLeft(); … … 3537 3531 LayoutUnit contentLogicalHeight = logicalHeight - bordersPlusPadding; 3538 3532 3539 const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock, 0, 0,false);3533 const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock, 0, false); 3540 3534 3541 3535 LayoutUnit logicalTopValue = 0; … … 3663 3657 3664 3658 const LayoutUnit containerLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock); 3665 const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock, 0, 0,false);3659 const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock, 0, false); 3666 3660 3667 3661 // To match WinIE, in quirks mode use the parent's 'direction' property … … 3832 3826 3833 3827 const LayoutUnit containerLogicalHeight = containingBlockLogicalHeightForPositioned(containerBlock); 3834 const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock, 0, 0,false);3828 const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock, 0, false); 3835 3829 3836 3830 // Variables to solve. … … 4599 4593 } 4600 4594 4595 LayoutUnit RenderBox::offsetFromLogicalTopOfFirstPage() const 4596 { 4597 LayoutState* layoutState = view()->layoutState(); 4598 if ((layoutState && !layoutState->isPaginated()) || (!layoutState && !flowThreadContainingBlock())) 4599 return 0; 4600 4601 RenderBlock* containerBlock = containingBlock(); 4602 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 4603 } 4604 4601 4605 } // namespace WebCore -
trunk/Source/WebCore/rendering/RenderBox.h
r150312 r150743 83 83 LayoutUnit logicalHeight() const { return style()->isHorizontalWritingMode() ? height() : width(); } 84 84 85 LayoutUnit constrainLogicalWidthInRegionByMinMax(LayoutUnit, LayoutUnit, RenderBlock*, RenderRegion* = 0 , LayoutUnit offsetFromLogicalTopOfFirstPage = 0) const;85 LayoutUnit constrainLogicalWidthInRegionByMinMax(LayoutUnit, LayoutUnit, RenderBlock*, RenderRegion* = 0) const; 86 86 LayoutUnit constrainLogicalHeightByMinMax(LayoutUnit) const; 87 87 LayoutUnit constrainContentBoxLogicalHeightByMinMax(LayoutUnit) const; … … 361 361 362 362 enum RenderBoxRegionInfoFlags { CacheRenderBoxRegionInfo, DoNotCacheRenderBoxRegionInfo }; 363 LayoutRect borderBoxRectInRegion(RenderRegion*, LayoutUnit offsetFromLogicalTopOfFirstPage = 0,RenderBoxRegionInfoFlags = CacheRenderBoxRegionInfo) const;363 LayoutRect borderBoxRectInRegion(RenderRegion*, RenderBoxRegionInfoFlags = CacheRenderBoxRegionInfo) const; 364 364 void clearRenderBoxRegionInfo(); 365 virtual LayoutUnit offsetFromLogicalTopOfFirstPage() const; 365 366 366 367 void positionLineBox(InlineBox*); … … 384 385 LayoutUnit containingBlockLogicalHeightForContent(AvailableLogicalHeightType) const; 385 386 386 LayoutUnit containingBlockLogicalWidthForContentInRegion(RenderRegion* , LayoutUnit offsetFromLogicalTopOfFirstPage) const;387 LayoutUnit containingBlockAvailableLineWidthInRegion(RenderRegion* , LayoutUnit offsetFromLogicalTopOfFirstPage) const;387 LayoutUnit containingBlockLogicalWidthForContentInRegion(RenderRegion*) const; 388 LayoutUnit containingBlockAvailableLineWidthInRegion(RenderRegion*) const; 388 389 LayoutUnit perpendicularContainingBlockLogicalHeight() const; 389 390 … … 392 393 virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const; 393 394 394 RenderBoxRegionInfo* renderBoxRegionInfo(RenderRegion*, LayoutUnit offsetFromLogicalTopOfFirstPage,RenderBoxRegionInfoFlags = CacheRenderBoxRegionInfo) const;395 void computeLogicalWidthInRegion(LogicalExtentComputedValues&, RenderRegion* = 0 , LayoutUnit offsetFromLogicalTopOfFirstPage = 0) const;395 RenderBoxRegionInfo* renderBoxRegionInfo(RenderRegion*, RenderBoxRegionInfoFlags = CacheRenderBoxRegionInfo) const; 396 void computeLogicalWidthInRegion(LogicalExtentComputedValues&, RenderRegion* = 0) const; 396 397 397 398 bool stretchesToViewport() const … … 408 409 bool sizesLogicalWidthToFitContent(SizeType) const; 409 410 410 LayoutUnit shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStart, LayoutUnit childMarginEnd, const RenderBlock* cb, RenderRegion* , LayoutUnit offsetFromLogicalTopOfFirstPage) const;411 412 LayoutUnit computeLogicalWidthInRegionUsing(SizeType, Length logicalWidth, LayoutUnit availableLogicalWidth, const RenderBlock* containingBlock, RenderRegion* , LayoutUnit offsetFromLogicalTopOfFirstPage) const;411 LayoutUnit shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStart, LayoutUnit childMarginEnd, const RenderBlock* cb, RenderRegion*) const; 412 413 LayoutUnit computeLogicalWidthInRegionUsing(SizeType, Length logicalWidth, LayoutUnit availableLogicalWidth, const RenderBlock* containingBlock, RenderRegion*) const; 413 414 LayoutUnit computeLogicalHeightUsing(const Length& height) const; 414 415 LayoutUnit computeContentLogicalHeight(const Length& height) const; … … 608 609 #endif 609 610 610 void computePositionedLogicalWidth(LogicalExtentComputedValues&, RenderRegion* = 0 , LayoutUnit offsetFromLogicalTopOfFirstPage = 0) const;611 void computePositionedLogicalWidth(LogicalExtentComputedValues&, RenderRegion* = 0) const; 611 612 612 613 LayoutUnit computeIntrinsicLogicalWidthUsing(Length logicalWidthLength, LayoutUnit availableLogicalWidth, LayoutUnit borderAndPadding) const; … … 637 638 bool skipContainingBlockForPercentHeightCalculation(const RenderBox* containingBlock) const; 638 639 639 LayoutUnit containingBlockLogicalWidthForPositioned(const RenderBoxModelObject* containingBlock, RenderRegion* = 0, 640 LayoutUnit offsetFromLogicalTopOfFirstPage = 0, bool checkForPerpendicularWritingMode = true) const; 640 LayoutUnit containingBlockLogicalWidthForPositioned(const RenderBoxModelObject* containingBlock, RenderRegion* = 0, bool checkForPerpendicularWritingMode = true) const; 641 641 LayoutUnit containingBlockLogicalHeightForPositioned(const RenderBoxModelObject* containingBlock, bool checkForPerpendicularWritingMode = true) const; 642 642 -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r150278 r150743 547 547 return child->computeContentLogicalHeight(size); 548 548 // FIXME: Figure out how this should work for regions and pass in the appropriate values. 549 LayoutUnit offsetFromLogicalTopOfFirstPage = 0;550 549 RenderRegion* region = 0; 551 return child->computeLogicalWidthInRegionUsing(sizeType, size, contentLogicalWidth(), this, region , offsetFromLogicalTopOfFirstPage) - child->borderAndPaddingLogicalWidth();550 return child->computeLogicalWidthInRegionUsing(sizeType, size, contentLogicalWidth(), this, region) - child->borderAndPaddingLogicalWidth(); 552 551 } 553 552 -
trunk/Source/WebCore/rendering/RenderFlowThread.cpp
r150427 r150743 433 433 if (boxModelObject.isBox()) { 434 434 // Use borderBoxRectInRegion to account for variations such as percentage margins. 435 LayoutRect borderBoxRect = toRenderBox(&boxModelObject)->borderBoxRectInRegion(startRegion, 0,RenderBox::DoNotCacheRenderBoxRegionInfo);435 LayoutRect borderBoxRect = toRenderBox(&boxModelObject)->borderBoxRectInRegion(startRegion, RenderBox::DoNotCacheRenderBoxRegionInfo); 436 436 referencePoint.move(borderBoxRect.location().x(), 0); 437 437 } … … 570 570 } 571 571 572 bool RenderFlowThread::logicalWidthChangedInRegions (const RenderBlock* block, LayoutUnit offsetFromLogicalTopOfFirstPage)572 bool RenderFlowThread::logicalWidthChangedInRegionsForBlock(const RenderBlock* block) 573 573 { 574 574 if (!hasRegions()) … … 596 596 597 597 LayoutUnit oldLogicalWidth = oldInfo->logicalWidth(); 598 RenderBoxRegionInfo* newInfo = block->renderBoxRegionInfo(region , offsetFromLogicalTopOfFirstPage);598 RenderBoxRegionInfo* newInfo = block->renderBoxRegionInfo(region); 599 599 if (!newInfo || newInfo->logicalWidth() != oldLogicalWidth) 600 600 return true; … … 1044 1044 } 1045 1045 1046 bool RenderFlowThread::hasCachedOffsetFromLogicalTopOfFirstRegion(const RenderBox* box) const 1047 { 1048 return m_boxesToOffsetMap.contains(box); 1049 } 1050 1051 LayoutUnit RenderFlowThread::cachedOffsetFromLogicalTopOfFirstRegion(const RenderBox* box) const 1052 { 1053 return m_boxesToOffsetMap.get(box); 1054 } 1055 1056 void RenderFlowThread::setOffsetFromLogicalTopOfFirstRegion(const RenderBox* box, LayoutUnit offset) 1057 { 1058 m_boxesToOffsetMap.set(box, offset); 1059 } 1060 1061 void RenderFlowThread::clearOffsetFromLogicalTopOfFirstRegion(const RenderBox* box) 1062 { 1063 ASSERT(m_boxesToOffsetMap.contains(box)); 1064 m_boxesToOffsetMap.remove(box); 1065 } 1066 1067 const RenderBox* RenderFlowThread::currentActiveRenderBox() const 1068 { 1069 const RenderObject* currentObject = m_activeObjectsStack.isEmpty() ? 0 : m_activeObjectsStack.last(); 1070 if (currentObject && currentObject->isBox()) 1071 return toRenderBox(currentObject); 1072 1073 return 0; 1074 } 1075 1076 void RenderFlowThread::pushFlowThreadLayoutState(const RenderObject* object) 1077 { 1078 const RenderBox* currentBoxDescendant = currentActiveRenderBox(); 1079 LayoutState* layoutState = view()->layoutState(); 1080 if (currentBoxDescendant && layoutState && layoutState->isPaginated()) { 1081 ASSERT(layoutState->m_renderer == currentBoxDescendant); 1082 LayoutSize offsetDelta = layoutState->m_layoutOffset - layoutState->m_pageOffset; 1083 setOffsetFromLogicalTopOfFirstRegion(currentBoxDescendant, currentBoxDescendant->isHorizontalWritingMode() ? offsetDelta.height() : offsetDelta.width()); 1084 } 1085 1086 m_activeObjectsStack.add(object); 1087 } 1088 1089 void RenderFlowThread::popFlowThreadLayoutState() 1090 { 1091 m_activeObjectsStack.removeLast(); 1092 1093 const RenderBox* currentBoxDescendant = currentActiveRenderBox(); 1094 LayoutState* layoutState = view()->layoutState(); 1095 if (currentBoxDescendant && layoutState && layoutState->isPaginated()) 1096 clearOffsetFromLogicalTopOfFirstRegion(currentBoxDescendant); 1097 } 1098 1099 LayoutUnit RenderFlowThread::offsetFromLogicalTopOfFirstRegion(const RenderBlock* currentBlock) const 1100 { 1101 // First check if we cached the offset for the block if it's an ancestor containing block of the box 1102 // being currently laid out. 1103 if (hasCachedOffsetFromLogicalTopOfFirstRegion(currentBlock)) 1104 return cachedOffsetFromLogicalTopOfFirstRegion(currentBlock); 1105 1106 // If it's the current box being laid out, use the layout state. 1107 const RenderBox* currentBoxDescendant = currentActiveRenderBox(); 1108 if (currentBlock == currentBoxDescendant) { 1109 LayoutState* layoutState = view()->layoutState(); 1110 ASSERT(layoutState->m_renderer == currentBlock); 1111 ASSERT(layoutState && layoutState->isPaginated()); 1112 LayoutSize offsetDelta = layoutState->m_layoutOffset - layoutState->m_pageOffset; 1113 return currentBoxDescendant->isHorizontalWritingMode() ? offsetDelta.height() : offsetDelta.width(); 1114 } 1115 1116 // As a last resort, take the slow path. 1117 LayoutRect blockRect(0, 0, currentBlock->width(), currentBlock->height()); 1118 while (currentBlock && !currentBlock->isRenderFlowThread()) { 1119 RenderBlock* containerBlock = currentBlock->containingBlock(); 1120 ASSERT(containerBlock); 1121 if (!containerBlock) 1122 return 0; 1123 LayoutPoint currentBlockLocation = currentBlock->location(); 1124 1125 if (containerBlock->style()->writingMode() != currentBlock->style()->writingMode()) { 1126 // We have to put the block rect in container coordinates 1127 // and we have to take into account both the container and current block flipping modes 1128 if (containerBlock->style()->isFlippedBlocksWritingMode()) { 1129 if (containerBlock->isHorizontalWritingMode()) 1130 blockRect.setY(currentBlock->height() - blockRect.maxY()); 1131 else 1132 blockRect.setX(currentBlock->width() - blockRect.maxX()); 1133 } 1134 currentBlock->flipForWritingMode(blockRect); 1135 } 1136 blockRect.moveBy(currentBlockLocation); 1137 currentBlock = containerBlock; 1138 } 1139 1140 return currentBlock->isHorizontalWritingMode() ? blockRect.y() : blockRect.x(); 1141 } 1142 1046 1143 void RenderFlowThread::RegionSearchAdapter::collectIfNeeded(const RegionInterval& interval) 1047 1144 { -
trunk/Source/WebCore/rendering/RenderFlowThread.h
r150383 r150743 116 116 117 117 void removeRenderBoxRegionInfo(RenderBox*); 118 bool logicalWidthChangedInRegions (const RenderBlock*, LayoutUnit offsetFromLogicalTopOfFirstPage);118 bool logicalWidthChangedInRegionsForBlock(const RenderBlock*); 119 119 120 120 LayoutUnit contentLogicalWidthOfFirstRegion() const; … … 163 163 void clearNeedsTwoPhasesLayout() { m_needsTwoPhasesLayout = false; } 164 164 165 void pushFlowThreadLayoutState(const RenderObject*); 166 void popFlowThreadLayoutState(); 167 LayoutUnit offsetFromLogicalTopOfFirstRegion(const RenderBlock*) const; 168 165 169 protected: 166 170 virtual const char* renderName() const = 0; … … 185 189 186 190 virtual void autoGenerateRegionsToBlockOffset(LayoutUnit) { }; 191 192 inline bool hasCachedOffsetFromLogicalTopOfFirstRegion(const RenderBox*) const; 193 inline LayoutUnit cachedOffsetFromLogicalTopOfFirstRegion(const RenderBox*) const; 194 inline void setOffsetFromLogicalTopOfFirstRegion(const RenderBox*, LayoutUnit); 195 inline void clearOffsetFromLogicalTopOfFirstRegion(const RenderBox*); 196 197 inline const RenderBox* currentActiveRenderBox() const; 187 198 188 199 RenderRegionList m_regionList; … … 244 255 RenderObjectToRegionMap m_breakAfterToRegionMap; 245 256 257 typedef ListHashSet<const RenderObject*> RenderObjectStack; 258 RenderObjectStack m_activeObjectsStack; 259 typedef HashMap<const RenderBox*, LayoutUnit> RenderBoxToOffsetMap; 260 RenderBoxToOffsetMap m_boxesToOffsetMap; 261 246 262 unsigned m_autoLogicalHeightRegionsCount; 247 263 -
trunk/Source/WebCore/rendering/RenderTable.cpp
r150355 r150743 267 267 if (shrinkToAvoidFloats() && cb->containsFloats() && !hasPerpendicularContainingBlock) { 268 268 // FIXME: Work with regions someday. 269 availableContentLogicalWidth = shrinkLogicalWidthToAvoidFloats(marginStart, marginEnd, cb, 0 , 0);269 availableContentLogicalWidth = shrinkLogicalWidthToAvoidFloats(marginStart, marginEnd, cb, 0); 270 270 } 271 271 … … 298 298 LayoutUnit containerLogicalWidthForAutoMargins = availableLogicalWidth; 299 299 if (avoidsFloats() && cb->containsFloats()) 300 containerLogicalWidthForAutoMargins = containingBlockAvailableLineWidthInRegion(0 , 0); // FIXME: Work with regions someday.300 containerLogicalWidthForAutoMargins = containingBlockAvailableLineWidthInRegion(0); // FIXME: Work with regions someday. 301 301 ComputedMarginValues marginValues; 302 302 bool hasInvertedDirection = cb->style()->isLeftToRightDirection() == style()->isLeftToRightDirection(); -
trunk/Source/WebCore/rendering/RenderView.cpp
r148921 r150743 1027 1027 ASSERT(m_layoutState == 0); 1028 1028 1029 pushLayoutStateForCurrentFlowThread(root); 1029 1030 m_layoutState = new (renderArena()) LayoutState(root); 1030 1031 } … … 1141 1142 } 1142 1143 1144 void RenderView::pushLayoutStateForCurrentFlowThread(const RenderObject* object) 1145 { 1146 if (!m_flowThreadController) 1147 return; 1148 1149 RenderFlowThread* currentFlowThread = m_flowThreadController->currentRenderFlowThread(); 1150 if (!currentFlowThread) 1151 return; 1152 1153 currentFlowThread->pushFlowThreadLayoutState(object); 1154 } 1155 1156 void RenderView::popLayoutStateForCurrentFlowThread() 1157 { 1158 if (!m_flowThreadController) 1159 return; 1160 1161 RenderFlowThread* currentFlowThread = m_flowThreadController->currentRenderFlowThread(); 1162 if (!currentFlowThread) 1163 return; 1164 1165 currentFlowThread->popFlowThreadLayoutState(); 1166 } 1167 1143 1168 RenderBlock::IntervalArena* RenderView::intervalArena() 1144 1169 { -
trunk/Source/WebCore/rendering/RenderView.h
r150312 r150743 254 254 #endif 255 255 ) { 256 pushLayoutStateForCurrentFlowThread(renderer); 256 257 m_layoutState = new (renderArena()) LayoutState(m_layoutState, renderer, offset, pageHeight, pageHeightChanged, colInfo); 257 258 return true; … … 265 266 m_layoutState = state->m_next; 266 267 state->destroy(renderArena()); 268 popLayoutStateForCurrentFlowThread(); 267 269 } 268 270 … … 283 285 size_t getRetainedWidgets(Vector<RenderWidget*>&); 284 286 void releaseWidgets(Vector<RenderWidget*>&); 287 288 void pushLayoutStateForCurrentFlowThread(const RenderObject*); 289 void popLayoutStateForCurrentFlowThread(); 285 290 286 291 friend class LayoutStateMaintainer;
Note: See TracChangeset
for help on using the changeset viewer.