Title: [96975] trunk
Revision
96975
Author
[email protected]
Date
2011-10-07 13:15:11 -0700 (Fri, 07 Oct 2011)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=69658
        
[CSS3 Regions] Box painting of overflow into regions is incorrect because children were being
incorrectly clamped to their containing block region ranges. Change the clamping model so that
renderRegionForLine no longer does it. A block will now truly have an accurate range across
all the regions that paint it. Instead, do the clamping at the time a child box asks the containing
block for its information. At that time clamp to the start and end regions, so that we never ask
a containing block for info about a region that it doesn't exist in.

Reviewed by Anders Carlsson.

Source/WebCore: 

Added new test in fast/regions and updated an old result to be correct.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::pageLogicalHeightForOffset):
(WebCore::RenderBlock::pageRemainingLogicalHeightForOffset):
(WebCore::RenderBlock::regionAtBlockOffset):
(WebCore::RenderBlock::clampToStartAndEndRegions):
* rendering/RenderBlock.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::borderBoxRectInRegion):
(WebCore::RenderBox::containingBlockLogicalWidthForContentInRegion):
(WebCore::RenderBox::renderBoxRegionInfo):
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::renderRegionForLine):
(WebCore::RenderFlowThread::regionLogicalWidthForLine):
(WebCore::RenderFlowThread::regionLogicalHeightForLine):
(WebCore::RenderFlowThread::regionRemainingLogicalHeightForLine):
(WebCore::RenderFlowThread::mapFromFlowToRegion):
(WebCore::RenderFlowThread::setRegionRangeForBox):
* rendering/RenderFlowThread.h:

LayoutTests: 

* fast/regions/bottom-overflow-out-of-first-region.html: Added.
* fast/regions/top-overflow-out-of-second-region.html:
* platform/mac/fast/regions/bottom-overflow-out-of-first-region-expected.png: Added.
* platform/mac/fast/regions/bottom-overflow-out-of-first-region-expected.txt: Added.
* platform/mac/fast/regions/top-overflow-out-of-second-region-expected.png:
* platform/mac/fast/regions/top-overflow-out-of-second-region-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (96974 => 96975)


--- trunk/LayoutTests/ChangeLog	2011-10-07 20:05:34 UTC (rev 96974)
+++ trunk/LayoutTests/ChangeLog	2011-10-07 20:15:11 UTC (rev 96975)
@@ -1,3 +1,23 @@
+2011-10-07  David Hyatt  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=69658
+        
+        [CSS3 Regions] Box painting of overflow into regions is incorrect because children were being
+        incorrectly clamped to their containing block region ranges. Change the clamping model so that
+        renderRegionForLine no longer does it. A block will now truly have an accurate range across
+        all the regions that paint it. Instead, do the clamping at the time a child box asks the containing
+        block for its information. At that time clamp to the start and end regions, so that we never ask
+        a containing block for info about a region that it doesn't exist in.
+
+        Reviewed by Anders Carlsson.
+
+        * fast/regions/bottom-overflow-out-of-first-region.html: Added.
+        * fast/regions/top-overflow-out-of-second-region.html:
+        * platform/mac/fast/regions/bottom-overflow-out-of-first-region-expected.png: Added.
+        * platform/mac/fast/regions/bottom-overflow-out-of-first-region-expected.txt: Added.
+        * platform/mac/fast/regions/top-overflow-out-of-second-region-expected.png:
+        * platform/mac/fast/regions/top-overflow-out-of-second-region-expected.txt:
+
 2011-10-07  Chang Shu  <[email protected]>
 
         Remove compile time flag ENABLE_PASSWORD_ECHO

Added: trunk/LayoutTests/fast/regions/bottom-overflow-out-of-first-region.html (0 => 96975)


