mirror of
https://github.com/servo/servo.git
synced 2025-08-30 01:28:21 +01:00
Auto merge of #18142 - emilio:less-mess-ns, r=SimonSapin
style: Less messy namespace handling. This PR accounts for the fact that the namespace table is only needed in `NestedRuleParser`, and only for style rules, in order to simplify the setup and be able to fix a few bugs wrt parsing of invalid rules. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18142) <!-- Reviewable:end -->
This commit is contained in:
commit
941e0dbb5a
9 changed files with 170 additions and 86 deletions
|
@ -1508,6 +1508,7 @@ pub extern "C" fn Servo_KeyframesRule_AppendRule(
|
|||
let css = unsafe { css.as_ref().unwrap().as_str_unchecked() };
|
||||
let contents = StylesheetContents::as_arc(&contents);
|
||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||
|
||||
match Keyframe::parse(css, &contents, &global_style_data.shared_lock) {
|
||||
Ok(keyframe) => {
|
||||
write_locked_arc(rule, |rule: &mut KeyframesRule| {
|
||||
|
@ -2811,9 +2812,16 @@ pub extern "C" fn Servo_CSSSupports(cond: *const nsACString) -> bool {
|
|||
if let Ok(cond) = cond {
|
||||
let url_data = unsafe { dummy_url_data() };
|
||||
let reporter = NullReporter;
|
||||
let context = ParserContext::new_for_cssom(url_data, &reporter, Some(CssRuleType::Style),
|
||||
PARSING_MODE_DEFAULT,
|
||||
QuirksMode::NoQuirks);
|
||||
// NOTE(emilio): The supports API is not associated to any stylesheet,
|
||||
// so the fact that there are no namespace map here is fine.
|
||||
let context =
|
||||
ParserContext::new_for_cssom(
|
||||
url_data,
|
||||
&reporter,
|
||||
Some(CssRuleType::Style),
|
||||
PARSING_MODE_DEFAULT,
|
||||
QuirksMode::NoQuirks,
|
||||
);
|
||||
cond.eval(&context)
|
||||
} else {
|
||||
false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue