Changeset 129975 in webkit


Ignore:
Timestamp:
Sep 29, 2012 3:22:22 AM (12 years ago)
Author:
kenneth@webkit.org
Message:

Scroll offset of flex items lost during relayout
https://bugs.webkit.org/show_bug.cgi?id=97706

Reviewed by Tony Chang.

Source/WebCore:

Test: fast/flexbox/overflow-keep-scrollpos.html

Flex box does a second pass layout of the flex children.

We layout the child without scrollbars (to get the size
used for flexing), then we relayout the child at its final size.

We must not apply the scroll position during the first pass,
as it will be clamped to 0 (no scrolling possible).

  • rendering/RenderBlock.h:

(RenderBlock):

Make updateScrollInfoAfterLayout public

  • rendering/RenderFlexibleBox.cpp:

(WebCore::RenderFlexibleBox::layoutBlock):

Delay applying scroll info until we clamp the size of the child
and get scrollbars back again. For this to work we use
RenderBlock::updateScrollInfoAfterLayout instead of the non-guarded
RenderLayer::updateScrollInfoAfterLayout.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::updateScrollInfoAfterLayout):

Add workaround for now to keep passing css3/flexbox/child-overflow.html

Basically do not postpone applying scroll changes for RenderBlocks
with opposite writing mode, as they need to have their content
overflow in the right direction.

LayoutTests:

Add a new test for testing that flex items scroll offsets are
not lost during relayout.

  • css3/flexbox/overflow-keep-scrollpos-expected.txt: Added.
  • css3/flexbox/overflow-keep-scrollpos.html: Added.
  • css3/flexbox/child-overflow.html: Fix minor errors.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r129958 r129975  
     12012-09-29  Kenneth Rohde Christiansen  <kenneth@webkit.org>
     2
     3        Scroll offset of flex items lost during relayout
     4        https://bugs.webkit.org/show_bug.cgi?id=97706
     5
     6        Reviewed by Tony Chang.
     7
     8        Add a new test for testing that flex items scroll offsets are
     9        not lost during relayout.
     10
     11        * css3/flexbox/overflow-keep-scrollpos-expected.txt: Added.
     12        * css3/flexbox/overflow-keep-scrollpos.html: Added.
     13        * css3/flexbox/child-overflow.html: Fix minor errors.
     14
    1152012-09-28  Emil A Eklund  <eae@chromium.org>
    216
  • trunk/LayoutTests/css3/flexbox/child-overflow.html

    r122508 r129975  
    7878            "<div class='" + containerClass + "'>" +
    7979            "<div class='" + flexboxClass + "'>" +
    80             "<div style='-webkit-flex: 0 1 auto; -webkit-flex: 0 1 auto'><div></div></div>" +
     80            "<div style='-webkit-flex: 0 1 auto'><div></div></div>" +
    8181            "</div>" +
    8282            "</div> ";
     
    8484    document.body.innerHTML += "<br>";
    8585});
    86 
    8786</script>
    88 </body>
    8987</html>
  • trunk/Source/WebCore/ChangeLog

    r129974 r129975  
     12012-09-29  Kenneth Rohde Christiansen  <kenneth@webkit.org>
     2
     3        Scroll offset of flex items lost during relayout
     4        https://bugs.webkit.org/show_bug.cgi?id=97706
     5
     6        Reviewed by Tony Chang.
     7
     8        Test: fast/flexbox/overflow-keep-scrollpos.html
     9
     10        Flex box does a second pass layout of the flex children.
     11
     12        We layout the child without scrollbars (to get the size
     13        used for flexing), then we relayout the child at its final size.
     14
     15        We must not apply the scroll position during the first pass,
     16        as it will be clamped to 0 (no scrolling possible).
     17
     18        * rendering/RenderBlock.h:
     19        (RenderBlock):
     20
     21        Make updateScrollInfoAfterLayout public
     22
     23        * rendering/RenderFlexibleBox.cpp:
     24        (WebCore::RenderFlexibleBox::layoutBlock):
     25
     26        Delay applying scroll info until we clamp the size of the child
     27        and get scrollbars back again. For this to work we use
     28        RenderBlock::updateScrollInfoAfterLayout instead of the non-guarded
     29        RenderLayer::updateScrollInfoAfterLayout.
     30
     31        * rendering/RenderBlock.cpp:
     32        (WebCore::RenderBlock::updateScrollInfoAfterLayout):
     33
     34        Add workaround for now to keep passing css3/flexbox/child-overflow.html
     35
     36        Basically do not postpone applying scroll changes for RenderBlocks
     37        with opposite writing mode, as they need to have their content
     38        overflow in the right direction.
     39
    1402012-09-29  Dimitri Glazkov  <dglazkov@chromium.org>
    241
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r129787 r129975  
    13561356{
    13571357    if (hasOverflowClip()) {
     1358        if (style()->isFlippedBlocksWritingMode()) {
     1359            // FIXME: https://bugs.webkit.org/show_bug.cgi?id=97937
     1360            // Workaround for now. We cannot delay the scroll info for overflow
     1361            // for items with opposite writing directions, as the contents needs
     1362            // to overflow in that direction
     1363            layer()->updateScrollInfoAfterLayout();
     1364            return;
     1365        }
     1366
    13581367        if (gDelayUpdateScrollInfo)
    13591368            gDelayedUpdateScrollInfoSet->add(this);
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r129787 r129975  
    461461    static void finishDelayUpdateScrollInfo();
    462462
     463    void updateScrollInfoAfterLayout();
     464
    463465    virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
    464466    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
     
    858860
    859861    bool expandsToEncloseOverhangingFloats() const;
    860 
    861     void updateScrollInfoAfterLayout();
    862862
    863863    void splitBlocks(RenderBlock* fromBlock, RenderBlock* toBlock, RenderBlock* middleBlock,
  • trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp

    r129914 r129975  
    259259    m_overflow.clear();
    260260
     261    RenderBlock::startDelayUpdateScrollInfo();
     262
    261263    WTF::Vector<LineContext> lineContexts;
    262264    OrderHashSet orderValues;
     
    269271    repositionLogicalHeightDependentFlexItems(*m_orderIterator, lineContexts, oldClientAfterEdge);
    270272
     273    RenderBlock::finishDelayUpdateScrollInfo();
     274
    271275    if (size() != previousSize)
    272276        relayoutChildren = true;
     
    284288    // Update our scroll information if we're overflow:auto/scroll/hidden now that we know if
    285289    // we overflow or not.
    286     if (hasOverflowClip())
    287         layer()->updateScrollInfoAfterLayout();
     290    updateScrollInfoAfterLayout();
    288291
    289292    repainter.repaintAfterLayout();
Note: See TracChangeset for help on using the changeset viewer.