Add support for the CSS 'unset' keyword.
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Oct 2015 23:54:46 +0000 (23:54 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Oct 2015 23:54:46 +0000 (23:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148614

Reviewed by Dean Jackson.

Source/WebCore:

Added new test in fast/css, and existing variables tests also use unset in several tests.

* WebCore.xcodeproj/project.pbxproj:
Add CSSUnsetValue.cpp to the project.

* bindings/objc/DOMCSS.mm:
(kitClass):
Make sure UNSET is handled in the switch.

* css/CSSParser.cpp:
(WebCore::parseKeywordValue):
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseCustomPropertyDeclaration):
Add cases to create a CSSUnsetValue properly.

* css/CSSToStyleMap.cpp:
(WebCore::CSSToStyleMap::styleImage):
(WebCore::CSSToStyleMap::mapFillAttachment):
(WebCore::CSSToStyleMap::mapFillClip):
(WebCore::CSSToStyleMap::mapFillComposite):
(WebCore::CSSToStyleMap::mapFillBlendMode):
(WebCore::CSSToStyleMap::mapFillOrigin):
(WebCore::CSSToStyleMap::mapFillImage):
(WebCore::CSSToStyleMap::mapFillRepeatX):
(WebCore::CSSToStyleMap::mapFillRepeatY):
(WebCore::convertToLengthSize):
(WebCore::CSSToStyleMap::mapFillSize):
(WebCore::CSSToStyleMap::mapFillXPosition):
(WebCore::CSSToStyleMap::mapFillYPosition):
(WebCore::CSSToStyleMap::mapFillMaskSourceType):
(WebCore::CSSToStyleMap::mapAnimationDelay):
(WebCore::CSSToStyleMap::mapAnimationDirection):
(WebCore::CSSToStyleMap::mapAnimationDuration):
(WebCore::CSSToStyleMap::mapAnimationFillMode):
(WebCore::CSSToStyleMap::mapAnimationIterationCount):
(WebCore::CSSToStyleMap::mapAnimationName):
(WebCore::CSSToStyleMap::mapAnimationPlayState):
(WebCore::CSSToStyleMap::mapAnimationProperty):
(WebCore::CSSToStyleMap::mapAnimationTimingFunction):
(WebCore::CSSToStyleMap::mapAnimationTrigger):
The background and animation functions need to check for unset and be able to map it properly to initial. This is done
with a new treatAsInitial method on CSSValue that can take the property ID and check for both initial
or unset on a non-inherited property.

* css/CSSUnsetValue.cpp: Added.
(WebCore::CSSUnsetValue::customCSSText):
* css/CSSUnsetValue.h: Added.
(WebCore::CSSUnsetValue::create):
(WebCore::CSSUnsetValue::equals):
(WebCore::CSSUnsetValue::CSSUnsetValue):
This new value looks exactly like CSSInheritedValue and CSSInitialValue.

* css/CSSValue.cpp:
(WebCore::CSSValue::cssValueType):
(WebCore::CSSValue::cssText):
(WebCore::CSSValue::destroy):
(WebCore::CSSValue::isInvalidCustomPropertyValue):
(WebCore::CSSValue::treatAsInheritedValue):
(WebCore::CSSValue::treatAsInitialValue):
* css/CSSValue.h:
(WebCore::CSSValue::isUnsetValue):
Add isUnsetValue and the UnsetClass. Add support for treatAsInheritedValue and treatAsInitialValue to have
a way to query for initial/inherit or the matching unset type.

* css/CSSValueKeywords.in:
Add the unset keyword.

* css/CSSValuePool.cpp:
(WebCore::CSSValuePool::CSSValuePool):
* css/CSSValuePool.h:
(WebCore::CSSValuePool::createUnsetValue):
Have a singleton model for unset just like we do for inherit/initial.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::applyProperty):
Handle unset correctly. It maps to inherit for inherited properties and initial for non-inherited ones.

LayoutTests:

* TestExpectations:
Remove the 3 failing variables tests that used the unset keyword now that they pass.

* fast/css/unset-keyword-expected.html: Added.
* fast/css/unset-keyword.html: Added.
New test for both inherited and initial properties.

* fast/css/variables/test-suite/129-expected.html: Added.
* fast/css/variables/test-suite/129.html: Added.
* fast/css/variables/test-suite/130-expected.html: Added.
* fast/css/variables/test-suite/130.html: Added.
* fast/css/variables/test-suite/134-expected.html: Added.
* fast/css/variables/test-suite/134.html: Added.
* fast/css/variables/test-suite/failures/129-expected.html: Removed.
* fast/css/variables/test-suite/failures/129.html: Removed.
* fast/css/variables/test-suite/failures/130-expected.html: Removed.
* fast/css/variables/test-suite/failures/130.html: Removed.
* fast/css/variables/test-suite/failures/134-expected.html: Removed.
* fast/css/variables/test-suite/failures/134.html: Removed.
Move these tests into the passing directory.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191151 268f45cc-cd09-0410-ab3c-d52691b4dbfc

24 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/fast/css/unset-keyword-expected.html [new file with mode: 0644]
LayoutTests/fast/css/unset-keyword.html [new file with mode: 0644]
LayoutTests/fast/css/variables/test-suite/129-expected.html [moved from LayoutTests/fast/css/variables/test-suite/failures/129-expected.html with 100% similarity]
LayoutTests/fast/css/variables/test-suite/129.html [moved from LayoutTests/fast/css/variables/test-suite/failures/129.html with 100% similarity]
LayoutTests/fast/css/variables/test-suite/130-expected.html [moved from LayoutTests/fast/css/variables/test-suite/failures/130-expected.html with 100% similarity]
LayoutTests/fast/css/variables/test-suite/130.html [moved from LayoutTests/fast/css/variables/test-suite/failures/130.html with 100% similarity]
LayoutTests/fast/css/variables/test-suite/134-expected.html [moved from LayoutTests/fast/css/variables/test-suite/failures/134-expected.html with 100% similarity]
LayoutTests/fast/css/variables/test-suite/134.html [moved from LayoutTests/fast/css/variables/test-suite/failures/134.html with 100% similarity]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/objc/DOMCSS.mm
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSToStyleMap.cpp
Source/WebCore/css/CSSUnsetValue.cpp [new file with mode: 0644]
Source/WebCore/css/CSSUnsetValue.h [new file with mode: 0644]
Source/WebCore/css/CSSValue.cpp
Source/WebCore/css/CSSValue.h
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/CSSValuePool.cpp
Source/WebCore/css/CSSValuePool.h
Source/WebCore/css/StyleResolver.cpp

index 33c2f01..8e95f05 100644 (file)
@@ -1,3 +1,31 @@
+2015-10-15  David Hyatt  <hyatt@apple.com>
+
+        Add support for the CSS 'unset' keyword.
+        https://bugs.webkit.org/show_bug.cgi?id=148614
+
+        Reviewed by Dean Jackson.
+
+        * TestExpectations:
+        Remove the 3 failing variables tests that used the unset keyword now that they pass.
+
+        * fast/css/unset-keyword-expected.html: Added.
+        * fast/css/unset-keyword.html: Added.
+        New test for both inherited and initial properties.
+
+        * fast/css/variables/test-suite/129-expected.html: Added.
+        * fast/css/variables/test-suite/129.html: Added.
+        * fast/css/variables/test-suite/130-expected.html: Added.
+        * fast/css/variables/test-suite/130.html: Added.
+        * fast/css/variables/test-suite/134-expected.html: Added.
+        * fast/css/variables/test-suite/134.html: Added.
+        * fast/css/variables/test-suite/failures/129-expected.html: Removed.
+        * fast/css/variables/test-suite/failures/129.html: Removed.
+        * fast/css/variables/test-suite/failures/130-expected.html: Removed.
+        * fast/css/variables/test-suite/failures/130.html: Removed.
+        * fast/css/variables/test-suite/failures/134-expected.html: Removed.
+        * fast/css/variables/test-suite/failures/134.html: Removed.
+        Move these tests into the passing directory.
+
 2015-10-15  Ryan Haddad  <ryanhaddad@apple.com>
 
         Remove deprecated function insertRule(), replace with appendRule()
index 5954d82..415a2da 100644 (file)
@@ -698,9 +698,6 @@ webkit.org/b/150183 fast/css/variables/test-suite/failures/103.html [ ImageOnlyF
 webkit.org/b/150183 fast/css/variables/test-suite/failures/111.html [ ImageOnlyFailure ]
 webkit.org/b/150183 fast/css/variables/test-suite/failures/115.html [ ImageOnlyFailure ]
 webkit.org/b/150183 fast/css/variables/test-suite/failures/126.html [ ImageOnlyFailure ]
-webkit.org/b/150183 fast/css/variables/test-suite/failures/129.html [ ImageOnlyFailure ]
-webkit.org/b/150183 fast/css/variables/test-suite/failures/130.html [ ImageOnlyFailure ]
-webkit.org/b/150183 fast/css/variables/test-suite/failures/134.html [ ImageOnlyFailure ]
 webkit.org/b/150183 fast/css/variables/test-suite/failures/152.html [ ImageOnlyFailure ]
 webkit.org/b/150183 fast/css/variables/test-suite/failures/159.html [ ImageOnlyFailure ]
 webkit.org/b/150183 fast/css/variables/test-suite/failures/161.html [ ImageOnlyFailure ]
diff --git a/LayoutTests/fast/css/unset-keyword-expected.html b/LayoutTests/fast/css/unset-keyword-expected.html
new file mode 100644 (file)
index 0000000..3690298
--- /dev/null
@@ -0,0 +1,10 @@
+<head>
+<style>
+body { color: green; background-color:#ccc; }
+p { border-left:5px solid black; border-right:5px solid black; }
+</style>
+</head>
+<body>
+This text should be green on a grey background and have only side borders.
+</body>
+</html>
diff --git a/LayoutTests/fast/css/unset-keyword.html b/LayoutTests/fast/css/unset-keyword.html
new file mode 100644 (file)
index 0000000..a486f75
--- /dev/null
@@ -0,0 +1,10 @@
+<head>
+<style>
+body { color: green; background-color:#ccc; }
+p { border:5px solid black; color: orange; color:unset; background-color:blue; background-color:unset; border-top:unset; border-bottom:unset; }
+</style>
+</head>
+<body>
+This text should be green on a grey background and have only side borders.
+</body>
+</html>
index c60cd7b..7db35ae 100644 (file)
@@ -1349,6 +1349,7 @@ set(WebCore_SOURCES
     css/CSSToLengthConversionData.cpp
     css/CSSToStyleMap.cpp
     css/CSSUnicodeRangeValue.cpp
+    css/CSSUnsetValue.cpp
     css/CSSValue.cpp
     css/CSSValueList.cpp
     css/CSSValuePool.cpp
index 2dd7da2..625bf69 100644 (file)
@@ -1,3 +1,87 @@
+2015-10-15  David Hyatt  <hyatt@apple.com>
+
+        Add support for the CSS 'unset' keyword.
+        https://bugs.webkit.org/show_bug.cgi?id=148614
+
+        Reviewed by Dean Jackson.
+
+        Added new test in fast/css, and existing variables tests also use unset in several tests.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        Add CSSUnsetValue.cpp to the project.
+
+        * bindings/objc/DOMCSS.mm:
+        (kitClass):
+        Make sure UNSET is handled in the switch.
+
+        * css/CSSParser.cpp:
+        (WebCore::parseKeywordValue):
+        (WebCore::CSSParser::parseValue):
+        (WebCore::CSSParser::parseCustomPropertyDeclaration):
+        Add cases to create a CSSUnsetValue properly.
+
+        * css/CSSToStyleMap.cpp:
+        (WebCore::CSSToStyleMap::styleImage):
+        (WebCore::CSSToStyleMap::mapFillAttachment):
+        (WebCore::CSSToStyleMap::mapFillClip):
+        (WebCore::CSSToStyleMap::mapFillComposite):
+        (WebCore::CSSToStyleMap::mapFillBlendMode):
+        (WebCore::CSSToStyleMap::mapFillOrigin):
+        (WebCore::CSSToStyleMap::mapFillImage):
+        (WebCore::CSSToStyleMap::mapFillRepeatX):
+        (WebCore::CSSToStyleMap::mapFillRepeatY):
+        (WebCore::convertToLengthSize):
+        (WebCore::CSSToStyleMap::mapFillSize):
+        (WebCore::CSSToStyleMap::mapFillXPosition):
+        (WebCore::CSSToStyleMap::mapFillYPosition):
+        (WebCore::CSSToStyleMap::mapFillMaskSourceType):
+        (WebCore::CSSToStyleMap::mapAnimationDelay):
+        (WebCore::CSSToStyleMap::mapAnimationDirection):
+        (WebCore::CSSToStyleMap::mapAnimationDuration):
+        (WebCore::CSSToStyleMap::mapAnimationFillMode):
+        (WebCore::CSSToStyleMap::mapAnimationIterationCount):
+        (WebCore::CSSToStyleMap::mapAnimationName):
+        (WebCore::CSSToStyleMap::mapAnimationPlayState):
+        (WebCore::CSSToStyleMap::mapAnimationProperty):
+        (WebCore::CSSToStyleMap::mapAnimationTimingFunction):
+        (WebCore::CSSToStyleMap::mapAnimationTrigger):
+        The background and animation functions need to check for unset and be able to map it properly to initial. This is done
+        with a new treatAsInitial method on CSSValue that can take the property ID and check for both initial
+        or unset on a non-inherited property.
+
+        * css/CSSUnsetValue.cpp: Added.
+        (WebCore::CSSUnsetValue::customCSSText):
+        * css/CSSUnsetValue.h: Added.
+        (WebCore::CSSUnsetValue::create):
+        (WebCore::CSSUnsetValue::equals):
+        (WebCore::CSSUnsetValue::CSSUnsetValue):
+        This new value looks exactly like CSSInheritedValue and CSSInitialValue.
+
+        * css/CSSValue.cpp:
+        (WebCore::CSSValue::cssValueType):
+        (WebCore::CSSValue::cssText):
+        (WebCore::CSSValue::destroy):
+        (WebCore::CSSValue::isInvalidCustomPropertyValue):
+        (WebCore::CSSValue::treatAsInheritedValue):
+        (WebCore::CSSValue::treatAsInitialValue):
+        * css/CSSValue.h:
+        (WebCore::CSSValue::isUnsetValue):
+        Add isUnsetValue and the UnsetClass. Add support for treatAsInheritedValue and treatAsInitialValue to have
+        a way to query for initial/inherit or the matching unset type.
+
+        * css/CSSValueKeywords.in:
+        Add the unset keyword.
+
+        * css/CSSValuePool.cpp:
+        (WebCore::CSSValuePool::CSSValuePool):
+        * css/CSSValuePool.h:
+        (WebCore::CSSValuePool::createUnsetValue):
+        Have a singleton model for unset just like we do for inherit/initial.
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::applyProperty):
+        Handle unset correctly. It maps to inherit for inherited properties and initial for non-inherited ones.
+
 2015-10-15  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Migrate to CGContextSetBaseCTM() and CGContextResetClip() from WKSI
index f4a8f07..acc4bdb 100644 (file)
                7C48A6D1191C9D6500026674 /* WebKitNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C48A6CF191C9D6500026674 /* WebKitNamespace.h */; };
                7C4902A218B825F8007D9298 /* DOMWheelEventInternal.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 85989DCA0ACC8BBD00A0BC51 /* DOMWheelEventInternal.h */; };
                7C4C96DC1AD4483500365A50 /* JSReadableStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4C96D81AD4483500365A50 /* JSReadableStream.cpp */; };
-               7C4C96DC1AD4483500365A51 /* ReadableStreamBuiltins.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4C96D81AD4483500365A51 /* ReadableStreamBuiltins.cpp */; };
-               7C4C96DC1AD4483500365A52 /* CountQueuingStrategyBuiltins.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4C96D81AD4483500365A52 /* CountQueuingStrategyBuiltins.cpp */; };
                7C4C96DD1AD4483500365A50 /* JSReadableStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C4C96D91AD4483500365A50 /* JSReadableStream.h */; };
                7C4C96DE1AD4483500365A50 /* JSReadableStreamReader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C4C96DA1AD4483500365A50 /* JSReadableStreamReader.cpp */; };
                7C4C96DF1AD4483500365A50 /* JSReadableStreamReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C4C96DB1AD4483500365A50 /* JSReadableStreamReader.h */; };
                BC772E16133162C2001EC9CE /* CSSLineBoxContainValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC772E15133162C2001EC9CE /* CSSLineBoxContainValue.cpp */; };
                BC779E141BB215BB00CAA8BF /* CSSCustomPropertyValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC779E131BB215BB00CAA8BF /* CSSCustomPropertyValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BC779E171BB227CA00CAA8BF /* StyleCustomPropertyData.h in Headers */ = {isa = PBXBuildFile; fileRef = BC779E151BB226A200CAA8BF /* StyleCustomPropertyData.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               BC7D8FEF1BD03B6400FFE540 /* CSSUnsetValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7D8FED1BD03B6400FFE540 /* CSSUnsetValue.cpp */; settings = {ASSET_TAGS = (); }; };
+               BC7D8FF01BD03B6400FFE540 /* CSSUnsetValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7D8FEE1BD03B6400FFE540 /* CSSUnsetValue.h */; settings = {ASSET_TAGS = (); }; };
                BC7F44A80B9E324E00A9D081 /* ImageObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7F44A70B9E324E00A9D081 /* ImageObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BC7FA6200D1F0CBD00DB22A9 /* LiveNodeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7FA61E0D1F0CBD00DB22A9 /* LiveNodeList.cpp */; };
                BC7FA6210D1F0CBD00DB22A9 /* LiveNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7FA61F0D1F0CBD00DB22A9 /* LiveNodeList.h */; };
                7C48A6CF191C9D6500026674 /* WebKitNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitNamespace.h; sourceTree = "<group>"; };
                7C48A6D2191C9D8E00026674 /* WebKitNamespace.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebKitNamespace.idl; sourceTree = "<group>"; };
                7C4C96D81AD4483500365A50 /* JSReadableStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSReadableStream.cpp; sourceTree = "<group>"; };
-               7C4C96D81AD4483500365A51 /* ReadableStreamBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReadableStreamBuiltins.cpp; sourceTree = "<group>"; };
-               7C4C96D81AD4483500365A52 /* CountQueuingStrategyBuiltins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CountQueuingStrategyBuiltins.cpp; sourceTree = "<group>"; };
                7C4C96D91AD4483500365A50 /* JSReadableStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSReadableStream.h; sourceTree = "<group>"; };
                7C4C96DA1AD4483500365A50 /* JSReadableStreamReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSReadableStreamReader.cpp; sourceTree = "<group>"; };
                7C4C96DB1AD4483500365A50 /* JSReadableStreamReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSReadableStreamReader.h; sourceTree = "<group>"; };
                BC779E131BB215BB00CAA8BF /* CSSCustomPropertyValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSCustomPropertyValue.h; sourceTree = "<group>"; };
                BC779E151BB226A200CAA8BF /* StyleCustomPropertyData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleCustomPropertyData.h; sourceTree = "<group>"; };
                BC7B2AF80450824100A8000F /* Scrollbar.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Scrollbar.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+               BC7D8FED1BD03B6400FFE540 /* CSSUnsetValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSUnsetValue.cpp; sourceTree = "<group>"; };
+               BC7D8FEE1BD03B6400FFE540 /* CSSUnsetValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSUnsetValue.h; sourceTree = "<group>"; };
                BC7F44A70B9E324E00A9D081 /* ImageObserver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ImageObserver.h; sourceTree = "<group>"; };
                BC7FA61E0D1F0CBD00DB22A9 /* LiveNodeList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LiveNodeList.cpp; sourceTree = "<group>"; };
                BC7FA61F0D1F0CBD00DB22A9 /* LiveNodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LiveNodeList.h; sourceTree = "<group>"; };
                                371F53E70D2704F900ECE0D5 /* CSSUnicodeRangeValue.h */,
                                A80E6CCE0A1989CA007FB8C5 /* CSSUnknownRule.h */,
                                85C56CAD0AA89FE000D95755 /* CSSUnknownRule.idl */,
+                               BC7D8FED1BD03B6400FFE540 /* CSSUnsetValue.cpp */,
+                               BC7D8FEE1BD03B6400FFE540 /* CSSUnsetValue.h */,
                                AD03AAF81468453900A39B5B /* CSSValue.cpp */,
                                A80E6CC40A1989CA007FB8C5 /* CSSValue.h */,
                                14CF787109F587CA00EB3665 /* CSSValue.idl */,
                                B2A1F2AB0CEF0ABF00442F6A /* SVGFontElement.h in Headers */,
                                B2227A150D00BF220071B782 /* SVGFontFaceElement.h in Headers */,
                                B2227A180D00BF220071B782 /* SVGFontFaceFormatElement.h in Headers */,
+                               BC7D8FF01BD03B6400FFE540 /* CSSUnsetValue.h in Headers */,
                                B2227A1B0D00BF220071B782 /* SVGFontFaceNameElement.h in Headers */,
                                B2227A1E0D00BF220071B782 /* SVGFontFaceSrcElement.h in Headers */,
                                B2227A210D00BF220071B782 /* SVGFontFaceUriElement.h in Headers */,
                                409EBDC516B7F3CA00CBA3FC /* JSCSSFontFaceLoadEvent.cpp in Sources */,
                                BC46C1FC0C0DDC8F0020CFC3 /* JSCSSFontFaceRule.cpp in Sources */,
                                BC46C1FE0C0DDC8F0020CFC3 /* JSCSSImportRule.cpp in Sources */,
+                               BC7D8FEF1BD03B6400FFE540 /* CSSUnsetValue.cpp in Sources */,
                                316FE0710E6CCBEE00BF6088 /* JSCSSKeyframeRule.cpp in Sources */,
                                316FE0730E6CCBEE00BF6088 /* JSCSSKeyframesRule.cpp in Sources */,
                                BC46C2000C0DDC8F0020CFC3 /* JSCSSMediaRule.cpp in Sources */,
index 7c6a2dd..bb1630c 100644 (file)
@@ -124,6 +124,7 @@ Class kitClass(WebCore::CSSValue* impl)
             return [DOMCSSValueList class];
         case WebCore::CSSValue::CSS_INHERIT:
         case WebCore::CSSValue::CSS_INITIAL:
+        case WebCore::CSSValue::CSS_UNSET:
             return [DOMCSSValue class];
         case WebCore::CSSValue::CSS_CUSTOM:
             return [DOMCSSValue class];
index 19339f3..ae0e8cf 100644 (file)
@@ -62,6 +62,7 @@
 #include "CSSStyleSheet.h"
 #include "CSSTimingFunctionValue.h"
 #include "CSSUnicodeRangeValue.h"
+#include "CSSUnsetValue.h"
 #include "CSSValueKeywords.h"
 #include "CSSValueList.h"
 #include "CSSValuePool.h"
@@ -1216,6 +1217,8 @@ static CSSParser::ParseResult parseKeywordValue(MutableStyleProperties* declarat
         value = CSSValuePool::singleton().createInheritedValue();
     else if (valueID == CSSValueInitial)
         value = CSSValuePool::singleton().createExplicitInitialValue();
+    else if (valueID == CSSValueUnset)
+        value = CSSValuePool::singleton().createUnsetValue();
     else if (isValidKeywordPropertyAndValue(propertyId, valueID, parserContext, styleSheetContents))
         value = CSSValuePool::singleton().createIdentifierValue(valueID);
     else
@@ -1957,6 +1960,11 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important)
             return false;
         addExpandedPropertyForValue(propId, cssValuePool.createExplicitInitialValue(), important);
         return true;
+    } else if (id == CSSValueUnset) {
+        if (num != 1)
+            return false;
+        addExpandedPropertyForValue(propId, cssValuePool.createUnsetValue(), important);
+        return true;
     }
 
     if (isKeywordPropertyID(propId)) {
@@ -4200,6 +4208,8 @@ bool CSSParser::parseCustomPropertyDeclaration(bool important, CSSValueID id)
         value = cssValuePool.createInheritedValue();
     else if (id == CSSValueInitial)
         value = cssValuePool.createExplicitInitialValue();
+    else if (id == CSSValueUnset)
+        value = cssValuePool.createUnsetValue();
     else {
         RefPtr<CSSValueList> valueList = CSSValueList::createFromParserValueList(*m_valueList);
         if (m_valueList->containsVariables())
index e1d4925..961ea10 100644 (file)
@@ -71,9 +71,9 @@ RefPtr<StyleImage> CSSToStyleMap::styleImage(CSSPropertyID propertyId, CSSValue&
     return m_resolver->styleImage(propertyId, value);
 }
 
-void CSSToStyleMap::mapFillAttachment(CSSPropertyID, FillLayer& layer, const CSSValue& value)
+void CSSToStyleMap::mapFillAttachment(CSSPropertyID propertyID, FillLayer& layer, const CSSValue& value)
 {
-    if (value.isInitialValue()) {
+    if (value.treatAsInitialValue(propertyID)) {
         layer.setAttachment(FillLayer::initialFillAttachment(layer.type()));
         return;
     }
@@ -96,9 +96,9 @@ void CSSToStyleMap::mapFillAttachment(CSSPropertyID, FillLayer& layer, const CSS
     }
 }
 
-void CSSToStyleMap::mapFillClip(CSSPropertyID, FillLayer& layer, const CSSValue& value)
+void CSSToStyleMap::mapFillClip(CSSPropertyID propertyID, FillLayer& layer, const CSSValue& value)
 {
-    if (value.isInitialValue()) {
+    if (value.treatAsInitialValue(propertyID)) {
         layer.setClip(FillLayer::initialFillClip(layer.type()));
         return;
     }
@@ -109,9 +109,9 @@ void CSSToStyleMap::mapFillClip(CSSPropertyID, FillLayer& layer, const CSSValue&
     layer.setClip(downcast<CSSPrimitiveValue>(value));
 }
 
-void CSSToStyleMap::mapFillComposite(CSSPropertyID, FillLayer& layer, const CSSValue& value)
+void CSSToStyleMap::mapFillComposite(CSSPropertyID propertyID, FillLayer& layer, const CSSValue& value)
 {
-    if (value.isInitialValue()) {
+    if (value.treatAsInitialValue(propertyID)) {
         layer.setComposite(FillLayer::initialFillComposite(layer.type()));
         return;
     }
@@ -122,9 +122,9 @@ void CSSToStyleMap::mapFillComposite(CSSPropertyID, FillLayer& layer, const CSSV
     layer.setComposite(downcast<CSSPrimitiveValue>(value));
 }
 
-void CSSToStyleMap::mapFillBlendMode(CSSPropertyID, FillLayer& layer, const CSSValue& value)
+void CSSToStyleMap::mapFillBlendMode(CSSPropertyID propertyID, FillLayer& layer, const CSSValue& value)
 {
-    if (value.isInitialValue()) {
+    if (value.treatAsInitialValue(propertyID)) {
         layer.setBlendMode(FillLayer::initialFillBlendMode(layer.type()));
         return;
     }
@@ -135,9 +135,9 @@ void CSSToStyleMap::mapFillBlendMode(CSSPropertyID, FillLayer& layer, const CSSV
     layer.setBlendMode(downcast<CSSPrimitiveValue>(value));
 }
 
-void CSSToStyleMap::mapFillOrigin(CSSPropertyID, FillLayer& layer, const CSSValue& value)
+void CSSToStyleMap::mapFillOrigin(CSSPropertyID propertyID, FillLayer& layer, const CSSValue& value)
 {
-    if (value.isInitialValue()) {
+    if (value.treatAsInitialValue(propertyID)) {
         layer.setOrigin(FillLayer::initialFillOrigin(layer.type()));
         return;
     }
@@ -148,19 +148,19 @@ void CSSToStyleMap::mapFillOrigin(CSSPropertyID, FillLayer& layer, const CSSValu
     layer.setOrigin(downcast<CSSPrimitiveValue>(value));
 }
 
-void CSSToStyleMap::mapFillImage(CSSPropertyID property, FillLayer& layer, CSSValue& value)
+void CSSToStyleMap::mapFillImage(CSSPropertyID propertyID, FillLayer& layer, CSSValue& value)
 {
-    if (value.isInitialValue()) {
+    if (value.treatAsInitialValue(propertyID)) {
         layer.setImage(FillLayer::initialFillImage(layer.type()));
         return;
     }
 
-    layer.setImage(styleImage(property, value));
+    layer.setImage(styleImage(propertyID, value));
 }
 
-void CSSToStyleMap::mapFillRepeatX(CSSPropertyID, FillLayer& layer, const CSSValue& value)
+void CSSToStyleMap::mapFillRepeatX(CSSPropertyID propertyID, FillLayer& layer, const CSSValue& value)
 {
-    if (value.isInitialValue()) {
+    if (value.treatAsInitialValue(propertyID)) {
         layer.setRepeatX(FillLayer::initialFillRepeatX(layer.type()));
         return;
     }
@@ -171,9 +171,9 @@ void CSSToStyleMap::mapFillRepeatX(CSSPropertyID, FillLayer& layer, const CSSVal
     layer.setRepeatX(downcast<CSSPrimitiveValue>(value));
 }
 
-void CSSToStyleMap::mapFillRepeatY(CSSPropertyID, FillLayer& layer, const CSSValue& value)
+void CSSToStyleMap::mapFillRepeatY(CSSPropertyID propertyID, FillLayer& layer, const CSSValue& value)
 {
-    if (value.isInitialValue()) {
+    if (value.treatAsInitialValue(propertyID)) {
         layer.setRepeatY(FillLayer::initialFillRepeatY(layer.type()));
         return;
     }
@@ -195,9 +195,9 @@ static inline bool convertToLengthSize(const CSSPrimitiveValue& primitiveValue,
     return !size.width().isUndefined() && !size.height().isUndefined();
 }
 
-void CSSToStyleMap::mapFillSize(CSSPropertyID, FillLayer& layer, const CSSValue& value)
+void CSSToStyleMap::mapFillSize(CSSPropertyID propertyID, FillLayer& layer, const CSSValue& value)
 {
-    if (value.isInitialValue()) {
+    if (value.treatAsInitialValue(propertyID)) {
         layer.setSize(FillLayer::initialFillSize(layer.type()));
         return;
     }
@@ -225,7 +225,7 @@ void CSSToStyleMap::mapFillSize(CSSPropertyID, FillLayer& layer, const CSSValue&
 
 void CSSToStyleMap::mapFillXPosition(CSSPropertyID propertyID, FillLayer& layer, const CSSValue& value)
 {
-    if (value.isInitialValue()) {
+    if (value.treatAsInitialValue(propertyID)) {
         layer.setXPosition(FillLayer::initialFillXPosition(layer.type()));
         return;
     }
@@ -257,7 +257,7 @@ void CSSToStyleMap::mapFillXPosition(CSSPropertyID propertyID, FillLayer& layer,
 
 void CSSToStyleMap::mapFillYPosition(CSSPropertyID propertyID, FillLayer& layer, const CSSValue& value)
 {
-    if (value.isInitialValue()) {
+    if (value.treatAsInitialValue(propertyID)) {
         layer.setYPosition(FillLayer::initialFillYPosition(layer.type()));
         return;
     }
@@ -287,10 +287,10 @@ void CSSToStyleMap::mapFillYPosition(CSSPropertyID propertyID, FillLayer& layer,
         layer.setBackgroundYOrigin(*pair->first());
 }
 
-void CSSToStyleMap::mapFillMaskSourceType(CSSPropertyID, FillLayer& layer, const CSSValue& value)
+void CSSToStyleMap::mapFillMaskSourceType(CSSPropertyID propertyID, FillLayer& layer, const CSSValue& value)
 {
     EMaskSourceType type = FillLayer::initialFillMaskSourceType(layer.type());
-    if (value.isInitialValue()) {
+    if (value.treatAsInitialValue(propertyID)) {
         layer.setMaskSourceType(type);
         return;
     }
@@ -316,7 +316,7 @@ void CSSToStyleMap::mapFillMaskSourceType(CSSPropertyID, FillLayer& layer, const
 
 void CSSToStyleMap::mapAnimationDelay(Animation& animation, const CSSValue& value)
 {
-    if (value.isInitialValue()) {
+    if (value.treatAsInitialValue(CSSPropertyWebkitAnimationDelay)) {
         animation.setDelay(Animation::initialDelay());
         return;
     }
@@ -329,7 +329,7 @@ void CSSToStyleMap::mapAnimationDelay(Animation& animation, const CSSValue& valu
 
 void CSSToStyleMap::mapAnimationDirection(Animation& layer, const CSSValue& value)
 {
-    if (value.isInitialValue()) {
+    if (value.treatAsInitialValue(CSSPropertyWebkitAnimationDirection)) {
         layer.setDirection(Animation::initialDirection());
         return;
     }
@@ -357,7 +357,7 @@ void CSSToStyleMap::mapAnimationDirection(Animation& layer, const CSSValue& valu
 
 void CSSToStyleMap::mapAnimationDuration(Animation& animation, const CSSValue& value)
 {
-    if (value.isInitialValue()) {
+    if (value.treatAsInitialValue(CSSPropertyWebkitAnimationDuration)) {
         animation.setDuration(Animation::initialDuration());
         return;
     }
@@ -370,7 +370,7 @@ void CSSToStyleMap::mapAnimationDuration(Animation& animation, const CSSValue& v
 
 void CSSToStyleMap::mapAnimationFillMode(Animation& layer, const CSSValue& value)
 {
-    if (value.isInitialValue()) {
+    if (value.treatAsInitialValue(CSSPropertyWebkitAnimationFillMode)) {
         layer.setFillMode(Animation::initialFillMode());
         return;
     }
@@ -398,7 +398,7 @@ void CSSToStyleMap::mapAnimationFillMode(Animation& layer, const CSSValue& value
 
 void CSSToStyleMap::mapAnimationIterationCount(Animation& animation, const CSSValue& value)
 {
-    if (value.isInitialValue()) {
+    if (value.treatAsInitialValue(CSSPropertyWebkitAnimationIterationCount)) {
         animation.setIterationCount(Animation::initialIterationCount());
         return;
     }
@@ -415,7 +415,7 @@ void CSSToStyleMap::mapAnimationIterationCount(Animation& animation, const CSSVa
 
 void CSSToStyleMap::mapAnimationName(Animation& layer, const CSSValue& value)
 {
-    if (value.isInitialValue()) {
+    if (value.treatAsInitialValue(CSSPropertyWebkitAnimationName)) {
         layer.setName(Animation::initialName());
         return;
     }
@@ -432,7 +432,7 @@ void CSSToStyleMap::mapAnimationName(Animation& layer, const CSSValue& value)
 
 void CSSToStyleMap::mapAnimationPlayState(Animation& layer, const CSSValue& value)
 {
-    if (value.isInitialValue()) {
+    if (value.treatAsInitialValue(CSSPropertyWebkitAnimationPlayState)) {
         layer.setPlayState(Animation::initialPlayState());
         return;
     }
@@ -446,7 +446,7 @@ void CSSToStyleMap::mapAnimationPlayState(Animation& layer, const CSSValue& valu
 
 void CSSToStyleMap::mapAnimationProperty(Animation& animation, const CSSValue& value)
 {
-    if (value.isInitialValue()) {
+    if (value.treatAsInitialValue(CSSPropertyWebkitAnimation)) {
         animation.setAnimationMode(Animation::AnimateAll);
         animation.setProperty(CSSPropertyInvalid);
         return;
@@ -470,7 +470,7 @@ void CSSToStyleMap::mapAnimationProperty(Animation& animation, const CSSValue& v
 
 void CSSToStyleMap::mapAnimationTimingFunction(Animation& animation, const CSSValue& value)
 {
-    if (value.isInitialValue()) {
+    if (value.treatAsInitialValue(CSSPropertyWebkitAnimationTimingFunction)) {
         animation.setTimingFunction(Animation::initialTimingFunction());
         return;
     }
@@ -516,7 +516,7 @@ void CSSToStyleMap::mapAnimationTimingFunction(Animation& animation, const CSSVa
 #if ENABLE(CSS_ANIMATIONS_LEVEL_2)
 void CSSToStyleMap::mapAnimationTrigger(Animation& animation, const CSSValue& value)
 {
-    if (value.isInitialValue()) {
+    if (value.treatAsInitialValue(CSSPropertyWebkitAnimationTrigger)) {
         animation.setTrigger(Animation::initialTrigger());
         return;
     }
diff --git a/Source/WebCore/css/CSSUnsetValue.cpp b/Source/WebCore/css/CSSUnsetValue.cpp
new file mode 100644 (file)
index 0000000..98472d7
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CSSUnsetValue.h"
+
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+String CSSUnsetValue::customCSSText() const
+{
+    return ASCIILiteral("unset");
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/css/CSSUnsetValue.h b/Source/WebCore/css/CSSUnsetValue.h
new file mode 100644 (file)
index 0000000..0aa6c22
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSUnsetValue_h
+#define CSSUnsetValue_h
+
+#include "CSSValue.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+class CSSUnsetValue : public CSSValue {
+public:
+    static Ref<CSSUnsetValue> create()
+    {
+        return adoptRef(*new CSSUnsetValue);
+    }
+
+    String customCSSText() const;
+
+    bool equals(const CSSUnsetValue&) const { return true; }
+
+private:
+    CSSUnsetValue()
+        : CSSValue(UnsetClass)
+    {
+    }
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSUnsetValue, isUnsetValue())
+
+#endif // CSSUnsetValue_h
index cdc8f51..18fe924 100644 (file)
 #include "CSSLineBoxContainValue.h"
 #include "CSSNamedImageValue.h"
 #include "CSSPrimitiveValue.h"
+#include "CSSProperty.h"
 #include "CSSReflectValue.h"
 #include "CSSShadowValue.h"
 #include "CSSTimingFunctionValue.h"
 #include "CSSUnicodeRangeValue.h"
+#include "CSSUnsetValue.h"
 #include "CSSValueList.h"
 #include "CSSVariableDependentValue.h"
 #include "CSSVariableValue.h"
@@ -110,6 +112,8 @@ CSSValue::Type CSSValue::cssValueType() const
         return CSS_VALUE_LIST;
     if (isInitialValue())
         return CSS_INITIAL;
+    if (isUnsetValue())
+        return CSS_UNSET;
     return CSS_CUSTOM;
 }
 
@@ -297,6 +301,8 @@ String CSSValue::cssText() const
         return downcast<CSSInheritedValue>(*this).customCSSText();
     case InitialClass:
         return downcast<CSSInitialValue>(*this).customCSSText();
+    case UnsetClass:
+        return downcast<CSSUnsetValue>(*this).customCSSText();
 #if ENABLE(CSS_GRID_LAYOUT)
     case GridLineNamesClass:
         return downcast<CSSGridLineNamesValue>(*this).customCSSText();
@@ -406,6 +412,9 @@ void CSSValue::destroy()
     case InitialClass:
         delete downcast<CSSInitialValue>(this);
         return;
+    case UnsetClass:
+        delete downcast<CSSUnsetValue>(this);
+        return;
 #if ENABLE(CSS_GRID_LAYOUT)
     case GridLineNamesClass:
         delete downcast<CSSGridLineNamesValue>(this);
@@ -515,4 +524,14 @@ bool CSSValue::isInvalidCustomPropertyValue() const
     return isCustomPropertyValue() && downcast<CSSCustomPropertyValue>(*this).isInvalid();
 }
 
+bool CSSValue::treatAsInheritedValue(CSSPropertyID propertyID) const
+{
+    return classType() == InheritedClass || (classType() == UnsetClass && CSSProperty::isInheritedProperty(propertyID));
+}
+
+bool CSSValue::treatAsInitialValue(CSSPropertyID propertyID) const
+{
+    return classType() == InitialClass || (classType() == UnsetClass && !CSSProperty::isInheritedProperty(propertyID));
+}
+
 }
index 7ae74b3..58f3785 100644 (file)
@@ -32,7 +32,8 @@ namespace WebCore {
 
 class CachedResource;
 class StyleSheetContents;
-    
+enum CSSPropertyID : uint16_t;
+
 // FIXME: The current CSSValue and subclasses should be turned into internal types (StyleValue).
 // The few subtypes that are actually exposed in CSSOM can be seen in the cloneForCSSOM() function.
 // They should be handled by separate wrapper classes.
@@ -45,8 +46,8 @@ public:
         CSS_PRIMITIVE_VALUE = 1,
         CSS_VALUE_LIST = 2,
         CSS_CUSTOM = 3,
-        CSS_INITIAL = 4
-
+        CSS_INITIAL = 4,
+        CSS_UNSET = 5
     };
 
     // Override RefCounted's deref() to ensure operator delete is called on
@@ -92,6 +93,9 @@ public:
     bool isImplicitInitialValue() const;
     bool isInheritedValue() const { return m_classType == InheritedClass; }
     bool isInitialValue() const { return m_classType == InitialClass; }
+    bool isUnsetValue() const { return m_classType == UnsetClass; }
+    bool treatAsInitialValue(CSSPropertyID) const;
+    bool treatAsInheritedValue(CSSPropertyID) const;
     bool isLinearGradientValue() const { return m_classType == LinearGradientClass; }
     bool isRadialGradientValue() const { return m_classType == RadialGradientClass; }
     bool isReflectValue() const { return m_classType == ReflectClass; }
@@ -164,6 +168,7 @@ protected:
 
         InheritedClass,
         InitialClass,
+        UnsetClass,
 
         ReflectClass,
         ShadowClass,
index 00d26cb..63a89c6 100644 (file)
@@ -3,6 +3,8 @@
 //
 inherit
 initial
+unset
+
 //
 // CSS_PROP_OUTLINE_STYLE
 // CSS_PROP_BORDER_TOP_STYLE
index aa2a7d4..d71c0ff 100644 (file)
@@ -44,6 +44,7 @@ CSSValuePool::CSSValuePool()
     : m_inheritedValue(CSSInheritedValue::create())
     , m_implicitInitialValue(CSSInitialValue::createImplicit())
     , m_explicitInitialValue(CSSInitialValue::createExplicit())
+    , m_unsetValue(CSSUnsetValue::create())
     , m_colorTransparent(CSSPrimitiveValue::createColor(Color::transparent))
     , m_colorWhite(CSSPrimitiveValue::createColor(Color::white))
     , m_colorBlack(CSSPrimitiveValue::createColor(Color::black))
index b2a903e..53e8836 100644 (file)
@@ -31,6 +31,7 @@
 #include "CSSInitialValue.h"
 #include "CSSPrimitiveValue.h"
 #include "CSSPropertyNames.h"
+#include "CSSUnsetValue.h"
 #include "CSSValueKeywords.h"
 #include <utility>
 #include <wtf/HashMap.h>
@@ -54,6 +55,7 @@ public:
     Ref<CSSInheritedValue> createInheritedValue() { return m_inheritedValue.copyRef(); }
     Ref<CSSInitialValue> createImplicitInitialValue() { return m_implicitInitialValue.copyRef(); }
     Ref<CSSInitialValue> createExplicitInitialValue() { return m_explicitInitialValue.copyRef(); }
+    Ref<CSSUnsetValue> createUnsetValue() { return m_unsetValue.copyRef(); }
     Ref<CSSPrimitiveValue> createIdentifierValue(CSSValueID identifier);
     Ref<CSSPrimitiveValue> createIdentifierValue(CSSPropertyID identifier);
     Ref<CSSPrimitiveValue> createColorValue(unsigned rgbValue);
@@ -71,6 +73,7 @@ private:
     Ref<CSSInheritedValue> m_inheritedValue;
     Ref<CSSInitialValue> m_implicitInitialValue;
     Ref<CSSInitialValue> m_explicitInitialValue;
+    Ref<CSSUnsetValue> m_unsetValue;
 
     RefPtr<CSSPrimitiveValue> m_identifierValueCache[numCSSValueKeywords];
 
index f0faf7c..ab8900e 100644 (file)
@@ -1907,7 +1907,14 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
 
     bool isInherit = state.parentStyle() && valueToCheckForInheritInitial->isInheritedValue();
     bool isInitial = valueToCheckForInheritInitial->isInitialValue() || (!state.parentStyle() && valueToCheckForInheritInitial->isInheritedValue());
-
+    
+    if (valueToCheckForInheritInitial->isUnsetValue()) {
+        if (CSSProperty::isInheritedProperty(id))
+            isInherit = true;
+        else
+            isInitial = true;
+    }
+    
     ASSERT(!isInherit || !isInitial); // isInherit -> !isInitial && isInitial -> !isInherit
 
     if (!state.applyPropertyToRegularStyle() && (!state.applyPropertyToVisitedLinkStyle() || !isValidVisitedLinkProperty(id))) {