Changeset 178045 in webkit


Ignore:
Timestamp:
Jan 7, 2015 12:13:07 PM (9 years ago)
Author:
Bem Jones-Bey
Message:

[CSS Shapes] Content does not wrap with overflow: hidden and reference box different from margin-box
https://bugs.webkit.org/show_bug.cgi?id=138139

Reviewed by David Hyatt.

Source/WebCore:

To determine how much an box needs to shink to avoid a float, the code
was only taking into account the first line of the box. This doesn't
work when the float has a shape, as it can make it seem like there is
more space on the line than there actually is. This patch changes the
calculations to take into account the entire height of the box that
needs to be shrunk, and thus computes the correct amount of space
available.

Test: fast/shapes/shape-outside-floats/shape-overflow-hidden-left-margin.html

fast/shapes/shape-outside-floats/shape-overflow-hidden-right-margin.html
fast/shapes/shape-outside-floats/shape-overflow-hidden.html

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::shrinkLogicalWidthToAvoidFloats):

LayoutTests:

  • fast/shapes/shape-outside-floats/shape-overflow-hidden-expected.html: Added.
  • fast/shapes/shape-outside-floats/shape-overflow-hidden-left-margin-expected.html: Added.
  • fast/shapes/shape-outside-floats/shape-overflow-hidden-left-margin.html: Added.
  • fast/shapes/shape-outside-floats/shape-overflow-hidden-right-margin-expected.html: Added.
  • fast/shapes/shape-outside-floats/shape-overflow-hidden-right-margin.html: Added.
  • fast/shapes/shape-outside-floats/shape-overflow-hidden.html: Added.
Location:
trunk
Files:
6 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r178040 r178045  
     12015-01-07  Bem Jones-Bey  <bjonesbe@adobe.com>
     2
     3        [CSS Shapes] Content does not wrap with overflow: hidden and reference box different from margin-box
     4        https://bugs.webkit.org/show_bug.cgi?id=138139
     5
     6        Reviewed by David Hyatt.
     7
     8        * fast/shapes/shape-outside-floats/shape-overflow-hidden-expected.html: Added.
     9        * fast/shapes/shape-outside-floats/shape-overflow-hidden-left-margin-expected.html: Added.
     10        * fast/shapes/shape-outside-floats/shape-overflow-hidden-left-margin.html: Added.
     11        * fast/shapes/shape-outside-floats/shape-overflow-hidden-right-margin-expected.html: Added.
     12        * fast/shapes/shape-outside-floats/shape-overflow-hidden-right-margin.html: Added.
     13        * fast/shapes/shape-outside-floats/shape-overflow-hidden.html: Added.
     14
    1152015-01-07  Eric Carlson  <eric.carlson@apple.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r178042 r178045  
     12015-01-07  Bem Jones-Bey  <bjonesbe@adobe.com>
     2
     3        [CSS Shapes] Content does not wrap with overflow: hidden and reference box different from margin-box
     4        https://bugs.webkit.org/show_bug.cgi?id=138139
     5
     6        Reviewed by David Hyatt.
     7
     8        To determine how much an box needs to shink to avoid a float, the code
     9        was only taking into account the first line of the box. This doesn't
     10        work when the float has a shape, as it can make it seem like there is
     11        more space on the line than there actually is. This patch changes the
     12        calculations to take into account the entire height of the box that
     13        needs to be shrunk, and thus computes the correct amount of space
     14        available.
     15
     16        Test: fast/shapes/shape-outside-floats/shape-overflow-hidden-left-margin.html
     17              fast/shapes/shape-outside-floats/shape-overflow-hidden-right-margin.html
     18              fast/shapes/shape-outside-floats/shape-overflow-hidden.html
     19
     20        * rendering/RenderBox.cpp:
     21        (WebCore::RenderBox::shrinkLogicalWidthToAvoidFloats):
     22
    1232015-01-07  Commit Queue  <commit-queue@webkit.org>
    224
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r178029 r178045  
    18021802    }
    18031803
    1804     LayoutUnit result = cb->availableLogicalWidthForLineInRegion(logicalTopPosition, false, containingBlockRegion) - childMarginStart - childMarginEnd;
     1804    LayoutUnit logicalHeight = cb->logicalHeightForChild(*this);
     1805    LayoutUnit result = cb->availableLogicalWidthForLineInRegion(logicalTopPosition, false, containingBlockRegion, logicalHeight) - childMarginStart - childMarginEnd;
    18051806
    18061807    // We need to see if margins on either the start side or the end side can contain the floats in question. If they can,
     
    18121813        LayoutUnit startContentSide = cb->startOffsetForContent(containingBlockRegion);
    18131814        LayoutUnit startContentSideWithMargin = startContentSide + childMarginStart;
    1814         LayoutUnit startOffset = cb->startOffsetForLineInRegion(logicalTopPosition, false, containingBlockRegion);
     1815        LayoutUnit startOffset = cb->startOffsetForLineInRegion(logicalTopPosition, false, containingBlockRegion, logicalHeight);
    18151816        if (startOffset > startContentSideWithMargin)
    18161817            result += childMarginStart;
     
    18221823        LayoutUnit endContentSide = cb->endOffsetForContent(containingBlockRegion);
    18231824        LayoutUnit endContentSideWithMargin = endContentSide + childMarginEnd;
    1824         LayoutUnit endOffset = cb->endOffsetForLineInRegion(logicalTopPosition, false, containingBlockRegion);
     1825        LayoutUnit endOffset = cb->endOffsetForLineInRegion(logicalTopPosition, false, containingBlockRegion, logicalHeight);
    18251826        if (endOffset > endContentSideWithMargin)
    18261827            result += childMarginEnd;
Note: See TracChangeset for help on using the changeset viewer.