Changeset 152906 in webkit


Ignore:
Timestamp:
Jul 19, 2013 10:46:08 AM (11 years ago)
Author:
zoltan@webkit.org
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:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r152904 r152906  
     12013-07-19  Zoltan Horvath  <zoltan@webkit.org>
     2
     3        [CSS Shapes] Clear overflowing line's segments in pushShapeContentOverflowBelowTheContentBox
     4        https://bugs.webkit.org/show_bug.cgi?id=118002
     5
     6        Reviewed by David Hyatt.
     7
     8        When the last line in the shape overlaps with the shape bottom boundaries we need to clear the computed segments. (We need to compute
     9        the segments anyway, since shape-outside's code uses the same code path to determine its segments and the line containing is not a
     10        requirement in that case.) Rather then doing the job in RenderBlock::LineBreaker::nextLineBreak I moved the functionality to its correct
     11        place to pushShapeContentOverflowBelowTheContentBox. Now all the overflow related functionality is located in one function. I fixed the
     12        corresponding layout test.
     13
     14        * fast/shapes/shape-inside/shape-inside-overflow-expected.html:
     15        * fast/shapes/shape-inside/shape-inside-overflow.html:
     16
    1172013-07-19  Zoltan Horvath  <zoltan@webkit.org>
    218
  • trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-overflow-expected.html

    r152800 r152906  
    1010        border: 2px solid blue;
    1111    }
    12     #border {
    13         position: absolute;
    14         left: 48px;
     12    #shape-inside {
     13        margin-top: -2px;
     14        margin-left: 48px;
    1515        width: 100px;
    16         height: 40px;
     16        height: 50px;
    1717        border: 2px solid green;
    1818    }
    19     .spacer {
    20         width: 50px;
    21         height: 40px;
    22     }
     19    #overflow { margin-top: -2px; }
    2320</style>
    2421</head>
    2522<body>
    2623    <div id="container">
    27         <div id="border"></div>
    28         <div id="shape-inside">
    29             <div class="spacer" style="float:left"></div>
    30             <div class="spacer" style="float:right"></div>
    31             This text should wrap inside the green rectangle, and overflow should wrap
     24        <div id="shape-inside">This text should wrap</div>
     25        <div id="overflow">
     26            inside the green rectangle, and overflow should wrap
    3227            inside the blue rectangle.
    3328        </div>
  • trunk/LayoutTests/fast/shapes/shape-inside/shape-inside-overflow.html

    r152800 r152906  
    2121        left: 48px;
    2222        width: 100px;
    23         height: 40px;
     23        height: 50px;
     24        margin-top: -2px;
    2425        border: 2px solid green;
    2526    }
  • trunk/Source/WebCore/ChangeLog

    r152905 r152906  
     12013-07-19  Zoltan Horvath  <zoltan@webkit.org>
     2
     3        [CSS Shapes] Clear overflowing line's segments in pushShapeContentOverflowBelowTheContentBox
     4        https://bugs.webkit.org/show_bug.cgi?id=118002
     5
     6        Reviewed by David Hyatt.
     7
     8        When the last line in the shape overlaps with the shape bottom boundaries we need to clear the computed segments. (We need to compute
     9        the segments anyway, since shape-outside's code uses the same code path to determine its segments and the line containing is not a
     10        requirement in that case.) Rather then doing the job in RenderBlock::LineBreaker::nextLineBreak I moved the functionality to its correct
     11        place to pushShapeContentOverflowBelowTheContentBox. Now all the overflow related functionality is located in one function. I fixed the
     12        corresponding layout test.
     13
     14        Tests: I modified shape-inside-overflow.html.
     15
     16        * rendering/RenderBlockLineLayout.cpp:
     17        (WebCore::pushShapeContentOverflowBelowTheContentBox): Remove segments if line overlaps with the shape's boundaries.
     18        (WebCore::RenderBlock::LineBreaker::nextLineBreak): Move segments clear logic to pushShapeContentOverflowBelowContentBox.
     19
    1202013-07-19  Geoffrey Garen  <ggaren@apple.com>
    221
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r152905 r152906  
    16661666
    16671667    LayoutUnit logicalLineBottom = lineTop + lineHeight;
     1668    LayoutUnit shapeLogicalBottom = shapeInsideInfo->shapeLogicalBottom();
    16681669    LayoutUnit shapeContainingBlockHeight = shapeInsideInfo->shapeContainingBlockHeight();
    16691670
    16701671    bool isOverflowPositionedAlready = (shapeContainingBlockHeight - shapeInsideInfo->owner()->borderAndPaddingAfter() + lineHeight) <= lineTop;
    16711672
    1672     if (logicalLineBottom <= shapeInsideInfo->shapeLogicalBottom() || !shapeContainingBlockHeight || isOverflowPositionedAlready)
     1673    // If the last line overlaps with the shape, we don't need the segments anymore
     1674    if (lineTop < shapeLogicalBottom && shapeLogicalBottom < logicalLineBottom)
     1675        shapeInsideInfo->clearSegments();
     1676
     1677    if (logicalLineBottom <= shapeLogicalBottom || !shapeContainingBlockHeight || isOverflowPositionedAlready)
    16731678        return;
    16741679
     
    28112816    if (!shapeInsideInfo || !shapeInsideInfo->lineOverlapsShapeBounds())
    28122817        return nextSegmentBreak(resolver, lineInfo, renderTextInfo, lastFloatFromPreviousLine, consecutiveHyphenatedLines, wordMeasurements);
    2813 
    2814     // 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,
    2815     // 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.
    2816     if (!m_block->flowThreadContainingBlock() && !shapeInsideInfo->lineWithinShapeBounds()) {
    2817         shapeInsideInfo->clearSegments();
    2818         return nextSegmentBreak(resolver, lineInfo, renderTextInfo, lastFloatFromPreviousLine, consecutiveHyphenatedLines, wordMeasurements);
    2819     }
    28202818
    28212819    InlineIterator end = resolver.position();
Note: See TracChangeset for help on using the changeset viewer.