Changeset 123696 in webkit


Ignore:
Timestamp:
Jul 25, 2012 7:24:47 PM (12 years ago)
Author:
tony@chromium.org
Message:

flexitems can overflow the flexbox due to rounding
https://bugs.webkit.org/show_bug.cgi?id=92163

Reviewed by Levi Weintraub.

Source/WebCore:

Don't round flex item sizes and use LayoutPoint for the location of flex items.

Test: css3/flexbox/flex-rounding.html

  • rendering/RenderFlexibleBox.cpp:

(WebCore::RenderFlexibleBox::resolveFlexibleLengths):
(WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
(WebCore::RenderFlexibleBox::layoutColumnReverse):

LayoutTests:

Tests for dividing space in non-integral amounts.

  • css3/flexbox/flex-rounding-expected.txt: Added.
  • css3/flexbox/flex-rounding.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r123692 r123696  
     12012-07-25  Tony Chang  <tony@chromium.org>
     2
     3        flexitems can overflow the flexbox due to rounding
     4        https://bugs.webkit.org/show_bug.cgi?id=92163
     5
     6        Reviewed by Levi Weintraub.
     7
     8        Tests for dividing space in non-integral amounts.
     9
     10        * css3/flexbox/flex-rounding-expected.txt: Added.
     11        * css3/flexbox/flex-rounding.html: Added.
     12
    1132012-07-25  Yoshifumi Inoue  <yosin@chromium.org>
    214
  • trunk/Source/WebCore/ChangeLog

    r123694 r123696  
     12012-07-25  Tony Chang  <tony@chromium.org>
     2
     3        flexitems can overflow the flexbox due to rounding
     4        https://bugs.webkit.org/show_bug.cgi?id=92163
     5
     6        Reviewed by Levi Weintraub.
     7
     8        Don't round flex item sizes and use LayoutPoint for the location of flex items.
     9
     10        Test: css3/flexbox/flex-rounding.html
     11
     12        * rendering/RenderFlexibleBox.cpp:
     13        (WebCore::RenderFlexibleBox::resolveFlexibleLengths):
     14        (WebCore::RenderFlexibleBox::layoutAndPlaceChildren):
     15        (WebCore::RenderFlexibleBox::layoutColumnReverse):
     16
    1172012-07-25  Jonathan Dong  <jonathan.dong@torchmobile.com.cn>
    218
  • trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp

    r122508 r123696  
    879879            LayoutUnit childSize = preferredChildSize;
    880880            if (availableFreeSpace > 0 && totalFlexGrow > 0 && flexSign == PositiveFlexibility && isfinite(totalFlexGrow))
    881                 childSize += static_cast<int>(lroundf(availableFreeSpace * child->style()->flexGrow() / totalFlexGrow));
     881                childSize += availableFreeSpace * child->style()->flexGrow() / totalFlexGrow;
    882882            else if (availableFreeSpace < 0 && totalWeightedFlexShrink > 0 && flexSign == NegativeFlexibility && isfinite(totalWeightedFlexShrink))
    883                 childSize += static_cast<int>(lroundf(availableFreeSpace * child->style()->flexShrink() * preferredChildSize / totalWeightedFlexShrink));
     883                childSize += availableFreeSpace * child->style()->flexShrink() * preferredChildSize / totalWeightedFlexShrink;
    884884
    885885            LayoutUnit adjustedChildSize = adjustChildSizeForMinAndMax(child, childSize, flexboxAvailableContentExtent);
     
    10191019
    10201020        LayoutUnit childMainExtent = mainAxisExtentForChild(child);
    1021         IntPoint childLocation(shouldFlipMainAxis ? totalMainExtent - mainAxisOffset - childMainExtent : mainAxisOffset,
     1021        LayoutPoint childLocation(shouldFlipMainAxis ? totalMainExtent - mainAxisOffset - childMainExtent : mainAxisOffset,
    10221022            crossAxisOffset + flowAwareMarginBeforeForChild(child));
    10231023
     
    10621062
    10631063        LayoutRect oldRect = child->frameRect();
    1064         setFlowAwareLocationForChild(child, IntPoint(mainAxisOffset, crossAxisOffset + flowAwareMarginBeforeForChild(child)));
     1064        setFlowAwareLocationForChild(child, LayoutPoint(mainAxisOffset, crossAxisOffset + flowAwareMarginBeforeForChild(child)));
    10651065        if (!selfNeedsLayout() && child->checkForRepaintDuringLayout())
    10661066            child->repaintDuringLayoutIfMoved(oldRect);
Note: See TracChangeset for help on using the changeset viewer.