mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Manually rename some variables.
lop is not an acceptable variable name for LengthPercentage. Differential Revision: https://phabricator.services.mozilla.com/D15813
This commit is contained in:
parent
daf1f02feb
commit
80651fde47
14 changed files with 92 additions and 92 deletions
|
@ -38,9 +38,9 @@ pub type VerticalPosition = PositionComponent<Y>;
|
|||
pub enum PositionComponent<S> {
|
||||
/// `center`
|
||||
Center,
|
||||
/// `<lop>`
|
||||
/// `<length-percentage>`
|
||||
Length(LengthPercentage),
|
||||
/// `<side> <lop>?`
|
||||
/// `<side> <length-percentage>?`
|
||||
Side(S, Option<LengthPercentage>),
|
||||
}
|
||||
|
||||
|
@ -113,22 +113,22 @@ impl Position {
|
|||
let y_pos = PositionComponent::Center;
|
||||
return Ok(Self::new(x_pos, y_pos));
|
||||
},
|
||||
Ok(PositionComponent::Side(x_keyword, lop)) => {
|
||||
Ok(PositionComponent::Side(x_keyword, lp)) => {
|
||||
if input.try(|i| i.expect_ident_matching("center")).is_ok() {
|
||||
let x_pos = PositionComponent::Side(x_keyword, lop);
|
||||
let x_pos = PositionComponent::Side(x_keyword, lp);
|
||||
let y_pos = PositionComponent::Center;
|
||||
return Ok(Self::new(x_pos, y_pos));
|
||||
}
|
||||
if let Ok(y_keyword) = input.try(Y::parse) {
|
||||
let y_lop = input
|
||||
let y_lp = input
|
||||
.try(|i| LengthPercentage::parse_quirky(context, i, allow_quirks))
|
||||
.ok();
|
||||
let x_pos = PositionComponent::Side(x_keyword, lop);
|
||||
let y_pos = PositionComponent::Side(y_keyword, y_lop);
|
||||
let x_pos = PositionComponent::Side(x_keyword, lp);
|
||||
let y_pos = PositionComponent::Side(y_keyword, y_lp);
|
||||
return Ok(Self::new(x_pos, y_pos));
|
||||
}
|
||||
let x_pos = PositionComponent::Side(x_keyword, None);
|
||||
let y_pos = lop.map_or(PositionComponent::Center, PositionComponent::Length);
|
||||
let y_pos = lp.map_or(PositionComponent::Center, PositionComponent::Length);
|
||||
return Ok(Self::new(x_pos, y_pos));
|
||||
},
|
||||
Ok(x_pos @ PositionComponent::Length(_)) => {
|
||||
|
@ -136,10 +136,10 @@ impl Position {
|
|||
let y_pos = PositionComponent::Side(y_keyword, None);
|
||||
return Ok(Self::new(x_pos, y_pos));
|
||||
}
|
||||
if let Ok(y_lop) =
|
||||
if let Ok(y_lp) =
|
||||
input.try(|i| LengthPercentage::parse_quirky(context, i, allow_quirks))
|
||||
{
|
||||
let y_pos = PositionComponent::Length(y_lop);
|
||||
let y_pos = PositionComponent::Length(y_lp);
|
||||
return Ok(Self::new(x_pos, y_pos));
|
||||
}
|
||||
let y_pos = PositionComponent::Center;
|
||||
|
@ -149,23 +149,23 @@ impl Position {
|
|||
Err(_) => {},
|
||||
}
|
||||
let y_keyword = Y::parse(input)?;
|
||||
let lop_and_x_pos: Result<_, ParseError> = input.try(|i| {
|
||||
let y_lop = i
|
||||
let lp_and_x_pos: Result<_, ParseError> = input.try(|i| {
|
||||
let y_lp = i
|
||||
.try(|i| LengthPercentage::parse_quirky(context, i, allow_quirks))
|
||||
.ok();
|
||||
if let Ok(x_keyword) = i.try(X::parse) {
|
||||
let x_lop = i
|
||||
let x_lp = i
|
||||
.try(|i| LengthPercentage::parse_quirky(context, i, allow_quirks))
|
||||
.ok();
|
||||
let x_pos = PositionComponent::Side(x_keyword, x_lop);
|
||||
return Ok((y_lop, x_pos));
|
||||
let x_pos = PositionComponent::Side(x_keyword, x_lp);
|
||||
return Ok((y_lp, x_pos));
|
||||
};
|
||||
i.expect_ident_matching("center")?;
|
||||
let x_pos = PositionComponent::Center;
|
||||
Ok((y_lop, x_pos))
|
||||
Ok((y_lp, x_pos))
|
||||
});
|
||||
if let Ok((y_lop, x_pos)) = lop_and_x_pos {
|
||||
let y_pos = PositionComponent::Side(y_keyword, y_lop);
|
||||
if let Ok((y_lp, x_pos)) = lp_and_x_pos {
|
||||
let y_pos = PositionComponent::Side(y_keyword, y_lp);
|
||||
return Ok(Self::new(x_pos, y_pos));
|
||||
}
|
||||
let x_pos = PositionComponent::Center;
|
||||
|
@ -188,18 +188,18 @@ impl ToCss for Position {
|
|||
match (&self.horizontal, &self.vertical) {
|
||||
(
|
||||
x_pos @ &PositionComponent::Side(_, Some(_)),
|
||||
&PositionComponent::Length(ref y_lop),
|
||||
&PositionComponent::Length(ref y_lp),
|
||||
) => {
|
||||
x_pos.to_css(dest)?;
|
||||
dest.write_str(" top ")?;
|
||||
y_lop.to_css(dest)
|
||||
y_lp.to_css(dest)
|
||||
},
|
||||
(
|
||||
&PositionComponent::Length(ref x_lop),
|
||||
&PositionComponent::Length(ref x_lp),
|
||||
y_pos @ &PositionComponent::Side(_, Some(_)),
|
||||
) => {
|
||||
dest.write_str("left ")?;
|
||||
x_lop.to_css(dest)?;
|
||||
x_lp.to_css(dest)?;
|
||||
dest.write_str(" ")?;
|
||||
y_pos.to_css(dest)
|
||||
},
|
||||
|
@ -231,14 +231,14 @@ impl<S: Parse> PositionComponent<S> {
|
|||
if input.try(|i| i.expect_ident_matching("center")).is_ok() {
|
||||
return Ok(PositionComponent::Center);
|
||||
}
|
||||
if let Ok(lop) = input.try(|i| LengthPercentage::parse_quirky(context, i, allow_quirks)) {
|
||||
return Ok(PositionComponent::Length(lop));
|
||||
if let Ok(lp) = input.try(|i| LengthPercentage::parse_quirky(context, i, allow_quirks)) {
|
||||
return Ok(PositionComponent::Length(lp));
|
||||
}
|
||||
let keyword = S::parse(context, input)?;
|
||||
let lop = input
|
||||
let lp = input
|
||||
.try(|i| LengthPercentage::parse_quirky(context, i, allow_quirks))
|
||||
.ok();
|
||||
Ok(PositionComponent::Side(keyword, lop))
|
||||
Ok(PositionComponent::Side(keyword, lp))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -371,10 +371,10 @@ impl LegacyPosition {
|
|||
return Ok(Self::new(x_pos, y_pos));
|
||||
}
|
||||
let x_pos = OriginComponent::Side(x_keyword);
|
||||
if let Ok(y_lop) =
|
||||
if let Ok(y_lp) =
|
||||
input.try(|i| LengthPercentage::parse_quirky(context, i, allow_quirks))
|
||||
{
|
||||
return Ok(Self::new(x_pos, OriginComponent::Length(y_lop)));
|
||||
return Ok(Self::new(x_pos, OriginComponent::Length(y_lp)));
|
||||
}
|
||||
let _ = input.try(|i| i.expect_ident_matching("center"));
|
||||
return Ok(Self::new(x_pos, OriginComponent::Center));
|
||||
|
@ -384,10 +384,10 @@ impl LegacyPosition {
|
|||
let y_pos = OriginComponent::Side(y_keyword);
|
||||
return Ok(Self::new(x_pos, y_pos));
|
||||
}
|
||||
if let Ok(y_lop) =
|
||||
if let Ok(y_lp) =
|
||||
input.try(|i| LengthPercentage::parse_quirky(context, i, allow_quirks))
|
||||
{
|
||||
let y_pos = OriginComponent::Length(y_lop);
|
||||
let y_pos = OriginComponent::Length(y_lp);
|
||||
return Ok(Self::new(x_pos, y_pos));
|
||||
}
|
||||
let _ = input.try(|i| i.expect_ident_matching("center"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue