mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Fix Servo build, and rustfmt recent changes.
This commit is contained in:
parent
9eaadc6860
commit
cd3b0c23fa
15 changed files with 90 additions and 60 deletions
|
@ -9,11 +9,15 @@ use crate::gecko_bindings::sugar::refptr::RefPtr;
|
|||
#[cfg(feature = "gecko")]
|
||||
use crate::gecko_bindings::{bindings, structs};
|
||||
use crate::values::animated::{ToAnimatedValue, ToAnimatedZero};
|
||||
use crate::values::computed::{Angle, Context, Integer, Length, NonNegativeLength, NonNegativePercentage};
|
||||
use crate::values::computed::{
|
||||
Angle, Context, Integer, Length, NonNegativeLength, NonNegativePercentage,
|
||||
};
|
||||
use crate::values::computed::{Number, Percentage, ToComputedValue};
|
||||
use crate::values::generics::{font as generics, NonNegative};
|
||||
use crate::values::generics::font::{FeatureTagValue, FontSettings, VariationValue};
|
||||
use crate::values::specified::font::{self as specified, KeywordInfo, MAX_FONT_WEIGHT, MIN_FONT_WEIGHT};
|
||||
use crate::values::generics::{font as generics, NonNegative};
|
||||
use crate::values::specified::font::{
|
||||
self as specified, KeywordInfo, MAX_FONT_WEIGHT, MIN_FONT_WEIGHT,
|
||||
};
|
||||
use crate::values::specified::length::{FontBaseSize, NoCalcLength};
|
||||
use crate::values::CSSFloat;
|
||||
use crate::Atom;
|
||||
|
|
|
@ -118,7 +118,9 @@ impl<I> Deref for CounterSetOrReset<I> {
|
|||
ToShmem,
|
||||
)]
|
||||
#[repr(transparent)]
|
||||
pub struct GenericCounters<I>(#[css(iterable, if_empty = "none")] crate::OwnedSlice<GenericCounterPair<I>>);
|
||||
pub struct GenericCounters<I>(
|
||||
#[css(iterable, if_empty = "none")] crate::OwnedSlice<GenericCounterPair<I>>,
|
||||
);
|
||||
pub use self::GenericCounters as Counters;
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
|
|
|
@ -171,7 +171,6 @@ impl Parse for FontTag {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/// A generic value for the `font-style` property.
|
||||
///
|
||||
/// https://drafts.csswg.org/css-fonts-4/#font-style-prop
|
||||
|
|
|
@ -309,4 +309,10 @@ impl<L> ClipRectOrAuto<L> {
|
|||
pub fn auto() -> Self {
|
||||
ClipRectOrAuto::Auto
|
||||
}
|
||||
|
||||
/// Returns whether this value is the `auto` value.
|
||||
#[inline]
|
||||
pub fn is_auto(&self) -> bool {
|
||||
matches!(*self, ClipRectOrAuto::Auto)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
use crate::computed_values::list_style_type::T as ListStyleType;
|
||||
use crate::parser::{Parse, ParserContext};
|
||||
use crate::values::generics::counters as generics;
|
||||
use crate::values::generics::counters::GenericCounterIncrement;
|
||||
use crate::values::generics::counters::CounterPair;
|
||||
use crate::values::generics::counters::GenericCounterIncrement;
|
||||
use crate::values::generics::counters::GenericCounterSetOrReset;
|
||||
#[cfg(feature = "gecko")]
|
||||
use crate::values::generics::CounterStyle;
|
||||
|
|
|
@ -12,8 +12,8 @@ use crate::values::computed::font::{FamilyName, FontFamilyList, FontStyleAngle,
|
|||
use crate::values::computed::{font as computed, Length, NonNegativeLength};
|
||||
use crate::values::computed::{Angle as ComputedAngle, Percentage as ComputedPercentage};
|
||||
use crate::values::computed::{CSSPixelLength, Context, ToComputedValue};
|
||||
use crate::values::generics::font::{self as generics, FeatureTagValue, FontSettings, FontTag};
|
||||
use crate::values::generics::font::VariationValue;
|
||||
use crate::values::generics::font::{self as generics, FeatureTagValue, FontSettings, FontTag};
|
||||
use crate::values::generics::NonNegative;
|
||||
use crate::values::specified::length::{FontBaseSize, AU_PER_PT, AU_PER_PX};
|
||||
use crate::values::specified::{AllowQuirks, Angle, Integer, LengthPercentage};
|
||||
|
@ -877,19 +877,17 @@ impl ToComputedValue for KeywordSize {
|
|||
impl FontSize {
|
||||
/// <https://html.spec.whatwg.org/multipage/#rules-for-parsing-a-legacy-font-size>
|
||||
pub fn from_html_size(size: u8) -> Self {
|
||||
FontSize::Keyword(
|
||||
KeywordInfo::new(match size {
|
||||
// If value is less than 1, let it be 1.
|
||||
0 | 1 => KeywordSize::XSmall,
|
||||
2 => KeywordSize::Small,
|
||||
3 => KeywordSize::Medium,
|
||||
4 => KeywordSize::Large,
|
||||
5 => KeywordSize::XLarge,
|
||||
6 => KeywordSize::XXLarge,
|
||||
// If value is greater than 7, let it be 7.
|
||||
_ => KeywordSize::XXXLarge,
|
||||
})
|
||||
)
|
||||
FontSize::Keyword(KeywordInfo::new(match size {
|
||||
// If value is less than 1, let it be 1.
|
||||
0 | 1 => KeywordSize::XSmall,
|
||||
2 => KeywordSize::Small,
|
||||
3 => KeywordSize::Medium,
|
||||
4 => KeywordSize::Large,
|
||||
5 => KeywordSize::XLarge,
|
||||
6 => KeywordSize::XXLarge,
|
||||
// If value is greater than 7, let it be 7.
|
||||
_ => KeywordSize::XXXLarge,
|
||||
}))
|
||||
}
|
||||
|
||||
/// Compute it against a given base font size
|
||||
|
@ -924,9 +922,7 @@ impl FontSize {
|
|||
FontSize::Length(LengthPercentage::Length(NoCalcLength::Absolute(ref l))) => {
|
||||
context.maybe_zoom_text(l.to_computed_value(context))
|
||||
},
|
||||
FontSize::Length(LengthPercentage::Length(ref l)) => {
|
||||
l.to_computed_value(context)
|
||||
},
|
||||
FontSize::Length(LengthPercentage::Length(ref l)) => l.to_computed_value(context),
|
||||
FontSize::Length(LengthPercentage::Percentage(pc)) => {
|
||||
// If the parent font was keyword-derived, this is too.
|
||||
// Tack the % onto the factor
|
||||
|
@ -983,8 +979,7 @@ impl FontSize {
|
|||
},
|
||||
FontSize::Larger => {
|
||||
info = compose_keyword(LARGER_FONT_SIZE_RATIO);
|
||||
FontRelativeLength::Em(LARGER_FONT_SIZE_RATIO)
|
||||
.to_computed_value(context, base_size)
|
||||
FontRelativeLength::Em(LARGER_FONT_SIZE_RATIO).to_computed_value(context, base_size)
|
||||
},
|
||||
|
||||
FontSize::System(_) => {
|
||||
|
@ -994,7 +989,13 @@ impl FontSize {
|
|||
}
|
||||
#[cfg(feature = "gecko")]
|
||||
{
|
||||
context.cached_system_font.as_ref().unwrap().font_size.size.0
|
||||
context
|
||||
.cached_system_font
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.font_size
|
||||
.size
|
||||
.0
|
||||
}
|
||||
},
|
||||
};
|
||||
|
@ -1115,7 +1116,15 @@ pub enum VariantAlternates {
|
|||
}
|
||||
|
||||
#[derive(
|
||||
Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToResolvedValue, ToShmem,
|
||||
Clone,
|
||||
Debug,
|
||||
Default,
|
||||
MallocSizeOf,
|
||||
PartialEq,
|
||||
SpecifiedValueInfo,
|
||||
ToCss,
|
||||
ToResolvedValue,
|
||||
ToShmem,
|
||||
)]
|
||||
#[repr(transparent)]
|
||||
/// List of Variant Alternates
|
||||
|
@ -1190,7 +1199,7 @@ impl Parse for FontVariantAlternates {
|
|||
.try(|input| input.expect_ident_matching("normal"))
|
||||
.is_ok()
|
||||
{
|
||||
return Ok(FontVariantAlternates::Value(Default::default()))
|
||||
return Ok(FontVariantAlternates::Value(Default::default()));
|
||||
}
|
||||
|
||||
let mut alternates = Vec::new();
|
||||
|
|
|
@ -706,7 +706,7 @@ impl ClipRectOrAuto {
|
|||
allow_quirks: AllowQuirks,
|
||||
) -> Result<Self, ParseError<'i>> {
|
||||
if let Ok(v) = input.try(|i| ClipRect::parse_quirky(context, i, allow_quirks)) {
|
||||
return Ok(generics::GenericClipRectOrAuto::Rect(v))
|
||||
return Ok(generics::GenericClipRectOrAuto::Rect(v));
|
||||
}
|
||||
input.expect_ident_matching("auto")?;
|
||||
Ok(generics::GenericClipRectOrAuto::Auto)
|
||||
|
|
|
@ -89,8 +89,7 @@ impl ToComputedValue for LineHeight {
|
|||
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))
|
||||
context.maybe_zoom_text(abs.to_computed_value(context))
|
||||
},
|
||||
LengthPercentage::Length(ref length) => length.to_computed_value(context),
|
||||
LengthPercentage::Percentage(ref p) => FontRelativeLength::Em(p.0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue