pub enum PropertyMeta {
Normal {
property: Property,
},
Important {
property: Property,
},
DebugGroup {
original_name_value: Box<(String, String)>,
properties: Box<[Property]>,
important: bool,
disabled: bool,
},
}
Expand description
A CSS property with some metadata.
Variants§
Normal
A single normal property, e.g. font-size: 16px
.
Important
A single property with !important
, e.g. font-size: 16px !important
.
DebugGroup
A group of properties.
It is designed for debugging only.
In production environment, properties are well-normalized -
shorthand properties (e.g. font
background
) are splitted in advance.
However, we may add new shorthand properties in debugger -
we can keep the shorthand properties as-is with DebugGroup
s.
Implementations§
Source§impl PropertyMeta
impl PropertyMeta
Sourcepub fn new_debug_properties(source: &str) -> Vec<Self>
pub fn new_debug_properties(source: &str) -> Vec<Self>
Generate a new property.
Note that the property is in debug mode so that:
- it cannot be serialized even if it has been inserted to a rule;
- it has a little performance penalty.
Sourcepub fn to_debug_state(&self, disabled: bool) -> Self
pub fn to_debug_state(&self, disabled: bool) -> Self
Clone the property and set the disable state of the new property.
Note that the new property is in debug mode so that:
- it cannot be serialized even if it has been inserted to a rule;
- it has a little performance penalty.
Sourcepub fn is_important(&self) -> bool
pub fn is_important(&self) -> bool
The property is !important
or not.
Sourcepub fn get_property_name(&self) -> Cow<'static, str>
pub fn get_property_name(&self) -> Cow<'static, str>
Get the property name.
Sourcepub fn get_property_value_string(&self) -> String
pub fn get_property_value_string(&self) -> String
Get the property value as a string.
Note that it may (and may not) be normalized.
Sourcepub fn is_disabled(&self) -> bool
pub fn is_disabled(&self) -> bool
The property is disabled (only possible in debug state) or not.
Sourcepub fn is_invalid(&self) -> bool
pub fn is_invalid(&self) -> bool
The property is invalid (only possible in debug state) or not.
Sourcepub fn is_deprecated(&self) -> bool
pub fn is_deprecated(&self) -> bool
The property is deprecated or not.
Sourcepub fn merge_to_node_properties(
&self,
node_properties: &mut NodeProperties,
parent_node_properties: Option<&NodeProperties>,
current_font_size: f32,
)
pub fn merge_to_node_properties( &self, node_properties: &mut NodeProperties, parent_node_properties: Option<&NodeProperties>, current_font_size: f32, )
Merge the property into a NodeProperties
.
Trait Implementations§
Source§impl Clone for PropertyMeta
impl Clone for PropertyMeta
Source§fn clone(&self) -> PropertyMeta
fn clone(&self) -> PropertyMeta
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more