mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 1814444
- Part 1: Update the syntax of scroll() to accept <scroller> and <axis> in any order. r=emilio
The order of <scroller> and <axis> doesn't matter in the parser. However, we serialize <scroller> first, if it is not the initial value. Differential Revision: https://phabricator.services.mozilla.com/D173906
This commit is contained in:
parent
18a5e8eff3
commit
9c425acafe
@ -13756,6 +13756,7 @@ if (IsCSSPropertyPrefEnabled("layout.css.scroll-driven-animations.enabled")) {
|
||||
"scroll(nearest)",
|
||||
"scroll(inline nearest)",
|
||||
"scroll(vertical root)",
|
||||
"scroll(root horizontal)",
|
||||
"view()",
|
||||
"view(inline)",
|
||||
"view(auto)",
|
||||
|
@ -283,12 +283,12 @@ impl Default for ScrollAxis {
|
||||
#[css(function = "scroll")]
|
||||
#[repr(C)]
|
||||
pub struct ScrollFunction {
|
||||
/// The axis of scrolling that drives the progress of the timeline.
|
||||
#[css(skip_if = "ScrollAxis::is_default")]
|
||||
pub axis: ScrollAxis,
|
||||
/// The scroll container element whose scroll position drives the progress of the timeline.
|
||||
#[css(skip_if = "Scroller::is_default")]
|
||||
pub scroller: Scroller,
|
||||
/// The axis of scrolling that drives the progress of the timeline.
|
||||
#[css(skip_if = "ScrollAxis::is_default")]
|
||||
pub axis: ScrollAxis,
|
||||
}
|
||||
|
||||
impl ScrollFunction {
|
||||
@ -296,11 +296,25 @@ impl ScrollFunction {
|
||||
fn parse_arguments<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||
// <scroll()> = scroll( [ <scroller> || <axis> ]? )
|
||||
// https://drafts.csswg.org/scroll-animations-1/#funcdef-scroll
|
||||
//
|
||||
// FIXME: This doesn't match the spec. I will update it in Bug 1814444.
|
||||
let mut scroller = None;
|
||||
let mut axis = None;
|
||||
loop {
|
||||
if scroller.is_none() {
|
||||
scroller = input.try_parse(Scroller::parse).ok();
|
||||
}
|
||||
|
||||
if axis.is_none() {
|
||||
axis = input.try_parse(ScrollAxis::parse).ok();
|
||||
if axis.is_some() {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Ok(Self {
|
||||
axis: input.try_parse(ScrollAxis::parse).unwrap_or_default(),
|
||||
scroller: input.try_parse(Scroller::parse).unwrap_or_default(),
|
||||
scroller: scroller.unwrap_or_default(),
|
||||
axis: axis.unwrap_or_default(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -5,14 +5,8 @@
|
||||
[Property animation-timeline value 'scroll(self), scroll(nearest)']
|
||||
expected: FAIL
|
||||
|
||||
[Property animation-timeline value 'scroll(nearest inline)']
|
||||
expected: FAIL
|
||||
|
||||
[Property animation-timeline value 'scroll(block self)']
|
||||
expected: FAIL
|
||||
|
||||
[Property animation-timeline value 'scroll(self block)']
|
||||
expected: FAIL
|
||||
|
||||
[Property animation-timeline value 'scroll(vertical root)']
|
||||
expected: FAIL
|
||||
|
@ -5,14 +5,8 @@
|
||||
[e.style['animation-timeline'\] = "scroll(self)" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['animation-timeline'\] = "scroll(nearest inline)" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['animation-timeline'\] = "scroll(block self)" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['animation-timeline'\] = "scroll(self block)" should set the property value]
|
||||
expected: FAIL
|
||||
|
||||
[e.style['animation-timeline'\] = "scroll(vertical root)" should set the property value]
|
||||
expected: FAIL
|
||||
|
Loading…
Reference in New Issue
Block a user