Ignore:
Timestamp:
Oct 18, 2021, 3:16:38 AM (4 years ago)
Author:
[email protected]
Message:

Implement parsing and animation support for offset-distance, offset-position, offset-anchor
https://bugs.webkit.org/show_bug.cgi?id=231491

Patch by Kiet Ho <Kiet Ho> on 2021-10-18
Reviewed by Antoine Quint.

LayoutTests/imported/w3c:

Updated relevant test expectations.

  • web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt:
  • web-platform-tests/css/cssom/cssstyledeclaration-csstext-expected.txt:
  • web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
  • web-platform-tests/css/motion/animation/offset-anchor-composition-expected.txt:
  • web-platform-tests/css/motion/animation/offset-anchor-interpolation-expected.txt:
  • web-platform-tests/css/motion/animation/offset-distance-composition-expected.txt:
  • web-platform-tests/css/motion/animation/offset-distance-interpolation-expected.txt:
  • web-platform-tests/css/motion/animation/offset-position-composition-expected.txt:
  • web-platform-tests/css/motion/animation/offset-position-interpolation-expected.txt:
  • web-platform-tests/css/motion/animation/offset-position-interpolation.html: Fixed test to accept other length expressions as equivalent.
  • web-platform-tests/css/motion/inheritance-expected.txt:
  • web-platform-tests/css/motion/offset-supports-calc-expected.txt:
  • web-platform-tests/css/motion/parsing/offset-anchor-computed-expected.txt:
  • web-platform-tests/css/motion/parsing/offset-anchor-parsing-valid-expected.txt:
  • web-platform-tests/css/motion/parsing/offset-anchor-parsing-valid.html: Fixed test to accept "center" as an alternative to "center center", "calc(20% + 10px) center" as an alternative to "calc(10px + 20%) center".
  • web-platform-tests/css/motion/parsing/offset-distance-computed-expected.txt:
  • web-platform-tests/css/motion/parsing/offset-distance-parsing-valid-expected.txt:
  • web-platform-tests/css/motion/parsing/offset-position-computed-expected.txt:
  • web-platform-tests/css/motion/parsing/offset-position-parsing-valid-expected.txt:
  • web-platform-tests/css/motion/parsing/offset-position-parsing-valid.html: Fixed test to accept "center" as an alternative to "center center", "calc(20% + 10px) center" as an alternative to "calc(10px + 20%) center".
  • web-platform-tests/css/motion/parsing/offset-shorthand-expected.txt:
  • web-platform-tests/web-animations/animation-model/animation-types/accumulation-per-property-002-expected.txt:
  • web-platform-tests/web-animations/animation-model/animation-types/addition-per-property-002-expected.txt:
  • web-platform-tests/web-animations/animation-model/animation-types/interpolation-per-property-002-expected.txt:

Source/WebCore:

Tests: imported/w3c/web-platform-tests/css/motion/animation/offset-anchor-composition.html

imported/w3c/web-platform-tests/css/motion/animation/offset-anchor-interpolation.html
imported/w3c/web-platform-tests/css/motion/animation/offset-distance-composition.html
imported/w3c/web-platform-tests/css/motion/animation/offset-distance-interpolation.html
imported/w3c/web-platform-tests/css/motion/animation/offset-position-composition.html
imported/w3c/web-platform-tests/css/motion/animation/offset-position-interpolation.html
imported/w3c/web-platform-tests/css/motion/inheritance.html
imported/w3c/web-platform-tests/css/motion/offset-supports-calc.html
imported/w3c/web-platform-tests/css/motion/parsing/offset-anchor-computed.html
imported/w3c/web-platform-tests/css/motion/parsing/offset-anchor-parsing-valid.html
imported/w3c/web-platform-tests/css/motion/parsing/offset-distance-computed.html
imported/w3c/web-platform-tests/css/motion/parsing/offset-distance-parsing-valid.html
imported/w3c/web-platform-tests/css/motion/parsing/offset-position-computed.html
imported/w3c/web-platform-tests/css/motion/parsing/offset-position-parsing-valid.html

  • animation/CSSPropertyAnimation.cpp:

(WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):

  • css/CSSComputedStyleDeclaration.cpp:

(WebCore::valueForPosition):
(WebCore::valueForPositionOrAuto):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):

  • css/CSSProperties.json:
  • css/parser/CSSPropertyParser.cpp:

(WebCore::consumePositionOrAuto):
(WebCore::CSSPropertyParser::parseSingleValue):

  • rendering/style/RenderStyle.h:

(WebCore::RenderStyle::offsetDistance const):
(WebCore::RenderStyle::setOffsetDistance):
(WebCore::RenderStyle::initialOffsetDistance):
(WebCore::RenderStyle::offsetPosition const):
(WebCore::RenderStyle::setOffsetPosition):
(WebCore::RenderStyle::initialOffsetPosition):
(WebCore::RenderStyle::offsetAnchor const):
(WebCore::RenderStyle::setOffsetAnchor):
(WebCore::RenderStyle::initialOffsetAnchor):

  • rendering/style/StyleRareNonInheritedData.cpp:

(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator== const):

  • rendering/style/StyleRareNonInheritedData.h:
  • style/StyleBuilderConverter.h:

(WebCore::Style::BuilderConverter::convertPosition):
(WebCore::Style::BuilderConverter::convertPositionOrAuto):

Source/WTF:

  • Scripts/Preferences/WebPreferencesExperimental.yaml: Add new preference for CSS Motion Path support.

LayoutTests:

Update platform-specific test expectations to accommodate for newly added CSS properties.

  • platform/gtk/imported/w3c/web-platform-tests/css/cssom/cssstyledeclaration-csstext-expected.txt:
  • platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
  • platform/ios-wk2/imported/w3c/web-platform-tests/css/cssom/cssstyledeclaration-csstext-expected.txt:
  • platform/ios-wk2/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
  • platform/ios/imported/w3c/web-platform-tests/css/cssom/cssstyledeclaration-csstext-expected.txt:
  • platform/wpe/imported/w3c/web-platform-tests/css/cssom/cssstyledeclaration-csstext-expected.txt:
  • platform/wpe/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp

    r284098 r284361  
    14391439        return downcast<Element>(node);
    14401440    return composedTreeAncestors(*node).first();
     1441}
     1442
     1443static Ref<CSSValue> valueForPosition(const RenderStyle& style, const LengthPoint& position)
     1444{
     1445    auto list = CSSValueList::createSpaceSeparated();
     1446    list->append(zoomAdjustedPixelValueForLength(position.x(), style));
     1447    list->append(zoomAdjustedPixelValueForLength(position.y(), style));
     1448    return list;
     1449}
     1450
     1451static Ref<CSSValue> valueForPositionOrAuto(const RenderStyle& style, const LengthPoint& position)
     1452{
     1453    if (position.x().isAuto() && position.y().isAuto())
     1454        return CSSValuePool::singleton().createIdentifierValue(CSSValueAuto);
     1455
     1456    return valueForPosition(style, position);
    14411457}
    14421458
     
    31623178        case CSSPropertyObjectFit:
    31633179            return cssValuePool.createValue(style.objectFit());
    3164         case CSSPropertyObjectPosition: {
    3165             auto list = CSSValueList::createSpaceSeparated();
    3166             list->append(zoomAdjustedPixelValueForLength(style.objectPosition().x(), style));
    3167             list->append(zoomAdjustedPixelValueForLength(style.objectPosition().y(), style));
    3168             return list;
    3169         }
     3180        case CSSPropertyObjectPosition:
     3181            return valueForPosition(style, style.objectPosition());
     3182        case CSSPropertyOffsetDistance:
     3183            return cssValuePool.createValue(style.offsetDistance(), style);
     3184        case CSSPropertyOffsetPosition:
     3185            return valueForPositionOrAuto(style, style.offsetPosition());
     3186        case CSSPropertyOffsetAnchor:
     3187            return valueForPositionOrAuto(style, style.offsetAnchor());
    31703188        case CSSPropertyOpacity:
    31713189            return cssValuePool.createValue(style.opacity(), CSSUnitType::CSS_NUMBER);
Note: See TracChangeset for help on using the changeset viewer.