pub struct LinkedStyleSheet { /* private fields */ }Expand description
A fully-parsed style sheet file.
A linked style sheet has a scope attached.
The scope can be used in style queries, to limit the style sheets which can be matched in the queries.
Implementations§
Source§impl LinkedStyleSheet
impl LinkedStyleSheet
Sourcepub fn scope(&self) -> Option<NonZeroUsize>
pub fn scope(&self) -> Option<NonZeroUsize>
Get the scope of the style sheet file.
Sourcepub fn sheets(&self) -> Vec<Rc<RefCell<StyleSheet>>>
pub fn sheets(&self) -> Vec<Rc<RefCell<StyleSheet>>>
Get all style sheets.
A style sheet file can contain several StyleSheet.
If the file has no @import, it has only one StyleSheet.
Otherwise, other StyleSheet will be imported.
All StyleSheets are ordered based on the imported order.
Sourcepub fn parse(source: &str, scope: Option<NonZeroUsize>) -> (Self, Vec<Warning>)
pub fn parse(source: &str, scope: Option<NonZeroUsize>) -> (Self, Vec<Warning>)
Parse style sheet source to a style sheet directly.
All @imports are ignored.
It is a convinient way if there is no @import in the source.
Sourcepub fn add_rule(&mut self, rule: Box<Rule>) -> u32
pub fn add_rule(&mut self, rule: Box<Rule>) -> u32
Append a new rule.
Generally it is used for debugging. Re-query is needed when the style sheet is updated.
Sourcepub fn replace_rule(
&mut self,
rule_index: u32,
rule: Box<Rule>,
) -> Result<Rc<Rule>, Box<Rule>>
pub fn replace_rule( &mut self, rule_index: u32, rule: Box<Rule>, ) -> Result<Rc<Rule>, Box<Rule>>
Replace an existing rule with a new rule.
The new rule is returned if success. Generally it is used for debugging. Re-query is needed when the style sheet is updated.
Sourcepub fn get_font_face(&self) -> Vec<Rc<FontFace>>
pub fn get_font_face(&self) -> Vec<Rc<FontFace>>
Get all @font-face definitions.
Trait Implementations§
Source§impl Clone for LinkedStyleSheet
impl Clone for LinkedStyleSheet
Source§fn clone(&self) -> LinkedStyleSheet
fn clone(&self) -> LinkedStyleSheet
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more