|
|
|
|
| 196 |
use std::sync::Arc; |
196 |
use std::sync::Arc; |
| 197 |
use values::computed::{Context, ToComputedValue}; |
197 |
use values::computed::{Context, ToComputedValue}; |
| 198 |
use values::{computed, specified}; |
198 |
use values::{computed, specified}; |
| 199 |
use Atom; |
199 |
use Atom; |
| 200 |
${caller.body()} |
200 |
${caller.body()} |
| 201 |
#[allow(unused_variables)] |
201 |
#[allow(unused_variables)] |
| 202 |
pub fn cascade_property(declaration: &PropertyDeclaration, |
202 |
pub fn cascade_property(declaration: &PropertyDeclaration, |
| 203 |
inherited_style: &ComputedValues, |
203 |
inherited_style: &ComputedValues, |
|
|
204 |
default_style: &Arc<ComputedValues>, |
| 204 |
context: &mut computed::Context, |
205 |
context: &mut computed::Context, |
| 205 |
seen: &mut PropertyBitField, |
206 |
seen: &mut PropertyBitField, |
| 206 |
cacheable: &mut bool, |
207 |
cacheable: &mut bool, |
| 207 |
cascade_info: &mut Option<<&mut CascadeInfo>, |
208 |
cascade_info: &mut Option<<&mut CascadeInfo>, |
| 208 |
error_reporter: &mut StdBox<ParseErrorReporter + Send>) { |
209 |
error_reporter: &mut StdBox<ParseErrorReporter + Send>) { |
| 209 |
let declared_value = match *declaration { |
210 |
let declared_value = match *declaration { |
| 210 |
PropertyDeclaration::${property.camel_case}(ref declared_value) => { |
211 |
PropertyDeclaration::${property.camel_case}(ref declared_value) => { |
| 211 |
declared_value |
212 |
declared_value |
|
|
| 246 |
} |
247 |
} |
| 247 |
DeclaredValue::WithVariables { .. } => unreachable!(), |
248 |
DeclaredValue::WithVariables { .. } => unreachable!(), |
| 248 |
% if not data.current_style_struct.inherited: |
249 |
% if not data.current_style_struct.inherited: |
| 249 |
DeclaredValue::Unset | |
250 |
DeclaredValue::Unset | |
| 250 |
% endif |
251 |
% endif |
| 251 |
DeclaredValue::Initial => { |
252 |
DeclaredValue::Initial => { |
| 252 |
// We assume that it's faster to use copy_*_from rather than |
253 |
// We assume that it's faster to use copy_*_from rather than |
| 253 |
// set_*(get_initial_value()); |
254 |
// set_*(get_initial_value()); |
| 254 |
let initial_struct = ComputedValues::initial_values() |
255 |
let initial_struct = default_style |
| 255 |
.get_${data.current_style_struct.name_lower}(); |
256 |
.get_${data.current_style_struct.name_lower}(); |
| 256 |
context.mutate_style().mutate_${data.current_style_struct.name_lower}() |
257 |
context.mutate_style().mutate_${data.current_style_struct.name_lower}() |
| 257 |
.copy_${property.ident}_from(initial_struct ${maybe_wm}); |
258 |
.copy_${property.ident}_from(initial_struct ${maybe_wm}); |
| 258 |
}, |
259 |
}, |
| 259 |
% if data.current_style_struct.inherited: |
260 |
% if data.current_style_struct.inherited: |
| 260 |
DeclaredValue::Unset | |
261 |
DeclaredValue::Unset | |
| 261 |
% endif |
262 |
% endif |
| 262 |
DeclaredValue::Inherit => { |
263 |
DeclaredValue::Inherit => { |