mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +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
|
@ -316,8 +316,8 @@ impl Parse for ShapeRadius {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if let Ok(lop) = input.try(|i| NonNegativeLengthPercentage::parse(context, i)) {
|
||||
return Ok(generic::ShapeRadius::Length(lop));
|
||||
if let Ok(lp) = input.try(|i| NonNegativeLengthPercentage::parse(context, i)) {
|
||||
return Ok(generic::ShapeRadius::Length(lp));
|
||||
}
|
||||
|
||||
try_match_ident_ignore_ascii_case! { input,
|
||||
|
|
|
@ -278,10 +278,10 @@ impl Parse for VerticalAlign {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if let Ok(lop) =
|
||||
if let Ok(lp) =
|
||||
input.try(|i| LengthPercentage::parse_quirky(context, i, AllowQuirks::Yes))
|
||||
{
|
||||
return Ok(GenericVerticalAlign::Length(lop));
|
||||
return Ok(GenericVerticalAlign::Length(lp));
|
||||
}
|
||||
|
||||
try_match_ident_ignore_ascii_case! { input,
|
||||
|
|
|
@ -985,10 +985,10 @@ impl FontSize {
|
|||
input: &mut Parser<'i, 't>,
|
||||
allow_quirks: AllowQuirks,
|
||||
) -> Result<FontSize, ParseError<'i>> {
|
||||
if let Ok(lop) =
|
||||
if let Ok(lp) =
|
||||
input.try(|i| LengthPercentage::parse_non_negative_quirky(context, i, allow_quirks))
|
||||
{
|
||||
return Ok(FontSize::Length(lop));
|
||||
return Ok(FontSize::Length(lp));
|
||||
}
|
||||
|
||||
if let Ok(kw) = input.try(KeywordSize::parse) {
|
||||
|
|
|
@ -32,8 +32,8 @@ impl Parse for TrackBreadth<LengthPercentage> {
|
|||
context: &ParserContext,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if let Ok(lop) = input.try(|i| LengthPercentage::parse_non_negative(context, i)) {
|
||||
return Ok(TrackBreadth::Breadth(lop));
|
||||
if let Ok(lp) = input.try(|i| LengthPercentage::parse_non_negative(context, i)) {
|
||||
return Ok(TrackBreadth::Breadth(lp));
|
||||
}
|
||||
|
||||
if let Ok(f) = input.try(parse_flex) {
|
||||
|
@ -57,7 +57,7 @@ impl Parse for TrackSize<LengthPercentage> {
|
|||
return input.parse_nested_block(|input| {
|
||||
let inflexible_breadth =
|
||||
match input.try(|i| LengthPercentage::parse_non_negative(context, i)) {
|
||||
Ok(lop) => TrackBreadth::Breadth(lop),
|
||||
Ok(lp) => TrackBreadth::Breadth(lp),
|
||||
Err(..) => {
|
||||
let keyword = TrackKeyword::parse(input)?;
|
||||
TrackBreadth::Keyword(keyword)
|
||||
|
@ -73,9 +73,9 @@ impl Parse for TrackSize<LengthPercentage> {
|
|||
}
|
||||
|
||||
input.expect_function_matching("fit-content")?;
|
||||
let lop =
|
||||
let lp =
|
||||
input.parse_nested_block(|i| LengthPercentage::parse_non_negative(context, i))?;
|
||||
Ok(TrackSize::FitContent(lop))
|
||||
Ok(TrackSize::FitContent(lp))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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"));
|
||||
|
|
|
@ -83,8 +83,8 @@ impl Parse for LineHeight {
|
|||
if let Ok(number) = input.try(|i| NonNegativeNumber::parse(context, i)) {
|
||||
return Ok(GenericLineHeight::Number(number));
|
||||
}
|
||||
if let Ok(nlop) = input.try(|i| NonNegativeLengthPercentage::parse(context, i)) {
|
||||
return Ok(GenericLineHeight::Length(nlop));
|
||||
if let Ok(nlp) = input.try(|i| NonNegativeLengthPercentage::parse(context, i)) {
|
||||
return Ok(GenericLineHeight::Length(nlp));
|
||||
}
|
||||
let location = input.current_source_location();
|
||||
let ident = input.expect_ident()?;
|
||||
|
@ -116,8 +116,8 @@ impl ToComputedValue for LineHeight {
|
|||
GenericLineHeight::Number(number) => {
|
||||
GenericLineHeight::Number(number.to_computed_value(context))
|
||||
},
|
||||
GenericLineHeight::Length(ref non_negative_lop) => {
|
||||
let result = match non_negative_lop.0 {
|
||||
GenericLineHeight::Length(ref non_negative_lp) => {
|
||||
let result = match non_negative_lp.0 {
|
||||
LengthPercentage::Length(NoCalcLength::Absolute(ref abs)) => {
|
||||
context
|
||||
.maybe_zoom_text(abs.to_computed_value(context).into())
|
||||
|
|
|
@ -235,7 +235,7 @@ impl Parse for Transform {
|
|||
pub enum OriginComponent<S> {
|
||||
/// `center`
|
||||
Center,
|
||||
/// `<lop>`
|
||||
/// `<length-percentage>`
|
||||
Length(LengthPercentage),
|
||||
/// `<side>`
|
||||
Side(S),
|
||||
|
@ -306,8 +306,8 @@ where
|
|||
if input.try(|i| i.expect_ident_matching("center")).is_ok() {
|
||||
return Ok(OriginComponent::Center);
|
||||
}
|
||||
if let Ok(lop) = input.try(|i| LengthPercentage::parse(context, i)) {
|
||||
return Ok(OriginComponent::Length(lop));
|
||||
if let Ok(lp) = input.try(|i| LengthPercentage::parse(context, i)) {
|
||||
return Ok(OriginComponent::Length(lp));
|
||||
}
|
||||
let keyword = S::parse(context, input)?;
|
||||
Ok(OriginComponent::Side(keyword))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue