Title: [136072] trunk
Revision
136072
Author
[email protected]
Date
2012-11-28 16:11:38 -0800 (Wed, 28 Nov 2012)

Log Message

CSS parser does not support -webkit-mask-size for -webkit-mask shorthand
https://bugs.webkit.org/show_bug.cgi?id=103020

Reviewed by David Hyatt.

Source/WebCore:

Harmonize the syntax of '-webkit-mask' property with 'background' according to the
CSS Masking specification[1]. This should make it easier to maintain both shorthand
properties in the long term.
It is very unlikely that a lot of content (if any) is affected by this change. The
computed style still is not implemented and this change should rather make it easier
for developers.

With the harmonization, the '-webkit-mask-size' property is part of the shorthand as
well now.

parsing-mask.html covers all the changes. Added new tests for the changed syntax and
'-webkit-mask-size'

[1] http://dvcs.w3.org/hg/FXTF/raw-file/tip/masking/index.html#mask-property

* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseFillShorthand):
* css/StylePropertySet.cpp:
(WebCore::StylePropertySet::getLayeredShorthandValue):
* css/StylePropertyShorthand.cpp:
(WebCore::webkitMaskShorthand):

LayoutTests:

Added new subtests to exisiting test for the changed syntax of '-webkit-mask' shorthand property.

* fast/masking/parsing-mask-expected.txt:
* fast/masking/parsing-mask.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (136071 => 136072)


--- trunk/LayoutTests/ChangeLog	2012-11-28 23:42:32 UTC (rev 136071)
+++ trunk/LayoutTests/ChangeLog	2012-11-29 00:11:38 UTC (rev 136072)
@@ -1,3 +1,15 @@
+2012-11-23  Dirk Schulze  <[email protected]>
+
+        CSS parser does not support -webkit-mask-size for -webkit-mask shorthand
+        https://bugs.webkit.org/show_bug.cgi?id=103020
+
+        Reviewed by David Hyatt.
+
+        Added new subtests to exisiting test for the changed syntax of '-webkit-mask' shorthand property.
+
+        * fast/masking/parsing-mask-expected.txt:
+        * fast/masking/parsing-mask.html:
+
 2012-11-28  Tom Sepez  <[email protected]>
 
         XSSAuditor bypass with script src="" URL ending in <!--

Modified: trunk/LayoutTests/fast/masking/parsing-mask-expected.txt (136071 => 136072)


--- trunk/LayoutTests/fast/masking/parsing-mask-expected.txt	2012-11-28 23:42:32 UTC (rev 136071)
+++ trunk/LayoutTests/fast/masking/parsing-mask-expected.txt	2012-11-29 00:11:38 UTC (rev 136072)
@@ -24,17 +24,17 @@
 PASS innerStyle("-webkit-mask", "50px 50%") is "50px 50%"
 PASS innerStyle("-webkit-mask", "center left") is "0% 50%"
 PASS innerStyle("-webkit-mask", "top center") is "50% 0%"
-PASS innerStyle("-webkit-mask", "repeat-x") is "repeat no-repeat"
-PASS innerStyle("-webkit-mask", "repeat-y") is "no-repeat repeat"
-PASS innerStyle("-webkit-mask", "repeat") is "repeat repeat"
-PASS innerStyle("-webkit-mask", "space") is "space space"
-PASS innerStyle("-webkit-mask", "no-repeat") is "no-repeat no-repeat"
+PASS innerStyle("-webkit-mask", "repeat-x") is "repeat-x"
+PASS innerStyle("-webkit-mask", "repeat-y") is "repeat-y"
+PASS innerStyle("-webkit-mask", "repeat") is "repeat"
+PASS innerStyle("-webkit-mask", "space") is "space"
+PASS innerStyle("-webkit-mask", "no-repeat") is "no-repeat"
 PASS innerStyle("-webkit-mask", "repeat space") is "repeat space"
 PASS innerStyle("-webkit-mask", "repeat round") is "repeat round"
 PASS innerStyle("-webkit-mask", "repeat no-repeat") is "repeat no-repeat"
