mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Rustfmt has changed its default style :/
This commit is contained in:
parent
82fc6d9f49
commit
be69f9c3e6
207 changed files with 1200 additions and 1339 deletions
|
@ -30,9 +30,10 @@ type MediaFeatureEvaluator<T> = fn(
|
|||
pub type KeywordSerializer = fn(KeywordDiscriminant) -> String;
|
||||
|
||||
/// Parses a given identifier.
|
||||
pub type KeywordParser =
|
||||
for<'a, 'i, 't> fn(context: &'a ParserContext, input: &'a mut Parser<'i, 't>)
|
||||
-> Result<KeywordDiscriminant, ParseError<'i>>;
|
||||
pub type KeywordParser = for<'a, 'i, 't> fn(
|
||||
context: &'a ParserContext,
|
||||
input: &'a mut Parser<'i, 't>,
|
||||
) -> Result<KeywordDiscriminant, ParseError<'i>>;
|
||||
|
||||
/// An evaluator for a given media feature.
|
||||
///
|
||||
|
|
|
@ -134,10 +134,11 @@ impl RangeOrOperator {
|
|||
|
||||
match range_or_op {
|
||||
RangeOrOperator::Range(range) => {
|
||||
cmp == Ordering::Equal || match range {
|
||||
Range::Min => cmp == Ordering::Greater,
|
||||
Range::Max => cmp == Ordering::Less,
|
||||
}
|
||||
cmp == Ordering::Equal ||
|
||||
match range {
|
||||
Range::Min => cmp == Ordering::Greater,
|
||||
Range::Max => cmp == Ordering::Less,
|
||||
}
|
||||
},
|
||||
RangeOrOperator::Operator(op) => match op {
|
||||
Operator::Equal => cmp == Ordering::Equal,
|
||||
|
@ -344,7 +345,7 @@ impl MediaFeatureExpression {
|
|||
Err(()) => {
|
||||
return Err(location.new_custom_error(
|
||||
StyleParseErrorKind::MediaQueryExpectedFeatureName(ident.clone()),
|
||||
))
|
||||
));
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -74,21 +74,22 @@ impl MediaList {
|
|||
pub fn evaluate(&self, device: &Device, quirks_mode: QuirksMode) -> bool {
|
||||
// Check if it is an empty media query list or any queries match.
|
||||
// https://drafts.csswg.org/mediaqueries-4/#mq-list
|
||||
self.media_queries.is_empty() || self.media_queries.iter().any(|mq| {
|
||||
let media_match = mq.media_type.matches(device.media_type());
|
||||
self.media_queries.is_empty() ||
|
||||
self.media_queries.iter().any(|mq| {
|
||||
let media_match = mq.media_type.matches(device.media_type());
|
||||
|
||||
// Check if the media condition match.
|
||||
let query_match = media_match && mq
|
||||
.condition
|
||||
.as_ref()
|
||||
.map_or(true, |c| c.matches(device, quirks_mode));
|
||||
// Check if the media condition match.
|
||||
let query_match = media_match &&
|
||||
mq.condition
|
||||
.as_ref()
|
||||
.map_or(true, |c| c.matches(device, quirks_mode));
|
||||
|
||||
// Apply the logical NOT qualifier to the result
|
||||
match mq.qualifier {
|
||||
Some(Qualifier::Not) => !query_match,
|
||||
_ => query_match,
|
||||
}
|
||||
})
|
||||
// Apply the logical NOT qualifier to the result
|
||||
match mq.qualifier {
|
||||
Some(Qualifier::Not) => !query_match,
|
||||
_ => query_match,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Whether this `MediaList` contains no media queries.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue