| Differences between
and this patch
- a/Source/WebCore/ChangeLog +32 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2011-10-23  Fady Samuel  <fsamuel@chromium.org>
2
3
        CSS Aspect Ratio Property Parsing Stage
4
        https://bugs.webkit.org/show_bug.cgi?id=70707
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        No new tests. (OOPS!)
9
10
        * css/CSSComputedStyleDeclaration.cpp:
11
        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
12
        * css/CSSMutableStyleDeclaration.cpp:
13
        * css/CSSParser.cpp:
14
        (WebCore::CSSParser::parseValue):
15
        (WebCore::CSSParser::parseAspectRatio):
16
        * css/CSSParser.h:
17
        * css/CSSPropertyNames.in:
18
        * css/CSSStyleSelector.cpp:
19
        (WebCore::CSSStyleSelector::applyProperty):
20
        * rendering/style/RenderStyle.h:
21
        (WebCore::InheritedFlags::hasAspectRatio):
22
        (WebCore::InheritedFlags::setHasAspectRatio):
23
        (WebCore::InheritedFlags::aspectRatio):
24
        (WebCore::InheritedFlags::setAspectRatio):
25
        (WebCore::InheritedFlags::initialAspectRatio):
26
        * rendering/style/StyleBoxData.cpp:
27
        (WebCore::StyleBoxData::StyleBoxData):
28
        (WebCore::StyleBoxData::operator==):
29
        * rendering/style/StyleBoxData.h:
30
        (WebCore::StyleBoxData::aspectRatio):
31
        (WebCore::StyleBoxData::hasAspectRatio):
32
1
2011-10-23  Mark Hahnenberg  <mhahnenberg@apple.com>
33
2011-10-23  Mark Hahnenberg  <mhahnenberg@apple.com>
2
34
3
        Add deleteProperty to the MethodTable
35
        Add deleteProperty to the MethodTable
- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp -1 / +2 lines
Lines 1118-1124 PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp_sec1
1118
    switch (static_cast<CSSPropertyID>(propertyID)) {
1118
    switch (static_cast<CSSPropertyID>(propertyID)) {
1119
        case CSSPropertyInvalid:
1119
        case CSSPropertyInvalid:
1120
            break;
1120
            break;
1121
1121
        case CSSPropertyWebkitAspectRatio:
1122
            break;
1122
        case CSSPropertyBackgroundColor:
1123
        case CSSPropertyBackgroundColor:
1123
            return primitiveValueCache->createColorValue(m_allowVisitedStyle? style->visitedDependentColor(CSSPropertyBackgroundColor).rgb() : style->backgroundColor().rgb());
1124
            return primitiveValueCache->createColorValue(m_allowVisitedStyle? style->visitedDependentColor(CSSPropertyBackgroundColor).rgb() : style->backgroundColor().rgb());
1124
        case CSSPropertyBackgroundImage:
1125
        case CSSPropertyBackgroundImage:
- a/Source/WebCore/css/CSSMutableStyleDeclaration.cpp +1 lines
Lines 787-792 void CSSMutableStyleDeclaration::addSubresourceStyleURLs(ListHashSet<KURL>& urls a/Source/WebCore/css/CSSMutableStyleDeclaration.cpp_sec1
787
static const int blockProperties[] = {
787
static const int blockProperties[] = {
788
    CSSPropertyOrphans,
788
    CSSPropertyOrphans,
789
    CSSPropertyOverflow, // This can be also be applied to replaced elements
789
    CSSPropertyOverflow, // This can be also be applied to replaced elements
790
    CSSPropertyWebkitAspectRatio,
790
    CSSPropertyWebkitColumnCount,
791
    CSSPropertyWebkitColumnCount,
791
    CSSPropertyWebkitColumnGap,
792
    CSSPropertyWebkitColumnGap,
792
    CSSPropertyWebkitColumnRuleColor,
793
    CSSPropertyWebkitColumnRuleColor,
- a/Source/WebCore/css/CSSParser.cpp +29 lines
Lines 1506-1511 bool CSSParser::parseValue(int propId, bool important) a/Source/WebCore/css/CSSParser.cpp_sec1
1506
        return true;
1506
        return true;
1507
    }
1507
    }
1508
    case CSSPropertyBorderRadius:
1508
    case CSSPropertyBorderRadius:
1509
    case CSSPropertyWebkitAspectRatio:
1510
        if (id == CSSValueNone)
1511
            validPrimitive = true;
1512
        else
1513
          return parseAspectRatio(propId, important);
1509
    case CSSPropertyWebkitBorderRadius:
1514
    case CSSPropertyWebkitBorderRadius:
1510
        return parseBorderRadius(propId, important);
1515
        return parseBorderRadius(propId, important);
1511
    case CSSPropertyOutlineOffset:
1516
    case CSSPropertyOutlineOffset:
Lines 5630-5635 bool CSSParser::parseBorderRadius(int propId, bool important) a/Source/WebCore/css/CSSParser.cpp_sec2
5630
    return true;
5635
    return true;
5631
}
5636
}
5632
5637
5638
bool CSSParser::parseAspectRatio(int propId, bool important)
5639
{
5640
    unsigned num = m_valueList->size();
5641
    if (num != 3)
5642
        return false;
5643
5644
    CSSParserValue* lvalue = m_valueList->valueAt(0);
5645
    CSSParserValue* op = m_valueList->valueAt(1);
5646
    CSSParserValue* rvalue = m_valueList->valueAt(2);
5647
5648
    if (!op->unit == CSSParserValue::Operator || op->iValue != '/')
5649
        return false;
5650
5651
    if (!validUnit(lvalue, FLength, m_strict) || !validUnit(rvalue, FLength, m_strict))
5652
        return false;
5653
5654
    if (!rvalue->fValue)
5655
        return false;
5656
5657
    addProperty(CSSPropertyWebkitAspectRatio, CSSPrimitiveValue::create(lvalue->fValue / rvalue->fValue, CSSPrimitiveValue::CSS_NUMBER), important);
5658
5659
    return true;
5660
}
5661
5633
bool CSSParser::parseCounter(int propId, int defaultValue, bool important)
5662
bool CSSParser::parseCounter(int propId, int defaultValue, bool important)
5634
{
5663
{
5635
    enum { ID, VAL } state = ID;
5664
    enum { ID, VAL } state = ID;
- a/Source/WebCore/css/CSSParser.h +2 lines
Lines 171-176 public: a/Source/WebCore/css/CSSParser.h_sec1
171
    bool parseBorderImageOutset(RefPtr<CSSPrimitiveValue>&);
171
    bool parseBorderImageOutset(RefPtr<CSSPrimitiveValue>&);
172
    bool parseBorderRadius(int propId, bool important);
172
    bool parseBorderRadius(int propId, bool important);
173
173
174
    bool parseAspectRatio(int propId, bool important);
175
174
    bool parseReflect(int propId, bool important);
176
    bool parseReflect(int propId, bool important);
175
177
176
    bool parseFlex(int propId, bool important);
178
    bool parseFlex(int propId, bool important);
- a/Source/WebCore/css/CSSPropertyNames.in +1 lines
Lines 183-188 word-break a/Source/WebCore/css/CSSPropertyNames.in_sec1
183
word-spacing
183
word-spacing
184
word-wrap
184
word-wrap
185
z-index
185
z-index
186
-webkit-aspect-ratio
186
-webkit-animation
187
-webkit-animation
187
-webkit-animation-delay
188
-webkit-animation-delay
188
-webkit-animation-direction
189
-webkit-animation-direction
- a/Source/WebCore/css/CSSStyleSelector.cpp +3 lines
Lines 2380-2385 void CSSStyleSelector::applyProperty(int id, CSSValue *value) a/Source/WebCore/css/CSSStyleSelector.cpp_sec1
2380
    // RenderStyle values.  Shorthands (e.g. border, background) occur in this list as well and
2380
    // RenderStyle values.  Shorthands (e.g. border, background) occur in this list as well and
2381
    // are only hit when mapping "inherit" or "initial" into front-end values.
2381
    // are only hit when mapping "inherit" or "initial" into front-end values.
2382
    switch (property) {
2382
    switch (property) {
2383
    case CSSPropertyWebkitAspectRatio:
2384
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(aspectRatio, AspectRatio)
2385
        return;
2383
// ident only properties
2386
// ident only properties
2384
    case CSSPropertyBorderCollapse:
2387
    case CSSPropertyBorderCollapse:
2385
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(borderCollapse, BorderCollapse)
2388
        HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(borderCollapse, BorderCollapse)
- a/Source/WebCore/rendering/style/RenderStyle.h +6 lines
Lines 1081-1086 public: a/Source/WebCore/rendering/style/RenderStyle.h_sec1
1081
    int zIndex() const { return m_box->zIndex(); }
1081
    int zIndex() const { return m_box->zIndex(); }
1082
    void setZIndex(int v) { SET_VAR(m_box, m_hasAutoZIndex, false); SET_VAR(m_box, m_zIndex, v) }
1082
    void setZIndex(int v) { SET_VAR(m_box, m_hasAutoZIndex, false); SET_VAR(m_box, m_zIndex, v) }
1083
1083
1084
    bool hasAspectRatio() const { return m_box->hasAspectRatio(); }
1085
    void setHasAspectRatio(bool v) { SET_VAR(m_box, m_hasAspectRatio, v); SET_VAR(m_box, m_aspectRatio, 1.0f) }
1086
    float aspectRatio() const { return m_box->aspectRatio(); }
1087
    void setAspectRatio(float v) { SET_VAR(m_box, m_hasAspectRatio, true); SET_VAR(m_box, m_aspectRatio, v) }
1088
1084
    void setWidows(short w) { SET_VAR(rareInheritedData, widows, w); }
1089
    void setWidows(short w) { SET_VAR(rareInheritedData, widows, w); }
1085
    void setOrphans(short o) { SET_VAR(rareInheritedData, orphans, o); }
1090
    void setOrphans(short o) { SET_VAR(rareInheritedData, orphans, o); }
1086
    // For valid values of page-break-inside see http://www.w3.org/TR/CSS21/page.html#page-break-props
1091
    // For valid values of page-break-inside see http://www.w3.org/TR/CSS21/page.html#page-break-props
Lines 1342-1347 public: a/Source/WebCore/rendering/style/RenderStyle.h_sec2
1342
    Color visitedDependentColor(int colorProperty) const;
1347
    Color visitedDependentColor(int colorProperty) const;
1343
1348
1344
    // Initial values for all the properties
1349
    // Initial values for all the properties
1350
    static float initialAspectRatio() { return 1.0f; }
1345
    static EBorderCollapse initialBorderCollapse() { return BSEPARATE; }
1351
    static EBorderCollapse initialBorderCollapse() { return BSEPARATE; }
1346
    static EBorderStyle initialBorderStyle() { return BNONE; }
1352
    static EBorderStyle initialBorderStyle() { return BNONE; }
1347
    static OutlineIsAuto initialOutlineStyleIsAuto() { return AUTO_OFF; }
1353
    static OutlineIsAuto initialOutlineStyleIsAuto() { return AUTO_OFF; }
- a/Source/WebCore/rendering/style/StyleBoxData.cpp +6 lines
Lines 33-39 StyleBoxData::StyleBoxData() a/Source/WebCore/rendering/style/StyleBoxData.cpp_sec1
33
    , m_minHeight(RenderStyle::initialMinSize())
33
    , m_minHeight(RenderStyle::initialMinSize())
34
    , m_maxHeight(RenderStyle::initialMaxSize())
34
    , m_maxHeight(RenderStyle::initialMaxSize())
35
    , m_zIndex(0)
35
    , m_zIndex(0)
36
    , m_aspectRatio(1)
36
    , m_hasAutoZIndex(true)
37
    , m_hasAutoZIndex(true)
38
    , m_hasAspectRatio(false)
37
    , m_boxSizing(CONTENT_BOX)
39
    , m_boxSizing(CONTENT_BOX)
38
{
40
{
39
}
41
}
Lines 47-53 StyleBoxData::StyleBoxData(const StyleBoxData& o) a/Source/WebCore/rendering/style/StyleBoxData.cpp_sec2
47
    , m_minHeight(o.m_minHeight)
49
    , m_minHeight(o.m_minHeight)
48
    , m_maxHeight(o.m_maxHeight)
50
    , m_maxHeight(o.m_maxHeight)
49
    , m_zIndex(o.m_zIndex)
51
    , m_zIndex(o.m_zIndex)
52
    , m_aspectRatio(o.m_aspectRatio)
50
    , m_hasAutoZIndex(o.m_hasAutoZIndex)
53
    , m_hasAutoZIndex(o.m_hasAutoZIndex)
54
    , m_hasAspectRatio(o.m_hasAspectRatio)
51
    , m_boxSizing(o.m_boxSizing)
55
    , m_boxSizing(o.m_boxSizing)
52
{
56
{
53
}
57
}
Lines 62-67 bool StyleBoxData::operator==(const StyleBoxData& o) const a/Source/WebCore/rendering/style/StyleBoxData.cpp_sec3
62
           && m_maxHeight == o.m_maxHeight
66
           && m_maxHeight == o.m_maxHeight
63
           && m_zIndex == o.m_zIndex
67
           && m_zIndex == o.m_zIndex
64
           && m_hasAutoZIndex == o.m_hasAutoZIndex
68
           && m_hasAutoZIndex == o.m_hasAutoZIndex
69
           && m_aspectRatio == o.m_aspectRatio
70
           && m_hasAspectRatio == o.m_hasAspectRatio
65
           && m_boxSizing == o.m_boxSizing;
71
           && m_boxSizing == o.m_boxSizing;
66
}
72
}
67
73
- a/Source/WebCore/rendering/style/StyleBoxData.h +6 lines
Lines 56-61 public: a/Source/WebCore/rendering/style/StyleBoxData.h_sec1
56
    
56
    
57
    int zIndex() const { return m_zIndex; }
57
    int zIndex() const { return m_zIndex; }
58
    bool hasAutoZIndex() const { return m_hasAutoZIndex; }
58
    bool hasAutoZIndex() const { return m_hasAutoZIndex; }
59
60
    float aspectRatio() const { return m_aspectRatio; }
61
    bool hasAspectRatio() const { return m_hasAspectRatio; }
59
    
62
    
60
    EBoxSizing boxSizing() const { return static_cast<EBoxSizing>(m_boxSizing); }
63
    EBoxSizing boxSizing() const { return static_cast<EBoxSizing>(m_boxSizing); }
61
64
Lines 77-83 private: a/Source/WebCore/rendering/style/StyleBoxData.h_sec2
77
    Length m_verticalAlign;
80
    Length m_verticalAlign;
78
81
79
    int m_zIndex;
82
    int m_zIndex;
83
    float m_aspectRatio;
84
 
80
    bool m_hasAutoZIndex : 1;
85
    bool m_hasAutoZIndex : 1;
86
    bool m_hasAspectRatio : 1;
81
    unsigned m_boxSizing : 1; // EBoxSizing
87
    unsigned m_boxSizing : 1; // EBoxSizing
82
};
88
};
83
89

Return to Bug 70707