mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 00:05:36 +00:00
Bug 1646811 - Fix gecko build.
Depends on D80248 Differential Revision: https://phabricator.services.mozilla.com/D80249
This commit is contained in:
parent
3222b8debd
commit
40b0214e2c
@ -889,7 +889,8 @@ impl ElementAnimationSet {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn apply_active_animations(
|
||||
/// Apply all active animations.
|
||||
pub fn apply_active_animations(
|
||||
&self,
|
||||
context: &SharedStyleContext,
|
||||
style: &mut Arc<ComputedValues>,
|
||||
@ -1237,7 +1238,7 @@ impl DocumentAnimationSet {
|
||||
|
||||
/// Get all the animation declarations for the given key, returning an empty
|
||||
/// `AnimationDeclarations` if there are no animations.
|
||||
pub(crate) fn get_all_declarations(
|
||||
pub fn get_all_declarations(
|
||||
&self,
|
||||
key: &AnimationSetKey,
|
||||
time: f64,
|
||||
@ -1264,7 +1265,7 @@ impl DocumentAnimationSet {
|
||||
}
|
||||
|
||||
/// Cancel all animations for set at the given key.
|
||||
pub(crate) fn cancel_all_animations_for_key(&self, key: &AnimationSetKey) {
|
||||
pub fn cancel_all_animations_for_key(&self, key: &AnimationSetKey) {
|
||||
if let Some(set) = self.sets.write().get_mut(key) {
|
||||
set.cancel_all_animations();
|
||||
}
|
||||
|
@ -884,18 +884,6 @@ pub trait TElement:
|
||||
doc_rules_apply
|
||||
}
|
||||
|
||||
/// Does a rough (and cheap) check for whether or not transitions might need to be updated that
|
||||
/// will quickly return false for the common case of no transitions specified or running. If
|
||||
/// this returns false, we definitely don't need to update transitions but if it returns true
|
||||
/// we can perform the more thoroughgoing check, needs_transitions_update, to further
|
||||
/// reduce the possibility of false positives.
|
||||
#[cfg(feature = "gecko")]
|
||||
fn might_need_transitions_update(
|
||||
&self,
|
||||
old_values: Option<&ComputedValues>,
|
||||
new_values: &ComputedValues,
|
||||
) -> bool;
|
||||
|
||||
/// Returns true if one of the transitions needs to be updated on this element. We check all
|
||||
/// the transition properties to make sure that updating transitions is necessary.
|
||||
/// This method should only be called if might_needs_transitions_update returns true when
|
||||
|
@ -567,6 +567,12 @@ impl<'le> GeckoElement<'le> {
|
||||
unsafe { self.0.mServoData.get().as_ref() }
|
||||
}
|
||||
|
||||
/// Returns whether any animation applies to this element.
|
||||
#[inline]
|
||||
pub fn has_any_animation(&self) -> bool {
|
||||
self.may_have_animations() && unsafe { Gecko_ElementHasAnimations(self.0) }
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn attrs(&self) -> &[structs::AttrArray_InternalAttr] {
|
||||
unsafe {
|
||||
@ -1235,11 +1241,11 @@ impl<'le> TElement for GeckoElement<'le> {
|
||||
}
|
||||
}
|
||||
|
||||
fn animation_rule(&self) -> Option<Arc<Locked<PropertyDeclarationBlock>>> {
|
||||
fn animation_rule(&self, _: &SharedStyleContext) -> Option<Arc<Locked<PropertyDeclarationBlock>>> {
|
||||
get_animation_rule(self, CascadeLevel::Animations)
|
||||
}
|
||||
|
||||
fn transition_rule(&self) -> Option<Arc<Locked<PropertyDeclarationBlock>>> {
|
||||
fn transition_rule(&self, _: &SharedStyleContext) -> Option<Arc<Locked<PropertyDeclarationBlock>>> {
|
||||
get_animation_rule(self, CascadeLevel::Transitions)
|
||||
}
|
||||
|
||||
@ -1516,8 +1522,9 @@ impl<'le> TElement for GeckoElement<'le> {
|
||||
}
|
||||
}
|
||||
|
||||
fn has_animations(&self) -> bool {
|
||||
self.may_have_animations() && unsafe { Gecko_ElementHasAnimations(self.0) }
|
||||
#[inline]
|
||||
fn has_animations(&self, _: &SharedStyleContext) -> bool {
|
||||
self.has_any_animation()
|
||||
}
|
||||
|
||||
fn has_css_animations(&self, _: &SharedStyleContext, _: Option<PseudoElement>) -> bool {
|
||||
@ -1529,7 +1536,8 @@ impl<'le> TElement for GeckoElement<'le> {
|
||||
}
|
||||
|
||||
// Detect if there are any changes that require us to update transitions.
|
||||
// This is used as a more thoroughgoing check than the, cheaper
|
||||
//
|
||||
// This is used as a more thoroughgoing check than the cheaper
|
||||
// might_need_transitions_update check.
|
||||
//
|
||||
// The following logic shadows the logic used on the Gecko side
|
||||
@ -1544,12 +1552,6 @@ impl<'le> TElement for GeckoElement<'le> {
|
||||
) -> bool {
|
||||
use crate::properties::LonghandIdSet;
|
||||
|
||||
debug_assert!(
|
||||
self.might_need_transitions_update(Some(before_change_style), after_change_style),
|
||||
"We should only call needs_transitions_update if \
|
||||
might_need_transitions_update returns true"
|
||||
);
|
||||
|
||||
let after_change_box_style = after_change_style.get_box();
|
||||
let existing_transitions = self.css_transitions_info();
|
||||
let mut transitions_to_keep = LonghandIdSet::new();
|
||||
|
@ -391,6 +391,7 @@ trait PrivateMatchMethods: TElement {
|
||||
use crate::context::UpdateAnimationsTasks;
|
||||
|
||||
let new_values = new_styles.primary_style_mut();
|
||||
let old_values = &old_styles.primary;
|
||||
if context.shared.traversal_flags.for_animation_only() {
|
||||
self.handle_display_change_for_smil_if_needed(
|
||||
context,
|
||||
@ -420,7 +421,7 @@ trait PrivateMatchMethods: TElement {
|
||||
new_values,
|
||||
/* pseudo_element = */ None,
|
||||
) {
|
||||
let after_change_style = if self.has_css_transitions(context.shared) {
|
||||
let after_change_style = if self.has_css_transitions(context.shared, /* pseudo_element = */ None) {
|
||||
self.after_change_style(context, new_values)
|
||||
} else {
|
||||
None
|
||||
@ -453,7 +454,7 @@ trait PrivateMatchMethods: TElement {
|
||||
None
|
||||
};
|
||||
|
||||
if self.has_animations() {
|
||||
if self.has_animations(&context.shared) {
|
||||
tasks.insert(UpdateAnimationsTasks::EFFECT_PROPERTIES);
|
||||
if important_rules_changed {
|
||||
tasks.insert(UpdateAnimationsTasks::CASCADE_RESULTS);
|
||||
|
@ -39,7 +39,7 @@ pub struct AnimationDeclarations {
|
||||
|
||||
impl AnimationDeclarations {
|
||||
/// Whether or not this `AnimationDeclarations` is empty.
|
||||
pub(crate) fn is_empty(&self) -> bool {
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.animations.is_none() && self.transitions.is_none()
|
||||
}
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ where
|
||||
}
|
||||
|
||||
/// Cascade a set of rules for pseudo element, using the default parent for inheritance.
|
||||
pub(crate) fn cascade_style_and_visited_for_pseudo_with_default_parents(
|
||||
pub fn cascade_style_and_visited_for_pseudo_with_default_parents(
|
||||
&mut self,
|
||||
inputs: CascadeInputs,
|
||||
pseudo: &PseudoElement,
|
||||
|
@ -35,14 +35,15 @@ fn moz_box_display_values_enabled(context: &ParserContext) -> bool {
|
||||
}
|
||||
|
||||
fn flexbox_enabled() -> bool {
|
||||
if cfg!(feature = "servo-layout-2020") {
|
||||
servo_config::prefs::pref_map()
|
||||
#[cfg(feature = "servo-layout-2020")]
|
||||
{
|
||||
return servo_config::prefs::pref_map()
|
||||
.get("layout.flexbox.enabled")
|
||||
.as_bool()
|
||||
.unwrap_or(false)
|
||||
} else {
|
||||
true
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
/// Defines an element’s display type, which consists of
|
||||
|
@ -5495,7 +5495,7 @@ fn create_context_for_animation<'a>(
|
||||
) -> Context<'a> {
|
||||
Context {
|
||||
builder: StyleBuilder::for_animation(per_doc_data.stylist.device(), style, parent_style),
|
||||
font_metrics_provider: font_metrics_provider,
|
||||
font_metrics_provider,
|
||||
cached_system_font: None,
|
||||
in_media_query: false,
|
||||
quirks_mode: per_doc_data.stylist.quirks_mode(),
|
||||
@ -6359,7 +6359,7 @@ pub extern "C" fn Servo_HasPendingRestyleAncestor(
|
||||
let mut has_yet_to_be_styled = false;
|
||||
let mut element = Some(GeckoElement(element));
|
||||
while let Some(e) = element {
|
||||
if e.has_animations() {
|
||||
if e.has_any_animation() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user