Title: [152906] trunk
Revision
152906
Author
[email protected]
Date
2013-07-19 10:46:08 -0700 (Fri, 19 Jul 2013)

Log Message

[CSS Shapes] Clear overflowing line's segments in pushShapeContentOverflowBelowTheContentBox
https://bugs.webkit.org/show_bug.cgi?id=118002

Reviewed by David Hyatt.

When the last line in the shape overlaps with the shape bottom boundaries we need to clear the computed segments. (We need to compute
the segments anyway, since shape-outside's code uses the same code path to determine its segments and the line containing is not a
requirement in that case.) Rather then doing the job in RenderBlock::LineBreaker::nextLineBreak I moved the functionality to its correct
place to pushShapeContentOverflowBelowTheContentBox. Now all the overflow related functionality is located in one function. I fixed the
corresponding layout test.

Source/WebCore:

Tests: I modified shape-inside-overflow.html.

* rendering/RenderBlockLineLayout.cpp:
(WebCore::pushShapeContentOverflowBelowTheContentBox): Remove segments if line overlaps with the shape's boundaries.
(WebCore::RenderBlock::LineBreaker::nextLineBreak): Move segments clear logic to pushShapeContentOverflowBelowContentBox.

LayoutTests:

* fast/shapes/shape-inside/shape-inside-overflow-expected.html:
* fast/shapes/shape-inside/shape-inside-overflow.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (152905 => 152906)


--- trunk/LayoutTests/ChangeLog	2013-07-19 17:43:07 UTC (rev 152905)
+++ trunk/LayoutTests/ChangeLog	2013-07-19 17:46:08 UTC (rev 152906)
@@ -1,5 +1,21 @@
 2013-07-19  Zoltan Horvath  <[email protected]>
 
+        [CSS Shapes] Clear overflowing line's segments in pushShapeContentOverflowBelowTheContentBox
+        https://bugs.webkit.org/show_bug.cgi?id=118002
+
+        Reviewed by David Hyatt.
+
+        When the last line in the shape overlaps with the shape bottom boundaries we need to clear the computed segments. (We need to compute
+        the segments anyway, since shape-outside's code uses the same code path to determine its segments and the line containing is not a
+        requirement in that case.) Rather then doing the job in RenderBlock::LineBreaker::nextLineBreak I moved the functionality to its correct
+        place to pushShapeContentOverflowBelowTheContentBox. Now all the overflow related functionality is located in one function. I fixed the
+        corresponding layout test.
+
+        * fast/shapes/shape-inside/shape-inside-overflow-expected.html:
+        * fast/shapes/shape-inside/shape-inside-overflow.html:
+
+2013-07-19  Zoltan Horvath  <[email protected]>
+
         [CSS Shapes][CSS Regions] Modify existing tests to test overflow also when padding is applied on the container
         https://bugs.webkit.org/show_bug.cgi?id=117881
 

Modified: trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-overflow-expected.html (152905 => 152906)


--- trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-overflow-expected.html	2013-07-19 17:43:07 UTC (rev 152905)
+++ trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-overflow-expected.html	2013-07-19 17:46:08 UTC (rev 152906)
@@ -9,26 +9,21 @@
         line-height: 20px;
         border: 2px solid blue;
     }
-    #border {
-        position: absolute;
-        left: 48px;
+    #shape-inside {
+        margin-top: -2px;
+        margin-left: 48px;
         width: 100px;
-        height: 40px;
+        height: 50px;
         border: 2px solid green;
     }
-    .spacer {
-        width: 50px;
-        height: 40px;
-    }
+    #overflow { margin-top: -2px; }
 </style>
 </head>
 <body>
     <div id="container">
-        <div id="border"></div>
-        <div id="shape-inside">
-            <div class="spacer" style="float:left"></div>
-            <div class="spacer" style="float:right"></div>
-            This text should wrap inside the green rectangle, and overflow should wrap
+        <div id="shape-inside">This text should wrap</div>
+        <div id="overflow">
+            inside the green rectangle, and overflow should wrap
             inside the blue rectangle.
         </div>
     </div>

Modified: trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-overflow.html (152905 => 152906)


--- trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-overflow.html	2013-07-19 17:43:07 UTC (rev 152905)
+++ trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-overflow.html	2013-07-19 17:46:08 UTC (rev 152906)
@@ -20,7 +20,8 @@
         position: absolute;
         left: 48px;
         width: 100px;
-        height: 40px;
+        height: 50px;
+        margin-top: -2px;
         border: 2px solid green;
     }
 </style>

Modified: trunk/Source/WebCore/ChangeLog (152905 => 152906)


--- trunk/Source/WebCore/ChangeLog	2013-07-19 17:43:07 UTC (rev 152905)
+++ trunk/Source/WebCore/ChangeLog	2013-07-19 17:46:08 UTC (rev 152906)
@@ -1,3 +1,22 @@
+2013-07-19  Zoltan Horvath  <[email protected]>
+
+        [CSS Shapes] Clear overflowing line's segments in pushShapeContentOverflowBelowTheContentBox
+        https://bugs.webkit.org/show_bug.cgi?id=118002
+
+        Reviewed by David Hyatt.
+
+        When the last line in the shape overlaps with the shape bottom boundaries we need to clear the computed segments. (We need to compute
+        the segments anyway, since shape-outside's code uses the same code path to determine its segments and the line containing is not a
+        requirement in that case.) Rather then doing the job in RenderBlock::LineBreaker::nextLineBreak I moved the functionality to its correct
+        place to pushShapeContentOverflowBelowTheContentBox. Now all the overflow related functionality is located in one function. I fixed the
+        corresponding layout test.
+
+        Tests: I modified shape-inside-overflow.html.
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::pushShapeContentOverflowBelowTheContentBox): Remove segments if line overlaps with the shape's boundaries.
+        (WebCore::RenderBlock::LineBreaker::nextLineBreak): Move segments clear logic to pushShapeContentOverflowBelowContentBox.
+
 2013-07-19  Geoffrey Garen  <[email protected]>
 
         TrailingObjects shouldn't shrink vector capacity in a loop

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (152905 => 152906)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-07-19 17:43:07 UTC (rev 152905)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-07-19 17:46:08 UTC (rev 152906)
@@ -1665,11 +1665,16 @@
     ASSERT(shapeInsideInfo);
 
     LayoutUnit logicalLineBottom = lineTop + lineHeight;
+    LayoutUnit shapeLogicalBottom = shapeInsideInfo->shapeLogicalBottom();
     LayoutUnit shapeContainingBlockHeight = shapeInsideInfo->shapeContainingBlockHeight();
 
     bool isOverflowPositionedAlready = (shapeContainingBlockHeight - shapeInsideInfo->owner()->borderAndPaddingAfter() + lineHeight) <= lineTop;
 
-    if (logicalLineBottom <= shapeInsideInfo->shapeLogicalBottom() || !shapeContainingBlockHeight || isOverflowPositionedAlready)
+    // If the last line overlaps with the shape, we don't need the segments anymore
+    if (lineTop < shapeLogicalBottom && shapeLogicalBottom < logicalLineBottom)
+        shapeInsideInfo->clearSegments();
+
+    if (logicalLineBottom <= shapeLogicalBottom || !shapeContainingBlockHeight || isOverflowPositionedAlready)
         return;
 
     LayoutUnit newLogicalHeight = block->logicalHeight() + (shapeContainingBlockHeight - (lineTop + shapeInsideInfo->owner()->borderAndPaddingAfter()));
@@ -2811,13 +2816,6 @@
     if (!shapeInsideInfo || !shapeInsideInfo->lineOverlapsShapeBounds())
         return nextSegmentBreak(resolver, lineInfo, renderTextInfo, lastFloatFromPreviousLine, consecutiveHyphenatedLines, wordMeasurements);
 
-    // In layoutRunsAndFloatsInRange we have to use lineOverlapsShapeBounds() to determine the line segments since shape-outside's codepaths uses the same code to determine its segments. The line containing is not a requirement for shape-outside,
-    // so in this case we can end up with some extra segments for the overflowing content, but we don't want to apply the segments for the overflowing content, so we need to reset it.
-    if (!m_block->flowThreadContainingBlock() && !shapeInsideInfo->lineWithinShapeBounds()) {
-        shapeInsideInfo->clearSegments();
-        return nextSegmentBreak(resolver, lineInfo, renderTextInfo, lastFloatFromPreviousLine, consecutiveHyphenatedLines, wordMeasurements);
-    }
-
     InlineIterator end = resolver.position();
     InlineIterator oldEnd = end;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to