--- trunk/LayoutTests/fast/regions/bottom-overflow-out-of-first-region.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/bottom-overflow-out-of-first-region.html	2011-10-07 20:15:11 UTC (rev 96975)
@@ -0,0 +1,62 @@
+<!doctype html>
+
+ <style>
+    #content {
+        -webkit-flow: "flow1";
+        text-align: justify;
+        padding: 5px;
+    }
+    
+    #first-box {
+        border: 1px solid blue;
+        height:188px;
+    }
+    
+    #second-box {
+        margin:auto;
+        border: 1px solid green;
+        width:75%
+    }
+    
+    #region1, #region2, #region3 {
+        border: 1px solid black;
+        content: -webkit-from-flow("flow1");
+    }
+
+    #region1 {
+        width: 400px;
+        height: 200px;
+    }
+    
+    #region2 {
+        width: 300px;
+        height: 100px;
+    }
+
+</style>
+
+<body>
+
+<p>In the test case below, the green block's width should not vary and should use the first region to determine its width.
+It is overflowing downwards out of the blue block, and so the portion that overflows should continue to use the blue block's
+containing block width. The blue block does not exist in region two, so using some hypothetical made-up width is incorrect.
+The overflow should be spilling out of the top of region one and be painted in region two. 
+
+<div id="content">
+    <div id="first-box">
+        <div id="second-box">
+            <p>These lines should all fit to the width of the block in the first region and spill out of the bottom of the first
+            region.</P>
+             <p>These lines should all fit to the width of the block in the first region and spill out of the bottom of the first
+            region.</P>
+             <p>These lines should all fit to the width of the block in the first region and spill out of the bottom of the first
+            region.</P>
+        </div>
+    </div>
+</div>
+
+<div id="container">
+    <div id="region1"></div>
+    <div id="region2"></div>
+    <div id="region3"></div>
+</div>

Modified: trunk/LayoutTests/fast/regions/top-overflow-out-of-second-region.html (96974 => 96975)


--- trunk/LayoutTests/fast/regions/top-overflow-out-of-second-region.html	2011-10-07 20:05:34 UTC (rev 96974)
+++ trunk/LayoutTests/fast/regions/top-overflow-out-of-second-region.html	2011-10-07 20:15:11 UTC (rev 96975)
@@ -21,7 +21,6 @@
     #region1, #region2, #region3 {
         border: 1px solid black;
         content: -webkit-from-flow("flow1");
-        display:inline-block
     }
 
     #region1 {
@@ -34,8 +33,6 @@
         height: 200px;
     }
 
-    #container { margin-top:150px }
-
 </style>
 
 <body>
@@ -43,7 +40,7 @@
 <p>In the test case below, the green block's width should not vary and should use the second region to determine its width.
 It is overflowing upwards out of the blue block, and so the portion that overflows should continue to use the blue block's
 containing block width. The blue block does not exist in region one, so using some hypothetical made-up width is incorrect.
-The overflow should be spilling out of the top of region two. <font color=red>RIGHT NOW THIS TEST HAS INCORRECT RESULTS.</font></p>
+The overflow should be spilling out of the top of region two and be painted in region one. 
 
 <div id="content">
     <div id="first-box">

Added: trunk/LayoutTests/platform/mac/fast/regions/bottom-overflow-out-of-first-region-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/fast/regions/bottom-overflow-out-of-first-region-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/fast/regions/bottom-overflow-out-of-first-region-expected.txt (0 => 96975)


--- trunk/LayoutTests/platform/mac/fast/regions/bottom-overflow-out-of-first-region-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/regions/bottom-overflow-out-of-first-region-expected.txt	2011-10-07 20:15:11 UTC (rev 96975)
@@ -0,0 +1,44 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x418
+  RenderBlock {HTML} at (0,0) size 800x418
+    RenderBody {BODY} at (8,16) size 784x394
+      RenderBlock {P} at (0,0) size 784x72
+        RenderText {#text} at (0,0) size 780x72
+          text run at (0,0) width 755: "In the test case below, the green block's width should not vary and should use the first region to determine its width. It is"
+          text run at (0,18) width 751: "overflowing downwards out of the blue block, and so the portion that overflows should continue to use the blue block's"
+          text run at (0,36) width 780: "containing block width. The blue block does not exist in region two, so using some hypothetical made-up width is incorrect."
+          text run at (0,54) width 565: "The overflow should be spilling out of the top of region one and be painted in region two."
+      RenderBlock {DIV} at (0,88) size 784x306
+        RenderRegion {DIV} at (0,0) size 402x202 [border: (1px solid #000000)]
+        RenderRegion {DIV} at (0,202) size 302x102 [border: (1px solid #000000)]
+        RenderRegion {DIV} at (0,304) size 2x2 [border: (1px solid #000000)]
+Flow Threads
+  Thread with flow-name 'flow1'
+    layer at (0,0) size 400x300
+      RenderFlowThread at (0,0) size 400x300
+        RenderBlock {DIV} at (0,0) size 400x200
+          RenderBlock {DIV} at (5,5) size 390x190 [border: (1px solid #0000FF)]
+            RenderBlock {DIV} at (48,1) size 293x229 [border: (1px solid #008000)]
+              RenderBlock {P} at (1,17) size 291x54
+                RenderText {#text} at (0,0) size 291x54
+                  text run at (0,0) width 291: "These lines should all fit to the width of the"
+                  text run at (0,18) width 291: "block in the first region and spill out of the"
+                  text run at (0,36) width 116: "bottom of the first "
+                  text run at (116,36) width 44: "region."
+              RenderBlock {P} at (1,87) size 291x54
+                RenderText {#text} at (0,0) size 291x54
+                  text run at (0,0) width 291: "These lines should all fit to the width of the"
+                  text run at (0,18) width 291: "block in the first region and spill out of the"
+                  text run at (0,36) width 116: "bottom of the first "
+                  text run at (116,36) width 44: "region."
+              RenderBlock {P} at (1,157) size 291x55
+                RenderText {#text} at (0,0) size 291x55
+                  text run at (0,0) width 291: "These lines should all fit to the width of the"
+                  text run at (0,18) width 291: "block in the first region and spill out of the"
+                  text run at (0,37) width 116: "bottom of the first "
+                  text run at (116,37) width 44: "region."
+  Regions for flow 'flow1'
+    RenderRegion {DIV} #region1 with index 0
+    RenderRegion {DIV} #region2 with index 0
+    RenderRegion {DIV} #region3 with index 0

Modified: trunk/LayoutTests/platform/mac/fast/regions/top-overflow-out-of-second-region-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/mac/fast/regions/top-overflow-out-of-second-region-expected.txt (96974 => 96975)


--- trunk/LayoutTests/platform/mac/fast/regions/top-overflow-out-of-second-region-expected.txt	2011-10-07 20:05:34 UTC (rev 96974)
+++ trunk/LayoutTests/platform/mac/fast/regions/top-overflow-out-of-second-region-expected.txt	2011-10-07 20:15:11 UTC (rev 96975)
@@ -1,40 +1,32 @@
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
-layer at (0,0) size 800x452
-  RenderBlock {HTML} at (0,0) size 800x452
-    RenderBody {BODY} at (8,16) size 784x428
+layer at (0,0) size 800x418
+  RenderBlock {HTML} at (0,0) size 800x418
+    RenderBody {BODY} at (8,16) size 784x394
       RenderBlock {P} at (0,0) size 784x72
         RenderText {#text} at (0,0) size 779x72
           text run at (0,0) width 775: "In the test case below, the green block's width should not vary and should use the second region to determine its width. It is"
           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"
           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."
-          text run at (0,54) width 386: "The overflow should be spilling out of the top of region two. "
-        RenderInline {FONT} at (0,0) size 389x18 [color=#FF0000]
-          RenderText {#text} at (386,54) size 389x18
-            text run at (386,54) width 389: "RIGHT NOW THIS TEST HAS INCORRECT RESULTS."
-      RenderBlock {DIV} at (0,222) size 784x206
-        RenderRegion {DIV} at (0,100) size 302x102 [border: (1px solid #000000)]
-        RenderText {#text} at (302,188) size 4x18
-          text run at (302,188) width 4: " "
-        RenderRegion {DIV} at (306,0) size 402x202 [border: (1px solid #000000)]
-        RenderText {#text} at (708,188) size 4x18
-          text run at (708,188) width 4: " "
-        RenderRegion {DIV} at (712,200) size 2x2 [border: (1px solid #000000)]
-        RenderText {#text} at (0,0) size 0x0
+          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."
+      RenderBlock {DIV} at (0,88) size 784x306
+        RenderRegion {DIV} at (0,0) size 302x102 [border: (1px solid #000000)]
+        RenderRegion {DIV} at (0,102) size 402x202 [border: (1px solid #000000)]
+        RenderRegion {DIV} at (0,304) size 2x2 [border: (1px solid #000000)]
 Flow Threads
   Thread with flow-name 'flow1'
     layer at (0,0) size 400x300
       RenderFlowThread at (0,0) size 400x300
-        RenderBlock {DIV} at (0,0) size 400x165
-          RenderBlock {DIV} at (5,100) size 390x60 [border: (1px solid #0000FF)]
-            RenderBlock {DIV} at (48,-99) size 293x158 [border: (1px solid #008000)]
+        RenderBlock {DIV} at (0,0) size 400x177
+          RenderBlock {DIV} at (5,100) size 390x72 [border: (1px solid #0000FF)]
+            RenderBlock {DIV} at (48,-99) size 293x170 [border: (1px solid #008000)]
               RenderBlock {P} at (1,17) size 291x54
                 RenderText {#text} at (0,0) size 291x54
                   text run at (0,0) width 291: "These lines should all fit to the width of the"
                   text run at (0,18) width 291: "block in the second region and spill out of the"
                   text run at (0,36) width 112: "top of the second "
                   text run at (112,36) width 44: "region."
-              RenderBlock {P} at (1,87) size 291x54
+              RenderBlock {P} at (1,99) size 291x54
                 RenderText {#text} at (0,0) size 291x54
                   text run at (0,0) width 291: "These lines should all fit to the width of the"
                   text run at (0,18) width 291: "block in the second region and spill out of the"

Modified: trunk/Source/WebCore/ChangeLog (96974 => 96975)


--- trunk/Source/WebCore/ChangeLog	2011-10-07 20:05:34 UTC (rev 96974)
+++ trunk/Source/WebCore/ChangeLog	2011-10-07 20:15:11 UTC (rev 96975)
@@ -1,3 +1,37 @@
+2011-10-07  David Hyatt  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=69658
+        
+        [CSS3 Regions] Box painting of overflow into regions is incorrect because children were being
+        incorrectly clamped to their containing block region ranges. Change the clamping model so that
+        renderRegionForLine no longer does it. A block will now truly have an accurate range across
+        all the regions that paint it. Instead, do the clamping at the time a child box asks the containing
+        block for its information. At that time clamp to the start and end regions, so that we never ask
+        a containing block for info about a region that it doesn't exist in.
+
+        Reviewed by Anders Carlsson.
+
+        Added new test in fast/regions and updated an old result to be correct.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::pageLogicalHeightForOffset):
+        (WebCore::RenderBlock::pageRemainingLogicalHeightForOffset):
+        (WebCore::RenderBlock::regionAtBlockOffset):
+        (WebCore::RenderBlock::clampToStartAndEndRegions):
+        * rendering/RenderBlock.h:
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::borderBoxRectInRegion):
+        (WebCore::RenderBox::containingBlockLogicalWidthForContentInRegion):
+        (WebCore::RenderBox::renderBoxRegionInfo):
+        * rendering/RenderFlowThread.cpp:
+        (WebCore::RenderFlowThread::renderRegionForLine):
+        (WebCore::RenderFlowThread::regionLogicalWidthForLine):
+        (WebCore::RenderFlowThread::regionLogicalHeightForLine):
+        (WebCore::RenderFlowThread::regionRemainingLogicalHeightForLine):
+        (WebCore::RenderFlowThread::mapFromFlowToRegion):
+        (WebCore::RenderFlowThread::setRegionRangeForBox):
+        * rendering/RenderFlowThread.h:
+
 2011-10-07  Chang Shu  <[email protected]>
 
         Remove compile time flag ENABLE_PASSWORD_ECHO

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (96974 => 96975)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-10-07 20:05:34 UTC (rev 96974)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-10-07 20:15:11 UTC (rev 96975)
@@ -6228,7 +6228,7 @@
     RenderView* renderView = view();
     if (!inRenderFlowThread())
         return renderView->layoutState()->m_pageLogicalHeight;
-    return enclosingRenderFlowThread()->regionLogicalHeightForLine(offset + offsetFromLogicalTopOfFirstPage(), this);
+    return enclosingRenderFlowThread()->regionLogicalHeightForLine(offset + offsetFromLogicalTopOfFirstPage());
 }
 
 LayoutUnit RenderBlock::pageRemainingLogicalHeightForOffset(LayoutUnit offset, PageBoundaryRule pageBoundaryRule) const
@@ -6247,7 +6247,7 @@
         return remainingHeight;
     }
     
-    return enclosingRenderFlowThread()->regionRemainingLogicalHeightForLine(offset, this, pageBoundaryRule);
+    return enclosingRenderFlowThread()->regionRemainingLogicalHeightForLine(offset, pageBoundaryRule);
 }
 
 LayoutUnit RenderBlock::adjustForUnsplittableChild(RenderBox* child, LayoutUnit logicalOffset, bool includeMargins)
@@ -6441,7 +6441,7 @@
     if (!flowThread || !flowThread->hasValidRegions())
         return 0;
 
-    return flowThread->renderRegionForLine(offsetFromLogicalTopOfFirstPage() + blockOffset, this, true);
+    return flowThread->renderRegionForLine(offsetFromLogicalTopOfFirstPage() + blockOffset, true);
 }
 
 bool RenderBlock::logicalWidthChangedInRegions() const
@@ -6456,6 +6456,26 @@
     return flowThread->logicalWidthChangedInRegions(this, offsetFromLogicalTopOfFirstPage());
 }
 
+RenderRegion* RenderBlock::clampToStartAndEndRegions(RenderRegion* region) const
+{
+    ASSERT(region && inRenderFlowThread());
+    
+    // We need to clamp to the block, since we want any lines or blocks that overflow out of the
+    // logical top or logical bottom of the block to size as though the border box in the first and
+    // last regions extended infinitely. Otherwise the lines are going to size according to the regions
+    // they overflow into, which makes no sense when this block doesn't exist in |region| at all.
+    RenderRegion* startRegion;
+    RenderRegion* endRegion;
+    enclosingRenderFlowThread()->getRegionRangeForBox(this, startRegion, endRegion);
+    
+    if (startRegion && region->offsetFromLogicalTopOfFirstPage() < startRegion->offsetFromLogicalTopOfFirstPage())
+        return startRegion;
+    if (endRegion && region->offsetFromLogicalTopOfFirstPage() > endRegion->offsetFromLogicalTopOfFirstPage())
+        return endRegion;
+    
+    return region;
+}
+
 LayoutUnit RenderBlock::collapsedMarginBeforeForChild(const RenderBox* child) const
 {
     // If the child has the same directionality as we do, then we can just return its

Modified: trunk/Source/WebCore/rendering/RenderBlock.h (96974 => 96975)


--- trunk/Source/WebCore/rendering/RenderBlock.h	2011-10-07 20:05:34 UTC (rev 96974)
+++ trunk/Source/WebCore/rendering/RenderBlock.h	2011-10-07 20:15:11 UTC (rev 96975)
@@ -896,6 +896,9 @@
 
     RenderRegion* regionAtBlockOffset(LayoutUnit) const;
     bool logicalWidthChangedInRegions() const;
+    
+public:
+    RenderRegion* clampToStartAndEndRegions(RenderRegion*) const;
 
 private:
     struct FloatingObjectHashFunctions {

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (96974 => 96975)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2011-10-07 20:05:34 UTC (rev 96974)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2011-10-07 20:15:11 UTC (rev 96975)
@@ -213,7 +213,7 @@
         
     // Now apply the parent inset since it is cumulative whenever anything in the containing block chain shifts.
     // FIXME: Doesn't work right with perpendicular writing modes.
-    const RenderBox* currentBox = containingBlock();
+    const RenderBlock* currentBox = containingBlock();
     offsetFromTopOfFirstPage -= logicalTop();
     RenderBoxRegionInfo* currentBoxInfo = currentBox->renderBoxRegionInfo(region, offsetFromTopOfFirstPage);
     while (currentBoxInfo && currentBoxInfo->isShifted()) {
@@ -223,6 +223,7 @@
             logicalLeft -= (currentBox->logicalWidth() - currentBoxInfo->logicalWidth()) - currentBoxInfo->logicalLeft();
         offsetFromTopOfFirstPage -= logicalTop();
         currentBox = currentBox->containingBlock();
+        region = currentBox->clampToStartAndEndRegions(region);
         currentBoxInfo = currentBox->renderBoxRegionInfo(region, offsetFromTopOfFirstPage);
     }
     
@@ -1284,12 +1285,13 @@
         return containingBlockLogicalWidthForContent();
 
     RenderBlock* cb = containingBlock();
+    RenderRegion* containingBlockRegion = cb->clampToStartAndEndRegions(region);
     if (shrinkToAvoidFloats()) {
         LayoutUnit offsetFromLogicalTopOfRegion = region->offsetFromLogicalTopOfFirstPage() - offsetFromLogicalTopOfFirstPage;
-        return cb->availableLogicalWidthForLine(max(logicalTop(), logicalTop() + offsetFromLogicalTopOfRegion), false, region, offsetFromLogicalTopOfFirstPage - logicalTop());
+        return cb->availableLogicalWidthForLine(max(logicalTop(), logicalTop() + offsetFromLogicalTopOfRegion), false, containingBlockRegion, offsetFromLogicalTopOfFirstPage - logicalTop());
     }
     LayoutUnit result = cb->availableLogicalWidth();
-    RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(region, offsetFromLogicalTopOfFirstPage - logicalTop());
+    RenderBoxRegionInfo* boxInfo = cb->renderBoxRegionInfo(containingBlockRegion, offsetFromLogicalTopOfFirstPage - logicalTop());
     if (!boxInfo)
         return result;
     return max(0, result - (cb->logicalWidth() - boxInfo->logicalWidth()));
@@ -1912,7 +1914,9 @@
             region, offsetFromLogicalTopOfFirstPage);
         logicalLeftOffset += cb->style()->isLeftToRightDirection() ? startPositionDelta : -startPositionDelta;
     }
-    RenderBoxRegionInfo* containingBlockInfo = cb->renderBoxRegionInfo(region, offsetFromLogicalTopOfFirstPage - logicalTop());
+    
+    RenderRegion* clampedContainingBlockRegion = cb->clampToStartAndEndRegions(region);
+    RenderBoxRegionInfo* containingBlockInfo = cb->renderBoxRegionInfo(clampedContainingBlockRegion, offsetFromLogicalTopOfFirstPage - logicalTop());
     bool isShifted = containingBlockInfo && (containingBlockInfo->isShifted()
         || (style()->direction() == LTR && logicalLeftOffset)
         || (style()->direction() == RTL && (logicalWidth() - (logicalLeftOffset + logicalWidthInRegion))));

Modified: trunk/Source/WebCore/rendering/RenderFlowThread.cpp (96974 => 96975)


--- trunk/Source/WebCore/rendering/RenderFlowThread.cpp	2011-10-07 20:05:34 UTC (rev 96974)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.cpp	2011-10-07 20:15:11 UTC (rev 96975)
@@ -532,21 +532,9 @@
     }
 }
 
-RenderRegion* RenderFlowThread::renderRegionForLine(LayoutUnit position, const RenderBox* box, bool extendLastRegion) const
+RenderRegion* RenderFlowThread::renderRegionForLine(LayoutUnit position, bool extendLastRegion) const
 {
     ASSERT(!m_regionsInvalidated);
-    
-    // We need to clamp blockOffset to our border box, since we want any lines or blocks that overflow out of the
-    // logical top or logical bottom to size as though the border box in the first and last regions extended infinitely.
-    // Otherwise the lines are going to size according to the regions they overflow into, which makes no sense when, for example,
-    // the ancestor blocks may not exist in the region either.
-    RenderRegion* startRegion;
-    RenderRegion* endRegion;
-    if (box == this) {
-        startRegion = firstRegion();
-        endRegion = lastRegion();
-    } else // Clamp to our containing block's set of regions.
-        getRegionRangeForBox(box->containingBlock(), startRegion, endRegion);
 
     // If no region matches the position and extendLastRegion is true, it will return
     // the last valid region. It is similar to auto extending the size of the last region. 
@@ -554,7 +542,7 @@
     
     // FIXME: The regions are always in order, optimize this search.
     bool useHorizontalWritingMode = isHorizontalWritingMode();
-    for (RenderRegionList::const_iterator iter = m_regionList.find(startRegion); iter != m_regionList.end(); ++iter) {
+    for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) {
         RenderRegion* region = *iter;
         if (!region->isValid())
             continue;
@@ -569,33 +557,30 @@
 
         if (extendLastRegion)
             lastValidRegion = region;
-            
-        if (region == endRegion)
-            break;
     }
 
     return lastValidRegion;
 }
 
-LayoutUnit RenderFlowThread::regionLogicalWidthForLine(LayoutUnit position, const RenderBox* box) const
+LayoutUnit RenderFlowThread::regionLogicalWidthForLine(LayoutUnit position) const
 {
-    RenderRegion* region = renderRegionForLine(position, box, true);
+    RenderRegion* region = renderRegionForLine(position, true);
     if (!region)
         return contentLogicalWidth();
     return isHorizontalWritingMode() ? region->regionRect().width() : region->regionRect().height();
 }
 
-LayoutUnit RenderFlowThread::regionLogicalHeightForLine(LayoutUnit position, const RenderBox* box) const
+LayoutUnit RenderFlowThread::regionLogicalHeightForLine(LayoutUnit position) const
 {
-    RenderRegion* region = renderRegionForLine(position, box);
+    RenderRegion* region = renderRegionForLine(position);
     if (!region)
         return 0;
     return isHorizontalWritingMode() ? region->regionRect().height() : region->regionRect().width();
 }
 
-LayoutUnit RenderFlowThread::regionRemainingLogicalHeightForLine(LayoutUnit position, const RenderBox* box, PageBoundaryRule pageBoundaryRule) const
+LayoutUnit RenderFlowThread::regionRemainingLogicalHeightForLine(LayoutUnit position, PageBoundaryRule pageBoundaryRule) const
 {
-    RenderRegion* region = renderRegionForLine(position, box);
+    RenderRegion* region = renderRegionForLine(position);
     if (!region)
         return 0;
 
@@ -623,7 +608,7 @@
     // Note: Using the center in order to avoid rounding errors.
 
     LayoutPoint center = boxRect.center();
-    RenderRegion* renderRegion = renderRegionForLine(isHorizontalWritingMode() ? center.y() : center.x(), this, true);
+    RenderRegion* renderRegion = renderRegionForLine(isHorizontalWritingMode() ? center.y() : center.x(), true);
     if (!renderRegion)
         return 0;
 
@@ -761,8 +746,8 @@
 void RenderFlowThread::setRegionRangeForBox(const RenderBox* box, LayoutUnit offsetFromLogicalTopOfFirstPage)
 {
     // FIXME: Not right for differing writing-modes.
-    RenderRegion* startRegion = renderRegionForLine(offsetFromLogicalTopOfFirstPage, box, true);
-    RenderRegion* endRegion = renderRegionForLine(offsetFromLogicalTopOfFirstPage + box->logicalHeight(), box, true);
+    RenderRegion* startRegion = renderRegionForLine(offsetFromLogicalTopOfFirstPage, true);
+    RenderRegion* endRegion = renderRegionForLine(offsetFromLogicalTopOfFirstPage + box->logicalHeight(), true);
     RenderRegionRange* range = m_regionRangeMap.get(box);
     if (range) {
         // If nothing changed, just bail.

Modified: trunk/Source/WebCore/rendering/RenderFlowThread.h (96974 => 96975)


--- trunk/Source/WebCore/rendering/RenderFlowThread.h	2011-10-07 20:05:34 UTC (rev 96974)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.h	2011-10-07 20:15:11 UTC (rev 96975)
@@ -98,10 +98,10 @@
 
     void repaintRectangleInRegions(const LayoutRect&, bool immediate);
 
-    LayoutUnit regionLogicalWidthForLine(LayoutUnit position, const RenderBox*) const;
-    LayoutUnit regionLogicalHeightForLine(LayoutUnit position, const RenderBox*) const;
-    LayoutUnit regionRemainingLogicalHeightForLine(LayoutUnit position, const RenderBox*, PageBoundaryRule = IncludePageBoundary) const;
-    RenderRegion* renderRegionForLine(LayoutUnit position, const RenderBox*, bool extendLastRegion = false) const;
+    LayoutUnit regionLogicalWidthForLine(LayoutUnit position) const;
+    LayoutUnit regionLogicalHeightForLine(LayoutUnit position) const;
+    LayoutUnit regionRemainingLogicalHeightForLine(LayoutUnit position, PageBoundaryRule = IncludePageBoundary) const;
+    RenderRegion* renderRegionForLine(LayoutUnit position, bool extendLastRegion = false) const;
 
     bool regionsHaveUniformLogicalWidth() const { return m_regionsHaveUniformLogicalWidth; }
     bool regionsHaveUniformLogicalHeight() const { return m_regionsHaveUniformLogicalHeight; }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to