mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
style: Record on a computed::Context whether we are computing a SMIL animated value.
This commit is contained in:
parent
30d6d6024b
commit
c81d62d36f
7 changed files with 37 additions and 3 deletions
|
@ -642,6 +642,7 @@ impl Expression {
|
|||
in_media_query: true,
|
||||
// TODO: pass the correct value here.
|
||||
quirks_mode: quirks_mode,
|
||||
for_smil_animation: false,
|
||||
};
|
||||
|
||||
let required_value = match self.value {
|
||||
|
|
|
@ -2996,6 +2996,7 @@ where
|
|||
cached_system_font: None,
|
||||
in_media_query: false,
|
||||
quirks_mode: quirks_mode,
|
||||
for_smil_animation: false,
|
||||
};
|
||||
|
||||
let ignore_colors = !device.use_document_colors();
|
||||
|
|
|
@ -246,6 +246,7 @@ impl Range<specified::Length> {
|
|||
in_media_query: true,
|
||||
cached_system_font: None,
|
||||
quirks_mode: quirks_mode,
|
||||
for_smil_animation: false,
|
||||
};
|
||||
|
||||
match *self {
|
||||
|
|
|
@ -709,6 +709,7 @@ impl MaybeNew for ViewportConstraints {
|
|||
cached_system_font: None,
|
||||
in_media_query: false,
|
||||
quirks_mode: quirks_mode,
|
||||
for_smil_animation: false,
|
||||
};
|
||||
|
||||
// DEVICE-ADAPT § 9.3 Resolving 'extend-to-zoom'
|
||||
|
|
|
@ -95,6 +95,12 @@ pub struct Context<'a> {
|
|||
|
||||
/// The quirks mode of this context.
|
||||
pub quirks_mode: QuirksMode,
|
||||
|
||||
/// Whether this computation is being done for a SMIL animation.
|
||||
///
|
||||
/// This is used to allow certain properties to generate out-of-range
|
||||
/// values, which SMIL allows.
|
||||
pub for_smil_animation: bool,
|
||||
}
|
||||
|
||||
impl<'a> Context<'a> {
|
||||
|
|
|
@ -2907,6 +2907,7 @@ fn create_context<'a>(
|
|||
style: &'a ComputedValues,
|
||||
parent_style: Option<&'a ComputedValues>,
|
||||
pseudo: Option<&'a PseudoElement>,
|
||||
for_smil_animation: bool,
|
||||
) -> Context<'a> {
|
||||
Context {
|
||||
is_root_element: false,
|
||||
|
@ -2920,6 +2921,7 @@ fn create_context<'a>(
|
|||
cached_system_font: None,
|
||||
in_media_query: false,
|
||||
quirks_mode: per_doc_data.stylist.quirks_mode(),
|
||||
for_smil_animation,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2989,7 +2991,14 @@ pub extern "C" fn Servo_GetComputedKeyframeValues(keyframes: RawGeckoKeyframeLis
|
|||
let parent_style = parent_data.as_ref().map(|d| d.styles.primary()).map(|x| &**x);
|
||||
|
||||
let pseudo = style.pseudo();
|
||||
let mut context = create_context(&data, &metrics, &style, parent_style, pseudo.as_ref());
|
||||
let mut context = create_context(
|
||||
&data,
|
||||
&metrics,
|
||||
&style,
|
||||
parent_style,
|
||||
pseudo.as_ref(),
|
||||
/* for_smil_animation = */ false,
|
||||
);
|
||||
|
||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||
let guard = global_style_data.shared_lock.read();
|
||||
|
@ -3069,7 +3078,14 @@ pub extern "C" fn Servo_GetAnimationValues(declarations: RawServoDeclarationBloc
|
|||
let parent_style = parent_data.as_ref().map(|d| d.styles.primary()).map(|x| &**x);
|
||||
|
||||
let pseudo = style.pseudo();
|
||||
let mut context = create_context(&data, &metrics, &style, parent_style, pseudo.as_ref());
|
||||
let mut context = create_context(
|
||||
&data,
|
||||
&metrics,
|
||||
&style,
|
||||
parent_style,
|
||||
pseudo.as_ref(),
|
||||
/* for_smil_animation = */ true
|
||||
);
|
||||
|
||||
let default_values = data.default_computed_values();
|
||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||
|
@ -3098,7 +3114,14 @@ pub extern "C" fn Servo_AnimationValue_Compute(element: RawGeckoElementBorrowed,
|
|||
let parent_style = parent_data.as_ref().map(|d| d.styles.primary()).map(|x| &**x);
|
||||
|
||||
let pseudo = style.pseudo();
|
||||
let mut context = create_context(&data, &metrics, style, parent_style, pseudo.as_ref());
|
||||
let mut context = create_context(
|
||||
&data,
|
||||
&metrics,
|
||||
style,
|
||||
parent_style,
|
||||
pseudo.as_ref(),
|
||||
/* for_smil_animation = */ false
|
||||
);
|
||||
|
||||
let default_values = data.default_computed_values();
|
||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||
|
|
|
@ -60,6 +60,7 @@ fn assert_computed_serialization<C, F, T>(f: F, input: &'static str, output: &st
|
|||
font_metrics_provider: &ServoMetricsProvider,
|
||||
in_media_query: false,
|
||||
quirks_mode: QuirksMode::NoQuirks,
|
||||
for_smil_animation: false,
|
||||
};
|
||||
|
||||
let parsed = parse(f, input).unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue