Skip to content

Commit

Permalink
style: Add ::marker when checking may_have_animations() during traver…
Browse files Browse the repository at this point in the history
…sal.

When unhidding a ::marker element, we construct its generated item, and
then call StyleNewSubtree() on this generated item. During traversal, we
may update any animation related values in Gecko_UpdateAnimations(), which
may update the base styles for animation properties.

The test case is an animation segment from "null" to "inital" value. We
replace the "null" value with the base style value for the specific animation
property, so we can do interpolation properly.
(e.g. opacity: "null => initial" becomes "1.0 => initial")
If we don't update the animation related values in
Gecko_UpdateAnimations after generating ::marker, we may do
interpolation from "null" to "initial", which causes a panic.

Differential Revision: https://phabricator.services.mozilla.com/D73408
  • Loading branch information
BorisChiou authored and emilio committed Jun 3, 2020
1 parent c67c9fd commit 6a7c0b7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions components/style/gecko/pseudo_element.rs
Expand Up @@ -92,6 +92,12 @@ impl PseudoElement {
EAGER_PSEUDOS[i].clone()
}

/// Whether the current pseudo element is animatable.
#[inline]
pub fn is_animatable(&self) -> bool {
matches!(*self, Self::Before | Self::After | Self::Marker)
}

/// Whether the current pseudo element is ::before or ::after.
#[inline]
pub fn is_before_or_after(&self) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion components/style/gecko/wrapper.rs
Expand Up @@ -1446,7 +1446,7 @@ impl<'le> TElement for GeckoElement<'le> {
#[inline]
fn may_have_animations(&self) -> bool {
if let Some(pseudo) = self.implemented_pseudo_element() {
if !pseudo.is_before_or_after() {
if !pseudo.is_animatable() {
return false;
}
// FIXME(emilio): When would the parent of a ::before / ::after
Expand Down

0 comments on commit 6a7c0b7

Please sign in to comment.