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)
commit5186c695defb13adda82cdd77f9d11656171710a
treedea65f7f4088f2e39441e7dd71c04c713592f219
parent58cbc10cc212735b12fa19be7f87238acb6f8e9b
Add support for the CSS 'unset' keyword.
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