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: http://svn.webkit.org/repository/webkit/trunk@191151 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed