Changeset 91410 in webkit


Ignore:
Timestamp:
Jul 20, 2011 3:00:29 PM (13 years ago)
Author:
tony@chromium.org
Message:

Pass -webkit-flex() values on to RenderStyle
https://bugs.webkit.org/show_bug.cgi?id=64038

Reviewed by Eric Seidel.

No new tests, this just copies data to RenderStyle, which we can
then access when doing layout. Tests will come with the layout
changes.

  • css/CSSStyleApplyProperty.cpp:

(WebCore::ApplyPropertyLength::applyValue):
(WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r91409 r91410  
     12011-07-20  Tony Chang  <tony@chromium.org>
     2
     3        Pass -webkit-flex() values on to RenderStyle
     4        https://bugs.webkit.org/show_bug.cgi?id=64038
     5
     6        Reviewed by Eric Seidel.
     7
     8        No new tests, this just copies data to RenderStyle, which we can
     9        then access when doing layout.  Tests will come with the layout
     10        changes.
     11
     12        * css/CSSStyleApplyProperty.cpp:
     13        (WebCore::ApplyPropertyLength::applyValue):
     14        (WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty):
     15
    1162011-07-20  Daniel Bates  <dbates@rim.com>
    217
  • trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp

    r91336 r91410  
    2727
    2828#include "CSSCursorImageValue.h"
     29#include "CSSFlexValue.h"
    2930#include "CSSPrimitiveValueMappings.h"
    3031#include "CSSStyleSelector.h"
     
    214215enum LengthNone {NoneDisabled = 0, NoneEnabled = 1};
    215216enum LengthUndefined {UndefinedDisabled = 0, UndefinedEnabled = 1};
     217enum LengthFlexDirection {FlexDirectionDisabled = 0, FlexWidth = 1, FlexHeight};
    216218template <LengthAuto autoEnabled = AutoDisabled,
    217219          LengthIntrinsic intrinsicEnabled = IntrinsicDisabled,
    218220          LengthMinIntrinsic minIntrinsicEnabled = MinIntrinsicDisabled,
    219221          LengthNone noneEnabled = NoneDisabled,
    220           LengthUndefined noneUndefined = UndefinedDisabled>
     222          LengthUndefined noneUndefined = UndefinedDisabled,
     223          LengthFlexDirection flexDirection = FlexDirectionDisabled>
    221224class ApplyPropertyLength : public ApplyPropertyDefaultBase<Length> {
    222225public:
     
    229232    virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const
    230233    {
     234#if ENABLE(CSS3_FLEXBOX)
     235        if (!value->isPrimitiveValue()) {
     236            if (!flexDirection || !value->isFlexValue())
     237                return;
     238
     239            CSSFlexValue* flexValue = static_cast<CSSFlexValue*>(value);
     240            value = flexValue->preferredSize();
     241
     242            if (flexDirection == FlexWidth) {
     243                selector->style()->setFlexboxWidthPositiveFlex(flexValue->positiveFlex());
     244                selector->style()->setFlexboxWidthNegativeFlex(flexValue->negativeFlex());
     245            } else if (flexDirection == FlexHeight) {
     246                selector->style()->setFlexboxHeightPositiveFlex(flexValue->positiveFlex());
     247                selector->style()->setFlexboxHeightNegativeFlex(flexValue->negativeFlex());
     248            }
     249        }
     250#else
    231251        if (!value->isPrimitiveValue())
    232252            return;
     253#endif
    233254
    234255        CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
     
    750771    setPropertyHandler(CSSPropertyLeft, new ApplyPropertyLength<AutoEnabled>(&RenderStyle::left, &RenderStyle::setLeft, &RenderStyle::initialOffset));
    751772
    752     setPropertyHandler(CSSPropertyWidth, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled>(&RenderStyle::width, &RenderStyle::setWidth, &RenderStyle::initialSize));
    753     setPropertyHandler(CSSPropertyHeight, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled>(&RenderStyle::height, &RenderStyle::setHeight, &RenderStyle::initialSize));
     773    setPropertyHandler(CSSPropertyWidth, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneDisabled, UndefinedDisabled, FlexWidth>(&RenderStyle::width, &RenderStyle::setWidth, &RenderStyle::initialSize));
     774    setPropertyHandler(CSSPropertyHeight, new ApplyPropertyLength<AutoEnabled, IntrinsicEnabled, MinIntrinsicEnabled, NoneDisabled, UndefinedDisabled, FlexHeight>(&RenderStyle::height, &RenderStyle::setHeight, &RenderStyle::initialSize));
    754775
    755776    setPropertyHandler(CSSPropertyTextIndent, new ApplyPropertyLength<>(&RenderStyle::textIndent, &RenderStyle::setTextIndent, &RenderStyle::initialTextIndent));
Note: See TracChangeset for help on using the changeset viewer.