style: Introduce InspectorUtils.supports().

Which allows to run CSS.supports in chrome/user-agent context. We should
probably add a couple more tweaks for stuff like quirks or what not (the
`ParsingMode` enum), but that seem lower priority.

I only added the one-value version of CSS.supports because it should be enough
and supporting the two value version required a bit of awkward code due to when
we parse the CSS property name right now.

Differential Revision: https://phabricator.services.mozilla.com/D92585
This commit is contained in:
Emilio Cobos Álvarez 2020-10-09 03:20:34 +00:00
parent 2b55918be6
commit 436632f378
2 changed files with 2 additions and 22 deletions

View file

@ -82,27 +82,6 @@ impl<'a> ParserContext<'a> {
}
}
/// Create a parser context for on-the-fly parsing in CSSOM
#[inline]
pub fn new_for_cssom(
url_data: &'a UrlExtraData,
rule_type: Option<CssRuleType>,
parsing_mode: ParsingMode,
quirks_mode: QuirksMode,
error_reporter: Option<&'a dyn ParseErrorReporter>,
use_counters: Option<&'a UseCounters>,
) -> Self {
Self::new(
Origin::Author,
url_data,
rule_type,
parsing_mode,
quirks_mode,
error_reporter,
use_counters,
)
}
/// Create a parser context based on a previous context, but with a modified
/// rule type.
#[inline]

View file

@ -1288,6 +1288,7 @@ pub fn parse_one_declaration_into(
declarations: &mut SourcePropertyDeclaration,
id: PropertyId,
input: &str,
origin: Origin,
url_data: &UrlExtraData,
error_reporter: Option<&dyn ParseErrorReporter>,
parsing_mode: ParsingMode,
@ -1295,7 +1296,7 @@ pub fn parse_one_declaration_into(
rule_type: CssRuleType,
) -> Result<(), ()> {
let context = ParserContext::new(
Origin::Author,
origin,
url_data,
Some(rule_type),
parsing_mode,