mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Some trivial cleanup.
Bug: 1464865 Reviewed-by: xidorn MozReview-Commit-ID: 8ClaBR9ooGb
This commit is contained in:
parent
142c9eca4b
commit
d5e19a146e
1 changed files with 30 additions and 34 deletions
|
@ -268,8 +268,8 @@ impl<'a, 'i, R: ParseErrorReporter> AtRuleParser<'i> for TopLevelRuleParser<'a,
|
||||||
self.state = State::Imports;
|
self.state = State::Imports;
|
||||||
CssRule::Import(import_rule)
|
CssRule::Import(import_rule)
|
||||||
},
|
},
|
||||||
AtRuleNonBlockPrelude::Namespace(prefix, url, location) => {
|
AtRuleNonBlockPrelude::Namespace(prefix, url, source_location) => {
|
||||||
let opt_prefix = if let Some(prefix) = prefix {
|
let prefix = if let Some(prefix) = prefix {
|
||||||
self.namespaces.prefixes.insert(prefix.clone(), url.clone());
|
self.namespaces.prefixes.insert(prefix.clone(), url.clone());
|
||||||
Some(prefix)
|
Some(prefix)
|
||||||
} else {
|
} else {
|
||||||
|
@ -279,9 +279,9 @@ impl<'a, 'i, R: ParseErrorReporter> AtRuleParser<'i> for TopLevelRuleParser<'a,
|
||||||
|
|
||||||
self.state = State::Namespaces;
|
self.state = State::Namespaces;
|
||||||
CssRule::Namespace(Arc::new(self.shared_lock.wrap(NamespaceRule {
|
CssRule::Namespace(Arc::new(self.shared_lock.wrap(NamespaceRule {
|
||||||
prefix: opt_prefix,
|
prefix,
|
||||||
url: url,
|
url,
|
||||||
source_location: location,
|
source_location,
|
||||||
})))
|
})))
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -506,27 +506,27 @@ impl<'a, 'b, 'i, R: ParseErrorReporter> AtRuleParser<'i> for NestedRuleParser<'a
|
||||||
),
|
),
|
||||||
)))
|
)))
|
||||||
},
|
},
|
||||||
AtRuleBlockPrelude::Media(media_queries, location) => {
|
AtRuleBlockPrelude::Media(media_queries, source_location) => {
|
||||||
Ok(CssRule::Media(Arc::new(self.shared_lock.wrap(MediaRule {
|
Ok(CssRule::Media(Arc::new(self.shared_lock.wrap(MediaRule {
|
||||||
media_queries: media_queries,
|
media_queries,
|
||||||
rules: self.parse_nested_rules(input, CssRuleType::Media),
|
rules: self.parse_nested_rules(input, CssRuleType::Media),
|
||||||
source_location: location,
|
source_location,
|
||||||
}))))
|
}))))
|
||||||
},
|
},
|
||||||
AtRuleBlockPrelude::Supports(cond, location) => {
|
AtRuleBlockPrelude::Supports(condition, source_location) => {
|
||||||
let eval_context = ParserContext::new_with_rule_type(
|
let eval_context = ParserContext::new_with_rule_type(
|
||||||
self.context,
|
self.context,
|
||||||
CssRuleType::Style,
|
CssRuleType::Style,
|
||||||
self.namespaces,
|
self.namespaces,
|
||||||
);
|
);
|
||||||
|
|
||||||
let enabled = cond.eval(&eval_context);
|
let enabled = condition.eval(&eval_context);
|
||||||
Ok(CssRule::Supports(Arc::new(self.shared_lock.wrap(
|
Ok(CssRule::Supports(Arc::new(self.shared_lock.wrap(
|
||||||
SupportsRule {
|
SupportsRule {
|
||||||
condition: cond,
|
condition,
|
||||||
rules: self.parse_nested_rules(input, CssRuleType::Supports),
|
rules: self.parse_nested_rules(input, CssRuleType::Supports),
|
||||||
enabled: enabled,
|
enabled,
|
||||||
source_location: location,
|
source_location,
|
||||||
},
|
},
|
||||||
))))
|
))))
|
||||||
},
|
},
|
||||||
|
@ -541,7 +541,7 @@ impl<'a, 'b, 'i, R: ParseErrorReporter> AtRuleParser<'i> for NestedRuleParser<'a
|
||||||
ViewportRule::parse(&context, self.error_context, input)?,
|
ViewportRule::parse(&context, self.error_context, input)?,
|
||||||
))))
|
))))
|
||||||
},
|
},
|
||||||
AtRuleBlockPrelude::Keyframes(name, prefix, location) => {
|
AtRuleBlockPrelude::Keyframes(name, vendor_prefix, source_location) => {
|
||||||
let context = ParserContext::new_with_rule_type(
|
let context = ParserContext::new_with_rule_type(
|
||||||
self.context,
|
self.context,
|
||||||
CssRuleType::Keyframes,
|
CssRuleType::Keyframes,
|
||||||
|
@ -550,19 +550,19 @@ impl<'a, 'b, 'i, R: ParseErrorReporter> AtRuleParser<'i> for NestedRuleParser<'a
|
||||||
|
|
||||||
Ok(CssRule::Keyframes(Arc::new(self.shared_lock.wrap(
|
Ok(CssRule::Keyframes(Arc::new(self.shared_lock.wrap(
|
||||||
KeyframesRule {
|
KeyframesRule {
|
||||||
name: name,
|
name,
|
||||||
keyframes: parse_keyframe_list(
|
keyframes: parse_keyframe_list(
|
||||||
&context,
|
&context,
|
||||||
self.error_context,
|
self.error_context,
|
||||||
input,
|
input,
|
||||||
self.shared_lock,
|
self.shared_lock,
|
||||||
),
|
),
|
||||||
vendor_prefix: prefix,
|
vendor_prefix,
|
||||||
source_location: location,
|
source_location,
|
||||||
},
|
},
|
||||||
))))
|
))))
|
||||||
},
|
},
|
||||||
AtRuleBlockPrelude::Page(location) => {
|
AtRuleBlockPrelude::Page(source_location) => {
|
||||||
let context = ParserContext::new_with_rule_type(
|
let context = ParserContext::new_with_rule_type(
|
||||||
self.context,
|
self.context,
|
||||||
CssRuleType::Page,
|
CssRuleType::Page,
|
||||||
|
@ -573,21 +573,20 @@ impl<'a, 'b, 'i, R: ParseErrorReporter> AtRuleParser<'i> for NestedRuleParser<'a
|
||||||
parse_property_declaration_list(&context, self.error_context, input);
|
parse_property_declaration_list(&context, self.error_context, input);
|
||||||
Ok(CssRule::Page(Arc::new(self.shared_lock.wrap(PageRule {
|
Ok(CssRule::Page(Arc::new(self.shared_lock.wrap(PageRule {
|
||||||
block: Arc::new(self.shared_lock.wrap(declarations)),
|
block: Arc::new(self.shared_lock.wrap(declarations)),
|
||||||
source_location: location,
|
source_location,
|
||||||
}))))
|
}))))
|
||||||
},
|
},
|
||||||
AtRuleBlockPrelude::Document(cond, location) => {
|
AtRuleBlockPrelude::Document(condition, source_location) => {
|
||||||
if cfg!(feature = "gecko") {
|
if !cfg!(feature = "gecko") {
|
||||||
Ok(CssRule::Document(Arc::new(self.shared_lock.wrap(
|
|
||||||
DocumentRule {
|
|
||||||
condition: cond,
|
|
||||||
rules: self.parse_nested_rules(input, CssRuleType::Document),
|
|
||||||
source_location: location,
|
|
||||||
},
|
|
||||||
))))
|
|
||||||
} else {
|
|
||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
||||||
|
Ok(CssRule::Document(Arc::new(self.shared_lock.wrap(
|
||||||
|
DocumentRule {
|
||||||
|
condition,
|
||||||
|
rules: self.parse_nested_rules(input, CssRuleType::Document),
|
||||||
|
source_location,
|
||||||
|
},
|
||||||
|
))))
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -608,13 +607,10 @@ impl<'a, 'b, 'i, R: ParseErrorReporter> QualifiedRuleParser<'i> for NestedRulePa
|
||||||
url_data: Some(self.context.url_data),
|
url_data: Some(self.context.url_data),
|
||||||
};
|
};
|
||||||
|
|
||||||
let location = input.current_source_location();
|
let source_location = input.current_source_location();
|
||||||
let selectors = SelectorList::parse(&selector_parser, input)?;
|
let selectors = SelectorList::parse(&selector_parser, input)?;
|
||||||
|
|
||||||
Ok(QualifiedRuleParserPrelude {
|
Ok(QualifiedRuleParserPrelude { selectors, source_location, })
|
||||||
selectors: selectors,
|
|
||||||
source_location: location,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn parse_block<'t>(
|
fn parse_block<'t>(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue