diff --git a/components/style/animation.rs b/components/style/animation.rs index 2dabb608d99..1545cac72f8 100644 --- a/components/style/animation.rs +++ b/components/style/animation.rs @@ -430,6 +430,7 @@ fn compute_style_for_animation_step(context: &SharedStyleContext, /* is_root = */ false, iter, previous_style, + &context.default_computed_values, /* cascade_info = */ None, context.error_reporter.clone(), /* Metrics provider */ None, diff --git a/components/style/gecko_bindings/bindings.rs b/components/style/gecko_bindings/bindings.rs index 0a94d146cd7..03f51a130ca 100644 --- a/components/style/gecko_bindings/bindings.rs +++ b/components/style/gecko_bindings/bindings.rs @@ -1248,7 +1248,8 @@ extern "C" { -> RawServoDeclarationBlockStrong; } extern "C" { - pub fn Servo_RestyleWithAddedDeclaration(declarations: + pub fn Servo_RestyleWithAddedDeclaration(set: RawServoStyleSetBorrowed, + declarations: RawServoDeclarationBlockBorrowed, previous_style: ServoComputedValuesBorrowed) diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 66a8e158582..d5d068060bf 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -1746,6 +1746,7 @@ pub fn cascade(viewport_size: Size2D, is_root_element, iter_declarations, inherited_style, + default_style, cascade_info, error_reporter, None, @@ -1758,6 +1759,7 @@ pub fn apply_declarations<'a, F, I>(viewport_size: Size2D, is_root_element: bool, iter_declarations: F, inherited_style: &ComputedValues, + default_style: &Arc, mut cascade_info: Option<<&mut CascadeInfo>, mut error_reporter: StdBox, font_metrics_provider: Option<<&FontMetricsProvider>, @@ -1784,8 +1786,6 @@ pub fn apply_declarations<'a, F, I>(viewport_size: Size2D, ::custom_properties::finish_cascade( custom_properties, &inherited_custom_properties); - let initial_values = ComputedValues::initial_values(); - let starting_style = if !flags.contains(INHERIT_ALL) { ComputedValues::new(custom_properties, flags.contains(SHAREABLE), @@ -1795,7 +1795,7 @@ pub fn apply_declarations<'a, F, I>(viewport_size: Size2D, % if style_struct.inherited: inherited_style.clone_${style_struct.name_lower}(), % else: - initial_values.clone_${style_struct.name_lower}(), + default_style.clone_${style_struct.name_lower}(), % endif % endfor ) diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 9c947fc73f7..a0be6d60f80 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -170,7 +170,8 @@ pub extern "C" fn Servo_TraverseSubtree(root: RawGeckoElementBorrowed, } #[no_mangle] -pub extern "C" fn Servo_RestyleWithAddedDeclaration(declarations: RawServoDeclarationBlockBorrowed, +pub extern "C" fn Servo_RestyleWithAddedDeclaration(raw_data: RawServoStyleSetBorrowed, + declarations: RawServoDeclarationBlockBorrowed, previous_style: ServoComputedValuesBorrowed) -> ServoComputedValuesStrong { @@ -183,11 +184,14 @@ pub extern "C" fn Servo_RestyleWithAddedDeclaration(declarations: RawServoDeclar guard.declarations.iter().rev().map(|&(ref decl, _importance)| decl) }; + let data = PerDocumentStyleData::from_ffi(raw_data).borrow(); + // FIXME (bug 1303229): Use the actual viewport size here let computed = apply_declarations(Size2D::new(Au(0), Au(0)), /* is_root_element = */ false, declarations, previous_style, + &data.default_computed_values, None, Box::new(StdoutErrorReporter), None,