Commit 14e3bfb3 authored by Eric Willigers's avatar Eric Willigers Committed by Commit Bot

CSS: computed scroll-snap-type uses shortest serialization

Values like "x proximity" are serialized as "x"
in the computed value.

If no strictness value is specified, proximity is assumed.

Spec: 
https: //drafts.csswg.org/css-scroll-snap-1/#scroll-snap-type
Change-Id: Ic0e0b73b62b17740452562d1aac0a52915db9fa6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1605243Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658466}
parent d159cc51
......@@ -2083,6 +2083,8 @@ CSSValue* ComputedStyleUtils::ValueForScrollSnapType(
const cc::ScrollSnapType& type,
const ComputedStyle& style) {
if (!type.is_none) {
if (type.strictness == cc::SnapStrictness::kProximity)
return CSSIdentifierValue::Create(type.axis);
return MakeGarbageCollected<CSSValuePair>(
CSSIdentifierValue::Create(type.axis),
CSSIdentifierValue::Create(type.strictness),
......
This is a testharness.js-based test.
PASS Property scroll-margin-block-end has initial value 0px
PASS Property scroll-margin-block-end does not inherit
PASS Property scroll-margin-block-start has initial value 0px
PASS Property scroll-margin-block-start does not inherit
PASS Property scroll-margin-bottom has initial value 0px
PASS Property scroll-margin-bottom does not inherit
PASS Property scroll-margin-inline-end has initial value 0px
PASS Property scroll-margin-inline-end does not inherit
PASS Property scroll-margin-inline-start has initial value 0px
PASS Property scroll-margin-inline-start does not inherit
PASS Property scroll-margin-left has initial value 0px
PASS Property scroll-margin-left does not inherit
PASS Property scroll-margin-right has initial value 0px
PASS Property scroll-margin-right does not inherit
PASS Property scroll-margin-top has initial value 0px
PASS Property scroll-margin-top does not inherit
PASS Property scroll-padding-block-end has initial value auto
PASS Property scroll-padding-block-end does not inherit
PASS Property scroll-padding-block-start has initial value auto
PASS Property scroll-padding-block-start does not inherit
PASS Property scroll-padding-bottom has initial value auto
PASS Property scroll-padding-bottom does not inherit
PASS Property scroll-padding-inline-end has initial value auto
PASS Property scroll-padding-inline-end does not inherit
PASS Property scroll-padding-inline-start has initial value auto
PASS Property scroll-padding-inline-start does not inherit
PASS Property scroll-padding-left has initial value auto
PASS Property scroll-padding-left does not inherit
PASS Property scroll-padding-right has initial value auto
PASS Property scroll-padding-right does not inherit
PASS Property scroll-padding-top has initial value auto
PASS Property scroll-padding-top does not inherit
PASS Property scroll-snap-align has initial value none
PASS Property scroll-snap-align does not inherit
PASS Property scroll-snap-stop has initial value normal
PASS Property scroll-snap-stop does not inherit
PASS Property scroll-snap-type has initial value none
FAIL Property scroll-snap-type does not inherit assert_equals: expected "inline" but got "inline proximity"
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Property scroll-snap-type value 'none' computes to 'none'
FAIL Property scroll-snap-type value 'x' computes to 'x' assert_equals: expected "x" but got "x proximity"
FAIL Property scroll-snap-type value 'y' computes to 'y' assert_equals: expected "y" but got "y proximity"
FAIL Property scroll-snap-type value 'block' computes to 'block' assert_equals: expected "block" but got "block proximity"
FAIL Property scroll-snap-type value 'inline' computes to 'inline' assert_equals: expected "inline" but got "inline proximity"
FAIL Property scroll-snap-type value 'both' computes to 'both' assert_equals: expected "both" but got "both proximity"
PASS Property scroll-snap-type value 'y mandatory' computes to 'y mandatory'
FAIL Property scroll-snap-type value 'inline proximity' computes to 'inline' assert_equals: expected "inline" but got "inline proximity"
Harness: the test ran to completion.
......@@ -2,11 +2,11 @@ This is a testharness.js-based test.
PASS Can set 'scroll-snap-type' to CSS-wide keywords
PASS Can set 'scroll-snap-type' to var() references
PASS Can set 'scroll-snap-type' to the 'none' keyword
FAIL Can set 'scroll-snap-type' to the 'x' keyword assert_equals: expected "CSSKeywordValue" but got "CSSStyleValue"
FAIL Can set 'scroll-snap-type' to the 'y' keyword assert_equals: expected "CSSKeywordValue" but got "CSSStyleValue"
FAIL Can set 'scroll-snap-type' to the 'block' keyword assert_equals: expected "CSSKeywordValue" but got "CSSStyleValue"
FAIL Can set 'scroll-snap-type' to the 'inline' keyword assert_equals: expected "CSSKeywordValue" but got "CSSStyleValue"
FAIL Can set 'scroll-snap-type' to the 'both' keyword assert_equals: expected "CSSKeywordValue" but got "CSSStyleValue"
PASS Can set 'scroll-snap-type' to the 'x' keyword
PASS Can set 'scroll-snap-type' to the 'y' keyword
PASS Can set 'scroll-snap-type' to the 'block' keyword
PASS Can set 'scroll-snap-type' to the 'inline' keyword
PASS Can set 'scroll-snap-type' to the 'both' keyword
PASS Setting 'scroll-snap-type' to a length throws TypeError
PASS Setting 'scroll-snap-type' to a percent throws TypeError
PASS Setting 'scroll-snap-type' to a time throws TypeError
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment