mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Fix font-size keywords parsing.
This commit is contained in:
parent
b30c4f70f9
commit
9f48dcd858
3 changed files with 6 additions and 4 deletions
|
@ -1912,14 +1912,14 @@ pub mod longhands {
|
||||||
}
|
}
|
||||||
/// <length> | <percentage> | <absolute-size> | <relative-size>
|
/// <length> | <percentage> | <absolute-size> | <relative-size>
|
||||||
pub fn parse(_context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> {
|
pub fn parse(_context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> {
|
||||||
let value = try!(input.try(specified::LengthOrPercentage::parse_non_negative));
|
input.try(specified::LengthOrPercentage::parse_non_negative)
|
||||||
match value {
|
.and_then(|value| match value {
|
||||||
specified::LengthOrPercentage::Length(value) => Ok(value),
|
specified::LengthOrPercentage::Length(value) => Ok(value),
|
||||||
specified::LengthOrPercentage::Percentage(value) =>
|
specified::LengthOrPercentage::Percentage(value) =>
|
||||||
Ok(specified::Length::FontRelative(specified::FontRelativeLength::Em(value.0))),
|
Ok(specified::Length::FontRelative(specified::FontRelativeLength::Em(value.0))),
|
||||||
// FIXME(dzbarsky) handle calc for font-size
|
// FIXME(dzbarsky) handle calc for font-size
|
||||||
specified::LengthOrPercentage::Calc(_) => return Err(())
|
specified::LengthOrPercentage::Calc(_) => Err(())
|
||||||
}
|
})
|
||||||
.or_else(|()| {
|
.or_else(|()| {
|
||||||
match_ignore_ascii_case! { try!(input.expect_ident()),
|
match_ignore_ascii_case! { try!(input.expect_ident()),
|
||||||
"xx-small" => Ok(specified::Length::Absolute(Au::from_px(MEDIUM_PX) * 3 / 5)),
|
"xx-small" => Ok(specified::Length::Absolute(Au::from_px(MEDIUM_PX) * 3 / 5)),
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<title>font-size (issues #1435, #3417)</title>
|
<title>font-size (issues #1435, #3417)</title>
|
||||||
|
<style>p { margin: .5em }</style>
|
||||||
<body style="font-size: 20px">
|
<body style="font-size: 20px">
|
||||||
<p style="font-size: 24pt">24pt is 32px.
|
<p style="font-size: 24pt">24pt is 32px.
|
||||||
<p style="font-size: 2em">2em is 40px.
|
<p style="font-size: 2em">2em is 40px.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<title>font-size (issues #1435, #3417)</title>
|
<title>font-size (issues #1435, #3417)</title>
|
||||||
|
<style>p { margin: .5em }</style>
|
||||||
<body>
|
<body>
|
||||||
<p style="font-size: 32px">24pt is 32px.
|
<p style="font-size: 32px">24pt is 32px.
|
||||||
<p style="font-size: 40px">2em is 40px.
|
<p style="font-size: 40px">2em is 40px.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue