Skip to content
  • hyatt@apple.com's avatar
    Flex boxes (both old and new) don't handle max-height images correctly. · b9f60e12
    hyatt@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=118000
    
    Reviewed by Beth Dakin.
    
    Source/WebCore: 
    
    Tests: css3/flexbox/image-percent-max-height.html
           fast/flexbox/image-percent-max-height.html
    
    * rendering/RenderBlock.cpp:
    (WebCore::RenderBlock::dirtyForLayoutFromPercentageHeightDescendants):
    (WebCore::RenderBlock::layoutBlockChildren):
    Pull the percentage height descendant code that dirties those descendants
    out of layoutBlockChildren and into a protected helper function,
    dirtyForLayoutFromPercentageHeightDescendants, that can be called from the 
    flex box code.
            
    Also patch dirtyForLayoutFromPercentageHeightDescendants so that it will dirty
    preferred logical widths when a child has an aspect ratio, since we know that
    percentage height changes will potentially affect the preferred widths of the image and
    its ancestor blocks.
    
    * rendering/RenderBlock.h:
    Declaration of the new dirtyForLayoutFromPercentageHeightDescendants function.
    
    * rendering/RenderDeprecatedFlexibleBox.cpp:
    (WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
    Make the old flex box code call dirtyForLayoutFromPercentageHeightDescendants so
    that everything is dirtied properly.
    
    (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox):
    (WebCore::RenderDeprecatedFlexibleBox::layoutVerticalBox):
    Remove the isReplaced()/percentage height/width dirtying now that the old flexible
    box is using the same dirtying mechanism as RenderBlock.
    
    * rendering/RenderFlexibleBox.cpp:
    (WebCore::RenderFlexibleBox::layoutBlock):
    Patch the new flexible box code to use the dirtying mechanism that RenderBlock
    uses for percentage heights/widths on replaced descendants.
    
    * rendering/RenderObject.h:
    (WebCore::RenderObject::hasAspectRatio):
    Pulled the static helper function from RenderReplaced into a full-blown method
    on RenderObject, so that dirtyForLayoutFromPercentageHeightDescendants can call
    it to check if an object has an aspect ratio.
    
    * rendering/RenderReplaced.cpp:
    (WebCore::RenderReplaced::computeAspectRatioInformationForRenderBox):
    (WebCore::RenderReplaced::computeIntrinsicRatioInformation):
    Patch the call sites of the static helper function to use hasAspectRatio instead
    and get rid of the static in the cpp file.
    
    LayoutTests: 
    
    * css3/flexbox/image-percent-max-height-expected.html: Added.
    * css3/flexbox/image-percent-max-height.html: Added.
    * css3/flexbox/resources/hero.png: Added.
    * fast/flexbox/image-percent-max-height-expected.html: Added.
    * fast/flexbox/image-percent-max-height.html: Added.
    * fast/flexbox/resources/hero.png: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151997 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    b9f60e12