Ignore:
Timestamp:
Jun 19, 2012, 5:40:39 PM (13 years ago)
Author:
[email protected]
Message:

Refactor RenderFlexibleBox terminology to use grow/shrink instead of positive/negative
https://bugs.webkit.org/show_bug.cgi?id=89493

Reviewed by Eric Seidel.

The spec stopped referring to positive and negative flex and now
talks about flex grow and flex shrink. Also, the preferred size is
now known as the flex basis. Make the code match the terms used in
the spec. http://dev.w3.org/csswg/css3-flexbox/

This will also make it easier to split flex into long hand notation
(flex-grow, flex-shrink and flex-basis).

No new tests, covered by existing tests.

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):

  • css/StyleBuilder.cpp:

(WebCore::ApplyPropertyFlex::applyInheritValue):
(WebCore::ApplyPropertyFlex::applyInitialValue):
(WebCore::ApplyPropertyFlex::applyValue):

  • page/animation/CSSPropertyAnimation.cpp:

(WebCore::PropertyWrapperFlex::equals):
(WebCore::PropertyWrapperFlex::blend):

  • rendering/RenderFlexibleBox.cpp:

(WebCore::RenderFlexibleBox::flexBasisForChild):
(WebCore::RenderFlexibleBox::preferredMainAxisContentExtentForChild):
(WebCore::RenderFlexibleBox::layoutFlexItems):
(WebCore::RenderFlexibleBox::computeMainAxisPreferredSizes):
(WebCore::RenderFlexibleBox::computeNextFlexLine):
(WebCore::RenderFlexibleBox::freezeViolations):
(WebCore::RenderFlexibleBox::resolveFlexibleLengths):

  • rendering/RenderFlexibleBox.h:
  • rendering/style/RenderStyle.h:
  • rendering/style/StyleFlexibleBoxData.cpp:

(WebCore::StyleFlexibleBoxData::StyleFlexibleBoxData):
(WebCore::StyleFlexibleBoxData::operator==):

  • rendering/style/StyleFlexibleBoxData.h:

(StyleFlexibleBoxData):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/StyleBuilder.cpp

    r120735 r120780  
    17081708    static void applyInheritValue(StyleResolver* styleResolver)
    17091709    {
    1710         ApplyPropertyDefaultBase<float, &RenderStyle::positiveFlex, float, &RenderStyle::setPositiveFlex, float, &RenderStyle::initialNegativeFlex>::applyInheritValue(styleResolver);
    1711         ApplyPropertyDefaultBase<float, &RenderStyle::negativeFlex, float, &RenderStyle::setNegativeFlex, float, &RenderStyle::initialPositiveFlex>::applyInheritValue(styleResolver);
    1712         ApplyPropertyDefaultBase<Length, &RenderStyle::flexPreferredSize, Length, &RenderStyle::setFlexPreferredSize, Length, &RenderStyle::initialFlexPreferredSize>::applyInheritValue(styleResolver);
     1710        ApplyPropertyDefaultBase<float, &RenderStyle::flexGrow, float, &RenderStyle::setFlexGrow, float, &RenderStyle::initialFlexGrow>::applyInheritValue(styleResolver);
     1711        ApplyPropertyDefaultBase<float, &RenderStyle::flexShrink, float, &RenderStyle::setFlexShrink, float, &RenderStyle::initialFlexShrink>::applyInheritValue(styleResolver);
     1712        ApplyPropertyDefaultBase<Length, &RenderStyle::flexBasis, Length, &RenderStyle::setFlexBasis, Length, &RenderStyle::initialFlexBasis>::applyInheritValue(styleResolver);
    17131713    }
    17141714
    17151715    static void applyInitialValue(StyleResolver* styleResolver)
    17161716    {
    1717         styleResolver->style()->setPositiveFlex(RenderStyle::initialPositiveFlex());
    1718         styleResolver->style()->setNegativeFlex(RenderStyle::initialNegativeFlex());
    1719         styleResolver->style()->setFlexPreferredSize(RenderStyle::initialFlexPreferredSize());
     1717        styleResolver->style()->setFlexGrow(RenderStyle::initialFlexGrow());
     1718        styleResolver->style()->setFlexShrink(RenderStyle::initialFlexShrink());
     1719        styleResolver->style()->setFlexBasis(RenderStyle::initialFlexBasis());
    17201720    }
    17211721
     
    17251725            CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
    17261726            if (primitiveValue->getIdent() == CSSValueNone) {
    1727                 styleResolver->style()->setPositiveFlex(0);
    1728                 styleResolver->style()->setNegativeFlex(0);
    1729                 styleResolver->style()->setFlexPreferredSize(Length(Auto));
     1727                styleResolver->style()->setFlexGrow(0);
     1728                styleResolver->style()->setFlexShrink(0);
     1729                styleResolver->style()->setFlexBasis(Length(Auto));
    17301730            }
    17311731            return;
     
    17411741        if (!getFlexValue(valueList->itemWithoutBoundsCheck(0), flexValue))
    17421742            return;
    1743         styleResolver->style()->setPositiveFlex(flexValue);
     1743        styleResolver->style()->setFlexGrow(flexValue);
    17441744
    17451745        if (!getFlexValue(valueList->itemWithoutBoundsCheck(1), flexValue))
    17461746            return;
    1747         styleResolver->style()->setNegativeFlex(flexValue);
    1748 
    1749         ApplyPropertyLength<&RenderStyle::flexPreferredSize, &RenderStyle::setFlexPreferredSize, &RenderStyle::initialFlexPreferredSize, AutoEnabled>::applyValue(styleResolver, valueList->itemWithoutBoundsCheck(2));
     1747        styleResolver->style()->setFlexShrink(flexValue);
     1748
     1749        ApplyPropertyLength<&RenderStyle::flexBasis, &RenderStyle::setFlexBasis, &RenderStyle::initialFlexBasis, AutoEnabled>::applyValue(styleResolver, valueList->itemWithoutBoundsCheck(2));
    17501750    }
    17511751
Note: See TracChangeset for help on using the changeset viewer.