Bug 97827

Summary: RenderFlexibleBox::preferredMainAxisContentExtentForChild can return a negative value
Product: WebKit Reporter: Ojan Vafai <ojan>
Component: Layout and RenderingAssignee: Tony Chang <tony>
Status: RESOLVED FIXED    
Severity: Normal CC: eric, tony, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 62048    
Attachments:
Description Flags
Patch none

Description Ojan Vafai 2012-09-27 16:00:58 PDT
LayoutUnit RenderFlexibleBox::preferredMainAxisContentExtentForChild(RenderBox* child)
{
    Length flexBasis = flexBasisForChild(child);
    if (flexBasis.isAuto()) {
        LayoutUnit mainAxisExtent = hasOrthogonalFlow(child) ? child->logicalHeight() : child->maxPreferredLogicalWidth();
        return mainAxisExtent - mainAxisBorderAndPaddingExtentForChild(child);
    }
    return std::max(LayoutUnit(0), computeMainAxisExtentForChild(child, MainOrPreferredSize, flexBasis));
}


In the first return statement we need to clamp to 0 the same way we do in the second one. If mainAxisExtent < mainAxisBorderAndPaddingExtentForChild, then we are incorrectly returning a negative value.
Comment 1 Tony Chang 2012-10-19 16:47:36 PDT
Created attachment 169722 [details]
Patch
Comment 2 WebKit Review Bot 2012-10-19 18:49:17 PDT
Comment on attachment 169722 [details]
Patch

Clearing flags on attachment: 169722

Committed r131972: <http://trac.webkit.org/changeset/131972>
Comment 3 WebKit Review Bot 2012-10-19 18:49:21 PDT
All reviewed patches have been landed.  Closing bug.