Title: [191178] trunk
Revision
191178
Author
hy...@apple.com
Date
2015-10-16 09:12:03 -0700 (Fri, 16 Oct 2015)

Log Message

Implement the "all" CSS property.
https://bugs.webkit.org/show_bug.cgi?id=116966

Reviewed by Zalan Bujtas.

Source/WebCore:

Added new tests in fast/css.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue):
Don't support "all" from computed style for now.

* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
Make sure to bail after checking inherit/unset/initial for all, since you can't actually
accept longhand values in the shorthand declarations.

(WebCore::CSSParser::parseAnimationProperty):
"all" for animations is a special value and should not be confused with the property. It
animates everything and does not omit unicode-bidi/direction the way the "all" property does.

* css/CSSPropertyNames.in:
Add the "all" property to the list and use a special keyword in the Longhands value, "all",
that makeprop.pl will look for. This way we don't have to dump every single CSS property
into the Longhands _expression_, since that would be nuts.

* css/StyleProperties.cpp:
(WebCore::StyleProperties::getPropertyValue):
Look for a common value across all properties supported by "all". That way you can get
back inherit/initial/unset from it.

* css/makeprop.pl:
Make the perl script look for "all" in the longhand list, and if it sees it, put every
single CSS property into the list for the all shorthand.

LayoutTests:

Added tests for the "all property, including a variables test!

* fast/css/all-keyword-direction-expected.html: Added.
* fast/css/all-keyword-direction.html: Added.
* fast/css/all-keyword-inherit-expected.html: Added.
* fast/css/all-keyword-inherit.html: Added.
* fast/css/all-keyword-initial-expected.html: Added.
* fast/css/all-keyword-initial.html: Added.
* fast/css/all-keyword-unset-expected.html: Added.
* fast/css/all-keyword-unset.html: Added.
* fast/css/variables/all-keyword-unset-expected.html: Added.
* fast/css/variables/all-keyword-unset.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (191177 => 191178)


--- trunk/LayoutTests/ChangeLog	2015-10-16 15:57:04 UTC (rev 191177)
+++ trunk/LayoutTests/ChangeLog	2015-10-16 16:12:03 UTC (rev 191178)
@@ -1,3 +1,23 @@
+2015-10-16  David Hyatt  <hy...@apple.com>
+
+        Implement the "all" CSS property.
+        https://bugs.webkit.org/show_bug.cgi?id=116966
+
+        Reviewed by Zalan Bujtas.
+
+        Added tests for the "all property, including a variables test!
+
+        * fast/css/all-keyword-direction-expected.html: Added.
+        * fast/css/all-keyword-direction.html: Added.
+        * fast/css/all-keyword-inherit-expected.html: Added.
+        * fast/css/all-keyword-inherit.html: Added.
+        * fast/css/all-keyword-initial-expected.html: Added.
+        * fast/css/all-keyword-initial.html: Added.
+        * fast/css/all-keyword-unset-expected.html: Added.
+        * fast/css/all-keyword-unset.html: Added.
+        * fast/css/variables/all-keyword-unset-expected.html: Added.
+        * fast/css/variables/all-keyword-unset.html: Added.
+
 2015-10-15  Michael Saboff  <msab...@apple.com>
 
         REGRESSION (r190289): Repro crash clicking back button on netflix.com

Added: trunk/LayoutTests/fast/css/all-keyword-direction-expected.html (0 => 191178)


--- trunk/LayoutTests/fast/css/all-keyword-direction-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/all-keyword-direction-expected.html	2015-10-16 16:12:03 UTC (rev 191178)
@@ -0,0 +1,13 @@
+<head>
+<style>
+html {
+  font-size: small;
+  background-color: #F0F0F0;
+  color: blue;
+}
+
+span { direction:rtl; }
+</style>
+</head>
+<body>
+<span id="quote">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</span> Phasellus eget velit sagittis.
\ No newline at end of file

Added: trunk/LayoutTests/fast/css/all-keyword-direction.html (0 => 191178)


--- trunk/LayoutTests/fast/css/all-keyword-direction.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/all-keyword-direction.html	2015-10-16 16:12:03 UTC (rev 191178)
@@ -0,0 +1,18 @@
+<head>
+<style>
+html {
+  font-size: small;
+  background-color: #F0F0F0;
+  color: blue;
+}
+
+blockquote {
+  background-color: skyblue;
+  color: red;
+  direction:rtl;
+  all: unset;
+}
+</style>
+</head>
+<body>
+<blockquote id="quote">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> Phasellus eget velit sagittis.
\ No newline at end of file

Added: trunk/LayoutTests/fast/css/all-keyword-inherit-expected.html (0 => 191178)


--- trunk/LayoutTests/fast/css/all-keyword-inherit-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/all-keyword-inherit-expected.html	2015-10-16 16:12:03 UTC (rev 191178)
@@ -0,0 +1,11 @@
+<head>
+<style>
+html {
+  font-size: small;
+  background-color: #F0F0F0;
+  color: blue;
+}
+</style>
+</head>
+<body>
+<div id="quote">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div> Phasellus eget velit sagittis.
\ No newline at end of file

Added: trunk/LayoutTests/fast/css/all-keyword-inherit.html (0 => 191178)


--- trunk/LayoutTests/fast/css/all-keyword-inherit.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/all-keyword-inherit.html	2015-10-16 16:12:03 UTC (rev 191178)
@@ -0,0 +1,18 @@
+<head>
+<style>
+html {
+  font-size: small;
+  background-color: #F0F0F0;
+  color: blue;
+}
+
+blockquote {
+  background-color: skyblue;
+  color: red;
+  all:inherit;
+}
+</style>
+</head>
+<body>
+<div>
+<blockquote id="quote">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> Phasellus eget velit sagittis.
\ No newline at end of file

Added: trunk/LayoutTests/fast/css/all-keyword-initial-expected.html (0 => 191178)


--- trunk/LayoutTests/fast/css/all-keyword-initial-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/all-keyword-initial-expected.html	2015-10-16 16:12:03 UTC (rev 191178)
@@ -0,0 +1,13 @@
+<head>
+<style>
+html {
+  font-size: small;
+  background-color: #F0F0F0;
+  color: blue;
+}
+
+span { font: initial; color:initial }
+</style>
+</head>
+<body>
+<span>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</span> Phasellus eget velit sagittis.
\ No newline at end of file

Added: trunk/LayoutTests/fast/css/all-keyword-initial.html (0 => 191178)


--- trunk/LayoutTests/fast/css/all-keyword-initial.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/all-keyword-initial.html	2015-10-16 16:12:03 UTC (rev 191178)
@@ -0,0 +1,17 @@
+<head>
+<style>
+html {
+  font-size: small;
+  background-color: #F0F0F0;
+  color: blue;
+}
+
+blockquote {
+  background-color: skyblue;
+  color: red;
+  all: initial;
+}
+</style>
+</head>
+<body>
+<blockquote id="quote">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> Phasellus eget velit sagittis.
\ No newline at end of file

Added: trunk/LayoutTests/fast/css/all-keyword-unset-expected.html (0 => 191178)


--- trunk/LayoutTests/fast/css/all-keyword-unset-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/all-keyword-unset-expected.html	2015-10-16 16:12:03 UTC (rev 191178)
@@ -0,0 +1,11 @@
+<head>
+<style>
+html {
+  font-size: small;
+  background-color: #F0F0F0;
+  color: blue;
+}
+</style>
+</head>
+<body>
+<span id="quote">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</span> Phasellus eget velit sagittis.
\ No newline at end of file

Added: trunk/LayoutTests/fast/css/all-keyword-unset.html (0 => 191178)


--- trunk/LayoutTests/fast/css/all-keyword-unset.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/all-keyword-unset.html	2015-10-16 16:12:03 UTC (rev 191178)
@@ -0,0 +1,17 @@
+<head>
+<style>
+html {
+  font-size: small;
+  background-color: #F0F0F0;
+  color: blue;
+}
+
+blockquote {
+  background-color: skyblue;
+  color: red;
+  all: unset;
+}
+</style>
+</head>
+<body>
+<blockquote id="quote">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> Phasellus eget velit sagittis.
\ No newline at end of file

Added: trunk/LayoutTests/fast/css/variables/all-keyword-unset-expected.html (0 => 191178)


--- trunk/LayoutTests/fast/css/variables/all-keyword-unset-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/variables/all-keyword-unset-expected.html	2015-10-16 16:12:03 UTC (rev 191178)
@@ -0,0 +1,11 @@
+<head>
+<style>
+html {
+  font-size: small;
+  background-color: #F0F0F0;
+  color: blue;
+}
+</style>
+</head>
+<body>
+<span id="quote">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</span> Phasellus eget velit sagittis.
\ No newline at end of file

Added: trunk/LayoutTests/fast/css/variables/all-keyword-unset.html (0 => 191178)


--- trunk/LayoutTests/fast/css/variables/all-keyword-unset.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/variables/all-keyword-unset.html	2015-10-16 16:12:03 UTC (rev 191178)
@@ -0,0 +1,18 @@
+<head>
+<style>
+html {
+  font-size: small;
+  background-color: #F0F0F0;
+  color: blue;
+  --a: unset;
+}
+
+blockquote {
+  background-color: skyblue;
+  color: red;
+  all: var(--a);
+}
+</style>
+</head>
+<body>
+<blockquote id="quote">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> Phasellus eget velit sagittis.
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (191177 => 191178)


--- trunk/Source/WebCore/ChangeLog	2015-10-16 15:57:04 UTC (rev 191177)
+++ trunk/Source/WebCore/ChangeLog	2015-10-16 16:12:03 UTC (rev 191178)
@@ -1,3 +1,39 @@
+2015-10-16  David Hyatt  <hy...@apple.com>
+
+        Implement the "all" CSS property.
+        https://bugs.webkit.org/show_bug.cgi?id=116966
+
+        Reviewed by Zalan Bujtas.
+
+        Added new tests in fast/css.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::ComputedStyleExtractor::propertyValue):
+        Don't support "all" from computed style for now.
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseValue):
+        Make sure to bail after checking inherit/unset/initial for all, since you can't actually
+        accept longhand values in the shorthand declarations.
+
+        (WebCore::CSSParser::parseAnimationProperty):
+        "all" for animations is a special value and should not be confused with the property. It
+        animates everything and does not omit unicode-bidi/direction the way the "all" property does.
+
+        * css/CSSPropertyNames.in:
+        Add the "all" property to the list and use a special keyword in the Longhands value, "all",
+        that makeprop.pl will look for. This way we don't have to dump every single CSS property
+        into the Longhands _expression_, since that would be nuts.
+
+        * css/StyleProperties.cpp:
+        (WebCore::StyleProperties::getPropertyValue):
+        Look for a common value across all properties supported by "all". That way you can get
+        back inherit/initial/unset from it.
+
+        * css/makeprop.pl:
+        Make the perl script look for "all" in the longhand list, and if it sees it, put every
+        single CSS property into the list for the all shorthand.
+
 2015-10-16  Youenn Fablet  <youenn.fab...@crf.canon.fr>
 
         Binding generator should use templated JSXXConstructor

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (191177 => 191178)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2015-10-16 15:57:04 UTC (rev 191177)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2015-10-16 16:12:03 UTC (rev 191178)
@@ -3461,6 +3461,7 @@
             return cssValuePool.createValue(style->textZoom());
 
         /* Unimplemented CSS 3 properties (including CSS3 shorthand properties) */
+        case CSSPropertyAll:
         case CSSPropertyAnimation:
         case CSSPropertyWebkitTextEmphasis:
         case CSSPropertyTextLineThrough:

Modified: trunk/Source/WebCore/css/CSSParser.cpp (191177 => 191178)


--- trunk/Source/WebCore/css/CSSParser.cpp	2015-10-16 15:57:04 UTC (rev 191177)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2015-10-16 16:12:03 UTC (rev 191178)
@@ -1966,6 +1966,9 @@
         addExpandedPropertyForValue(propId, cssValuePool.createUnsetValue(), important);
         return true;
     }
+    
+    if (propId == CSSPropertyAll)
+        return false; // "all" doesn't allow you to specify anything other than inherit/initial/unset.
 
     if (isKeywordPropertyID(propId)) {
         if (!isValidKeywordPropertyAndValue(propId, id, m_context, m_styleSheet))
@@ -5095,7 +5098,7 @@
     if (value.unit != CSSPrimitiveValue::CSS_IDENT)
         return nullptr;
     CSSPropertyID result = cssPropertyID(value.string);
-    if (result)
+    if (result && result != CSSPropertyAll) // "all" value in animation is not equivalent to the all property.
         return CSSValuePool::singleton().createIdentifierValue(result);
     if (equalIgnoringCase(value, "all")) {
         context.sawAnimationPropertyKeyword();

Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (191177 => 191178)


--- trunk/Source/WebCore/css/CSSPropertyNames.in	2015-10-16 15:57:04 UTC (rev 191177)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in	2015-10-16 16:12:03 UTC (rev 191178)
@@ -132,6 +132,7 @@
 
 // The remaining properties are listed in alphabetical order
 alignment-baseline [SVG]
+all [Longhands=all]
 animation [Longhands=animation-name|animation-duration|animation-timing-function|animation-delay|animation-iteration-count|animation-direction|animation-fill-mode]
 animation-delay [AnimationProperty, NameForMethods=Delay]
 animation-direction [AnimationProperty, NameForMethods=Direction]

Modified: trunk/Source/WebCore/css/StyleProperties.cpp (191177 => 191178)


--- trunk/Source/WebCore/css/StyleProperties.cpp	2015-10-16 15:57:04 UTC (rev 191177)
+++ trunk/Source/WebCore/css/StyleProperties.cpp	2015-10-16 16:12:03 UTC (rev 191178)
@@ -127,6 +127,8 @@
 
     // Shorthand and 4-values properties
     switch (propertyID) {
+    case CSSPropertyAll:
+        return getCommonValue(allShorthand());
     case CSSPropertyAnimation:
         return getLayeredShorthandValue(animationShorthand());
     case CSSPropertyBorderSpacing:

Modified: trunk/Source/WebCore/css/makeprop.pl (191177 => 191178)


--- trunk/Source/WebCore/css/makeprop.pl	2015-10-16 15:57:04 UTC (rev 191177)
+++ trunk/Source/WebCore/css/makeprop.pl	2015-10-16 16:12:03 UTC (rev 191178)
@@ -960,9 +960,19 @@
   print SHORTHANDS_CPP "{\n";
   print SHORTHANDS_CPP "    static const CSSPropertyID " . $lowercaseId . "Properties[] = {\n";
   foreach (@longhands) {
-    die "Unknown CSS property used in Longhands: " . $nameToId{$_} if !exists($nameToId{$_});
-    push(@{$longhandToShorthands{$_}}, $name);
-    print SHORTHANDS_CPP "        CSSProperty" . $nameToId{$_} . ",\n";
+    if ($_ eq "all") {
+        foreach my $propname (@names) {
+            next if (exists $propertiesWithStyleBuilderOptions{$propname}{"Longhands"});
+            next if ($propname eq "direction" || $propname eq "unicode-bidi");
+            die "Unknown CSS property used in all shorthand: " . $nameToId{$propname} if !exists($nameToId{$propname});
+            push(@{$longhandToShorthands{$propname}}, $name);
+            print SHORTHANDS_CPP "        CSSProperty" . $nameToId{$propname} . ",\n";
+        }
+    } else {
+        die "Unknown CSS property used in Longhands: " . $nameToId{$_} if !exists($nameToId{$_});
+        push(@{$longhandToShorthands{$_}}, $name);
+        print SHORTHANDS_CPP "        CSSProperty" . $nameToId{$_} . ",\n";
+    }
   }
   print SHORTHANDS_CPP "    };\n";
   print SHORTHANDS_CPP "    return StylePropertyShorthand(CSSProperty" . $nameToId{$name} . ", " . $lowercaseId . "Properties);\n";
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to