mirror of
https://github.com/servo/servo.git
synced 2025-10-08 12:39:30 +01:00
style: Rename Expression to MediaFeatureExpression.
Which is more appropriate, given it represents a `<media-feature>` per spec, and expression is a bit overloaded :) Bug: 1422225 Reviewed-by: xidorn MozReview-Commit-ID: Fed1nJhHxDu
This commit is contained in:
parent
ef14e65636
commit
e7cc548c35
5 changed files with 31 additions and 32 deletions
|
@ -170,9 +170,9 @@ pub enum ExpressionKind {
|
|||
/// <http://dev.w3.org/csswg/mediaqueries-3/#media1>
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
|
||||
pub struct Expression(pub ExpressionKind);
|
||||
pub struct MediaFeatureExpression(pub ExpressionKind);
|
||||
|
||||
impl Expression {
|
||||
impl MediaFeatureExpression {
|
||||
/// The kind of expression we're, just for unit testing.
|
||||
///
|
||||
/// Eventually this will become servo-only.
|
||||
|
@ -196,7 +196,7 @@ impl Expression {
|
|||
let name = input.expect_ident_cloned()?;
|
||||
input.expect_colon()?;
|
||||
// TODO: Handle other media features
|
||||
Ok(Expression(match_ignore_ascii_case! { &name,
|
||||
Ok(MediaFeatureExpression(match_ignore_ascii_case! { &name,
|
||||
"min-width" => {
|
||||
ExpressionKind::Width(Range::Min(specified::Length::parse_non_negative(context, input)?))
|
||||
},
|
||||
|
@ -206,7 +206,7 @@ impl Expression {
|
|||
"width" => {
|
||||
ExpressionKind::Width(Range::Eq(specified::Length::parse_non_negative(context, input)?))
|
||||
},
|
||||
_ => return Err(input.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(name.clone())))
|
||||
_ => return Err(input.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(name)))
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ impl Expression {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToCss for Expression {
|
||||
impl ToCss for MediaFeatureExpression {
|
||||
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
||||
where
|
||||
W: Write,
|
||||
|
@ -246,8 +246,8 @@ impl ToCss for Expression {
|
|||
|
||||
/// An enumeration that represents a ranged value.
|
||||
///
|
||||
/// Only public for testing, implementation details of `Expression` may change
|
||||
/// for Stylo.
|
||||
/// Only public for testing, implementation details of `MediaFeatureExpression`
|
||||
/// may change for Stylo.
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
|
||||
pub enum Range<T> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue