|
|
|
Lines 1555-1582
pub fn cascade(viewport_size: Size2D<Au>
|
Link Here
|
|---|
|
| 1555 |
} |
1555 |
} |
| 1556 |
}) |
1556 |
}) |
| 1557 |
}) |
1557 |
}) |
| 1558 |
}; |
1558 |
}; |
| 1559 |
apply_declarations(viewport_size, |
1559 |
apply_declarations(viewport_size, |
| 1560 |
is_root_element, |
1560 |
is_root_element, |
| 1561 |
iter_declarations, |
1561 |
iter_declarations, |
| 1562 |
inherited_style, |
1562 |
inherited_style, |
|
|
1563 |
default_style, |
| 1563 |
cascade_info, |
1564 |
cascade_info, |
| 1564 |
error_reporter, |
1565 |
error_reporter, |
| 1565 |
None, |
1566 |
None, |
| 1566 |
flags) |
1567 |
flags) |
| 1567 |
} |
1568 |
} |
| 1568 |
|
1569 |
|
| 1569 |
/// NOTE: This function expects the declaration with more priority to appear |
1570 |
/// NOTE: This function expects the declaration with more priority to appear |
| 1570 |
/// first. |
1571 |
/// first. |
| 1571 |
pub fn apply_declarations<'a, F, I>(viewport_size: Size2D<Au>, |
1572 |
pub fn apply_declarations<'a, F, I>(viewport_size: Size2D<Au>, |
| 1572 |
is_root_element: bool, |
1573 |
is_root_element: bool, |
| 1573 |
iter_declarations: F, |
1574 |
iter_declarations: F, |
| 1574 |
inherited_style: &ComputedValues, |
1575 |
inherited_style: &ComputedValues, |
|
|
1576 |
default_style: &Arc<ComputedValues>, |
| 1575 |
mut cascade_info: Option<<&mut CascadeInfo>, |
1577 |
mut cascade_info: Option<<&mut CascadeInfo>, |
| 1576 |
mut error_reporter: StdBox<ParseErrorReporter + Send>, |
1578 |
mut error_reporter: StdBox<ParseErrorReporter + Send>, |
| 1577 |
font_metrics_provider: Option<<&FontMetricsProvider>, |
1579 |
font_metrics_provider: Option<<&FontMetricsProvider>, |
| 1578 |
flags: CascadeFlags) |
1580 |
flags: CascadeFlags) |
| 1579 |
-> ComputedValues |
1581 |
-> ComputedValues |
| 1580 |
where F: Fn() -> I, I: Iterator<Item = &'a PropertyDeclaration> |
1582 |
where F: Fn() -> I, I: Iterator<Item = &'a PropertyDeclaration> |
| 1581 |
{ |
1583 |
{ |
| 1582 |
let inherited_custom_properties = inherited_style.custom_properties(); |
1584 |
let inherited_custom_properties = inherited_style.custom_properties(); |
|
Lines 1592-1619
pub fn apply_declarations<'a, F, I>(view
|
Link Here
|
|---|
|
| 1592 |
_ => {} |
1594 |
_ => {} |
| 1593 |
} |
1595 |
} |
| 1594 |
} |
1596 |
} |
| 1595 |
|
1597 |
|
| 1596 |
let custom_properties = |
1598 |
let custom_properties = |
| 1597 |
::custom_properties::finish_cascade( |
1599 |
::custom_properties::finish_cascade( |
| 1598 |
custom_properties, &inherited_custom_properties); |
1600 |
custom_properties, &inherited_custom_properties); |
| 1599 |
|
1601 |
|
| 1600 |
let initial_values = ComputedValues::initial_values(); |
|
|
| 1601 |
|
| 1602 |
let starting_style = if !flags.contains(INHERIT_ALL) { |
1602 |
let starting_style = if !flags.contains(INHERIT_ALL) { |
| 1603 |
ComputedValues::new(custom_properties, |
1603 |
ComputedValues::new(custom_properties, |
| 1604 |
flags.contains(SHAREABLE), |
1604 |
flags.contains(SHAREABLE), |
| 1605 |
WritingMode::empty(), |
1605 |
WritingMode::empty(), |
| 1606 |
inherited_style.root_font_size(), |
1606 |
inherited_style.root_font_size(), |
| 1607 |
% for style_struct in data.active_style_structs(): |
1607 |
% for style_struct in data.active_style_structs(): |
| 1608 |
% if style_struct.inherited: |
1608 |
% if style_struct.inherited: |
| 1609 |
inherited_style.clone_${style_struct.name_lower}(), |
1609 |
inherited_style.clone_${style_struct.name_lower}(), |
| 1610 |
% else: |
1610 |
% else: |
| 1611 |
initial_values.clone_${style_struct.name_lower}(), |
1611 |
default_style.clone_${style_struct.name_lower}(), |
| 1612 |
% endif |
1612 |
% endif |
| 1613 |
% endfor |
1613 |
% endfor |
| 1614 |
) |
1614 |
) |
| 1615 |
} else { |
1615 |
} else { |
| 1616 |
ComputedValues::new(custom_properties, |
1616 |
ComputedValues::new(custom_properties, |
| 1617 |
flags.contains(SHAREABLE), |
1617 |
flags.contains(SHAREABLE), |
| 1618 |
WritingMode::empty(), |
1618 |
WritingMode::empty(), |
| 1619 |
inherited_style.root_font_size(), |
1619 |
inherited_style.root_font_size(), |