Title: [158016] trunk/Source/WebCore
Revision
158016
Author
[email protected]
Date
2013-10-25 10:27:42 -0700 (Fri, 25 Oct 2013)

Log Message

[CSS Regions][CSS Shapes] Update updateShapeAndSegmentsForCurrentLineInFlowThread to deal better with multiple regions
<https://webkit.org/b/123210>

Reviewed by David Hyatt.

I simplified the determination of the next region part of updateShapeAndSegmentsForCurrentLineInFlowThread's implementation
in order to make the code more straightforward. I also tried to avoid using regionAtBlockOffset(...) function where it's possible,
since it's not always that reliable, what I'll will report in a separate bug.

No new tests, covered by existing tests.

* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::updateShapeAndSegmentsForCurrentLineInFlowThread):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (158015 => 158016)


--- trunk/Source/WebCore/ChangeLog	2013-10-25 17:26:35 UTC (rev 158015)
+++ trunk/Source/WebCore/ChangeLog	2013-10-25 17:27:42 UTC (rev 158016)
@@ -1,5 +1,21 @@
 2013-10-25  Zoltan Horvath  <[email protected]>
 
+        [CSS Regions][CSS Shapes] Update updateShapeAndSegmentsForCurrentLineInFlowThread to deal better with multiple regions
+        <https://webkit.org/b/123210>
+
+        Reviewed by David Hyatt.
+
+        I simplified the determination of the next region part of updateShapeAndSegmentsForCurrentLineInFlowThread's implementation
+        in order to make the code more straightforward. I also tried to avoid using regionAtBlockOffset(...) function where it's possible,
+        since it's not always that reliable, what I'll will report in a separate bug.
+
+        No new tests, covered by existing tests.
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlockFlow::updateShapeAndSegmentsForCurrentLineInFlowThread):
+
+2013-10-25  Zoltan Horvath  <[email protected]>
+
         [CSS Regions][CSS Shapes] Update updateShapeAndSegmentsForCurrentLineInFlowThread to deal better with the first lines
         <https://bugs.webkit.org/show_bug.cgi?id=123275>
 

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (158015 => 158016)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-10-25 17:26:35 UTC (rev 158015)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-10-25 17:27:42 UTC (rev 158016)
@@ -1389,43 +1389,45 @@
 {
     ASSERT(layoutState.flowThread());
 
-    LayoutUnit lineHeight = this->lineHeight(layoutState.lineInfo().isFirstLine(), isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
-
     RenderRegion* currentRegion = regionAtBlockOffset(logicalHeight());
     if (!currentRegion || !currentRegion->logicalHeight())
         return;
 
     shapeInsideInfo = currentRegion->shapeInsideInfo();
 
+    RenderRegion* nextRegion = 0;
+    if (!currentRegion->isLastRegion()) {
+        RenderRegionList regionList = layoutState.flowThread()->renderRegionList();
+        auto it = regionList.find(currentRegion);
+        nextRegion = *(++it);
+    }
+
+    // We only want to deal regions with shapes, so we check if the next region has a shape
+    if (!shapeInsideInfo && nextRegion && !nextRegion->shapeInsideInfo())
+        return;
+
+    LayoutUnit lineHeight = this->lineHeight(layoutState.lineInfo().isFirstLine(), isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
     LayoutUnit logicalLineTopInFlowThread = logicalHeight() + offsetFromLogicalTopOfFirstPage();
     LayoutUnit logicalLineBottomInFlowThread = logicalLineTopInFlowThread + lineHeight;
     LayoutUnit logicalRegionTopInFlowThread = currentRegion->logicalTopForFlowThreadContent();
     LayoutUnit logicalRegionBottomInFlowThread = logicalRegionTopInFlowThread + currentRegion->logicalHeight() - currentRegion->borderAndPaddingBefore() - currentRegion->borderAndPaddingAfter();
 
-    // We only want to deal regions with shapes, so we look up for the next region whether it has a shape
-    if (!shapeInsideInfo && !currentRegion->isLastRegion()) {
-        LayoutUnit deltaToNextRegion = logicalHeight() + logicalRegionBottomInFlowThread - logicalLineTopInFlowThread;
-        RenderRegion* lookupForNextRegion = regionAtBlockOffset(logicalHeight() + deltaToNextRegion);
-        if (!lookupForNextRegion->shapeInsideInfo())
-            return;
-    }
-
     LayoutUnit shapeBottomInFlowThread = LayoutUnit::max();
     if (shapeInsideInfo)
         shapeBottomInFlowThread = shapeInsideInfo->shapeLogicalBottom() + currentRegion->logicalTopForFlowThreadContent();
 
+    bool lineOverLapsWithShapeBottom = shapeBottomInFlowThread < logicalLineBottomInFlowThread;
+    bool lineOverLapsWithRegionBottom = logicalLineBottomInFlowThread > logicalRegionBottomInFlowThread;
+    bool overFlowsToNextRegion = nextRegion && (lineOverLapsWithShapeBottom || lineOverLapsWithRegionBottom);
+
     // If the line is between two shapes/regions we position the line to the top of the next shape/region
-    RenderRegion* nextRegion = regionAtBlockOffset(logicalHeight() + lineHeight);
-    if ((currentRegion != nextRegion && (logicalLineBottomInFlowThread > logicalRegionBottomInFlowThread)) || (!currentRegion->isLastRegion() && shapeBottomInFlowThread < logicalLineBottomInFlowThread)) {
+    if (overFlowsToNextRegion) {
+        ASSERT(currentRegion != nextRegion);
         LayoutUnit deltaToNextRegion = logicalRegionBottomInFlowThread - logicalLineTopInFlowThread;
-        nextRegion = regionAtBlockOffset(logicalHeight() + deltaToNextRegion);
-
-        ASSERT(currentRegion != nextRegion);
-
-        shapeInsideInfo = nextRegion->shapeInsideInfo();
         setLogicalHeight(logicalHeight() + deltaToNextRegion);
 
         currentRegion = nextRegion;
+        shapeInsideInfo = currentRegion->shapeInsideInfo();
 
         logicalLineTopInFlowThread = logicalHeight() + offsetFromLogicalTopOfFirstPage();
         logicalLineBottomInFlowThread = logicalLineTopInFlowThread + lineHeight;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to