Title: [94597] trunk
Revision
94597
Author
[email protected]
Date
2011-09-06 14:45:08 -0700 (Tue, 06 Sep 2011)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=67672
        
Improve background-size parsing. Make it actually dump auto values properly, and also make it omit
auto if it is the second value. Fix the parsing to not create a value list when only a singleton value
is specified.

Reviewed by Beth Dakin.

Covered well by existing tests.

Source/WebCore: 

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::fillSizeToCSSValue):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseFillSize):
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::mapFillSize):

LayoutTests: 

* fast/backgrounds/size/parsing-background-size-values-expected.txt:
* fast/backgrounds/size/parsing-inherit-expected.txt:
* fast/backgrounds/size/resources/parsing-background-size-values.js:
* fast/backgrounds/size/resources/parsing-inherit.js:
* fast/css/getComputedStyle/computed-style-expected.txt:
* fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
* fast/css/getComputedStyle/getComputedStyle-background-size-expected.txt:
* fast/css/value-list-out-of-bounds-crash.html:
* svg/css/getComputedStyle-basic-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (94596 => 94597)


--- trunk/LayoutTests/ChangeLog	2011-09-06 21:18:54 UTC (rev 94596)
+++ trunk/LayoutTests/ChangeLog	2011-09-06 21:45:08 UTC (rev 94597)
@@ -1,5 +1,27 @@
 2011-09-06  David Hyatt  <[email protected]>
 
+        https://bugs.webkit.org/show_bug.cgi?id=67672
+        
+        Improve background-size parsing. Make it actually dump auto values properly, and also make it omit
+        auto if it is the second value. Fix the parsing to not create a value list when only a singleton value
+        is specified.
+
+        Reviewed by Beth Dakin.
+
+        Covered well by existing tests.
+
+        * fast/backgrounds/size/parsing-background-size-values-expected.txt:
+        * fast/backgrounds/size/parsing-inherit-expected.txt:
+        * fast/backgrounds/size/resources/parsing-background-size-values.js:
+        * fast/backgrounds/size/resources/parsing-inherit.js:
+        * fast/css/getComputedStyle/computed-style-expected.txt:
+        * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+        * fast/css/getComputedStyle/getComputedStyle-background-size-expected.txt:
+        * fast/css/value-list-out-of-bounds-crash.html:
+        * svg/css/getComputedStyle-basic-expected.txt:
+
+2011-09-06  David Hyatt  <[email protected]>
+
         Update some layout test results following the improved Pair parsing code that landed in r94593.
 
         * fast/backgrounds/size/parsing-background-size-values-expected.txt:

Modified: trunk/LayoutTests/fast/backgrounds/size/parsing-background-size-values-expected.txt (94596 => 94597)


--- trunk/LayoutTests/fast/backgrounds/size/parsing-background-size-values-expected.txt	2011-09-06 21:18:54 UTC (rev 94596)
+++ trunk/LayoutTests/fast/backgrounds/size/parsing-background-size-values-expected.txt	2011-09-06 21:45:08 UTC (rev 94597)
@@ -7,19 +7,19 @@
 PASS test("background-size: cover;") is "cover"
 PASS test("background-size: 100 100;") is "100px"
 PASS test("background-size: 100px 100px;") is "100px"
-PASS test("background-size: auto 50px;") is " 50px"
-PASS test("background-size: 50px auto;") is "50px "
-PASS test("background-size: auto auto;") is " "
+PASS test("background-size: auto 50px;") is "auto 50px"
+PASS test("background-size: 50px auto;") is "50px"
+PASS test("background-size: auto auto;") is "auto"
 PASS test("background-size: 30% 20%;") is "30% 20%"
-PASS test("background-size: 4em auto;") is "4em "
-PASS test("background-size: 5em;") is "5em "
+PASS test("background-size: 4em auto;") is "4em"
+PASS test("background-size: 5em;") is "5em"
 PASS test("-webkit-background-size: 5em ;") is "5em"
 PASS test("background-size: 100 100 100;") is null
 PASS test("background-size: coconut;") is null
 PASS test("background-size: 100px,;") is null
-PASS test("background-size: 100px, 50%;") is "100px , 50% "
+PASS test("background-size: 100px, 50%;") is "100px, 50%"
 PASS test("-webkit-background-size: 100px, 50%;") is "100px, 50%"
-PASS test("background-size: 50% 100px, 2em, 100px 50%;") is "50% 100px, 2em , 100px 50%"
+PASS test("background-size: 50% 100px, 2em, 100px 50%;") is "50% 100px, 2em, 100px 50%"
 PASS test("-webkit-background-size: 50% 100px, 2em, 100px 50%;") is "50% 100px, 2em, 100px 50%"
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/fast/backgrounds/size/parsing-inherit-expected.txt (94596 => 94597)


--- trunk/LayoutTests/fast/backgrounds/size/parsing-inherit-expected.txt	2011-09-06 21:18:54 UTC (rev 94596)
+++ trunk/LayoutTests/fast/backgrounds/size/parsing-inherit-expected.txt	2011-09-06 21:45:08 UTC (rev 94597)
@@ -8,14 +8,14 @@
 PASS test("background-size: 100 100;") is "100px 100px"
 PASS test("background-size: 100px 100px;") is "100px 100px"
 PASS test("background-size: auto 50px;") is "auto 50px"
-PASS test("background-size: 50px auto;") is "50px auto"
-PASS test("background-size: auto auto;") is "auto auto"
+PASS test("background-size: 50px auto;") is "50px"
+PASS test("background-size: auto auto;") is "auto"
 PASS test("background-size: 30% 20%;") is "30% 20%"
-PASS test("background-size: 4em auto;") is "64px auto"
-PASS test("background-size: 5em ;") is "80px auto"
+PASS test("background-size: 4em auto;") is "64px"
+PASS test("background-size: 5em ;") is "80px"
 PASS test("-webkit-background-size: 5em ;") is "80px 80px"
-PASS test("background-size: 100 100 100;") is "auto auto"
-PASS test("background-size: coconut;") is "auto auto"
+PASS test("background-size: 100 100 100;") is "auto"
+PASS test("background-size: coconut;") is "auto"
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/backgrounds/size/resources/parsing-background-size-values.js (94596 => 94597)


--- trunk/LayoutTests/fast/backgrounds/size/resources/parsing-background-size-values.js	2011-09-06 21:18:54 UTC (rev 94596)
+++ trunk/LayoutTests/fast/backgrounds/size/resources/parsing-background-size-values.js	2011-09-06 21:45:08 UTC (rev 94597)
@@ -15,21 +15,21 @@
 shouldBe('test("background-size: cover;")', '"cover"');
 shouldBe('test("background-size: 100 100;")', '"100px"');
 shouldBe('test("background-size: 100px 100px;")', '"100px"');
-shouldBe('test("background-size: auto 50px;")', '" 50px"');
-shouldBe('test("background-size: 50px auto;")', '"50px "');
-shouldBe('test("background-size: auto auto;")', '" "');
+shouldBe('test("background-size: auto 50px;")', '"auto 50px"');
+shouldBe('test("background-size: 50px auto;")', '"50px"');
+shouldBe('test("background-size: auto auto;")', '"auto"');
 shouldBe('test("background-size: 30% 20%;")', '"30% 20%"');
-shouldBe('test("background-size: 4em auto;")', '"4em "');
-shouldBe('test("background-size: 5em;")', '"5em "');
+shouldBe('test("background-size: 4em auto;")', '"4em"');
+shouldBe('test("background-size: 5em;")', '"5em"');
 shouldBe('test("-webkit-background-size: 5em ;")', '"5em"');
 
 shouldBe('test("background-size: 100 100 100;")', 'null');
 shouldBe('test("background-size: coconut;")', 'null');
 
 shouldBe('test("background-size: 100px,;")', 'null');
-shouldBe('test("background-size: 100px, 50%;")', '"100px , 50% "');
+shouldBe('test("background-size: 100px, 50%;")', '"100px, 50%"');
 shouldBe('test("-webkit-background-size: 100px, 50%;")', '"100px, 50%"');
-shouldBe('test("background-size: 50% 100px, 2em, 100px 50%;")', '"50% 100px, 2em , 100px 50%"');
+shouldBe('test("background-size: 50% 100px, 2em, 100px 50%;")', '"50% 100px, 2em, 100px 50%"');
 shouldBe('test("-webkit-background-size: 50% 100px, 2em, 100px 50%;")', '"50% 100px, 2em, 100px 50%"');
 
 var successfullyParsed = true;

Modified: trunk/LayoutTests/fast/backgrounds/size/resources/parsing-inherit.js (94596 => 94597)


--- trunk/LayoutTests/fast/backgrounds/size/resources/parsing-inherit.js	2011-09-06 21:18:54 UTC (rev 94596)
+++ trunk/LayoutTests/fast/backgrounds/size/resources/parsing-inherit.js	2011-09-06 21:45:08 UTC (rev 94597)
@@ -20,14 +20,14 @@
 shouldBe('test("background-size: 100 100;")', '"100px 100px"');
 shouldBe('test("background-size: 100px 100px;")', '"100px 100px"');
 shouldBe('test("background-size: auto 50px;")', '"auto 50px"');
-shouldBe('test("background-size: 50px auto;")', '"50px auto"');
-shouldBe('test("background-size: auto auto;")', '"auto auto"');
+shouldBe('test("background-size: 50px auto;")', '"50px"');
+shouldBe('test("background-size: auto auto;")', '"auto"');
 shouldBe('test("background-size: 30% 20%;")', '"30% 20%"');
-shouldBe('test("background-size: 4em auto;")', '"64px auto"');
-shouldBe('test("background-size: 5em ;")', '"80px auto"');
+shouldBe('test("background-size: 4em auto;")', '"64px"');
+shouldBe('test("background-size: 5em ;")', '"80px"');
 shouldBe('test("-webkit-background-size: 5em ;")', '"80px 80px"');
 
-shouldBe('test("background-size: 100 100 100;")', '"auto auto"');
-shouldBe('test("background-size: coconut;")', '"auto auto"');
+shouldBe('test("background-size: 100 100 100;")', '"auto"');
+shouldBe('test("background-size: coconut;")', '"auto"');
 
 var successfullyParsed = true;

Modified: trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt (94596 => 94597)


--- trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt	2011-09-06 21:18:54 UTC (rev 94596)
+++ trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt	2011-09-06 21:45:08 UTC (rev 94597)
@@ -7,7 +7,7 @@
 background-origin: padding-box;
 background-position: 0% 0%;
 background-repeat: repeat;
-background-size: auto auto;
+background-size: auto;
 border-bottom-color: rgb(0, 0, 0);
 border-bottom-left-radius: 0px;
 border-bottom-right-radius: 0px;
@@ -114,7 +114,7 @@
 -webkit-background-clip: border-box;
 -webkit-background-composite: source-over;
 -webkit-background-origin: padding-box;
--webkit-background-size: auto auto;
+-webkit-background-size: auto;
 -webkit-border-fit: border;
 -webkit-border-horizontal-spacing: 0px;
 -webkit-border-image: none;
@@ -168,7 +168,7 @@
 -webkit-mask-origin: border-box;
 -webkit-mask-position: 0% 0%;
 -webkit-mask-repeat: repeat;
--webkit-mask-size: auto auto;
+-webkit-mask-size: auto;
 -webkit-nbsp-mode: normal;
 -webkit-perspective: none;
 -webkit-perspective-origin: 392px 288px;

Modified: trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt (94596 => 94597)


--- trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt	2011-09-06 21:18:54 UTC (rev 94596)
+++ trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt	2011-09-06 21:45:08 UTC (rev 94597)
@@ -6,7 +6,7 @@
     background-origin: padding-box
     background-position: 0% 0%
     background-repeat: repeat
-    background-size: auto auto
+    background-size: auto
     border-bottom-color: rgb(0, 0, 0)
     border-bottom-left-radius: 0px
     border-bottom-right-radius: 0px
@@ -113,7 +113,7 @@
     -webkit-background-clip: border-box
     -webkit-background-composite: source-over
     -webkit-background-origin: padding-box
-    -webkit-background-size: auto auto
+    -webkit-background-size: auto
     -webkit-border-fit: border
     -webkit-border-horizontal-spacing: 0px
     -webkit-border-image: none
@@ -167,7 +167,7 @@
     -webkit-mask-origin: border-box
     -webkit-mask-position: 0% 0%
     -webkit-mask-repeat: repeat
-    -webkit-mask-size: auto auto
+    -webkit-mask-size: auto
     -webkit-nbsp-mode: normal
     -webkit-perspective: none
     -webkit-perspective-origin: 50% 50%

Modified: trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-background-size-expected.txt (94596 => 94597)


--- trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-background-size-expected.txt	2011-09-06 21:18:54 UTC (rev 94596)
+++ trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-background-size-expected.txt	2011-09-06 21:45:08 UTC (rev 94597)
@@ -12,6 +12,6 @@
 getPropertyCSSValue(-webkit-background-size): [object CSSValueList]
 
 Test getting initial value of the background size.
-getPropertyValue(-webkit-background-size): auto auto
-getPropertyCSSValue(-webkit-background-size): [object CSSValueList]
+getPropertyValue(-webkit-background-size): auto
+getPropertyCSSValue(-webkit-background-size): [object CSSPrimitiveValue]
 

Modified: trunk/LayoutTests/fast/css/value-list-out-of-bounds-crash.html (94596 => 94597)


--- trunk/LayoutTests/fast/css/value-list-out-of-bounds-crash.html	2011-09-06 21:18:54 UTC (rev 94596)
+++ trunk/LayoutTests/fast/css/value-list-out-of-bounds-crash.html	2011-09-06 21:45:08 UTC (rev 94597)
@@ -4,7 +4,7 @@
         width: 200px;
         height: 200px;
         background-image:url(resources/bikes.bmp); 
-        -webkit-background-size: 50% auto;
+        -webkit-background-size: 50% 100%;
     }
 </style>
 </head>

Modified: trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt (94596 => 94597)


--- trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt	2011-09-06 21:18:54 UTC (rev 94596)
+++ trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt	2011-09-06 21:45:08 UTC (rev 94597)
@@ -12,8 +12,8 @@
 rect: style.getPropertyCSSValue(background-position) : [object CSSValueList]
 rect: style.getPropertyValue(background-repeat) : repeat
 rect: style.getPropertyCSSValue(background-repeat) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(background-size) : auto auto
-rect: style.getPropertyCSSValue(background-size) : [object CSSValueList]
+rect: style.getPropertyValue(background-size) : auto
+rect: style.getPropertyCSSValue(background-size) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(border-bottom-color) : rgb(0, 0, 0)
 rect: style.getPropertyCSSValue(border-bottom-color) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(border-bottom-left-radius) : 0px
@@ -226,8 +226,8 @@
 rect: style.getPropertyCSSValue(-webkit-background-composite) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(-webkit-background-origin) : padding-box
 rect: style.getPropertyCSSValue(-webkit-background-origin) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(-webkit-background-size) : auto auto
-rect: style.getPropertyCSSValue(-webkit-background-size) : [object CSSValueList]
+rect: style.getPropertyValue(-webkit-background-size) : auto
+rect: style.getPropertyCSSValue(-webkit-background-size) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(-webkit-border-fit) : border
 rect: style.getPropertyCSSValue(-webkit-border-fit) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(-webkit-border-horizontal-spacing) : 0px
@@ -334,8 +334,8 @@
 rect: style.getPropertyCSSValue(-webkit-mask-position) : [object CSSValueList]
 rect: style.getPropertyValue(-webkit-mask-repeat) : repeat
 rect: style.getPropertyCSSValue(-webkit-mask-repeat) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(-webkit-mask-size) : auto auto
-rect: style.getPropertyCSSValue(-webkit-mask-size) : [object CSSValueList]
+rect: style.getPropertyValue(-webkit-mask-size) : auto
+rect: style.getPropertyCSSValue(-webkit-mask-size) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(-webkit-nbsp-mode) : normal
 rect: style.getPropertyCSSValue(-webkit-nbsp-mode) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(-webkit-perspective) : none
@@ -486,8 +486,8 @@
 g: style.getPropertyCSSValue(background-position) : [object CSSValueList]
 g: style.getPropertyValue(background-repeat) : repeat
 g: style.getPropertyCSSValue(background-repeat) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(background-size) : auto auto
-g: style.getPropertyCSSValue(background-size) : [object CSSValueList]
+g: style.getPropertyValue(background-size) : auto
+g: style.getPropertyCSSValue(background-size) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(border-bottom-color) : rgb(0, 0, 0)
 g: style.getPropertyCSSValue(border-bottom-color) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(border-bottom-left-radius) : 0px
@@ -700,8 +700,8 @@
 g: style.getPropertyCSSValue(-webkit-background-composite) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(-webkit-background-origin) : padding-box
 g: style.getPropertyCSSValue(-webkit-background-origin) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(-webkit-background-size) : auto auto
-g: style.getPropertyCSSValue(-webkit-background-size) : [object CSSValueList]
+g: style.getPropertyValue(-webkit-background-size) : auto
+g: style.getPropertyCSSValue(-webkit-background-size) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(-webkit-border-fit) : border
 g: style.getPropertyCSSValue(-webkit-border-fit) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(-webkit-border-horizontal-spacing) : 0px
@@ -808,8 +808,8 @@
 g: style.getPropertyCSSValue(-webkit-mask-position) : [object CSSValueList]
 g: style.getPropertyValue(-webkit-mask-repeat) : repeat
 g: style.getPropertyCSSValue(-webkit-mask-repeat) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(-webkit-mask-size) : auto auto
-g: style.getPropertyCSSValue(-webkit-mask-size) : [object CSSValueList]
+g: style.getPropertyValue(-webkit-mask-size) : auto
+g: style.getPropertyCSSValue(-webkit-mask-size) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(-webkit-nbsp-mode) : normal
 g: style.getPropertyCSSValue(-webkit-nbsp-mode) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(-webkit-perspective) : none

Modified: trunk/Source/WebCore/ChangeLog (94596 => 94597)


--- trunk/Source/WebCore/ChangeLog	2011-09-06 21:18:54 UTC (rev 94596)
+++ trunk/Source/WebCore/ChangeLog	2011-09-06 21:45:08 UTC (rev 94597)
@@ -1,5 +1,24 @@
 2011-09-06  David Hyatt  <[email protected]>
 
+        https://bugs.webkit.org/show_bug.cgi?id=67672
+        
+        Improve background-size parsing. Make it actually dump auto values properly, and also make it omit
+        auto if it is the second value. Fix the parsing to not create a value list when only a singleton value
+        is specified.
+
+        Reviewed by Beth Dakin.
+
+        Covered well by existing tests.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::fillSizeToCSSValue):
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseFillSize):
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::mapFillSize):
+
+2011-09-06  David Hyatt  <[email protected]>
+
         https://bugs.webkit.org/show_bug.cgi?id=67657
         
         Implement border-image-width. This patch stops short of converting -webkit-border-image to a shorthand.

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (94596 => 94597)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2011-09-06 21:18:54 UTC (rev 94596)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2011-09-06 21:45:08 UTC (rev 94597)
@@ -863,6 +863,9 @@
     if (fillSize.type == Cover)
         return primitiveValueCache->createIdentifierValue(CSSValueCover);
 
+    if (fillSize.size.height().isAuto())
+        return primitiveValueCache->createValue(fillSize.size.width());
+
     RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
     list->append(primitiveValueCache->createValue(fillSize.size.width()));
     list->append(primitiveValueCache->createValue(fillSize.size.height()));

Modified: trunk/Source/WebCore/css/CSSParser.cpp (94596 => 94597)


--- trunk/Source/WebCore/css/CSSParser.cpp	2011-09-06 21:18:54 UTC (rev 94596)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2011-09-06 21:45:08 UTC (rev 94597)
@@ -2993,7 +2993,7 @@
     RefPtr<CSSPrimitiveValue> parsedValue1;
 
     if (value->id == CSSValueAuto)
-        parsedValue1 = primitiveValueCache()->createValue(0, CSSPrimitiveValue::CSS_UNKNOWN);
+        parsedValue1 = primitiveValueCache()->createIdentifierValue(CSSValueAuto);
     else {
         if (!validUnit(value, FLength | FPercent, m_strict))
             return 0;
@@ -3003,23 +3003,22 @@
     CSSPropertyID property = static_cast<CSSPropertyID>(propId);
     RefPtr<CSSPrimitiveValue> parsedValue2;
     if ((value = m_valueList->next())) {
-        if (value->id == CSSValueAuto)
-            parsedValue2 = primitiveValueCache()->createValue(0, CSSPrimitiveValue::CSS_UNKNOWN);
-        else if (value->unit == CSSParserValue::Operator && value->iValue == ',')
+        if (value->unit == CSSParserValue::Operator && value->iValue == ',')
             allowComma = false;
-        else {
+        else if (value->id != CSSValueAuto) {
             if (!validUnit(value, FLength | FPercent, m_strict))
                 return 0;
             parsedValue2 = createPrimitiveNumericValue(value);
         }
+    } else if (!parsedValue2 && property == CSSPropertyWebkitBackgroundSize) {
+        // For backwards compatibility we set the second value to the first if it is omitted.
+        // We only need to do this for -webkit-background-size. It should be safe to let masks match
+        // the real property.
+        parsedValue2 = parsedValue1;
     }
-    if (!parsedValue2) {
-        if (property == CSSPropertyWebkitBackgroundSize || property == CSSPropertyWebkitMaskSize)
-            parsedValue2 = parsedValue1;
-        else
-            parsedValue2 = primitiveValueCache()->createValue(0, CSSPrimitiveValue::CSS_UNKNOWN);
-    }
 
+    if (!parsedValue2)
+        return parsedValue1;
     return primitiveValueCache()->createValue(Pair::create(parsedValue1.release(), parsedValue2.release()));
 }
 

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (94596 => 94597)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-09-06 21:18:54 UTC (rev 94596)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-09-06 21:45:08 UTC (rev 94597)
@@ -5439,20 +5439,18 @@
     }
 
     Pair* pair = primitiveValue->getPairValue();
-    if (!pair || !pair->first() || !pair->second())
-        return;
+
+    CSSPrimitiveValue* first = pair ? static_cast<CSSPrimitiveValue*>(pair->first()) : primitiveValue;
+    CSSPrimitiveValue* second = pair ? static_cast<CSSPrimitiveValue*>(pair->second()) : 0;
     
-    CSSPrimitiveValue* first = static_cast<CSSPrimitiveValue*>(pair->first());
-    CSSPrimitiveValue* second = static_cast<CSSPrimitiveValue*>(pair->second());
-    
     Length firstLength, secondLength;
     int firstType = first->primitiveType();
-    int secondType = second->primitiveType();
-    
+    int secondType = second ? second->primitiveType() : 0;
+
     float zoomFactor = m_style->effectiveZoom();
 
-    if (firstType == CSSPrimitiveValue::CSS_UNKNOWN)
-        firstLength = Length(Auto);
+    if (first->getIdent() == CSSValueAuto)
+        firstLength = Length();
     else if (CSSPrimitiveValue::isUnitTypeLength(firstType))
         firstLength = first->computeLength<Length>(style(), m_rootElementStyle, zoomFactor);
     else if (firstType == CSSPrimitiveValue::CSS_PERCENTAGE)
@@ -5460,8 +5458,8 @@
     else
         return;
 
-    if (secondType == CSSPrimitiveValue::CSS_UNKNOWN)
-        secondLength = Length(Auto);
+    if (!second || second->getIdent() == CSSValueAuto)
+        secondLength = Length();
     else if (CSSPrimitiveValue::isUnitTypeLength(secondType))
         secondLength = second->computeLength<Length>(style(), m_rootElementStyle, zoomFactor);
     else if (secondType == CSSPrimitiveValue::CSS_PERCENTAGE)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to