Changeset 130714 in webkit


Ignore:
Timestamp:
Oct 8, 2012 6:52:21 PM (12 years ago)
Author:
tony@chromium.org
Message:

image not displayed in flexbox
https://bugs.webkit.org/show_bug.cgi?id=98611

Reviewed by Ojan Vafai.

Source/WebCore:

Flexbox will override the width of a child and when stretching, will override the height of the child.
When this happens, when an image loads, it checks to see if it's width/height has
changed, and if so, does a relayout. The overridden width/height was preventing this
relayout from happening.

To fix, we clear all the override sizes when we're done laying out the flex children.

Test: css3/flexbox/relayout-image-load.html

  • rendering/RenderFlexibleBox.cpp:

(WebCore::RenderFlexibleBox::layoutBlock): Clear child override sizes.
(WebCore::RenderFlexibleBox::clearChildOverrideSizes):
(WebCore::RenderFlexibleBox::computeMainAxisPreferredSizes): No longer need to clear the override size
here since it should have already been cleared.

  • rendering/RenderFlexibleBox.h:

LayoutTests:

Load an image after flexbox layout has happened.

  • css3/flexbox/relayout-image-load-expected.txt: Added.
  • css3/flexbox/relayout-image-load.html: Added.
  • platform/chromium/TestExpectations: Remove css3/flexbox/flexitem-stretch-image.html

since it should no longer be flaky.

Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r130709 r130714  
     12012-10-08  Tony Chang  <tony@chromium.org>
     2
     3        image not displayed in flexbox
     4        https://bugs.webkit.org/show_bug.cgi?id=98611
     5
     6        Reviewed by Ojan Vafai.
     7
     8        Load an image after flexbox layout has happened.
     9
     10        * css3/flexbox/relayout-image-load-expected.txt: Added.
     11        * css3/flexbox/relayout-image-load.html: Added.
     12        * platform/chromium/TestExpectations: Remove css3/flexbox/flexitem-stretch-image.html
     13        since it should no longer be flaky.
     14
    1152012-10-08  Dirk Pranke  <dpranke@chromium.org>
    216
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r130702 r130714  
    34133413
    34143414webkit.org/b/94660 fast/js/create-lots-of-workers.html [ Crash Pass Timeout ]
    3415 webkit.org/b/95366 [ Debug ] css3/flexbox/flexitem-stretch-image.html [ Failure Pass ]
    34163415
    34173416crbug.com/67540 webkit.org/b/94735 [ Linux ] fast/text/emphasis-overlap.html [ Failure ImageOnlyFailure ]
  • trunk/Source/WebCore/ChangeLog

    r130712 r130714  
     12012-10-08  Tony Chang  <tony@chromium.org>
     2
     3        image not displayed in flexbox
     4        https://bugs.webkit.org/show_bug.cgi?id=98611
     5
     6        Reviewed by Ojan Vafai.
     7
     8        Flexbox will override the width of a child and when stretching, will override the height of the child.
     9        When this happens, when an image loads, it checks to see if it's width/height has
     10        changed, and if so, does a relayout.  The overridden width/height was preventing this
     11        relayout from happening.
     12
     13        To fix, we clear all the override sizes when we're done laying out the flex children.
     14
     15        Test: css3/flexbox/relayout-image-load.html
     16
     17        * rendering/RenderFlexibleBox.cpp:
     18        (WebCore::RenderFlexibleBox::layoutBlock): Clear child override sizes.
     19        (WebCore::RenderFlexibleBox::clearChildOverrideSizes):
     20        (WebCore::RenderFlexibleBox::computeMainAxisPreferredSizes): No longer need to clear the override size
     21        here since it should have already been cleared.
     22        * rendering/RenderFlexibleBox.h:
     23
    1242012-10-08  Andreas Kling  <kling@webkit.org>
    225
  • trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp

    r130553 r130714  
    325325
    326326    computeRegionRangeForBlock();
     327    clearChildOverrideSizes();
    327328
    328329    // FIXME: css3/flexbox/repaint-rtl-column.html seems to repaint more overflow than it needs to.
     
    372373    // direction:rtl + flex-direction:column means the cross-axis direction is flipped.
    373374    flipForRightToLeftColumn(iterator);
     375}
     376
     377void RenderFlexibleBox::clearChildOverrideSizes()
     378{
     379    for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox())
     380        child->clearOverrideSize();
    374381}
    375382
     
    807814            continue;
    808815
    809         child->clearOverrideSize();
    810816        // Only need to layout here if we will need to get the logicalHeight of the child in computeNextFlexLine.
    811817        Length childMainAxisMin = isHorizontalFlow() ? child->style()->minWidth() : child->style()->minHeight();
  • trunk/Source/WebCore/rendering/RenderFlexibleBox.h

    r130409 r130714  
    121121    bool updateAutoMarginsInCrossAxis(RenderBox* child, LayoutUnit availableAlignmentSpace);
    122122    void repositionLogicalHeightDependentFlexItems(OrderIterator&, WTF::Vector<LineContext>&, LayoutUnit& oldClientAfterEdge);
     123    void clearChildOverrideSizes();
    123124
    124125    LayoutUnit availableAlignmentSpaceForChild(LayoutUnit lineCrossAxisExtent, RenderBox*);
Note: See TracChangeset for help on using the changeset viewer.