Struct style::parser::ParserContext
[−]
[src]
pub struct ParserContext<'a> { pub stylesheet_origin: Origin, pub url_data: &'a UrlExtraData, pub rule_type: Option<CssRuleType>, pub parsing_mode: ParsingMode, pub quirks_mode: QuirksMode, pub namespaces: Option<&'a Namespaces>, }
The data that the parser needs from outside in order to parse a stylesheet.
Fields
stylesheet_origin: Origin
The Origin
of the stylesheet, whether it's a user, author or
user-agent stylesheet.
url_data: &'a UrlExtraData
The extra data we need for resolving url values.
rule_type: Option<CssRuleType>
The current rule type, if any.
parsing_mode: ParsingMode
The mode to use when parsing.
quirks_mode: QuirksMode
The quirks mode of this stylesheet.
namespaces: Option<&'a Namespaces>
The currently active namespaces.
Methods
impl<'a> ParserContext<'a>
[src]
pub fn new(
stylesheet_origin: Origin,
url_data: &'a UrlExtraData,
rule_type: Option<CssRuleType>,
parsing_mode: ParsingMode,
quirks_mode: QuirksMode
) -> Self
[src]
stylesheet_origin: Origin,
url_data: &'a UrlExtraData,
rule_type: Option<CssRuleType>,
parsing_mode: ParsingMode,
quirks_mode: QuirksMode
) -> Self
Create a parser context.
pub fn new_for_cssom(
url_data: &'a UrlExtraData,
rule_type: Option<CssRuleType>,
parsing_mode: ParsingMode,
quirks_mode: QuirksMode
) -> Self
[src]
url_data: &'a UrlExtraData,
rule_type: Option<CssRuleType>,
parsing_mode: ParsingMode,
quirks_mode: QuirksMode
) -> Self
Create a parser context for on-the-fly parsing in CSSOM
pub fn new_with_rule_type(
context: &'a ParserContext,
rule_type: CssRuleType,
namespaces: &'a Namespaces
) -> ParserContext<'a>
[src]
context: &'a ParserContext,
rule_type: CssRuleType,
namespaces: &'a Namespaces
) -> ParserContext<'a>
Create a parser context based on a previous context, but with a modified rule type.
pub fn rule_type(&self) -> CssRuleType
[src]
Get the rule type, which assumes that one is available.
pub fn log_css_error<R>(
&self,
context: &ParserErrorContext<R>,
location: SourceLocation,
error: ContextualParseError
) where
R: ParseErrorReporter,
[src]
&self,
context: &ParserErrorContext<R>,
location: SourceLocation,
error: ContextualParseError
) where
R: ParseErrorReporter,
Record a CSS parse error with this context’s error reporting.
pub fn chrome_rules_enabled(&self) -> bool
[src]
Returns whether chrome-only rules should be parsed.