Changeset 95750 in webkit
- Timestamp:
- Sep 22, 2011 1:50:41 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 deleted
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r95746 r95750 1 2011-09-22 David Hyatt <hyatt@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=68650 4 5 Make determineStartPosition smart enough to not skip over clean lines that have moved to a new 6 region with a different available content logical width. When this happens, we go ahead and treat 7 the line as dirty. 8 9 Reviewed by Sam Weinig. 10 11 * platform/mac/fast/regions/webkit-flow-floats-inside-regions-bounds-expected.png: 12 * platform/mac/fast/regions/webkit-flow-floats-inside-regions-bounds-expected.txt: 13 * platform/mac/fast/regions/webkit-flow-inlines-inside-regions-bounds-expected.png: 14 * platform/mac/fast/regions/webkit-flow-inlines-inside-regions-bounds-expected.txt: 15 1 16 2011-09-22 Robert Hogan <robert@webkit.org> 2 17 -
trunk/LayoutTests/platform/mac/fast/regions/webkit-flow-floats-inside-regions-bounds-expected.txt
r95741 r95750 24 24 RenderBlock (anonymous) at (1,84) size 266x90 25 25 RenderText {#text} at (0,0) size 266x90 26 text run at (0,0) width 1 66: "This line of text should"27 text run at (0,18) width 194: " not get out of the region. This"28 text run at (0,36) width 194: " line of text should not get out"29 text run at (0,54) width 266: " of the region. This line of text should not"30 text run at (0,72) width 131: "get outof the region."26 text run at (0,0) width 194: "This line of text should not get" 27 text run at (0,18) width 194: "out of the region. This line of" 28 text run at (0,36) width 194: "text should not get out of the" 29 text run at (0,54) width 266: "region. This line of text should not get out" 30 text run at (0,72) width 84: "of the region." 31 31 RenderBlock {P} at (1,190) size 266x0 32 32 RenderBlock {P} at (1,190) size 266x128 -
trunk/LayoutTests/platform/mac/fast/regions/webkit-flow-inlines-inside-regions-bounds-expected.txt
r95741 r95750 12 12 layer at (0,0) size 300x400 13 13 RenderFlowThread at (0,0) size 300x400 14 RenderBlock {DIV} at (0,0) size 300x3 4915 RenderBlock {DIV} at (5,5) size 290x3 39[border: (1px solid #0000FF)]16 RenderBlock {DIV} at (11,11) size 268x3 17[border: (1px solid #008000)]14 RenderBlock {DIV} at (0,0) size 300x385 15 RenderBlock {DIV} at (5,5) size 290x375 [border: (1px solid #0000FF)] 16 RenderBlock {DIV} at (11,11) size 268x353 [border: (1px solid #008000)] 17 17 RenderBlock {P} at (1,17) size 266x121 18 18 RenderText {#text} at (0,0) size 266x121 … … 30 30 text run at (0,54) width 266: "get out of the region. This line of text" 31 31 text run at (0,72) width 201: "should not get out of the region." 32 RenderBlock {P} at (1,264) size 266x36 33 RenderText {#text} at (0,0) size 266x36 34 text run at (0,0) width 266: "This line of text should not get out of the" 35 text run at (0,18) width 44: "region." 32 RenderBlock {P} at (1,264) size 266x72 33 RenderText {#text} at (0,0) size 86x72 34 text run at (0,0) width 86: "This line of" 35 text run at (0,18) width 86: "text should" 36 text run at (0,36) width 86: "not get out of" 37 text run at (0,54) width 67: "the region." 36 38 Regions for flow 'flow1' 37 39 RenderRegion {DIV} #region1 with index 0 -
trunk/Source/WebCore/ChangeLog
r95749 r95750 1 2011-09-22 David Hyatt <hyatt@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=68650 4 5 Make determineStartPosition smart enough to not skip over clean lines that have moved to a new 6 region with a different available content logical width. When this happens, we go ahead and treat 7 the line as dirty. 8 9 Reviewed by Sam Weinig. 10 11 Covered by existing fast/regions tests. 12 13 * rendering/RenderBlock.cpp: 14 (WebCore::RenderBlock::layoutBlock): 15 Disable region fitting if we detect that the regions all have uniform widths. In this case we know 16 the content width can't vary, so there's no reason to waste time worrying about it. 17 18 (WebCore::RenderBlock::computeLogicalLocationForFloat): 19 Pull the content width checking code into computeLogicalLocationForFloat, since we've incorporated 20 region fitting into the fixed offsets now rather than the line functions. 21 22 (WebCore::RenderBlock::positionNewFloats): 23 Changed because more code moved from here into computeLogicalLocationForFloat. 24 25 (WebCore::RenderBlock::adjustForRegionFittingIfNeeded): 26 No changes. Just moved the function above the left offset function. 27 28 (WebCore::RenderBlock::logicalLeftOffsetForContent): 29 (WebCore::RenderBlock::logicalRightOffsetForContent): 30 Added. These new functions give the fixed left and right offsets for lines in a particular region. 31 When no regions are present or when all the regions have a uniform width, they are identical 32 to the versions of the functions that take no arguments. 33 34 (WebCore::RenderBlock::logicalRightOffsetForLine): 35 Changed to no longer do region fitting, since that's built into logicalRightOffsetForContent now. 36 37 (WebCore::RenderBlock::lineWidthForPaginatedLineChanged): 38 New function that takes a root line box and compares its cached old content width with the width 39 available at the line's new location. 40 41 * rendering/RenderBlock.h: 42 (WebCore::RenderBlock::logicalRightOffsetForLine): 43 (WebCore::RenderBlock::logicalLeftOffsetForLine): 44 Modified to call the logicalXXXOffsetForContent functions that take a block direction position. 45 46 (WebCore::RenderBlock::logicalRightOffsetForContent): 47 (WebCore::RenderBlock::logicalLeftOffsetForContent): 48 Added the new functions that take a position so that they can fit to the correct region. 49 50 (WebCore::RenderBlock::availableLogicalWidthForContent): 51 New helper function that calls right - left (similar to the corresponding line function that includes 52 floats). 53 54 * rendering/RenderBlockLineLayout.cpp: 55 (WebCore::RenderBlock::determineStartPosition): 56 Patched to check if a line has moved to a place with a different available content width. If so, the line 57 is dirtied so that line layout can re-run. 58 59 * rendering/RootInlineBox.cpp: 60 (WebCore::RootInlineBox::RootInlineBox): 61 (WebCore::RootInlineBox::alignBoxesInBlockDirection): 62 Sets the paginated line width from the current block logical height. 63 64 * rendering/RootInlineBox.h: 65 (WebCore::RootInlineBox::paginationStrut): 66 (WebCore::RootInlineBox::setPaginationStrut): 67 Fixed paginationStrut to be LayoutUnit instead of int. 68 69 (WebCore::RootInlineBox::paginatedLineWidth): 70 (WebCore::RootInlineBox::setPaginatedLineWidth): 71 Added paginatedLineWidth getter/setter for caching the content width for a given root line. 72 1 73 2011-09-21 Anders Carlsson <andersca@apple.com> 2 74 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r95724 r95750 1219 1219 LayoutStateMaintainer statePusher(renderView, this, locationOffset(), hasColumns() || hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode(), pageLogicalHeight, pageLogicalHeightChanged, colInfo); 1220 1220 1221 bool disableRegionFitting = renderView->hasRenderFlowThread() && (hasColumns() || (isPositioned() && !isRenderFlowThread()) || isFloating()); 1221 bool disableRegionFitting = renderView->hasRenderFlowThread() && (renderView->currentRenderFlowThread()->regionsHaveUniformLogicalWidth() 1222 || hasColumns() || (isPositioned() && !isRenderFlowThread()) || isFloating()); 1222 1223 RegionFittingDisabler regionFittingDisabler(renderView->currentRenderFlowThread(), disableRegionFitting); 1223 1224 … … 3270 3271 } 3271 3272 3272 LayoutPoint RenderBlock::computeLogicalLocationForFloat(const FloatingObject* floatingObject, LayoutUnit logicalTopOffset, 3273 LayoutUnit logicalLeftOffset, LayoutUnit logicalRightOffset, LayoutUnit floatLogicalWidth) const 3273 LayoutPoint RenderBlock::computeLogicalLocationForFloat(const FloatingObject* floatingObject, LayoutUnit logicalTopOffset) const 3274 3274 { 3275 3275 RenderBox* childBox = floatingObject->renderer(); 3276 3276 LayoutUnit logicalRightOffset = logicalRightOffsetForContent(logicalTopOffset); // Constant part of right offset. 3277 LayoutUnit logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset); // Constant part of left offset. 3278 LayoutUnit floatLogicalWidth = logicalWidthForFloat(floatingObject); // The width we look for. 3279 if (logicalRightOffset - logicalLeftOffset < floatLogicalWidth) 3280 floatLogicalWidth = logicalRightOffset - logicalLeftOffset; // Never look for more than what will be available. 3281 3277 3282 LayoutUnit floatLogicalLeft; 3278 3283 … … 3350 3355 LayoutUnit childLogicalLeftMargin = style()->isLeftToRightDirection() ? marginStartForChild(childBox) : marginEndForChild(childBox); 3351 3356 3352 LayoutUnit rightOffset = logicalRightOffsetForContent(); // Constant part of right offset.3353 LayoutUnit leftOffset = logicalLeftOffsetForContent(); // Constant part of left offset.3354 LayoutUnit floatLogicalWidth = logicalWidthForFloat(floatingObject); // The width we look for.3355 if (rightOffset - leftOffset < floatLogicalWidth)3356 floatLogicalWidth = rightOffset - leftOffset; // Never look for more than what will be available.3357 3358 3357 LayoutRect oldRect(childBox->x(), childBox->y() , childBox->width(), childBox->height()); 3359 3358 … … 3363 3362 logicalTop = max(lowestFloatLogicalBottom(FloatingObject::FloatRight), logicalTop); 3364 3363 3365 LayoutPoint floatLogicalLocation = computeLogicalLocationForFloat(floatingObject, logicalTop , leftOffset, rightOffset, floatLogicalWidth);3364 LayoutPoint floatLogicalLocation = computeLogicalLocationForFloat(floatingObject, logicalTop); 3366 3365 3367 3366 setLogicalLeftForFloat(floatingObject, floatLogicalLocation.x()); … … 3391 3390 floatingObject->m_paginationStrut = newLogicalTop - floatLogicalLocation.y(); 3392 3391 3393 floatLogicalLocation = computeLogicalLocationForFloat(floatingObject, newLogicalTop , leftOffset, rightOffset, floatLogicalWidth);3392 floatLogicalLocation = computeLogicalLocationForFloat(floatingObject, newLogicalTop); 3394 3393 setLogicalLeftForFloat(floatingObject, floatLogicalLocation.x()); 3395 3394 setLogicalLeftForChild(childBox, floatLogicalLocation.x() + childLogicalLeftMargin); … … 3539 3538 } 3540 3539 3540 void RenderBlock::adjustForRegionFittingIfNeeded(LayoutUnit logicalTop, LayoutUnit& rightOffset) const 3541 { 3542 RenderView* renderView = view(); 3543 if (!renderView->hasRenderFlowThread()) 3544 return; 3545 3546 RenderFlowThread* flowThread = renderView->currentRenderFlowThread(); 3547 if (!flowThread->isRegionFittingEnabled() || !flowThread->hasValidRegions()) 3548 return; 3549 3550 LayoutUnit regionWidth = flowThread->regionLogicalWidthForLine(logicalPageOffset() + logicalTop); 3551 rightOffset -= flowThread->logicalWidth() - regionWidth; 3552 } 3553 3554 LayoutUnit RenderBlock::logicalLeftOffsetForContent(LayoutUnit) const 3555 { 3556 // FIXME: For now we don't adjust this at all. Eventually when we have RTL blocks or centered blocks, where the left offset 3557 // can shift, then we will have to make an adjustment. 3558 return logicalLeftOffsetForContent(); 3559 } 3560 3561 LayoutUnit RenderBlock::logicalRightOffsetForContent(LayoutUnit position) const 3562 { 3563 LayoutUnit logicalRightOffset = logicalRightOffsetForContent(); 3564 adjustForRegionFittingIfNeeded(position, logicalRightOffset); 3565 return logicalRightOffset; 3566 } 3567 3541 3568 LayoutUnit RenderBlock::logicalLeftOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining) const 3542 3569 { … … 3556 3583 } 3557 3584 3558 void RenderBlock::adjustForRegionFittingIfNeeded(LayoutUnit logicalTop, LayoutUnit& rightOffset) const3559 {3560 RenderView* renderView = view();3561 if (!renderView->hasRenderFlowThread())3562 return;3563 3564 RenderFlowThread* flowThread = renderView->currentRenderFlowThread();3565 if (!flowThread->isRegionFittingEnabled() || !flowThread->hasValidRegions())3566 return;3567 3568 LayoutUnit regionWidth = flowThread->regionLogicalWidthForLine(logicalPageOffset() + logicalTop);3569 rightOffset -= flowThread->logicalWidth() - regionWidth;3570 }3571 3572 3585 LayoutUnit RenderBlock::logicalRightOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining) const 3573 3586 { 3574 3587 LayoutUnit right = fixedOffset; 3575 adjustForRegionFittingIfNeeded(logicalTop, right);3576 3577 3588 if (m_floatingObjects && m_floatingObjects->hasRightObjects()) { 3578 3589 if (heightRemaining) … … 6339 6350 } 6340 6351 6352 bool RenderBlock::lineWidthForPaginatedLineChanged(RootInlineBox* rootBox) const 6353 { 6354 if (!view()->hasRenderFlowThread() || view()->currentRenderFlowThread()->regionsHaveUniformLogicalWidth()) 6355 return false; 6356 6357 return rootBox->paginatedLineWidth() != availableLogicalWidthForContent(rootBox->lineTopWithLeading()); 6358 } 6359 6341 6360 LayoutUnit RenderBlock::collapsedMarginBeforeForChild(RenderBox* child) const 6342 6361 { -
trunk/Source/WebCore/rendering/RenderBlock.h
r95726 r95750 127 127 128 128 LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool firstLine) const; 129 LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool firstLine) const { return logicalRightOffsetForLine(position, logicalRightOffsetForContent( ), firstLine); }130 LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, bool firstLine) const { return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent( ), firstLine); }129 LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool firstLine) const { return logicalRightOffsetForLine(position, logicalRightOffsetForContent(position), firstLine); } 130 LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, bool firstLine) const { return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(position), firstLine); } 131 131 LayoutUnit startOffsetForLine(LayoutUnit position, bool firstLine) const { return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine) : width() - logicalRightOffsetForLine(position, firstLine); } 132 132 LayoutUnit startAlignedOffsetForLine(RenderBox* child, LayoutUnit position, bool firstLine); … … 260 260 virtual void scrollbarsChanged(bool /*horizontalScrollbarChanged*/, bool /*verticalScrollbarChanged*/) { }; 261 261 262 int logicalRightOffsetForContent() const { return isHorizontalWritingMode() ? borderLeft() + paddingLeft() + availableLogicalWidth() : borderTop() + paddingTop() + availableLogicalWidth(); } 263 int logicalLeftOffsetForContent() const { return isHorizontalWritingMode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); } 262 LayoutUnit logicalRightOffsetForContent() const { return isHorizontalWritingMode() ? borderLeft() + paddingLeft() + availableLogicalWidth() : borderTop() + paddingTop() + availableLogicalWidth(); } 263 LayoutUnit logicalLeftOffsetForContent() const { return isHorizontalWritingMode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); } 264 265 LayoutUnit logicalLeftOffsetForContent(LayoutUnit position) const; 266 LayoutUnit logicalRightOffsetForContent(LayoutUnit position) const; 267 LayoutUnit availableLogicalWidthForContent(LayoutUnit position) const { return max(0, logicalRightOffsetForContent(position) - logicalLeftOffsetForContent(position)); } 264 268 265 269 #ifndef NDEBUG … … 556 560 } 557 561 558 LayoutPoint computeLogicalLocationForFloat(const FloatingObject*, LayoutUnit logicalTopOffset, LayoutUnit logicalLeftOffset, 559 LayoutUnit logicalRightOffset, LayoutUnit floatLogicalWidth) const; 562 LayoutPoint computeLogicalLocationForFloat(const FloatingObject*, LayoutUnit logicalTopOffset) const; 560 563 561 564 // The following functions' implementations are in RenderBlockLineLayout.cpp. … … 826 829 LayoutUnit adjustBlockChildForPagination(LayoutUnit logicalTopAfterClear, LayoutUnit estimateWithoutPagination, RenderBox* child, bool atBeforeSideOfBlock); 827 830 831 // This function is called to test a line box that has moved in the block direction to see if it has ended up in a new 832 // region/page/column that has a different available line width than the old one. Used to know when you have to dirty a 833 // line, i.e., that it can't be re-used. 834 bool lineWidthForPaginatedLineChanged(RootInlineBox*) const; 835 828 836 struct FloatingObjectHashFunctions { 829 837 static unsigned hash(FloatingObject* key) { return DefaultHash<RenderBox*>::Hash::hash(key->m_renderer); } -
trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp
r95726 r95750 1236 1236 trailingFloatsLineBox->alignBoxesInBlockDirection(blockLogicalHeight, textBoxDataMap, verticalPositionCache); 1237 1237 trailingFloatsLineBox->setLineTopBottomPositions(blockLogicalHeight, blockLogicalHeight, blockLogicalHeight, blockLogicalHeight); 1238 trailingFloatsLineBox->setPaginatedLineWidth(availableLogicalWidthForContent(blockLogicalHeight)); 1238 1239 IntRect logicalLayoutOverflow(0, blockLogicalHeight, 1, bottomLayoutOverflow - blockLogicalHeight); 1239 1240 IntRect logicalVisualOverflow(0, blockLogicalHeight, 1, bottomVisualOverflow - blockLogicalHeight); … … 1402 1403 for (curr = firstRootBox(); curr && !curr->isDirty(); curr = curr->nextRootBox()) { 1403 1404 if (paginated) { 1405 if (lineWidthForPaginatedLineChanged(curr)) { 1406 curr->markDirty(); 1407 break; 1408 } 1404 1409 paginationDelta -= curr->paginationStrut(); 1405 1410 adjustLinePositionForPagination(curr, paginationDelta); -
trunk/Source/WebCore/rendering/RootInlineBox.cpp
r94710 r95750 52 52 , m_lineBottomWithLeading(0) 53 53 , m_paginationStrut(0) 54 , m_paginatedLineWidth(0) 54 55 , m_baselineType(AlphabeticBaseline) 55 56 , m_hasAnnotationsBefore(false) … … 277 278 278 279 setLineTopBottomPositions(lineTop, lineBottom, heightOfBlock, heightOfBlock + maxHeight); 280 setPaginatedLineWidth(block()->availableLogicalWidthForContent(heightOfBlock)); 279 281 280 282 int annotationsAdjustment = beforeAnnotationsAdjustment(); -
trunk/Source/WebCore/rendering/RootInlineBox.h
r94710 r95750 54 54 LayoutUnit lineBottomWithLeading() const { return m_lineBottomWithLeading; } 55 55 56 int paginationStrut() const { return m_paginationStrut; } 57 void setPaginationStrut(int s) { m_paginationStrut = s; } 56 LayoutUnit paginationStrut() const { return m_paginationStrut; } 57 void setPaginationStrut(LayoutUnit s) { m_paginationStrut = s; } 58 59 LayoutUnit paginatedLineWidth() const { return m_paginatedLineWidth; } 60 void setPaginatedLineWidth(LayoutUnit width) { m_paginatedLineWidth = width; } 58 61 59 62 LayoutUnit selectionTop() const; … … 194 197 LayoutUnit m_lineBottomWithLeading; 195 198 196 int m_paginationStrut; 199 LayoutUnit m_paginationStrut; 200 LayoutUnit m_paginatedLineWidth; 197 201 198 202 // Floats hanging off the line are pushed into this vector during layout. It is only
Note: See TracChangeset
for help on using the changeset viewer.