-PASS innerStyle("-webkit-mask", "repeat space, repeat-x") is "repeat space, repeat no-repeat"
-PASS innerStyle("-webkit-mask", "repeat none") is "none repeat repeat"
-PASS innerStyle("-webkit-mask", "none repeat") is "none repeat repeat"
+PASS innerStyle("-webkit-mask", "repeat space, repeat-x") is "repeat space, repeat-x"
+PASS innerStyle("-webkit-mask", "repeat none") is "none repeat"
+PASS innerStyle("-webkit-mask", "none repeat") is "none repeat"
 PASS innerStyle("-webkit-mask", "padding-box") is "padding-box padding-box"
 PASS innerStyle("-webkit-mask", "border-box") is "border-box border-box"
 PASS innerStyle("-webkit-mask", "content-box") is "content-box content-box"
@@ -45,10 +45,19 @@
 PASS innerStyle("-webkit-mask", "padding-box border-box") is "padding-box border-box"
 PASS innerStyle("-webkit-mask", "padding-box border-box none") is "none padding-box border-box"
 PASS innerStyle("-webkit-mask", "none padding-box border-box") is "none padding-box border-box"
+PASS innerStyle("-webkit-mask", "none left top / auto") is "none 0% 0% / auto"
+PASS innerStyle("-webkit-mask", "none left top / auto auto") is "none 0% 0% / auto"
+PASS innerStyle("-webkit-mask", "none left top / 100%") is "none 0% 0% / 100%"
+PASS innerStyle("-webkit-mask", "none left top / 0%") is "none 0% 0% / 0%"
+PASS innerStyle("-webkit-mask", "none left top / auto 0%") is "none 0% 0% / auto 0%"
+PASS innerStyle("-webkit-mask", "none left top / cover") is "none 0% 0% / cover"
+PASS innerStyle("-webkit-mask", "none left top / contain") is "none 0% 0% / contain"
 PASS innerStyle("-webkit-mask", "none padding-box content-box") is "none padding-box content-box"
 PASS innerStyle("-webkit-mask", "none padding-box") is "none padding-box padding-box"
 PASS innerStyle("-webkit-mask", "none top") is "none 50% 0%"
 PASS innerStyle("-webkit-mask", "none border-box left top") is "none 0% 0% border-box border-box"
+PASS innerStyle("-webkit-mask", "none border-box content-box left top repeat-x") is "none 0% 0% repeat-x border-box content-box"
+PASS innerStyle("-webkit-mask", "none border-box content-box left top / auto repeat-x") is "none 0% 0% / auto repeat-x border-box content-box"
 PASS innerStyle("-webkit-mask", "top none left") is null
 PASS innerStyle("-webkit-mask", "right none bottom") is null
 PASS innerStyle("-webkit-mask", "right right") is null
@@ -60,6 +69,10 @@
 PASS innerStyle("-webkit-mask", "space repeat-y") is null
 PASS innerStyle("-webkit-mask", "repeat space space") is null
 PASS innerStyle("-webkit-mask", "padding-box border-box content-box") is null
+PASS innerStyle("-webkit-mask", "none / auto") is null
+PASS innerStyle("-webkit-mask", "none repeat-x / auto") is null
+PASS innerStyle("-webkit-mask", "none border-box / auto") is null
+PASS innerStyle("-webkit-mask", "none top left / cover 100%") is null
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/masking/parsing-mask.html (136071 => 136072)


--- trunk/LayoutTests/fast/masking/parsing-mask.html	2012-11-28 23:42:32 UTC (rev 136071)
+++ trunk/LayoutTests/fast/masking/parsing-mask.html	2012-11-29 00:11:38 UTC (rev 136072)
@@ -68,17 +68,17 @@
 testInner("-webkit-mask", "top center", "50% 0%");
 
 // test mask-repeat
-testInner("-webkit-mask", "repeat-x", "repeat no-repeat");
-testInner("-webkit-mask", "repeat-y", "no-repeat repeat");
-testInner("-webkit-mask", "repeat", "repeat repeat");
-testInner("-webkit-mask", "space", "space space");
-testInner("-webkit-mask", "no-repeat", "no-repeat no-repeat");
+testInner("-webkit-mask", "repeat-x", "repeat-x");
+testInner("-webkit-mask", "repeat-y", "repeat-y");
+testInner("-webkit-mask", "repeat", "repeat");
+testInner("-webkit-mask", "space", "space");
+testInner("-webkit-mask", "no-repeat", "no-repeat");
 testInner("-webkit-mask", "repeat space", "repeat space");
 testInner("-webkit-mask", "repeat round", "repeat round");
 testInner("-webkit-mask", "repeat no-repeat", "repeat no-repeat");
-testInner("-webkit-mask", "repeat space, repeat-x", "repeat space, repeat no-repeat");
-testInner("-webkit-mask", "repeat none", "none repeat repeat");
-testInner("-webkit-mask", "none repeat", "none repeat repeat");
+testInner("-webkit-mask", "repeat space, repeat-x", "repeat space, repeat-x");
+testInner("-webkit-mask", "repeat none", "none repeat");
+testInner("-webkit-mask", "none repeat", "none repeat");
 
 // test mask-origin / mask-clip
 testInner("-webkit-mask", "padding-box", "padding-box padding-box");
@@ -92,14 +92,22 @@
 testInner("-webkit-mask", "padding-box border-box none", "none padding-box border-box");
 testInner("-webkit-mask", "none padding-box border-box", "none padding-box border-box");
 
-// FIXME: mask-size not part of the shorthand yet.
-// https://bugs.webkit.org/show_bug.cgi?id=103020
+// test mask-size
+testInner("-webkit-mask", "none left top / auto", "none 0% 0% / auto");
+testInner("-webkit-mask", "none left top / auto auto", "none 0% 0% / auto");
+testInner("-webkit-mask", "none left top / 100%", "none 0% 0% / 100%");
+testInner("-webkit-mask", "none left top / 0%", "none 0% 0% / 0%");
+testInner("-webkit-mask", "none left top / auto 0%", "none 0% 0% / auto 0%");
+testInner("-webkit-mask", "none left top / cover", "none 0% 0% / cover");
+testInner("-webkit-mask", "none left top / contain", "none 0% 0% / contain");
 
 // combinations
 testInner("-webkit-mask", "none padding-box content-box", "none padding-box content-box");
 testInner("-webkit-mask", "none padding-box", "none padding-box padding-box");
 testInner("-webkit-mask", "none top", "none 50% 0%");
 testInner("-webkit-mask", "none border-box left top", "none 0% 0% border-box border-box");
+testInner("-webkit-mask", "none border-box content-box left top repeat-x", "none 0% 0% repeat-x border-box content-box");
+testInner("-webkit-mask", "none border-box content-box left top / auto repeat-x", "none 0% 0% / auto repeat-x border-box content-box");
 
 
 // FIXME: Computed style not yet implemented.
@@ -118,6 +126,10 @@
 negativeTest("-webkit-mask", "space repeat-y");
 negativeTest("-webkit-mask", "repeat space space");
 negativeTest("-webkit-mask", "padding-box border-box content-box");
+negativeTest("-webkit-mask", "none / auto");
+negativeTest("-webkit-mask", "none repeat-x / auto");
+negativeTest("-webkit-mask", "none border-box / auto");
+negativeTest("-webkit-mask", "none top left / cover 100%");
 
 // FIXME: Add negative tests for mask-attachment, which should not be supported.
 // https://bugs.webkit.org/show_bug.cgi?id=67137

Modified: trunk/Source/WebCore/ChangeLog (136071 => 136072)


--- trunk/Source/WebCore/ChangeLog	2012-11-28 23:42:32 UTC (rev 136071)
+++ trunk/Source/WebCore/ChangeLog	2012-11-29 00:11:38 UTC (rev 136072)
@@ -1,3 +1,33 @@
+2012-11-23  Dirk Schulze  <[email protected]>
+
+        CSS parser does not support -webkit-mask-size for -webkit-mask shorthand
+        https://bugs.webkit.org/show_bug.cgi?id=103020
+
+        Reviewed by David Hyatt.
+
+        Harmonize the syntax of '-webkit-mask' property with 'background' according to the
+        CSS Masking specification[1]. This should make it easier to maintain both shorthand
+        properties in the long term.
+        It is very unlikely that a lot of content (if any) is affected by this change. The
+        computed style still is not implemented and this change should rather make it easier
+        for developers.
+
+        With the harmonization, the '-webkit-mask-size' property is part of the shorthand as
+        well now.
+
+        parsing-mask.html covers all the changes. Added new tests for the changed syntax and
+        '-webkit-mask-size'
+
+        [1] http://dvcs.w3.org/hg/FXTF/raw-file/tip/masking/index.html#mask-property
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseValue):
+        (WebCore::CSSParser::parseFillShorthand):
+        * css/StylePropertySet.cpp:
+        (WebCore::StylePropertySet::getLayeredShorthandValue):
+        * css/StylePropertyShorthand.cpp:
+        (WebCore::webkitMaskShorthand):
+
 2012-11-28  Alec Flett  <[email protected]>
 
         IndexedDB: Change frontend to call IDBDatabaseBackendInterface::createTransaction()

Modified: trunk/Source/WebCore/css/CSSParser.cpp (136071 => 136072)


--- trunk/Source/WebCore/css/CSSParser.cpp	2012-11-28 23:42:32 UTC (rev 136071)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2012-11-29 00:11:38 UTC (rev 136072)
@@ -2623,9 +2623,9 @@
     }
     case CSSPropertyWebkitMask: {
         const CSSPropertyID properties[] = { CSSPropertyWebkitMaskImage, CSSPropertyWebkitMaskRepeat,
-                                   CSSPropertyWebkitMaskAttachment, CSSPropertyWebkitMaskPosition,
-                                   CSSPropertyWebkitMaskOrigin, CSSPropertyWebkitMaskClip };
-        return parseFillShorthand(propId, properties, 6, important);
+            CSSPropertyWebkitMaskAttachment, CSSPropertyWebkitMaskPosition,
+            CSSPropertyWebkitMaskOrigin, CSSPropertyWebkitMaskClip, CSSPropertyWebkitMaskSize };
+        return parseFillShorthand(propId, properties, WTF_ARRAY_LENGTH(properties), important);
     }
     case CSSPropertyBorder:
         // [ 'border-width' || 'border-style' || <color> ] | inherit
@@ -2972,7 +2972,7 @@
     RefPtr<CSSValue> repeatYValue;
     bool foundClip = false;
     int i;
-    bool foundBackgroundPositionCSSProperty = false;
+    bool foundPositionCSSProperty = false;
 
     while (m_valueList->current()) {
         CSSParserValue* val = m_valueList->current();
@@ -3002,19 +3002,19 @@
                 break;
         }
 
-        bool backgroundSizeCSSPropertyExpected = false;
-        if ((val->unit == CSSParserValue::Operator && val->iValue == '/') && foundBackgroundPositionCSSProperty) {
-            backgroundSizeCSSPropertyExpected = true;
+        bool sizeCSSPropertyExpected = false;
+        if ((val->unit == CSSParserValue::Operator && val->iValue == '/') && foundPositionCSSProperty) {
+            sizeCSSPropertyExpected = true;
             m_valueList->next();
         }
 
-        foundBackgroundPositionCSSProperty = false;
+        foundPositionCSSProperty = false;
         bool found = false;
         for (i = 0; !found && i < numProperties; ++i) {
 
-            if (backgroundSizeCSSPropertyExpected && properties[i] != CSSPropertyBackgroundSize)
+            if (sizeCSSPropertyExpected && (properties[i] != CSSPropertyBackgroundSize && properties[i] != CSSPropertyWebkitMaskSize))
                 continue;
-            if (!backgroundSizeCSSPropertyExpected && properties[i] == CSSPropertyBackgroundSize)
+            if (!sizeCSSPropertyExpected && (properties[i] == CSSPropertyBackgroundSize || properties[i] == CSSPropertyWebkitMaskSize))
                 continue;
 
             if (!parsedProperty[i]) {
@@ -3041,8 +3041,8 @@
                         addFillValue(clipValue, val1.release());
                         foundClip = true;
                     }
-                    if (properties[i] == CSSPropertyBackgroundPosition)
-                        foundBackgroundPositionCSSProperty =  true;
+                    if (properties[i] == CSSPropertyBackgroundPosition || properties[i] == CSSPropertyWebkitMaskPosition)
+                        foundPositionCSSProperty = true;
                 }
             }
         }
@@ -3062,7 +3062,7 @@
                 addFillValue(positionYValue, cssValuePool().createImplicitInitialValue());
             if (properties[i] == CSSPropertyBackgroundRepeat || properties[i] == CSSPropertyWebkitMaskRepeat)
                 addFillValue(repeatYValue, cssValuePool().createImplicitInitialValue());
-            if ((properties[i] == CSSPropertyBackgroundOrigin || properties[i] == CSSPropertyWebkitMaskOrigin)) {
+            if (properties[i] == CSSPropertyBackgroundOrigin || properties[i] == CSSPropertyWebkitMaskOrigin) {
                 // If background-origin wasn't present, then reset background-clip also.
                 addFillValue(clipValue, cssValuePool().createImplicitInitialValue());
             }

Modified: trunk/Source/WebCore/css/StylePropertySet.cpp (136071 => 136072)


--- trunk/Source/WebCore/css/StylePropertySet.cpp	2012-11-28 23:42:32 UTC (rev 136071)
+++ trunk/Source/WebCore/css/StylePropertySet.cpp	2012-11-29 00:11:38 UTC (rev 136072)
@@ -378,7 +378,7 @@
         bool useRepeatXShorthand = false;
         bool useRepeatYShorthand = false;
         bool useSingleWordShorthand = false;
-        bool foundBackgroundPositionYCSSProperty = false;
+        bool foundPositionYCSSProperty = false;
         for (unsigned j = 0; j < size; j++) {
             RefPtr<CSSValue> value;
             if (values[j]) {
@@ -399,10 +399,12 @@
             // We need to report background-repeat as it was written in the CSS. If the property is implicit,
             // then it was written with only one value. Here we figure out which value that was so we can
             // report back correctly.
-            if (shorthand.properties()[j] == CSSPropertyBackgroundRepeatX && isPropertyImplicit(shorthand.properties()[j])) {
+            if ((shorthand.properties()[j] == CSSPropertyBackgroundRepeatX && isPropertyImplicit(shorthand.properties()[j]))
+                || (shorthand.properties()[j] == CSSPropertyWebkitMaskRepeatX && isPropertyImplicit(shorthand.properties()[j]))) {
 
                 // BUG 49055: make sure the value was not reset in the layer check just above.
-                if (j < size - 1 && shorthand.properties()[j + 1] == CSSPropertyBackgroundRepeatY && value) {
+                if ((j < size - 1 && shorthand.properties()[j + 1] == CSSPropertyBackgroundRepeatY && value)
+                    || (j < size - 1 && shorthand.properties()[j + 1] == CSSPropertyWebkitMaskRepeatY && value)) {
                     RefPtr<CSSValue> yValue;
                     RefPtr<CSSValue> nextValue = values[j + 1];
                     if (nextValue->isValueList())
@@ -431,9 +433,11 @@
             if (value && !value->isImplicitInitialValue()) {
                 if (!layerResult.isEmpty())
                     layerResult.append(' ');
-                if (foundBackgroundPositionYCSSProperty && shorthand.properties()[j] == CSSPropertyBackgroundSize) 
+                if (foundPositionYCSSProperty
+                    && (shorthand.properties()[j] == CSSPropertyBackgroundSize || shorthand.properties()[j] == CSSPropertyWebkitMaskSize))
                     layerResult.appendLiteral("/ ");
-                if (!foundBackgroundPositionYCSSProperty && shorthand.properties()[j] == CSSPropertyBackgroundSize) 
+                if (!foundPositionYCSSProperty
+                    && (shorthand.properties()[j] == CSSPropertyBackgroundSize || shorthand.properties()[j] == CSSPropertyWebkitMaskSize))
                     continue;
 
                 if (useRepeatXShorthand) {
@@ -449,8 +453,9 @@
                     layerResult.append(valueText);
                 }
 
-                if (shorthand.properties()[j] == CSSPropertyBackgroundPositionY) {
-                    foundBackgroundPositionYCSSProperty = true;
+                if (shorthand.properties()[j] == CSSPropertyBackgroundPositionY
+                    || shorthand.properties()[j] == CSSPropertyWebkitMaskPositionY) {
+                    foundPositionYCSSProperty = true;
 
                     // background-position is a special case: if only the first offset is specified,
                     // the second one defaults to "center", not the same value.

Modified: trunk/Source/WebCore/css/StylePropertyShorthand.cpp (136071 => 136072)


--- trunk/Source/WebCore/css/StylePropertyShorthand.cpp	2012-11-28 23:42:32 UTC (rev 136071)
+++ trunk/Source/WebCore/css/StylePropertyShorthand.cpp	2012-11-29 00:11:38 UTC (rev 136072)
@@ -370,11 +370,12 @@
 {
     static const CSSPropertyID maskProperties[] = {
         CSSPropertyWebkitMaskImage,
+        CSSPropertyWebkitMaskPositionX,
+        CSSPropertyWebkitMaskPositionY,
+        CSSPropertyWebkitMaskSize,
         CSSPropertyWebkitMaskRepeatX,
         CSSPropertyWebkitMaskRepeatY,
         CSSPropertyWebkitMaskAttachment,
-        CSSPropertyWebkitMaskPositionX,
-        CSSPropertyWebkitMaskPositionY,
         CSSPropertyWebkitMaskOrigin,
         CSSPropertyWebkitMaskClip
     };
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to