Bug 97827 - RenderFlexibleBox::preferredMainAxisContentExtentForChild can return a negative value
Summary: RenderFlexibleBox::preferredMainAxisContentExtentForChild can return a negati...
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tony Chang
Depends on:
Blocks: 62048
  Show dependency treegraph
Reported: 2012-09-27 16:00 PDT by Ojan Vafai
Modified: 2012-10-19 18:49 PDT (History)
3 users (show)

See Also:

Patch (1.80 KB, patch)
2012-10-19 16:47 PDT, Tony Chang
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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]
Comment 2 WebKit Review Bot 2012-10-19 18:49:17 PDT
Comment on attachment 169722 [details]

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.