Changeset 110747 in webkit


Ignore:
Timestamp:
Mar 14, 2012 2:10:24 PM (12 years ago)
Author:
tony@chromium.org
Message:

multiline column flexbox with auto height wrap too much
https://bugs.webkit.org/show_bug.cgi?id=80929

Reviewed by David Hyatt.

Source/WebCore:

Test: css3/flexbox/multiline-column-auto.html

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::computeLogicalHeightUsing):
(WebCore):
(WebCore::RenderBox::computeContentLogicalHeightUsing): Pull out into a separate method.

  • rendering/RenderBox.h:

(RenderBox):

  • rendering/RenderFlexibleBox.cpp:

(WebCore::RenderFlexibleBox::lineBreakLength): Compute the value based on height & max-height for column layout.
(WebCore):
(WebCore::RenderFlexibleBox::computeNextFlexLine):

  • rendering/RenderFlexibleBox.h:

(RenderFlexibleBox):

LayoutTests:

  • css3/flexbox/multiline-column-auto-expected.txt: Added.
  • css3/flexbox/multiline-column-auto.html: Added.
  • css3/flexbox/multiline-shrink-to-fit-expected.html:
  • css3/flexbox/multiline-shrink-to-fit.html:
Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r110745 r110747  
     12012-03-14  Tony Chang  <tony@chromium.org>
     2
     3        multiline column flexbox with auto height wrap too much
     4        https://bugs.webkit.org/show_bug.cgi?id=80929
     5
     6        Reviewed by David Hyatt.
     7
     8        * css3/flexbox/multiline-column-auto-expected.txt: Added.
     9        * css3/flexbox/multiline-column-auto.html: Added.
     10        * css3/flexbox/multiline-shrink-to-fit-expected.html:
     11        * css3/flexbox/multiline-shrink-to-fit.html:
     12
    1132012-03-14  Jessie Berlin  <jberlin@apple.com>
    214
  • trunk/LayoutTests/css3/flexbox/multiline-shrink-to-fit-expected.html

    r110583 r110747  
    3434<p>Test to make sure that multiline column flexboxes shrink-to-fit properly.</p>
    3535
    36 <!-- FIXME: Remove the height once https://bugs.webkit.org/show_bug.cgi?id=80929 is fixed. -->
    3736<div class="testcase" style="height: 60px; width: 400px">
    3837  <div style="width: 100px; height: 20px"></div>
     
    5756<p style="clear:left">The grey background should be 400px wide.</p>
    5857
    59 <!-- FIXME: Remove the height once https://bugs.webkit.org/show_bug.cgi?id=80929 is fixed. -->
    6058<div style="width: 150px">
    6159<div class="testcase" style="height: 60px; width: 150px">
  • trunk/LayoutTests/css3/flexbox/multiline-shrink-to-fit.html

    r110583 r110747  
    2727<p>Test to make sure that multiline column flexboxes shrink-to-fit properly.</p>
    2828
    29 <!-- FIXME: Remove the height once https://bugs.webkit.org/show_bug.cgi?id=80929 is fixed. -->
    30 <div class="flexbox" style="height: 60px">
     29<div class="flexbox">
    3130  <div style="width: 100px; height: 20px"></div>
    3231  <div style="width: 100px; height: 10px"></div>
     
    4443<p style="clear:left">The grey background should be 400px wide.</p>
    4544
    46 <!-- FIXME: Remove the height once https://bugs.webkit.org/show_bug.cgi?id=80929 is fixed. -->
    4745<div style="width: 150px">
    48 <div class="flexbox" style="height: 60px">
     46<div class="flexbox">
    4947  <div style="width: 100px; height: 20px"></div>
    5048  <div style="width: 100px; height: 10px"></div>
  • trunk/Source/WebCore/ChangeLog

    r110744 r110747  
     12012-03-14  Tony Chang  <tony@chromium.org>
     2
     3        multiline column flexbox with auto height wrap too much
     4        https://bugs.webkit.org/show_bug.cgi?id=80929
     5
     6        Reviewed by David Hyatt.
     7
     8        Test: css3/flexbox/multiline-column-auto.html
     9
     10        * rendering/RenderBox.cpp:
     11        (WebCore::RenderBox::computeLogicalHeightUsing):
     12        (WebCore):
     13        (WebCore::RenderBox::computeContentLogicalHeightUsing): Pull out into a separate method.
     14        * rendering/RenderBox.h:
     15        (RenderBox):
     16        * rendering/RenderFlexibleBox.cpp:
     17        (WebCore::RenderFlexibleBox::lineBreakLength): Compute the value based on height & max-height for column layout.
     18        (WebCore):
     19        (WebCore::RenderFlexibleBox::computeNextFlexLine):
     20        * rendering/RenderFlexibleBox.h:
     21        (RenderFlexibleBox):
     22
    1232012-03-14  Xingnan Wang  <xingnan.wang@intel.com>
    224
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r110135 r110747  
    21532153}
    21542154
    2155 LayoutUnit RenderBox::computeLogicalHeightUsing(const Length& h)
     2155LayoutUnit RenderBox::computeLogicalHeightUsing(const Length& height)
     2156{
     2157    LayoutUnit logicalHeight = computeContentLogicalHeightUsing(height);
     2158    if (logicalHeight != -1)
     2159        logicalHeight = computeBorderBoxLogicalHeight(logicalHeight);
     2160    return logicalHeight;
     2161}
     2162
     2163LayoutUnit RenderBox::computeContentLogicalHeightUsing(const Length& height)
    21562164{
    21572165    LayoutUnit logicalHeight = -1;
    2158     if (!h.isAuto()) {
    2159         if (h.isFixed())
    2160             logicalHeight = h.value();
    2161         else if (h.isPercent())
    2162             logicalHeight = computePercentageLogicalHeight(h);
    2163         if (logicalHeight != -1) {
    2164             logicalHeight = computeBorderBoxLogicalHeight(logicalHeight);
    2165             return logicalHeight;
    2166         }
     2166    if (!height.isAuto()) {
     2167        if (height.isFixed())
     2168            logicalHeight = height.value();
     2169        else if (height.isPercent())
     2170            logicalHeight = computePercentageLogicalHeight(height);
    21672171    }
    21682172    return logicalHeight;
  • trunk/Source/WebCore/rendering/RenderBox.h

    r110732 r110747  
    342342    LayoutUnit computeLogicalWidthInRegionUsing(LogicalWidthType, LayoutUnit availableLogicalWidth, const RenderBlock* containingBlock, RenderRegion*, LayoutUnit offsetFromLogicalTopOfFirstPage);
    343343    LayoutUnit computeLogicalHeightUsing(const Length& height);
     344    LayoutUnit computeContentLogicalHeightUsing(const Length& height);
    344345    LayoutUnit computeReplacedLogicalWidthUsing(Length width) const;
    345346    LayoutUnit computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUnit logicalWidth, bool includeMaxWidth = true) const;
  • trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp

    r110583 r110747  
    670670}
    671671
     672LayoutUnit RenderFlexibleBox::lineBreakLength()
     673{
     674    if (!isColumnFlow())
     675        return mainAxisContentExtent();
     676
     677    LayoutUnit height = computeContentLogicalHeightUsing(style()->logicalHeight());
     678    if (height == -1)
     679        height = std::numeric_limits<LayoutUnit>::max();
     680    LayoutUnit maxHeight = computeContentLogicalHeightUsing(style()->logicalMaxHeight());
     681    if (maxHeight != -1)
     682        height = std::min(height, maxHeight);
     683    return height;
     684}
     685
    672686bool RenderFlexibleBox::computeNextFlexLine(FlexOrderIterator& iterator, OrderedFlexItemList& orderedChildren, LayoutUnit& preferredMainAxisExtent, float& totalPositiveFlexibility, float& totalNegativeFlexibility)
    673687{
     
    678692    if (!iterator.currentChild())
    679693        return false;
     694
     695    LayoutUnit lineBreak = lineBreakLength();
    680696
    681697    for (RenderBox* child = iterator.currentChild(); child; child = iterator.next()) {
     
    691707            childMainAxisExtent += child->marginHeight();
    692708
    693         // FIXME: For auto sized column flexbox, mainAxisContentExtent (the height) hasn't been computed yet so we break
    694         // after the first child. If the height is auto, we need to look at max-height to determine the line breaks.
    695         // https://bugs.webkit.org/show_bug.cgi?id=80929
    696         if (isMultiline() && preferredMainAxisExtent + childMainAxisExtent > mainAxisContentExtent() && orderedChildren.size() > 0)
     709        if (isMultiline() && preferredMainAxisExtent + childMainAxisExtent > lineBreak && orderedChildren.size() > 0)
    697710            break;
    698711        orderedChildren.append(child);
  • trunk/Source/WebCore/rendering/RenderFlexibleBox.h

    r110209 r110747  
    104104
    105105    void computeMainAxisPreferredSizes(bool relayoutChildren, FlexOrderHashSet&);
     106    LayoutUnit lineBreakLength();
    106107    bool computeNextFlexLine(FlexOrderIterator&, OrderedFlexItemList& orderedChildren, LayoutUnit& preferredMainAxisExtent, float& totalPositiveFlexibility, float& totalNegativeFlexibility);
    107108    bool runFreeSpaceAllocationAlgorithm(const OrderedFlexItemList&, LayoutUnit& availableFreeSpace, float& totalPositiveFlexibility, float& totalNegativeFlexibility, InflexibleFlexItemSize&, WTF::Vector<LayoutUnit>& childSizes);
Note: See TracChangeset for help on using the changeset viewer.