Commit 6bdff8b6 authored by Jihwan Marc Kim's avatar Jihwan Marc Kim Committed by Commit Bot

scroll-margin should not accept percentages

So far, scroll-margin-*, scroll-margin-block-*, scroll-margin-inline-*
are defined as simple length property in |IsSimpleLengthPropertyID|.
But scroll-margin should not accept percentages,
therefore these properties are removed from simple length property.

https://drafts.csswg.org/css-scroll-snap-1/#propdef-scroll-margin
https://drafts.csswg.org/css-scroll-snap-1/#propdef-scroll-margin-block

The properties are only supported by Blink and Firefox,
and Firefox already correctly rejects percentages:
https://wpt.fyi/results/css/css-scroll-snap/parsing

Bug: 930517
Change-Id: Iaf7286552a8b352c2901a42b8fadc83ce79c9077
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1640259
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Reviewed-by: default avatarMajid Valipour <majidvp@chromium.org>
Reviewed-by: default avatarEric Willigers <ericwilligers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#666570}
parent 05c13910
......@@ -41,14 +41,6 @@ static inline bool IsSimpleLengthPropertyID(CSSPropertyID property_id,
case CSSPropertyID::kPaddingLeft:
case CSSPropertyID::kPaddingRight:
case CSSPropertyID::kPaddingTop:
case CSSPropertyID::kScrollMarginBlockEnd:
case CSSPropertyID::kScrollMarginBlockStart:
case CSSPropertyID::kScrollMarginBottom:
case CSSPropertyID::kScrollMarginInlineEnd:
case CSSPropertyID::kScrollMarginInlineStart:
case CSSPropertyID::kScrollMarginLeft:
case CSSPropertyID::kScrollMarginRight:
case CSSPropertyID::kScrollMarginTop:
case CSSPropertyID::kScrollPaddingBlockEnd:
case CSSPropertyID::kScrollPaddingBlockStart:
case CSSPropertyID::kScrollPaddingBottom:
......
This is a testharness.js-based test.
PASS e.style['scroll-margin-block-start'] = "auto" should not set the property value
FAIL e.style['scroll-margin-block-start'] = "20%" should not set the property value assert_equals: expected "" but got "20%"
PASS e.style['scroll-margin-block-start'] = "-30%" should not set the property value
PASS e.style['scroll-margin-block-start'] = "1px 2px" should not set the property value
PASS e.style['scroll-margin-block-end'] = "auto" should not set the property value
FAIL e.style['scroll-margin-block-end'] = "20%" should not set the property value assert_equals: expected "" but got "20%"
PASS e.style['scroll-margin-block-end'] = "-30%" should not set the property value
PASS e.style['scroll-margin-block-end'] = "1px 2px" should not set the property value
PASS e.style['scroll-margin-block'] = "auto" should not set the property value
PASS e.style['scroll-margin-block'] = "20%" should not set the property value
PASS e.style['scroll-margin-block'] = "-30%" should not set the property value
PASS e.style['scroll-margin-block'] = "1px 2px 3px" should not set the property value
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS e.style['scroll-margin-inline-start'] = "auto" should not set the property value
FAIL e.style['scroll-margin-inline-start'] = "20%" should not set the property value assert_equals: expected "" but got "20%"
PASS e.style['scroll-margin-inline-start'] = "-30%" should not set the property value
PASS e.style['scroll-margin-inline-start'] = "1px 2px" should not set the property value
PASS e.style['scroll-margin-inline-end'] = "auto" should not set the property value
FAIL e.style['scroll-margin-inline-end'] = "20%" should not set the property value assert_equals: expected "" but got "20%"
PASS e.style['scroll-margin-inline-end'] = "-30%" should not set the property value
PASS e.style['scroll-margin-inline-end'] = "1px 2px" should not set the property value
PASS e.style['scroll-margin-inline'] = "auto" should not set the property value
PASS e.style['scroll-margin-inline'] = "20%" should not set the property value
PASS e.style['scroll-margin-inline'] = "-30%" should not set the property value
PASS e.style['scroll-margin-inline'] = "1px 2px 3px" should not set the property value
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS e.style['scroll-margin-top'] = "auto" should not set the property value
FAIL e.style['scroll-margin-top'] = "20%" should not set the property value assert_equals: expected "" but got "20%"
PASS e.style['scroll-margin-top'] = "-30%" should not set the property value
PASS e.style['scroll-margin-top'] = "1px 2px" should not set the property value
PASS e.style['scroll-margin-right'] = "auto" should not set the property value
FAIL e.style['scroll-margin-right'] = "20%" should not set the property value assert_equals: expected "" but got "20%"
PASS e.style['scroll-margin-right'] = "-30%" should not set the property value
PASS e.style['scroll-margin-right'] = "1px 2px" should not set the property value
PASS e.style['scroll-margin-bottom'] = "auto" should not set the property value
FAIL e.style['scroll-margin-bottom'] = "20%" should not set the property value assert_equals: expected "" but got "20%"
PASS e.style['scroll-margin-bottom'] = "-30%" should not set the property value
PASS e.style['scroll-margin-bottom'] = "1px 2px" should not set the property value
PASS e.style['scroll-margin-left'] = "auto" should not set the property value
FAIL e.style['scroll-margin-left'] = "20%" should not set the property value assert_equals: expected "" but got "20%"
PASS e.style['scroll-margin-left'] = "-30%" should not set the property value
PASS e.style['scroll-margin-left'] = "1px 2px" should not set the property value
PASS e.style['scroll-margin'] = "auto" should not set the property value
PASS e.style['scroll-margin'] = "20%" should not set the property value
PASS e.style['scroll-margin'] = "-30%" should not set the property value
PASS e.style['scroll-margin'] = "1px 2px 3px 4px 5px" should not set the property value
Harness: the test ran to completion.
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