mirror of
https://github.com/servo/servo.git
synced 2025-08-18 03:45:33 +01:00
style: remove is_servo(), as_servo() and as_servo_mut()
This commit adds a need_index prop to the style system, and autogenerates iterators, and a get_xxx_mod(i) function from a get_xxx_prop() and get_xxx_at(index) functions. This allows us to (finally!) take rid of the as_servo() hack. There are a few unimplemented clones, but I'm just too lazy for that right now.
This commit is contained in:
parent
ba53c4ea8d
commit
30963dd74d
7 changed files with 296 additions and 81 deletions
|
@ -1246,14 +1246,6 @@ pub trait ComputedValues : Debug + Clone + Send + Sync + 'static {
|
|||
type Concrete${style_struct.trait_name}: style_struct_traits::${style_struct.trait_name};
|
||||
% endfor
|
||||
|
||||
// Temporary bailout case for stuff we haven't made work with the trait
|
||||
// yet - panics for non-Servo implementations.
|
||||
//
|
||||
// Used only for animations. Don't use it in other places.
|
||||
fn is_servo(&self) -> bool;
|
||||
fn as_servo<'a>(&'a self) -> &'a ServoComputedValues;
|
||||
fn as_servo_mut<'a>(&'a mut self) -> &'a mut ServoComputedValues;
|
||||
|
||||
fn new(custom_properties: Option<Arc<::custom_properties::ComputedValuesMap>>,
|
||||
shareable: bool,
|
||||
writing_mode: WritingMode,
|
||||
|
@ -1302,13 +1294,6 @@ impl ComputedValues for ServoComputedValues {
|
|||
type Concrete${style_struct.trait_name} = style_structs::${style_struct.servo_struct_name};
|
||||
% endfor
|
||||
|
||||
#[inline]
|
||||
fn is_servo(&self) -> bool { true }
|
||||
#[inline]
|
||||
fn as_servo<'a>(&'a self) -> &'a ServoComputedValues { self }
|
||||
#[inline]
|
||||
fn as_servo_mut<'a>(&'a mut self) -> &'a mut ServoComputedValues { self }
|
||||
|
||||
fn new(custom_properties: Option<Arc<::custom_properties::ComputedValuesMap>>,
|
||||
shareable: bool,
|
||||
writing_mode: WritingMode,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue