Changeset 145736 in webkit


Ignore:
Timestamp:
Mar 13, 2013 12:28:59 PM (11 years ago)
Author:
tony@chromium.org
Message:

Regression(r143542): -webkit-align-items: center with overflow: auto/scroll has extra bottom padding
https://bugs.webkit.org/show_bug.cgi?id=112047

Reviewed by Ojan Vafai.

Source/WebCore:

Add a new pass for computing the client bottom edge that runs after we've repositioned children
due to wrap-reverse, flex-end or vertical centering.

Test: css3/flexbox/negative-overflow.html

  • rendering/RenderFlexibleBox.cpp:

(WebCore::RenderFlexibleBox::layoutBlock): Remove the code to use clientLogicalBottom() that was computed before
repositioning. The repositioning can change the edge.
(WebCore::RenderFlexibleBox::clientLogicalBottomAfterRepositioning): Compute the new bottom based on the final position
of flex items.

  • rendering/RenderFlexibleBox.h:

(RenderFlexibleBox):

LayoutTests:

  • css3/flexbox/negative-overflow-expected.txt: Added.
  • css3/flexbox/negative-overflow.html: Added.
  • resources/check-layout.js: Add attributes for checking scroll width and scroll height.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r145735 r145736  
     12013-03-13  Tony Chang  <tony@chromium.org>
     2
     3        Regression(r143542): -webkit-align-items: center with overflow: auto/scroll has extra bottom padding
     4        https://bugs.webkit.org/show_bug.cgi?id=112047
     5
     6        Reviewed by Ojan Vafai.
     7
     8        * css3/flexbox/negative-overflow-expected.txt: Added.
     9        * css3/flexbox/negative-overflow.html: Added.
     10        * resources/check-layout.js: Add attributes for checking scroll width and scroll height.
     11
    1122013-03-13  Nate Chapin  <japhet@chromium.org>
    213
  • trunk/LayoutTests/resources/check-layout.js

    r141147 r145736  
    6161        if (node.clientHeight != parseInt(expectedHeight))
    6262            failures.push("Expected " + expectedHeight + " for clientHeight, but got " + node.clientHeight + ". ");
     63    }
     64
     65    var expectedWidth = node.getAttribute && node.getAttribute("data-expected-scroll-width");
     66    if (expectedWidth) {
     67        if (node.scrollWidth != parseInt(expectedWidth))
     68            failures.push("Expected " + expectedWidth + " for scrollWidth, but got " + node.scrollWidth + ". ");
     69    }
     70
     71    var expectedHeight = node.getAttribute && node.getAttribute("data-expected-scroll-height");
     72    if (expectedHeight) {
     73        if (node.scrollHeight != parseInt(expectedHeight))
     74            failures.push("Expected " + expectedHeight + " for scrollHeight, but got " + node.scrollHeight + ". ");
    6375    }
    6476
  • trunk/Source/WebCore/ChangeLog

    r145735 r145736  
     12013-03-13  Tony Chang  <tony@chromium.org>
     2
     3        Regression(r143542): -webkit-align-items: center with overflow: auto/scroll has extra bottom padding
     4        https://bugs.webkit.org/show_bug.cgi?id=112047
     5
     6        Reviewed by Ojan Vafai.
     7
     8        Add a new pass for computing the client bottom edge that runs after we've repositioned children
     9        due to wrap-reverse, flex-end or vertical centering.
     10
     11        Test: css3/flexbox/negative-overflow.html
     12
     13        * rendering/RenderFlexibleBox.cpp:
     14        (WebCore::RenderFlexibleBox::layoutBlock): Remove the code to use clientLogicalBottom() that was computed before
     15        repositioning. The repositioning can change the edge.
     16        (WebCore::RenderFlexibleBox::clientLogicalBottomAfterRepositioning): Compute the new bottom based on the final position
     17        of flex items.
     18        * rendering/RenderFlexibleBox.h:
     19        (RenderFlexibleBox):
     20
    1212013-03-13  Nate Chapin  <japhet@chromium.org>
    222
  • trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp

    r145457 r145736  
    356356    layoutFlexItems(relayoutChildren, lineContexts);
    357357
    358     LayoutUnit oldClientAfterEdge = clientLogicalBottom();
    359358    updateLogicalHeight();
    360359    repositionLogicalHeightDependentFlexItems(lineContexts);
     
    371370    repaintChildrenDuringLayoutIfMoved(oldChildRects);
    372371    // FIXME: css3/flexbox/repaint-rtl-column.html seems to repaint more overflow than it needs to.
    373     computeOverflow(oldClientAfterEdge);
     372    computeOverflow(clientLogicalBottomAfterRepositioning());
    374373    statePusher.pop();
    375374
     
    434433    // direction:rtl + flex-direction:column means the cross-axis direction is flipped.
    435434    flipForRightToLeftColumn();
     435}
     436
     437LayoutUnit RenderFlexibleBox::clientLogicalBottomAfterRepositioning()
     438{
     439    LayoutUnit maxChildLogicalBottom = 0;
     440    for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
     441        if (child->isOutOfFlowPositioned())
     442            continue;
     443        LayoutUnit childLogicalBottom = logicalTopForChild(child) + logicalHeightForChild(child) + marginAfterForChild(child);
     444        maxChildLogicalBottom = std::max(maxChildLogicalBottom, childLogicalBottom);
     445    }
     446    return std::max(clientLogicalBottom(), maxChildLogicalBottom);
    436447}
    437448
  • trunk/Source/WebCore/rendering/RenderFlexibleBox.h

    r145457 r145736  
    147147    bool updateAutoMarginsInCrossAxis(RenderBox* child, LayoutUnit availableAlignmentSpace);
    148148    void repositionLogicalHeightDependentFlexItems(Vector<LineContext>&);
     149    LayoutUnit clientLogicalBottomAfterRepositioning();
    149150    void appendChildFrameRects(ChildFrameRects&);
    150151    void repaintChildrenDuringLayoutIfMoved(const ChildFrameRects&);
Note: See TracChangeset for help on using the changeset viewer.