mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Implement GeckoComputedValues::do_cascade.
With this patch, we finally panic on an actual style struct setter (set_text_rendering). Exciting!
This commit is contained in:
parent
899d6a9f64
commit
43e49705be
2 changed files with 17 additions and 6 deletions
|
@ -6722,10 +6722,8 @@ pub type CascadePropertyFn<C /*: ComputedValues */> =
|
||||||
cacheable: &mut bool,
|
cacheable: &mut bool,
|
||||||
error_reporter: &mut Box<ParseErrorReporter + Send>);
|
error_reporter: &mut Box<ParseErrorReporter + Send>);
|
||||||
|
|
||||||
// This is a thread-local rather than a lazy static to avoid atomic operations when cascading
|
pub fn make_cascade_vec<C: ComputedValues>() -> Vec<Option<CascadePropertyFn<C>>> {
|
||||||
// properties.
|
let mut result: Vec<Option<CascadePropertyFn<C>>> = Vec::new();
|
||||||
thread_local!(static CASCADE_PROPERTY: Vec<Option<CascadePropertyFn<ServoComputedValues>>> = {
|
|
||||||
let mut result: Vec<Option<CascadePropertyFn<ServoComputedValues>>> = Vec::new();
|
|
||||||
% for style_struct in STYLE_STRUCTS:
|
% for style_struct in STYLE_STRUCTS:
|
||||||
% for property in style_struct.longhands:
|
% for property in style_struct.longhands:
|
||||||
let discriminant;
|
let discriminant;
|
||||||
|
@ -6741,6 +6739,12 @@ thread_local!(static CASCADE_PROPERTY: Vec<Option<CascadePropertyFn<ServoCompute
|
||||||
% endfor
|
% endfor
|
||||||
% endfor
|
% endfor
|
||||||
result
|
result
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is a thread-local rather than a lazy static to avoid atomic operations when cascading
|
||||||
|
// properties.
|
||||||
|
thread_local!(static CASCADE_PROPERTY: Vec<Option<CascadePropertyFn<ServoComputedValues>>> = {
|
||||||
|
make_cascade_vec::<ServoComputedValues>()
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Performs the CSS cascade, computing new styles for an element from its parent style and
|
/// Performs the CSS cascade, computing new styles for an element from its parent style and
|
||||||
|
|
|
@ -19,6 +19,7 @@ use style::custom_properties::ComputedValuesMap;
|
||||||
use style::logical_geometry::WritingMode;
|
use style::logical_geometry::WritingMode;
|
||||||
use style::properties::{CascadePropertyFn, ServoComputedValues, ComputedValues};
|
use style::properties::{CascadePropertyFn, ServoComputedValues, ComputedValues};
|
||||||
use style::properties::longhands;
|
use style::properties::longhands;
|
||||||
|
use style::properties::make_cascade_vec;
|
||||||
use style::properties::style_struct_traits::*;
|
use style::properties::style_struct_traits::*;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
@ -63,8 +64,8 @@ impl ComputedValues for GeckoComputedValues {
|
||||||
|
|
||||||
fn initial_values() -> &'static Self { &*INITIAL_GECKO_VALUES }
|
fn initial_values() -> &'static Self { &*INITIAL_GECKO_VALUES }
|
||||||
|
|
||||||
fn do_cascade_property<F: FnOnce(&Vec<Option<CascadePropertyFn<Self>>>)>(_: F) {
|
fn do_cascade_property<F: FnOnce(&Vec<Option<CascadePropertyFn<Self>>>)>(f: F) {
|
||||||
unimplemented!()
|
CASCADE_PROPERTY.with(|x| f(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
% for style_struct in STYLE_STRUCTS:
|
% for style_struct in STYLE_STRUCTS:
|
||||||
|
@ -229,3 +230,9 @@ lazy_static! {
|
||||||
root_font_size: longhands::font_size::get_initial_value(),
|
root_font_size: longhands::font_size::get_initial_value(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is a thread-local rather than a lazy static to avoid atomic operations when cascading
|
||||||
|
// properties.
|
||||||
|
thread_local!(static CASCADE_PROPERTY: Vec<Option<CascadePropertyFn<GeckoComputedValues>>> = {
|
||||||
|
make_cascade_vec::<GeckoComputedValues>()
|
||||||
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue