mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Bug 1298588 part 10, servo piece. Pass through useful default styles to apply_declarations(). r=bholley
This commit is contained in:
parent
61f6025dc3
commit
c826b18f87
4 changed files with 11 additions and 5 deletions
|
@ -430,6 +430,7 @@ fn compute_style_for_animation_step(context: &SharedStyleContext,
|
||||||
/* is_root = */ false,
|
/* is_root = */ false,
|
||||||
iter,
|
iter,
|
||||||
previous_style,
|
previous_style,
|
||||||
|
&context.default_computed_values,
|
||||||
/* cascade_info = */ None,
|
/* cascade_info = */ None,
|
||||||
context.error_reporter.clone(),
|
context.error_reporter.clone(),
|
||||||
/* Metrics provider */ None,
|
/* Metrics provider */ None,
|
||||||
|
|
|
@ -1248,7 +1248,8 @@ extern "C" {
|
||||||
-> RawServoDeclarationBlockStrong;
|
-> RawServoDeclarationBlockStrong;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn Servo_RestyleWithAddedDeclaration(declarations:
|
pub fn Servo_RestyleWithAddedDeclaration(set: RawServoStyleSetBorrowed,
|
||||||
|
declarations:
|
||||||
RawServoDeclarationBlockBorrowed,
|
RawServoDeclarationBlockBorrowed,
|
||||||
previous_style:
|
previous_style:
|
||||||
ServoComputedValuesBorrowed)
|
ServoComputedValuesBorrowed)
|
||||||
|
|
|
@ -1746,6 +1746,7 @@ pub fn cascade(viewport_size: Size2D<Au>,
|
||||||
is_root_element,
|
is_root_element,
|
||||||
iter_declarations,
|
iter_declarations,
|
||||||
inherited_style,
|
inherited_style,
|
||||||
|
default_style,
|
||||||
cascade_info,
|
cascade_info,
|
||||||
error_reporter,
|
error_reporter,
|
||||||
None,
|
None,
|
||||||
|
@ -1758,6 +1759,7 @@ pub fn apply_declarations<'a, F, I>(viewport_size: Size2D<Au>,
|
||||||
is_root_element: bool,
|
is_root_element: bool,
|
||||||
iter_declarations: F,
|
iter_declarations: F,
|
||||||
inherited_style: &ComputedValues,
|
inherited_style: &ComputedValues,
|
||||||
|
default_style: &Arc<ComputedValues>,
|
||||||
mut cascade_info: Option<<&mut CascadeInfo>,
|
mut cascade_info: Option<<&mut CascadeInfo>,
|
||||||
mut error_reporter: StdBox<ParseErrorReporter + Send>,
|
mut error_reporter: StdBox<ParseErrorReporter + Send>,
|
||||||
font_metrics_provider: Option<<&FontMetricsProvider>,
|
font_metrics_provider: Option<<&FontMetricsProvider>,
|
||||||
|
@ -1784,8 +1786,6 @@ pub fn apply_declarations<'a, F, I>(viewport_size: Size2D<Au>,
|
||||||
::custom_properties::finish_cascade(
|
::custom_properties::finish_cascade(
|
||||||
custom_properties, &inherited_custom_properties);
|
custom_properties, &inherited_custom_properties);
|
||||||
|
|
||||||
let initial_values = ComputedValues::initial_values();
|
|
||||||
|
|
||||||
let starting_style = if !flags.contains(INHERIT_ALL) {
|
let starting_style = if !flags.contains(INHERIT_ALL) {
|
||||||
ComputedValues::new(custom_properties,
|
ComputedValues::new(custom_properties,
|
||||||
flags.contains(SHAREABLE),
|
flags.contains(SHAREABLE),
|
||||||
|
@ -1795,7 +1795,7 @@ pub fn apply_declarations<'a, F, I>(viewport_size: Size2D<Au>,
|
||||||
% if style_struct.inherited:
|
% if style_struct.inherited:
|
||||||
inherited_style.clone_${style_struct.name_lower}(),
|
inherited_style.clone_${style_struct.name_lower}(),
|
||||||
% else:
|
% else:
|
||||||
initial_values.clone_${style_struct.name_lower}(),
|
default_style.clone_${style_struct.name_lower}(),
|
||||||
% endif
|
% endif
|
||||||
% endfor
|
% endfor
|
||||||
)
|
)
|
||||||
|
|
|
@ -170,7 +170,8 @@ pub extern "C" fn Servo_TraverseSubtree(root: RawGeckoElementBorrowed,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_RestyleWithAddedDeclaration(declarations: RawServoDeclarationBlockBorrowed,
|
pub extern "C" fn Servo_RestyleWithAddedDeclaration(raw_data: RawServoStyleSetBorrowed,
|
||||||
|
declarations: RawServoDeclarationBlockBorrowed,
|
||||||
previous_style: ServoComputedValuesBorrowed)
|
previous_style: ServoComputedValuesBorrowed)
|
||||||
-> ServoComputedValuesStrong
|
-> ServoComputedValuesStrong
|
||||||
{
|
{
|
||||||
|
@ -183,11 +184,14 @@ pub extern "C" fn Servo_RestyleWithAddedDeclaration(declarations: RawServoDeclar
|
||||||
guard.declarations.iter().rev().map(|&(ref decl, _importance)| decl)
|
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
|
// FIXME (bug 1303229): Use the actual viewport size here
|
||||||
let computed = apply_declarations(Size2D::new(Au(0), Au(0)),
|
let computed = apply_declarations(Size2D::new(Au(0), Au(0)),
|
||||||
/* is_root_element = */ false,
|
/* is_root_element = */ false,
|
||||||
declarations,
|
declarations,
|
||||||
previous_style,
|
previous_style,
|
||||||
|
&data.default_computed_values,
|
||||||
None,
|
None,
|
||||||
Box::new(StdoutErrorReporter),
|
Box::new(StdoutErrorReporter),
|
||||||
None,
|
None,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue