mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
style: Unship line-height: -moz-block-height.
They're only used in forms.css, and only for some anonymous content, which are not content-accessible in the first place. The only place where this could be exposed is calling getComputedStyle(input, "::placeholder"), so I think this should be pretty safe, but I've added a pref just in case. While at it, also derive the Parse implementation. Less code is better. Differential Revision: https://phabricator.services.mozilla.com/D25118
This commit is contained in:
parent
bd77cd64b9
commit
7b14499665
2 changed files with 10 additions and 27 deletions
|
@ -61,6 +61,14 @@ impl<Value> Spacing<Value> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "gecko")]
|
||||||
|
fn line_height_moz_block_height_enabled(context: &ParserContext) -> bool {
|
||||||
|
use crate::gecko_bindings::structs;
|
||||||
|
context.in_ua_sheet() || unsafe {
|
||||||
|
structs::StaticPrefs_sVarCache_layout_css_line_height_moz_block_height_content_enabled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A generic value for the `line-height` property.
|
/// A generic value for the `line-height` property.
|
||||||
#[derive(
|
#[derive(
|
||||||
Animate,
|
Animate,
|
||||||
|
@ -73,6 +81,7 @@ impl<Value> Spacing<Value> {
|
||||||
SpecifiedValueInfo,
|
SpecifiedValueInfo,
|
||||||
ToAnimatedValue,
|
ToAnimatedValue,
|
||||||
ToCss,
|
ToCss,
|
||||||
|
Parse,
|
||||||
)]
|
)]
|
||||||
#[repr(C, u8)]
|
#[repr(C, u8)]
|
||||||
pub enum GenericLineHeight<N, L> {
|
pub enum GenericLineHeight<N, L> {
|
||||||
|
@ -80,6 +89,7 @@ pub enum GenericLineHeight<N, L> {
|
||||||
Normal,
|
Normal,
|
||||||
/// `-moz-block-height`
|
/// `-moz-block-height`
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
|
#[parse(condition = "line_height_moz_block_height_enabled")]
|
||||||
MozBlockHeight,
|
MozBlockHeight,
|
||||||
/// `<number>`
|
/// `<number>`
|
||||||
Number(N),
|
Number(N),
|
||||||
|
|
|
@ -73,33 +73,6 @@ impl Parse for WordSpacing {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Parse for LineHeight {
|
|
||||||
fn parse<'i, 't>(
|
|
||||||
context: &ParserContext,
|
|
||||||
input: &mut Parser<'i, 't>,
|
|
||||||
) -> Result<Self, ParseError<'i>> {
|
|
||||||
if let Ok(number) = input.try(|i| NonNegativeNumber::parse(context, i)) {
|
|
||||||
return Ok(GenericLineHeight::Number(number));
|
|
||||||
}
|
|
||||||
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()?;
|
|
||||||
match ident {
|
|
||||||
ref ident if ident.eq_ignore_ascii_case("normal") => Ok(GenericLineHeight::Normal),
|
|
||||||
#[cfg(feature = "gecko")]
|
|
||||||
ref ident if ident.eq_ignore_ascii_case("-moz-block-height") => {
|
|
||||||
Ok(GenericLineHeight::MozBlockHeight)
|
|
||||||
},
|
|
||||||
ident => {
|
|
||||||
Err(location
|
|
||||||
.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone())))
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl ToComputedValue for LineHeight {
|
impl ToComputedValue for LineHeight {
|
||||||
type ComputedValue = ComputedLineHeight;
|
type ComputedValue = ComputedLineHeight;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue