Inherit computed value flags when inheriting computed values.

This commit is contained in:
Xidorn Quan 2017-07-14 10:33:53 +10:00
parent 2a05c29c30
commit 86799d4d6e
2 changed files with 9 additions and 0 deletions

View file

@ -8,6 +8,11 @@ use properties::{ComputedValues, StyleBuilder};
bitflags! { bitflags! {
/// Misc information about a given computed style. /// Misc information about a given computed style.
///
/// All flags are currently inherited for text, pseudo elements, and
/// anonymous boxes, see StyleBuilder::for_inheritance and its callsites.
/// If we ever want to add some flags that shouldn't inherit for them,
/// we might want to add a function to handle this.
pub flags ComputedValueFlags: u8 { pub flags ComputedValueFlags: u8 {
/// Whether the style or any of the ancestors has a text-decoration-line /// Whether the style or any of the ancestors has a text-decoration-line
/// property that should get propagated to descendants. /// property that should get propagated to descendants.

View file

@ -2414,6 +2414,7 @@ impl<'a> StyleBuilder<'a> {
custom_properties: Option<Arc<::custom_properties::CustomPropertiesMap>>, custom_properties: Option<Arc<::custom_properties::CustomPropertiesMap>>,
writing_mode: WritingMode, writing_mode: WritingMode,
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32)>, font_size_keyword: Option<(longhands::font_size::KeywordSize, f32)>,
flags: ComputedValueFlags,
visited_style: Option<Arc<ComputedValues>>, visited_style: Option<Arc<ComputedValues>>,
) -> Self { ) -> Self {
StyleBuilder { StyleBuilder {
@ -2422,6 +2423,7 @@ impl<'a> StyleBuilder<'a> {
custom_properties, custom_properties,
writing_mode, writing_mode,
font_size_keyword, font_size_keyword,
flags,
visited_style, visited_style,
% for style_struct in data.active_style_structs(): % for style_struct in data.active_style_structs():
% if style_struct.inherited: % if style_struct.inherited:
@ -2452,6 +2454,7 @@ impl<'a> StyleBuilder<'a> {
parent.custom_properties(), parent.custom_properties(),
parent.writing_mode, parent.writing_mode,
parent.font_computation_data.font_size_keyword, parent.font_computation_data.font_size_keyword,
parent.flags,
parent.clone_visited_style() parent.clone_visited_style()
) )
} }
@ -2747,6 +2750,7 @@ pub fn apply_declarations<'a, F, I>(device: &Device,
custom_properties, custom_properties,
WritingMode::empty(), WritingMode::empty(),
inherited_style.font_computation_data.font_size_keyword, inherited_style.font_computation_data.font_size_keyword,
ComputedValueFlags::empty(),
visited_style, visited_style,
), ),
font_metrics_provider: font_metrics_provider, font_metrics_provider: font_metrics_provider,