style: Add some flags to the computed values.

This will allow us to fix propagation of text-decoration, and also to implement
inlinization of ruby kids.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
Emilio Cobos Álvarez 2017-06-26 22:50:43 +02:00
parent 3f2d747689
commit 5c7632f4c4
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
4 changed files with 135 additions and 81 deletions

View file

@ -54,9 +54,8 @@ use gecko::values::round_border_to_device_pixels;
use logical_geometry::WritingMode;
use media_queries::Device;
use properties::animated_properties::TransitionProperty;
use properties::longhands;
use properties:: FontComputationData;
use properties::{Importance, LonghandId};
use properties::computed_value_flags::ComputedValueFlags;
use properties::{longhands, FontComputationData, Importance, LonghandId};
use properties::{PropertyDeclaration, PropertyDeclarationBlock, PropertyDeclarationId};
use rule_tree::StrongRuleNode;
use std::fmt::{self, Debug};
@ -75,16 +74,16 @@ pub mod style_structs {
% endfor
}
// FIXME(emilio): Unify both definitions, since they're equal now.
#[derive(Clone)]
pub struct ComputedValues {
% for style_struct in data.style_structs:
${style_struct.ident}: Arc<style_structs::${style_struct.name}>,
% endfor
custom_properties: Option<Arc<ComputedValuesMap>>,
pub writing_mode: WritingMode,
pub font_computation_data: FontComputationData,
pub flags: ComputedValueFlags,
/// The rule node representing the ordered list of rules matched for this
/// node. Can be None for default values and text nodes. This is
@ -100,6 +99,7 @@ impl ComputedValues {
pub fn new(custom_properties: Option<Arc<ComputedValuesMap>>,
writing_mode: WritingMode,
font_size_keyword: Option<(longhands::font_size::KeywordSize, f32)>,
flags: ComputedValueFlags,
rules: Option<StrongRuleNode>,
visited_style: Option<Arc<ComputedValues>>,
% for style_struct in data.style_structs:
@ -107,13 +107,14 @@ impl ComputedValues {
% endfor
) -> Self {
ComputedValues {
custom_properties: custom_properties,
writing_mode: writing_mode,
custom_properties,
writing_mode,
font_computation_data: FontComputationData::new(font_size_keyword),
rules: rules,
flags,
rules,
visited_style: visited_style,
% for style_struct in data.style_structs:
${style_struct.ident}: ${style_struct.ident},
${style_struct.ident},
% endfor
}
}