зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1789447 - Part 1: Drop the usage of @scroll-timeline from animation builder. r=hiro
@scroll-timeline rule was removed from the spec and wpt, so it's safe to remove this from Gecko. Differential Revision: https://phabricator.services.mozilla.com/D157248
This commit is contained in:
Родитель
6b12ad64d3
Коммит
8250077606
|
@ -70,46 +70,6 @@ already_AddRefed<ScrollTimeline> ScrollTimeline::GetOrCreateScrollTimeline(
|
|||
return timeline.forget();
|
||||
}
|
||||
|
||||
static StyleScrollAxis ToStyleScrollAxis(
|
||||
const StyleScrollDirection aDirection) {
|
||||
switch (aDirection) {
|
||||
// The spec defines auto, but there is a spec issue:
|
||||
// "ISSUE 5 Define these values." in this section. The DOM interface removed
|
||||
// auto and use block as default value, so we treat auto as block now.
|
||||
// https://drafts.csswg.org/scroll-animations-1/#descdef-scroll-timeline-orientation
|
||||
case StyleScrollDirection::Auto:
|
||||
case StyleScrollDirection::Block:
|
||||
return StyleScrollAxis::Block;
|
||||
case StyleScrollDirection::Inline:
|
||||
return StyleScrollAxis::Inline;
|
||||
case StyleScrollDirection::Horizontal:
|
||||
return StyleScrollAxis::Horizontal;
|
||||
case StyleScrollDirection::Vertical:
|
||||
return StyleScrollAxis::Vertical;
|
||||
}
|
||||
|
||||
MOZ_ASSERT_UNREACHABLE("Unsupported StyleScrollDirection");
|
||||
return StyleScrollAxis::Block;
|
||||
}
|
||||
|
||||
/* static */
|
||||
already_AddRefed<ScrollTimeline> ScrollTimeline::FromRule(
|
||||
const RawServoScrollTimelineRule& aRule, Document* aDocument,
|
||||
const NonOwningAnimationTarget& aTarget) {
|
||||
// Note: If the rules changes after we build the scroll-timeline rule, we
|
||||
// rebuild all CSS animtions, and then try to look up the scroll-timeline by
|
||||
// the new source and the new direction. If we cannot find a specific
|
||||
// timeline, we create one, and the unused scroll-timeline object will be
|
||||
// dropped automatically becuase no animation owns it and its ref-count
|
||||
// becomes zero.
|
||||
|
||||
StyleScrollAxis axis =
|
||||
ToStyleScrollAxis(Servo_ScrollTimelineRule_GetOrientation(&aRule));
|
||||
|
||||
auto autoScroller = Scroller::Root(aTarget.mElement->OwnerDoc());
|
||||
return GetOrCreateScrollTimeline(aDocument, autoScroller, axis);
|
||||
}
|
||||
|
||||
/* static */
|
||||
already_AddRefed<ScrollTimeline> ScrollTimeline::FromAnonymousScroll(
|
||||
Document* aDocument, const NonOwningAnimationTarget& aTarget,
|
||||
|
|
|
@ -101,10 +101,6 @@ class ScrollTimeline final : public AnimationTimeline {
|
|||
}
|
||||
};
|
||||
|
||||
static already_AddRefed<ScrollTimeline> FromRule(
|
||||
const RawServoScrollTimelineRule& aRule, Document* aDocument,
|
||||
const NonOwningAnimationTarget& aTarget);
|
||||
|
||||
static already_AddRefed<ScrollTimeline> FromAnonymousScroll(
|
||||
Document* aDocument, const NonOwningAnimationTarget& aTarget,
|
||||
StyleScrollAxis aAxis, StyleScroller aScroller);
|
||||
|
|
|
@ -6,9 +6,6 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../testcommon.js"></script>
|
||||
<style>
|
||||
@scroll-timeline test-timeline {
|
||||
source: auto;
|
||||
}
|
||||
@keyframes animWidth {
|
||||
from { width: 100px; }
|
||||
to { width: 200px }
|
||||
|
@ -33,7 +30,7 @@
|
|||
test(function(t) {
|
||||
const div = addDiv(t,
|
||||
{ style: "width: 10px; height: 100px; " +
|
||||
"animation: animWidth 100s test-timeline, animTop 200s;" });
|
||||
"animation: animWidth 100s scroll(), animTop 200s;" });
|
||||
|
||||
// Sanity check to make sure the scroll animation is there.
|
||||
addDiv(t, { class: "fill-vh" });
|
||||
|
@ -53,7 +50,7 @@ test(function(t) {
|
|||
test(function(t) {
|
||||
const div = addDiv(t,
|
||||
{ style: "width: 10px; height: 100px; " +
|
||||
"animation: animWidth 100s test-timeline, animTop 100s;" });
|
||||
"animation: animWidth 100s scroll(), animTop 100s;" });
|
||||
|
||||
// Sanity check to make sure the scroll animation is there.
|
||||
addDiv(t, { class: "fill-vh" });
|
||||
|
|
|
@ -446,7 +446,6 @@ cbindgen-types = [
|
|||
{ gecko = "StyleBreakWithin", servo = "crate::values::computed::BreakWithin" },
|
||||
{ gecko = "StyleBorderStyle", servo = "crate::values::computed::BorderStyle" },
|
||||
{ gecko = "StyleOutlineStyle", servo = "crate::values::computed::OutlineStyle" },
|
||||
{ gecko = "StyleScrollDirection", servo = "crate::stylesheets::scroll_timeline_rule::ScrollDirection" },
|
||||
{ gecko = "StyleScrollSnapAlign", servo = "crate::values::computed::ScrollSnapAlign" },
|
||||
{ gecko = "StyleScrollSnapStop", servo = "crate::values::computed::ScrollSnapStop" },
|
||||
{ gecko = "StyleScrollSnapStrictness", servo = "crate::values::computed::ScrollSnapStrictness" },
|
||||
|
|
|
@ -1217,12 +1217,6 @@ const RawServoCounterStyleRule* ServoStyleSet::CounterStyleRuleForName(
|
|||
return Servo_StyleSet_GetCounterStyleRule(mRawSet.get(), aName);
|
||||
}
|
||||
|
||||
const RawServoScrollTimelineRule* ServoStyleSet::ScrollTimelineRuleForName(
|
||||
nsAtom* aName) {
|
||||
MOZ_ASSERT(!StylistNeedsUpdate());
|
||||
return Servo_StyleSet_GetScrollTimelineRule(mRawSet.get(), aName);
|
||||
}
|
||||
|
||||
already_AddRefed<gfxFontFeatureValueSet>
|
||||
ServoStyleSet::BuildFontFeatureValueSet() {
|
||||
MOZ_ASSERT(!StylistNeedsUpdate());
|
||||
|
|
|
@ -363,8 +363,6 @@ class ServoStyleSet {
|
|||
|
||||
const RawServoCounterStyleRule* CounterStyleRuleForName(nsAtom* aName);
|
||||
|
||||
const RawServoScrollTimelineRule* ScrollTimelineRuleForName(nsAtom* aName);
|
||||
|
||||
// Get all the currently-active font feature values set.
|
||||
already_AddRefed<gfxFontFeatureValueSet> BuildFontFeatureValueSet();
|
||||
|
||||
|
|
|
@ -218,23 +218,12 @@ static already_AddRefed<dom::AnimationTimeline> GetTimeline(
|
|||
const NonOwningAnimationTarget& aTarget) {
|
||||
switch (aStyleTimeline.tag) {
|
||||
case StyleAnimationTimeline::Tag::Timeline: {
|
||||
// Check scroll-timeline-name property.
|
||||
nsAtom* name = aStyleTimeline.AsTimeline().AsAtom();
|
||||
if (name == nsGkAtoms::_empty) {
|
||||
// That's how we represent `none`.
|
||||
return nullptr;
|
||||
}
|
||||
// 1. Check @scroll-timeline rule.
|
||||
if (const auto* rule =
|
||||
aPresContext->StyleSet()->ScrollTimelineRuleForName(name)) {
|
||||
// We do intentionally use the pres context's document for the owner of
|
||||
// ScrollTimeline since it's consistent with what we do for
|
||||
// KeyframeEffect instance.
|
||||
return ScrollTimeline::FromRule(*rule, aPresContext->Document(),
|
||||
aTarget);
|
||||
}
|
||||
// 2. Check scroll-timeline-name property.
|
||||
return ScrollTimeline::FromNamedScroll(aPresContext->Document(), aTarget,
|
||||
name);
|
||||
return name != nsGkAtoms::_empty
|
||||
? ScrollTimeline::FromNamedScroll(aPresContext->Document(),
|
||||
aTarget, name)
|
||||
: nullptr;
|
||||
}
|
||||
case StyleAnimationTimeline::Tag::Scroll: {
|
||||
const auto& scroll = aStyleTimeline.AsScroll();
|
||||
|
|
|
@ -289,7 +289,7 @@ trait PrivateMatchMethods: TElement {
|
|||
|
||||
let old_ui_style = old_style.get_ui();
|
||||
|
||||
let keyframes_or_timeline_could_have_changed = context
|
||||
let keyframes_could_have_changed = context
|
||||
.shared
|
||||
.traversal_flags
|
||||
.contains(TraversalFlags::ForCSSRuleChanges);
|
||||
|
@ -299,9 +299,9 @@ trait PrivateMatchMethods: TElement {
|
|||
// element has or will have CSS animation style regardless of whether
|
||||
// the animation is running or not.
|
||||
//
|
||||
// TODO: We should check which @keyframes/@scroll-timeline were added/changed/deleted and
|
||||
// update only animations corresponding to those @keyframes/@scroll-timeline.
|
||||
if keyframes_or_timeline_could_have_changed {
|
||||
// TODO: We should check which @keyframes were added/changed/deleted and
|
||||
// update only animations corresponding to those @keyframes.
|
||||
if keyframes_could_have_changed {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -845,13 +845,10 @@ pub enum AnimationTimeline {
|
|||
/// Use default timeline. The animation’s timeline is a DocumentTimeline.
|
||||
Auto,
|
||||
/// The scroll-timeline name.
|
||||
///
|
||||
/// Note: This could be the timeline name from @scroll-timeline rule, or scroll-timeline-name
|
||||
/// from itself, its ancestors, or its previous siblings.
|
||||
/// https://drafts.csswg.org/scroll-animations-1/rewrite#scroll-timelines-named
|
||||
/// https://drafts.csswg.org/scroll-animations-1/#scroll-timelines-named
|
||||
Timeline(TimelineName),
|
||||
/// The scroll() notation.
|
||||
/// https://drafts.csswg.org/scroll-animations-1/rewrite#scroll-notation
|
||||
/// https://drafts.csswg.org/scroll-animations-1/#scroll-notation
|
||||
#[css(function)]
|
||||
Scroll(
|
||||
#[css(skip_if = "is_default")] ScrollAxis,
|
||||
|
|
|
@ -117,7 +117,6 @@ use style::style_adjuster::StyleAdjuster;
|
|||
use style::stylesheets::import_rule::ImportSheet;
|
||||
use style::stylesheets::keyframes_rule::{Keyframe, KeyframeSelector, KeyframesStepValue};
|
||||
use style::stylesheets::layer_rule::LayerOrder;
|
||||
use style::stylesheets::scroll_timeline_rule::ScrollDirection;
|
||||
use style::stylesheets::supports_rule::parse_condition_or_declaration;
|
||||
use style::stylesheets::{
|
||||
AllowImportRules, CounterStyleRule, CssRule, CssRuleType, CssRules, CssRulesHelpers,
|
||||
|
@ -2841,15 +2840,6 @@ pub extern "C" fn Servo_ScrollTimelineRule_GetOrientationAsString(
|
|||
})
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_ScrollTimelineRule_GetOrientation(
|
||||
rule: &RawServoScrollTimelineRule,
|
||||
) -> ScrollDirection {
|
||||
read_locked_arc(rule, |rule: &ScrollTimelineRule| {
|
||||
rule.descriptors.orientation.unwrap_or_default()
|
||||
})
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_ScrollTimelineRule_GetScrollOffsets(
|
||||
rule: &RawServoScrollTimelineRule,
|
||||
|
@ -6540,21 +6530,6 @@ pub unsafe extern "C" fn Servo_StyleSet_GetCounterStyleRule(
|
|||
})
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn Servo_StyleSet_GetScrollTimelineRule(
|
||||
raw_data: &RawServoStyleSet,
|
||||
name: *mut nsAtom,
|
||||
) -> *const RawServoScrollTimelineRule {
|
||||
let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
|
||||
Atom::with(name, |name| {
|
||||
data.stylist
|
||||
.iter_extra_data_origins()
|
||||
.filter_map(|(d, _)| d.scroll_timelines.get(name))
|
||||
.next()
|
||||
.map_or(ptr::null(), |rule| rule.as_borrowed())
|
||||
})
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_StyleSet_BuildFontFeatureValueSet(
|
||||
raw_data: &RawServoStyleSet,
|
||||
|
|
Загрузка…
Ссылка в новой задаче