haikuwebkit/LayoutTests/css-custom-properties-api/length-expected.txt

31 lines
732 B
Plaintext
Raw Permalink Normal View History

Registered custom properties should allow inheritance to be controlled https://bugs.webkit.org/show_bug.cgi?id=190038 Patch by Justin Michaud <justin_michaud@apple.com> on 2018-10-03 Reviewed by Antti Koivisto. LayoutTests/imported/w3c: Update web platform tests for css registered custom properties to fail in a different way. * web-platform-tests/css/css-properties-values-api/registered-properties-inheritance-expected.txt: * web-platform-tests/css/css-properties-values-api/registered-property-computation-expected.txt: * web-platform-tests/css/css-properties-values-api/registered-property-cssom-expected.txt: * web-platform-tests/css/css-properties-values-api/url-resolution-expected.txt: * web-platform-tests/css/css-properties-values-api/var-reference-registered-properties-cycles-expected.txt: * web-platform-tests/css/css-properties-values-api/var-reference-registered-properties-expected.txt: Source/WebCore: Tests: css-custom-properties-api/inherits.html css-custom-properties-api/length.html css-custom-properties-api/length2.html Add support for inherits property on registered css custom properties, as well as a starting point for evaluating registered custom properties with types. Registered custom properties are evaluated as length values before being substituted. Currently, relative unit cycles are not detected. A proper solution is still needed to resolve relative unit cycles, and to apply properties like font and line-height before they are needed by custom properties. In this patch, the font-size property is applied twice, once before and once after resolving custom property values. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::customPropertyValue): (WebCore::CSSComputedStyleDeclaration::length const): (WebCore::CSSComputedStyleDeclaration::item const): Allow JS to get custom properties that have been resolved to a length. Also add properties from m_rareNonInheritedData. * css/CSSCustomPropertyValue.cpp: (WebCore::CSSCustomPropertyValue::checkVariablesForCycles const): (WebCore::CSSCustomPropertyValue::resolveVariableReferences const): * css/CSSCustomPropertyValue.h: * css/CSSRegisteredCustomProperty.cpp: Copied from Source/WebCore/css/CSSRegisteredCustomProperty.h. (WebCore::CSSRegisteredCustomProperty::CSSRegisteredCustomProperty): (WebCore::CSSRegisteredCustomProperty::initialValueCopy const): * css/CSSRegisteredCustomProperty.h: (WebCore::CSSRegisteredCustomProperty::initialValue const): * css/CSSVariableData.cpp: (WebCore::CSSVariableData::checkVariablesForCycles const): (WebCore::CSSVariableData::checkVariablesForCyclesWithRange const): (WebCore::CSSVariableData::resolveVariableFallback const): (WebCore::CSSVariableData::resolveVariableReference const): (WebCore::CSSVariableData::resolveVariableReferences const): (WebCore::CSSVariableData::resolveTokenRange const): * css/CSSVariableData.h: * css/CSSVariableReferenceValue.cpp: (WebCore::CSSVariableReferenceValue::checkVariablesForCycles const): * css/CSSVariableReferenceValue.h: * css/DOMCSSRegisterCustomProperty.cpp: (WebCore::DOMCSSRegisterCustomProperty::registerProperty): Use RenderStyle over passing in a customProperties map. * css/StyleBuilder.h: * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertLength): (WebCore::StyleBuilderConverter::convertLengthOrAuto): (WebCore::StyleBuilderConverter::convertLengthSizing): (WebCore::StyleBuilderConverter::convertLengthMaxSizing): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyInitialCustomProperty): (WebCore::StyleBuilderCustom::applyInheritCustomProperty): (WebCore::StyleBuilderCustom::applyValueCustomProperty): * css/StyleResolver.cpp: (WebCore::StyleResolver::useSVGZoomRules const): (WebCore::StyleResolver::useSVGZoomRulesForLength const): (WebCore::StyleResolver::applyProperty): (WebCore::StyleResolver::resolvedVariableValue const): (WebCore::StyleResolver::applyCascadedProperties): (WebCore::StyleResolver::useSVGZoomRules): Deleted. (WebCore::StyleResolver::useSVGZoomRulesForLength): Deleted. (WebCore::StyleResolver::resolvedVariableValue): Deleted. * css/StyleResolver.h: * css/makeprop.pl: Move custom property initial values to StyleBuilerCustom. Hook them up to correctly deal with inheritance, unset and revert values. * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseValueWithVariableReferences): * css/parser/CSSParser.h: * css/parser/CSSParserContext.cpp: (WebCore::CSSParserContext::CSSParserContext): * css/parser/CSSParserContext.h: * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseSingleValue): Allow parsing custom property values as lengths. * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::checkVariablesInCustomProperties): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::inheritedCustomProperties const): (WebCore::RenderStyle::nonInheritedCustomProperties const): (WebCore::RenderStyle::setInheritedCustomPropertyValue): (WebCore::RenderStyle::setNonInheritedCustomPropertyValue): (WebCore::RenderStyle::getCustomProperty const): (WebCore::RenderStyle::customProperties const): Deleted. (WebCore::RenderStyle::setCustomPropertyValue): Deleted. * rendering/style/StyleRareNonInheritedData.cpp: (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): (WebCore::StyleRareNonInheritedData::operator== const): * rendering/style/StyleRareNonInheritedData.h: * style/StyleResolveForDocument.cpp: (WebCore::Style::resolveForDocument): Add support for RenderStyle to deal with both inherited and non-inherited properties, and to find cycles between them. LayoutTests: Add tests to check css registered custom properties with inherits. Also test calc expression evaluation for inherited registered custom properties. * css-custom-properties-api/inherits-expected.txt: Added. * css-custom-properties-api/inherits.html: Added. * css-custom-properties-api/length-expected.txt: Added. * css-custom-properties-api/length.html: Added. * css-custom-properties-api/length2-expected.txt: Added. * css-custom-properties-api/length2.html: Added. Canonical link: https://commits.webkit.org/205226@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236828 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-04 06:23:02 +00:00
Test calc + inherits, registered, inherits=true
170px green
Test calc + inherits, registered, inherits=false
200px green
Test calc + inherits, not registered
330px green
Calc test with unregistered property
Calc test with registered property
Calc test with registered property
Substitution test
PASS Registration is successful
PASS JS Attributes are valid for element 1
PASS JS Attributes are valid for element 2
PASS JS Attributes are valid for element 3
PASS Test that calc is not substituted for unregistered property
PASS Test that calc is substituted for custom property with length syntax
PASS Test that calc is substituted for custom property with length syntax 2
PASS Test that variables are substituted from JS
Registered custom properties should allow inheritance to be controlled https://bugs.webkit.org/show_bug.cgi?id=190038 Patch by Justin Michaud <justin_michaud@apple.com> on 2018-10-03 Reviewed by Antti Koivisto. LayoutTests/imported/w3c: Update web platform tests for css registered custom properties to fail in a different way. * web-platform-tests/css/css-properties-values-api/registered-properties-inheritance-expected.txt: * web-platform-tests/css/css-properties-values-api/registered-property-computation-expected.txt: * web-platform-tests/css/css-properties-values-api/registered-property-cssom-expected.txt: * web-platform-tests/css/css-properties-values-api/url-resolution-expected.txt: * web-platform-tests/css/css-properties-values-api/var-reference-registered-properties-cycles-expected.txt: * web-platform-tests/css/css-properties-values-api/var-reference-registered-properties-expected.txt: Source/WebCore: Tests: css-custom-properties-api/inherits.html css-custom-properties-api/length.html css-custom-properties-api/length2.html Add support for inherits property on registered css custom properties, as well as a starting point for evaluating registered custom properties with types. Registered custom properties are evaluated as length values before being substituted. Currently, relative unit cycles are not detected. A proper solution is still needed to resolve relative unit cycles, and to apply properties like font and line-height before they are needed by custom properties. In this patch, the font-size property is applied twice, once before and once after resolving custom property values. * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::customPropertyValue): (WebCore::CSSComputedStyleDeclaration::length const): (WebCore::CSSComputedStyleDeclaration::item const): Allow JS to get custom properties that have been resolved to a length. Also add properties from m_rareNonInheritedData. * css/CSSCustomPropertyValue.cpp: (WebCore::CSSCustomPropertyValue::checkVariablesForCycles const): (WebCore::CSSCustomPropertyValue::resolveVariableReferences const): * css/CSSCustomPropertyValue.h: * css/CSSRegisteredCustomProperty.cpp: Copied from Source/WebCore/css/CSSRegisteredCustomProperty.h. (WebCore::CSSRegisteredCustomProperty::CSSRegisteredCustomProperty): (WebCore::CSSRegisteredCustomProperty::initialValueCopy const): * css/CSSRegisteredCustomProperty.h: (WebCore::CSSRegisteredCustomProperty::initialValue const): * css/CSSVariableData.cpp: (WebCore::CSSVariableData::checkVariablesForCycles const): (WebCore::CSSVariableData::checkVariablesForCyclesWithRange const): (WebCore::CSSVariableData::resolveVariableFallback const): (WebCore::CSSVariableData::resolveVariableReference const): (WebCore::CSSVariableData::resolveVariableReferences const): (WebCore::CSSVariableData::resolveTokenRange const): * css/CSSVariableData.h: * css/CSSVariableReferenceValue.cpp: (WebCore::CSSVariableReferenceValue::checkVariablesForCycles const): * css/CSSVariableReferenceValue.h: * css/DOMCSSRegisterCustomProperty.cpp: (WebCore::DOMCSSRegisterCustomProperty::registerProperty): Use RenderStyle over passing in a customProperties map. * css/StyleBuilder.h: * css/StyleBuilderConverter.h: (WebCore::StyleBuilderConverter::convertLength): (WebCore::StyleBuilderConverter::convertLengthOrAuto): (WebCore::StyleBuilderConverter::convertLengthSizing): (WebCore::StyleBuilderConverter::convertLengthMaxSizing): * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyInitialCustomProperty): (WebCore::StyleBuilderCustom::applyInheritCustomProperty): (WebCore::StyleBuilderCustom::applyValueCustomProperty): * css/StyleResolver.cpp: (WebCore::StyleResolver::useSVGZoomRules const): (WebCore::StyleResolver::useSVGZoomRulesForLength const): (WebCore::StyleResolver::applyProperty): (WebCore::StyleResolver::resolvedVariableValue const): (WebCore::StyleResolver::applyCascadedProperties): (WebCore::StyleResolver::useSVGZoomRules): Deleted. (WebCore::StyleResolver::useSVGZoomRulesForLength): Deleted. (WebCore::StyleResolver::resolvedVariableValue): Deleted. * css/StyleResolver.h: * css/makeprop.pl: Move custom property initial values to StyleBuilerCustom. Hook them up to correctly deal with inheritance, unset and revert values. * css/parser/CSSParser.cpp: (WebCore::CSSParser::parseValueWithVariableReferences): * css/parser/CSSParser.h: * css/parser/CSSParserContext.cpp: (WebCore::CSSParserContext::CSSParserContext): * css/parser/CSSParserContext.h: * css/parser/CSSPropertyParser.cpp: (WebCore::CSSPropertyParser::parseSingleValue): Allow parsing custom property values as lengths. * rendering/style/RenderStyle.cpp: (WebCore::RenderStyle::checkVariablesInCustomProperties): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::inheritedCustomProperties const): (WebCore::RenderStyle::nonInheritedCustomProperties const): (WebCore::RenderStyle::setInheritedCustomPropertyValue): (WebCore::RenderStyle::setNonInheritedCustomPropertyValue): (WebCore::RenderStyle::getCustomProperty const): (WebCore::RenderStyle::customProperties const): Deleted. (WebCore::RenderStyle::setCustomPropertyValue): Deleted. * rendering/style/StyleRareNonInheritedData.cpp: (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): (WebCore::StyleRareNonInheritedData::operator== const): * rendering/style/StyleRareNonInheritedData.h: * style/StyleResolveForDocument.cpp: (WebCore::Style::resolveForDocument): Add support for RenderStyle to deal with both inherited and non-inherited properties, and to find cycles between them. LayoutTests: Add tests to check css registered custom properties with inherits. Also test calc expression evaluation for inherited registered custom properties. * css-custom-properties-api/inherits-expected.txt: Added. * css-custom-properties-api/inherits.html: Added. * css-custom-properties-api/length-expected.txt: Added. * css-custom-properties-api/length.html: Added. * css-custom-properties-api/length2-expected.txt: Added. * css-custom-properties-api/length2.html: Added. Canonical link: https://commits.webkit.org/205226@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236828 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-04 06:23:02 +00:00