Changeset 96975 in webkit
- Timestamp:
- Oct 7, 2011 1:15:11 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r96974 r96975 1 2011-10-07 David Hyatt <hyatt@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=69658 4 5 [CSS3 Regions] Box painting of overflow into regions is incorrect because children were being 6 incorrectly clamped to their containing block region ranges. Change the clamping model so that 7 renderRegionForLine no longer does it. A block will now truly have an accurate range across 8 all the regions that paint it. Instead, do the clamping at the time a child box asks the containing 9 block for its information. At that time clamp to the start and end regions, so that we never ask 10 a containing block for info about a region that it doesn't exist in. 11 12 Reviewed by Anders Carlsson. 13 14 * fast/regions/bottom-overflow-out-of-first-region.html: Added. 15 * fast/regions/top-overflow-out-of-second-region.html: 16 * platform/mac/fast/regions/bottom-overflow-out-of-first-region-expected.png: Added. 17 * platform/mac/fast/regions/bottom-overflow-out-of-first-region-expected.txt: Added. 18 * platform/mac/fast/regions/top-overflow-out-of-second-region-expected.png: 19 * platform/mac/fast/regions/top-overflow-out-of-second-region-expected.txt: 20 1 21 2011-10-07 Chang Shu <cshu@webkit.org> 2 22 -
trunk/LayoutTests/fast/regions/top-overflow-out-of-second-region.html
r96842 r96975 22 22 border: 1px solid black; 23 23 content: -webkit-from-flow("flow1"); 24 display:inline-block25 24 } 26 25 … … 35 34 } 36 35 37 #container { margin-top:150px }38 39 36 </style> 40 37 … … 44 41 It is overflowing upwards out of the blue block, and so the portion that overflows should continue to use the blue block's 45 42 containing block width. The blue block does not exist in region one, so using some hypothetical made-up width is incorrect. 46 The overflow should be spilling out of the top of region two . <font color=red>RIGHT NOW THIS TEST HAS INCORRECT RESULTS.</font></p>43 The overflow should be spilling out of the top of region two and be painted in region one. 47 44 48 45 <div id="content"> -
trunk/LayoutTests/platform/mac/fast/regions/top-overflow-out-of-second-region-expected.txt
r96842 r96975 1 1 layer at (0,0) size 800x600 2 2 RenderView at (0,0) size 800x600 3 layer at (0,0) size 800x4 524 RenderBlock {HTML} at (0,0) size 800x4 525 RenderBody {BODY} at (8,16) size 784x 4283 layer at (0,0) size 800x418 4 RenderBlock {HTML} at (0,0) size 800x418 5 RenderBody {BODY} at (8,16) size 784x394 6 6 RenderBlock {P} at (0,0) size 784x72 7 7 RenderText {#text} at (0,0) size 779x72 … … 9 9 text run at (0,18) width 731: "overflowing upwards out of the blue block, and so the portion that overflows should continue to use the blue block's" 10 10 text run at (0,36) width 779: "containing block width. The blue block does not exist in region one, so using some hypothetical made-up width is incorrect." 11 text run at (0,54) width 386: "The overflow should be spilling out of the top of region two. " 12 RenderInline {FONT} at (0,0) size 389x18 [color=#FF0000] 13 RenderText {#text} at (386,54) size 389x18 14 text run at (386,54) width 389: "RIGHT NOW THIS TEST HAS INCORRECT RESULTS." 15 RenderBlock {DIV} at (0,222) size 784x206 16 RenderRegion {DIV} at (0,100) size 302x102 [border: (1px solid #000000)] 17 RenderText {#text} at (302,188) size 4x18 18 text run at (302,188) width 4: " " 19 RenderRegion {DIV} at (306,0) size 402x202 [border: (1px solid #000000)] 20 RenderText {#text} at (708,188) size 4x18 21 text run at (708,188) width 4: " " 22 RenderRegion {DIV} at (712,200) size 2x2 [border: (1px solid #000000)] 23 RenderText {#text} at (0,0) size 0x0 11 text run at (0,54) width 565: "The overflow should be spilling out of the top of region two and be painted in region one." 12 RenderBlock {DIV} at (0,88) size 784x306 13 RenderRegion {DIV} at (0,0) size 302x102 [border: (1px solid #000000)] 14 RenderRegion {DIV} at (0,102) size 402x202 [border: (1px solid #000000)] 15 RenderRegion {DIV} at (0,304) size 2x2 [border: (1px solid #000000)] 24 16 Flow Threads 25 17 Thread with flow-name 'flow1' 26 18 layer at (0,0) size 400x300 27 19 RenderFlowThread at (0,0) size 400x300 28 RenderBlock {DIV} at (0,0) size 400x1 6529 RenderBlock {DIV} at (5,100) size 390x 60[border: (1px solid #0000FF)]30 RenderBlock {DIV} at (48,-99) size 293x1 58[border: (1px solid #008000)]20 RenderBlock {DIV} at (0,0) size 400x177 21 RenderBlock {DIV} at (5,100) size 390x72 [border: (1px solid #0000FF)] 22 RenderBlock {DIV} at (48,-99) size 293x170 [border: (1px solid #008000)] 31 23 RenderBlock {P} at (1,17) size 291x54 32 24 RenderText {#text} at (0,0) size 291x54 … … 35 27 text run at (0,36) width 112: "top of the second " 36 28 text run at (112,36) width 44: "region." 37 RenderBlock {P} at (1, 87) size 291x5429 RenderBlock {P} at (1,99) size 291x54 38 30 RenderText {#text} at (0,0) size 291x54 39 31 text run at (0,0) width 291: "These lines should all fit to the width of the" -
trunk/Source/WebCore/ChangeLog
r96974 r96975 1 2011-10-07 David Hyatt <hyatt@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=69658 4 5 [CSS3 Regions] Box painting of overflow into regions is incorrect because children were being 6 incorrectly clamped to their containing block region ranges. Change the clamping model so that 7 renderRegionForLine no longer does it. A block will now truly have an accurate range across 8 all the regions that paint it. Instead, do the clamping at the time a child box asks the containing 9 block for its information. At that time clamp to the start and end regions, so that we never ask 10 a containing block for info about a region that it doesn't exist in. 11 12 Reviewed by Anders Carlsson. 13 14 Added new test in fast/regions and updated an old result to be correct. 15 16 * rendering/RenderBlock.cpp: 17 (WebCore::RenderBlock::pageLogicalHeightForOffset): 18 (WebCore::RenderBlock::pageRemainingLogicalHeightForOffset): 19 (WebCore::RenderBlock::regionAtBlockOffset): 20 (WebCore::RenderBlock::clampToStartAndEndRegions): 21 * rendering/RenderBlock.h: 22 * rendering/RenderBox.cpp: 23 (WebCore::RenderBox::borderBoxRectInRegion): 24 (WebCore::RenderBox::containingBlockLogicalWidthForContentInRegion): 25 (WebCore::RenderBox::renderBoxRegionInfo): 26 * rendering/RenderFlowThread.cpp: 27 (WebCore::RenderFlowThread::renderRegionForLine): 28 (WebCore::RenderFlowThread::regionLogicalWidthForLine): 29 (WebCore::RenderFlowThread::regionLogicalHeightForLine): 30 (WebCore::RenderFlowThread::regionRemainingLogicalHeightForLine): 31 (WebCore::RenderFlowThread::mapFromFlowToRegion): 32 (WebCore::RenderFlowThread::setRegionRangeForBox): 33 * rendering/RenderFlowThread.h: 34 1 35 2011-10-07 Chang Shu <cshu@webkit.org> 2 36 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r96859 r96975 6229 6229 if (!inRenderFlowThread()) 6230 6230 return renderView->layoutState()->m_pageLogicalHeight; 6231 return enclosingRenderFlowThread()->regionLogicalHeightForLine(offset + offsetFromLogicalTopOfFirstPage() , this);6231 return enclosingRenderFlowThread()->regionLogicalHeightForLine(offset + offsetFromLogicalTopOfFirstPage()); 6232 6232 } 6233 6233 … … 6248 6248 } 6249 6249 6250 return enclosingRenderFlowThread()->regionRemainingLogicalHeightForLine(offset, this,pageBoundaryRule);6250 return enclosingRenderFlowThread()->regionRemainingLogicalHeightForLine(offset, pageBoundaryRule); 6251 6251 } 6252 6252 … … 6442 6442 return 0; 6443 6443 6444 return flowThread->renderRegionForLine(offsetFromLogicalTopOfFirstPage() + blockOffset, t his, true);6444 return flowThread->renderRegionForLine(offsetFromLogicalTopOfFirstPage() + blockOffset, true); 6445 6445 } 6446 6446 … … 6455 6455 6456 6456 return flowThread->logicalWidthChangedInRegions(this, offsetFromLogicalTopOfFirstPage()); 6457 } 6458 6459 RenderRegion* RenderBlock::clampToStartAndEndRegions(RenderRegion* region) const 6460 { 6461 ASSERT(region && inRenderFlowThread()); 6462 6463 // We need to clamp to the block, since we want any lines or blocks that overflow out of the 6464 // logical top or logical bottom of the block to size as though the border box in the first and 6465 // last regions extended infinitely. Otherwise the lines are going to size according to the regions 6466 // they overflow into, which makes no sense when this block doesn't exist in |region| at all. 6467 RenderRegion* startRegion; 6468 RenderRegion* endRegion; 6469 enclosingRenderFlowThread()->getRegionRangeForBox(this, startRegion, endRegion); 6470 6471 if (startRegion && region->offsetFromLogicalTopOfFirstPage() < startRegion->offsetFromLogicalTopOfFirstPage()) 6472 return startRegion; 6473 if (endRegion && region->offsetFromLogicalTopOfFirstPage() > endRegion->offsetFromLogicalTopOfFirstPage()) 6474 return endRegion; 6475 6476 return region; 6457 6477 } 6458 6478 -
trunk/Source/WebCore/rendering/RenderBlock.h
r96859 r96975 897 897 RenderRegion* regionAtBlockOffset(LayoutUnit) const; 898 898 bool logicalWidthChangedInRegions() const; 899 900 public: 901 RenderRegion* clampToStartAndEndRegions(RenderRegion*) const; 899 902 900 903 private: -
trunk/Source/WebCore/rendering/RenderBox.cpp
r96859 r96975 214 214 // Now apply the parent inset since it is cumulative whenever anything in the containing block chain shifts. 215 215 // FIXME: Doesn't work right with perpendicular writing modes. 216 const RenderB ox* currentBox = containingBlock();216 const RenderBlock* currentBox = containingBlock(); 217 217 offsetFromTopOfFirstPage -= logicalTop(); 218 218 RenderBoxRegionInfo* currentBoxInfo = currentBox->renderBoxRegionInfo(region, offsetFromTopOfFirstPage); … … 224 224 offsetFromTopOfFirstPage -= logicalTop(); 225 225 currentBox = currentBox->containingBlock(); 226 region = currentBox->clampToStartAndEndRegions(region); 226 227 currentBoxInfo = currentBox->renderBoxRegionInfo(region, offsetFromTopOfFirstPage); 227 228 } … … 1285 1286 1286 1287 RenderBlock* cb = containingBlock(); 1288 RenderRegion* containingBlockRegion = cb->clampToStartAndEndRegions(region); 1287 1289 if (shrinkToAvoidFloats()) { 1288 1290 LayoutUnit offsetFromLogicalTopOfRegion = region->offsetFromLogicalTopOfFirstPage() - offsetFromLogicalTopOfFirstPage; 1289 return cb->availableLogicalWidthForLine(max(logicalTop(), logicalTop() + offsetFromLogicalTopOfRegion), false, region, offsetFromLogicalTopOfFirstPage - logicalTop());1291 return cb->availableLogicalWidthForLine(max(logicalTop(), logicalTop() + offsetFromLogicalTopOfRegion), false, containingBlockRegion, offsetFromLogicalTopOfFirstPage - logicalTop()); 1290 1292 } 1291 1293 LayoutUnit result = cb->availableLogicalWidth(); 1292 RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo( region, offsetFromLogicalTopOfFirstPage - logicalTop());1294 RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(containingBlockRegion, offsetFromLogicalTopOfFirstPage - logicalTop()); 1293 1295 if (!boxInfo) 1294 1296 return result; … … 1913 1915 logicalLeftOffset += cb->style()->isLeftToRightDirection() ? startPositionDelta : -startPositionDelta; 1914 1916 } 1915 RenderBoxRegionInfo* containingBlockInfo = cb->renderBoxRegionInfo(region, offsetFromLogicalTopOfFirstPage - logicalTop()); 1917 1918 RenderRegion* clampedContainingBlockRegion = cb->clampToStartAndEndRegions(region); 1919 RenderBoxRegionInfo* containingBlockInfo = cb->renderBoxRegionInfo(clampedContainingBlockRegion, offsetFromLogicalTopOfFirstPage - logicalTop()); 1916 1920 bool isShifted = containingBlockInfo && (containingBlockInfo->isShifted() 1917 1921 || (style()->direction() == LTR && logicalLeftOffset) -
trunk/Source/WebCore/rendering/RenderFlowThread.cpp
r96842 r96975 533 533 } 534 534 535 RenderRegion* RenderFlowThread::renderRegionForLine(LayoutUnit position, const RenderBox* box,bool extendLastRegion) const535 RenderRegion* RenderFlowThread::renderRegionForLine(LayoutUnit position, bool extendLastRegion) const 536 536 { 537 537 ASSERT(!m_regionsInvalidated); 538 539 // We need to clamp blockOffset to our border box, since we want any lines or blocks that overflow out of the540 // logical top or logical bottom to size as though the border box in the first and last regions extended infinitely.541 // Otherwise the lines are going to size according to the regions they overflow into, which makes no sense when, for example,542 // the ancestor blocks may not exist in the region either.543 RenderRegion* startRegion;544 RenderRegion* endRegion;545 if (box == this) {546 startRegion = firstRegion();547 endRegion = lastRegion();548 } else // Clamp to our containing block's set of regions.549 getRegionRangeForBox(box->containingBlock(), startRegion, endRegion);550 538 551 539 // If no region matches the position and extendLastRegion is true, it will return … … 555 543 // FIXME: The regions are always in order, optimize this search. 556 544 bool useHorizontalWritingMode = isHorizontalWritingMode(); 557 for (RenderRegionList::const_iterator iter = m_regionList. find(startRegion); iter != m_regionList.end(); ++iter) {545 for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) { 558 546 RenderRegion* region = *iter; 559 547 if (!region->isValid()) … … 570 558 if (extendLastRegion) 571 559 lastValidRegion = region; 572 573 if (region == endRegion)574 break;575 560 } 576 561 … … 578 563 } 579 564 580 LayoutUnit RenderFlowThread::regionLogicalWidthForLine(LayoutUnit position , const RenderBox* box) const581 { 582 RenderRegion* region = renderRegionForLine(position, box,true);565 LayoutUnit RenderFlowThread::regionLogicalWidthForLine(LayoutUnit position) const 566 { 567 RenderRegion* region = renderRegionForLine(position, true); 583 568 if (!region) 584 569 return contentLogicalWidth(); … … 586 571 } 587 572 588 LayoutUnit RenderFlowThread::regionLogicalHeightForLine(LayoutUnit position , const RenderBox* box) const589 { 590 RenderRegion* region = renderRegionForLine(position , box);573 LayoutUnit RenderFlowThread::regionLogicalHeightForLine(LayoutUnit position) const 574 { 575 RenderRegion* region = renderRegionForLine(position); 591 576 if (!region) 592 577 return 0; … … 594 579 } 595 580 596 LayoutUnit RenderFlowThread::regionRemainingLogicalHeightForLine(LayoutUnit position, const RenderBox* box,PageBoundaryRule pageBoundaryRule) const597 { 598 RenderRegion* region = renderRegionForLine(position , box);581 LayoutUnit RenderFlowThread::regionRemainingLogicalHeightForLine(LayoutUnit position, PageBoundaryRule pageBoundaryRule) const 582 { 583 RenderRegion* region = renderRegionForLine(position); 599 584 if (!region) 600 585 return 0; … … 624 609 625 610 LayoutPoint center = boxRect.center(); 626 RenderRegion* renderRegion = renderRegionForLine(isHorizontalWritingMode() ? center.y() : center.x(), t his, true);611 RenderRegion* renderRegion = renderRegionForLine(isHorizontalWritingMode() ? center.y() : center.x(), true); 627 612 if (!renderRegion) 628 613 return 0; … … 762 747 { 763 748 // FIXME: Not right for differing writing-modes. 764 RenderRegion* startRegion = renderRegionForLine(offsetFromLogicalTopOfFirstPage, box,true);765 RenderRegion* endRegion = renderRegionForLine(offsetFromLogicalTopOfFirstPage + box->logicalHeight(), box,true);749 RenderRegion* startRegion = renderRegionForLine(offsetFromLogicalTopOfFirstPage, true); 750 RenderRegion* endRegion = renderRegionForLine(offsetFromLogicalTopOfFirstPage + box->logicalHeight(), true); 766 751 RenderRegionRange* range = m_regionRangeMap.get(box); 767 752 if (range) { -
trunk/Source/WebCore/rendering/RenderFlowThread.h
r96842 r96975 99 99 void repaintRectangleInRegions(const LayoutRect&, bool immediate); 100 100 101 LayoutUnit regionLogicalWidthForLine(LayoutUnit position , const RenderBox*) const;102 LayoutUnit regionLogicalHeightForLine(LayoutUnit position , const RenderBox*) const;103 LayoutUnit regionRemainingLogicalHeightForLine(LayoutUnit position, const RenderBox*,PageBoundaryRule = IncludePageBoundary) const;104 RenderRegion* renderRegionForLine(LayoutUnit position, const RenderBox*,bool extendLastRegion = false) const;101 LayoutUnit regionLogicalWidthForLine(LayoutUnit position) const; 102 LayoutUnit regionLogicalHeightForLine(LayoutUnit position) const; 103 LayoutUnit regionRemainingLogicalHeightForLine(LayoutUnit position, PageBoundaryRule = IncludePageBoundary) const; 104 RenderRegion* renderRegionForLine(LayoutUnit position, bool extendLastRegion = false) const; 105 105 106 106 bool regionsHaveUniformLogicalWidth() const { return m_regionsHaveUniformLogicalWidth; }
Note: See TracChangeset
for help on using the changeset viewer.