Changeset 91268 in webkit


Ignore:
Timestamp:
Jul 19, 2011 10:22:57 AM (13 years ago)
Author:
tony@chromium.org
Message:

use more specific types in CSSFlexValue
https://bugs.webkit.org/show_bug.cgi?id=64763

Reviewed by Ojan Vafai.

No new tests because no change in functionality.

  • css/CSSFlexValue.h:

(WebCore::CSSFlexValue::create):
(WebCore::CSSFlexValue::isFlexValue): Make it possible to tell if

we're a flex value or not. Will be needed when we're copying
values to RenderStyle.

(WebCore::CSSFlexValue::positiveFlex): Use floats for positive and

negative flex because in the render code, we use floats.

(WebCore::CSSFlexValue::negativeFlex): Add accessors for these since

we'll need it when reading the flex values.

(WebCore::CSSFlexValue::preferredSize):
(WebCore::CSSFlexValue::CSSFlexValue):

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseValidPrimitive): Make the type more

specific.

(WebCore::CSSParser::parseFlex):

  • css/CSSParser.h:
  • css/CSSValue.h:

(WebCore::CSSValue::isFlexValue):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r91267 r91268  
     12011-07-19  Tony Chang  <tony@chromium.org>
     2
     3        use more specific types in CSSFlexValue
     4        https://bugs.webkit.org/show_bug.cgi?id=64763
     5
     6        Reviewed by Ojan Vafai.
     7
     8        No new tests because no change in functionality.
     9
     10        * css/CSSFlexValue.h:
     11        (WebCore::CSSFlexValue::create):
     12        (WebCore::CSSFlexValue::isFlexValue): Make it possible to tell if
     13            we're a flex value or not.  Will be needed when we're copying
     14            values to RenderStyle.
     15        (WebCore::CSSFlexValue::positiveFlex): Use floats for positive and
     16            negative flex because in the render code, we use floats.
     17        (WebCore::CSSFlexValue::negativeFlex): Add accessors for these since
     18            we'll need it when reading the flex values.
     19        (WebCore::CSSFlexValue::preferredSize):
     20        (WebCore::CSSFlexValue::CSSFlexValue):
     21        * css/CSSParser.cpp:
     22        (WebCore::CSSParser::parseValidPrimitive): Make the type more
     23            specific.
     24        (WebCore::CSSParser::parseFlex):
     25        * css/CSSParser.h:
     26        * css/CSSValue.h:
     27        (WebCore::CSSValue::isFlexValue):
     28
    1292011-07-19  Chris Fleizach  <cfleizach@apple.com>
    230
  • trunk/Source/WebCore/css/CSSFlexValue.h

    r89396 r91268  
    3939class CSSFlexValue : public CSSValue {
    4040public:
    41     static PassRefPtr<CSSFlexValue> create(double positiveFlex, double negativeFlex, PassRefPtr<CSSValue> preferredSize)
     41    static PassRefPtr<CSSFlexValue> create(float positiveFlex, float negativeFlex, PassRefPtr<CSSPrimitiveValue> preferredSize)
    4242    {
    4343        return adoptRef(new CSSFlexValue(positiveFlex, negativeFlex, preferredSize));
     
    4848    virtual String cssText() const;
    4949
     50    virtual bool isFlexValue() const { return true; }
     51
     52    float positiveFlex() { return m_positiveFlex; }
     53    float negativeFlex() { return m_negativeFlex; }
     54    CSSPrimitiveValue* preferredSize() { return m_preferredSize.get(); }
     55
    5056private:
    51     CSSFlexValue(double positiveFlex, double negativeFlex, PassRefPtr<CSSValue> preferredSize)
     57    CSSFlexValue(float positiveFlex, float negativeFlex, PassRefPtr<CSSPrimitiveValue> preferredSize)
    5258        : m_positiveFlex(positiveFlex)
    5359        , m_negativeFlex(negativeFlex)
     
    5662    }
    5763
    58     double m_positiveFlex;
    59     double m_negativeFlex;
    60     RefPtr<CSSValue> m_preferredSize;
     64    float m_positiveFlex;
     65    float m_negativeFlex;
     66    RefPtr<CSSPrimitiveValue> m_preferredSize;
    6167};
    6268
  • trunk/Source/WebCore/css/CSSParser.cpp

    r90966 r91268  
    794794}
    795795
    796 inline PassRefPtr<CSSValue> CSSParser::parseValidPrimitive(int id, CSSParserValue* value)
     796inline PassRefPtr<CSSPrimitiveValue> CSSParser::parseValidPrimitive(int id, CSSParserValue* value)
    797797{
    798798    if (id)
     
    50505050    double positiveFlex = unsetValue;
    50515051    double negativeFlex = unsetValue;
    5052     RefPtr<CSSValue> preferredSize;
     5052    RefPtr<CSSPrimitiveValue> preferredSize;
    50535053
    50545054    while (CSSParserValue* arg = args->current()) {
     
    50815081        preferredSize = primitiveValueCache()->createIdentifierValue(CSSValueAuto);
    50825082
    5083     RefPtr<CSSFlexValue> flex = CSSFlexValue::create(positiveFlex, negativeFlex, preferredSize);
     5083    RefPtr<CSSFlexValue> flex = CSSFlexValue::create(clampToFloat(positiveFlex), clampToFloat(negativeFlex), preferredSize);
    50845084    addProperty(propId, flex.release(), important);
    50855085    return true;
  • trunk/Source/WebCore/css/CSSParser.h

    r90863 r91268  
    6969        static bool parseColor(RGBA32& color, const String&, bool strict = false);
    7070        static bool parseSystemColor(RGBA32& color, const String&, Document*);
    71         PassRefPtr<CSSValue> parseValidPrimitive(int propId, CSSParserValue*);
     71        PassRefPtr<CSSPrimitiveValue> parseValidPrimitive(int propId, CSSParserValue*);
    7272        bool parseColor(CSSMutableStyleDeclaration*, const String&);
    7373        bool parseDeclaration(CSSMutableStyleDeclaration*, const String&, RefPtr<CSSStyleSourceData>* styleSourceData = 0);
  • trunk/Source/WebCore/css/CSSValue.h

    r81684 r91268  
    5555    virtual bool isBorderImageValue() const { return false; }
    5656    virtual bool isCursorImageValue() const { return false; }
     57#if ENABLE(CSS3_FLEXBOX)
     58    virtual bool isFlexValue() const { return false; }
     59#endif
    5760    virtual bool isFontFamilyValue() const { return false; }
    5861    virtual bool isFontValue() const { return false; }
Note: See TracChangeset for help on using the changeset viewer.