style: Fix Gecko and Servo builds, and appease tidy.

This commit is contained in:
Emilio Cobos Álvarez 2019-03-26 16:23:12 +01:00
parent f9ce3a9da2
commit ff41f82720
16 changed files with 155 additions and 78 deletions

View file

@ -135,7 +135,9 @@ impl FontRelativeLength {
base_size: FontBaseSize,
orientation: FontMetricsOrientation,
) -> FontMetrics {
context.font_metrics_provider.query(context, base_size, orientation)
context
.font_metrics_provider
.query(context, base_size, orientation)
}
let reference_font_size = base_size.resolve(context);
@ -160,13 +162,12 @@ impl FontRelativeLength {
if context.for_non_inherited_property.is_some() {
context.rule_cache_conditions.borrow_mut().set_uncacheable();
}
context.builder.add_flags(ComputedValueFlags::DEPENDS_ON_FONT_METRICS);
context
.builder
.add_flags(ComputedValueFlags::DEPENDS_ON_FONT_METRICS);
// The x-height is an intrinsically horizontal metric.
let metrics = query_font_metrics(
context,
base_size,
FontMetricsOrientation::Horizontal
);
let metrics =
query_font_metrics(context, base_size, FontMetricsOrientation::Horizontal);
let reference_size = metrics.x_height.unwrap_or_else(|| {
// https://drafts.csswg.org/css-values/#ex
//
@ -182,7 +183,9 @@ impl FontRelativeLength {
if context.for_non_inherited_property.is_some() {
context.rule_cache_conditions.borrow_mut().set_uncacheable();
}
context.builder.add_flags(ComputedValueFlags::DEPENDS_ON_FONT_METRICS);
context
.builder
.add_flags(ComputedValueFlags::DEPENDS_ON_FONT_METRICS);
// https://drafts.csswg.org/css-values/#ch:
//
// Equal to the used advance measure of the “0” (ZERO,
@ -190,11 +193,8 @@ impl FontRelativeLength {
// measure of a glyph is its advance width or height,
// whichever is in the inline axis of the element.)
//
let metrics = query_font_metrics(
context,
base_size,
FontMetricsOrientation::MatchContext,
);
let metrics =
query_font_metrics(context, base_size, FontMetricsOrientation::MatchContext);
let reference_size = metrics.zero_advance_measure.unwrap_or_else(|| {
// https://drafts.csswg.org/css-values/#ch
//

View file

@ -125,7 +125,19 @@ impl Parse for Quotes {
}
/// Specified and computed `-moz-list-reversed` property (for UA sheets only).
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)]
#[derive(
Clone,
Copy,
Debug,
Eq,
Hash,
MallocSizeOf,
Parse,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
)]
#[repr(u8)]
pub enum MozListReversed {
/// the initial value

View file

@ -282,7 +282,6 @@ bitflags! {
}
}
impl Parse for TextDecorationLine {
/// none | [ underline || overline || line-through || blink ]
fn parse<'i, 't>(
@ -318,7 +317,7 @@ impl Parse for TextDecorationLine {
}
if result.contains(flag) {
return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError))
return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError));
}
result.insert(flag)
@ -341,6 +340,13 @@ impl ToCss for TextDecorationLine {
return dest.write_str("none");
}
#[cfg(feature = "gecko")]
{
if *self == TextDecorationLine::COLOR_OVERRIDE {
return Ok(());
}
}
let mut writer = SequenceWriter::new(dest, " ");
let mut any = false;
@ -358,7 +364,7 @@ impl ToCss for TextDecorationLine {
maybe_write!(LINE_THROUGH => "line-through");
maybe_write!(BLINK => "blink");
debug_assert!(any || *self == TextDecorationLine::COLOR_OVERRIDE);
debug_assert!(any);
Ok(())
}