mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
style: Reformat recent changes.
This commit is contained in:
parent
9a8cee2800
commit
5aeab7adb1
17 changed files with 70 additions and 53 deletions
|
@ -515,11 +515,7 @@ impl<'a> CustomPropertiesBuilder<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Cascade a given custom property declaration.
|
/// Cascade a given custom property declaration.
|
||||||
pub fn cascade(
|
pub fn cascade(&mut self, declaration: &'a CustomDeclaration, origin: Origin) {
|
||||||
&mut self,
|
|
||||||
declaration: &'a CustomDeclaration,
|
|
||||||
origin: Origin,
|
|
||||||
) {
|
|
||||||
let CustomDeclaration {
|
let CustomDeclaration {
|
||||||
ref name,
|
ref name,
|
||||||
ref value,
|
ref value,
|
||||||
|
|
|
@ -116,10 +116,7 @@ impl Device {
|
||||||
};
|
};
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
bindings::Gecko_AnimationNameMayBeReferencedFromStyle(
|
bindings::Gecko_AnimationNameMayBeReferencedFromStyle(pc, name.as_atom().as_ptr())
|
||||||
pc,
|
|
||||||
name.as_atom().as_ptr(),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +166,12 @@ impl Device {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn pres_context(&self) -> Option<&structs::nsPresContext> {
|
pub fn pres_context(&self) -> Option<&structs::nsPresContext> {
|
||||||
unsafe {
|
unsafe {
|
||||||
self.document().mPresShell.as_ref()?.mPresContext.mRawPtr.as_ref()
|
self.document()
|
||||||
|
.mPresShell
|
||||||
|
.as_ref()?
|
||||||
|
.mPresContext
|
||||||
|
.mRawPtr
|
||||||
|
.as_ref()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,9 +270,8 @@ impl Device {
|
||||||
if doc.mIsBeingUsedAsImage() {
|
if doc.mIsBeingUsedAsImage() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
let document_color_use = unsafe {
|
let document_color_use =
|
||||||
structs::StaticPrefs_sVarCache_browser_display_document_color_use
|
unsafe { structs::StaticPrefs_sVarCache_browser_display_document_color_use };
|
||||||
};
|
|
||||||
let prefs = self.pref_sheet_prefs();
|
let prefs = self.pref_sheet_prefs();
|
||||||
match document_color_use {
|
match document_color_use {
|
||||||
1 => true,
|
1 => true,
|
||||||
|
|
|
@ -1246,8 +1246,7 @@ impl<'le> TElement for GeckoElement<'le> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn owner_doc_matches_for_testing(&self, device: &Device) -> bool {
|
fn owner_doc_matches_for_testing(&self, device: &Device) -> bool {
|
||||||
self.as_node().owner_doc().0 as *const structs::Document ==
|
self.as_node().owner_doc().0 as *const structs::Document == device.document() as *const _
|
||||||
device.document() as *const _
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn style_attribute(&self) -> Option<ArcBorrow<Locked<PropertyDeclarationBlock>>> {
|
fn style_attribute(&self) -> Option<ArcBorrow<Locked<PropertyDeclarationBlock>>> {
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
//! Rust helpers for Gecko's `nsStyleCoord`.
|
//! Rust helpers for Gecko's `nsStyleCoord`.
|
||||||
|
|
||||||
use crate::gecko_bindings::bindings;
|
use crate::gecko_bindings::bindings;
|
||||||
use crate::gecko_bindings::structs::{nsStyleCoord, nsStyleCoord_Calc, nsStyleCoord_CalcValue};
|
|
||||||
use crate::gecko_bindings::structs::nsStyleSides;
|
use crate::gecko_bindings::structs::nsStyleSides;
|
||||||
|
use crate::gecko_bindings::structs::{nsStyleCoord, nsStyleCoord_Calc, nsStyleCoord_CalcValue};
|
||||||
use crate::gecko_bindings::structs::{nsStyleUnion, nsStyleUnit, nscoord};
|
use crate::gecko_bindings::structs::{nsStyleUnion, nsStyleUnit, nscoord};
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ use crate::applicable_declarations::ApplicableDeclarationList;
|
||||||
use crate::gecko::selector_parser::PseudoElement;
|
use crate::gecko::selector_parser::PseudoElement;
|
||||||
use crate::properties::{Importance, LonghandIdSet, PropertyDeclarationBlock};
|
use crate::properties::{Importance, LonghandIdSet, PropertyDeclarationBlock};
|
||||||
use crate::shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
|
use crate::shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
|
||||||
use crate::stylesheets::{StyleRule, Origin};
|
use crate::stylesheets::{Origin, StyleRule};
|
||||||
use crate::thread_state;
|
use crate::thread_state;
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||||
|
@ -663,10 +663,8 @@ impl CascadeLevel {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn origin(&self) -> Origin {
|
pub fn origin(&self) -> Origin {
|
||||||
match *self {
|
match *self {
|
||||||
CascadeLevel::UAImportant |
|
CascadeLevel::UAImportant | CascadeLevel::UANormal => Origin::UserAgent,
|
||||||
CascadeLevel::UANormal => Origin::UserAgent,
|
CascadeLevel::UserImportant | CascadeLevel::UserNormal => Origin::User,
|
||||||
CascadeLevel::UserImportant |
|
|
||||||
CascadeLevel::UserNormal => Origin::User,
|
|
||||||
CascadeLevel::PresHints |
|
CascadeLevel::PresHints |
|
||||||
CascadeLevel::InnerShadowNormal |
|
CascadeLevel::InnerShadowNormal |
|
||||||
CascadeLevel::SameTreeAuthorNormal |
|
CascadeLevel::SameTreeAuthorNormal |
|
||||||
|
|
|
@ -76,7 +76,11 @@ impl OriginSet {
|
||||||
/// See the `OriginSet` documentation for information about the order
|
/// See the `OriginSet` documentation for information about the order
|
||||||
/// origins are iterated.
|
/// origins are iterated.
|
||||||
pub fn iter(&self) -> OriginSetIterator {
|
pub fn iter(&self) -> OriginSetIterator {
|
||||||
OriginSetIterator { set: *self, cur: 0, rev: false }
|
OriginSetIterator {
|
||||||
|
set: *self,
|
||||||
|
cur: 0,
|
||||||
|
rev: false,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ use super::{Animate, Procedure, ToAnimatedZero};
|
||||||
use crate::properties::animated_properties::ListAnimation;
|
use crate::properties::animated_properties::ListAnimation;
|
||||||
use crate::values::animated::color::Color as AnimatedColor;
|
use crate::values::animated::color::Color as AnimatedColor;
|
||||||
use crate::values::computed::url::ComputedUrl;
|
use crate::values::computed::url::ComputedUrl;
|
||||||
use crate::values::distance::{SquaredDistance, ComputeSquaredDistance};
|
use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
|
||||||
use crate::values::generics::svg::{SVGPaint, SVGStrokeDashArray};
|
use crate::values::generics::svg::{SVGPaint, SVGStrokeDashArray};
|
||||||
|
|
||||||
/// Animated SVGPaint.
|
/// Animated SVGPaint.
|
||||||
|
|
|
@ -76,7 +76,7 @@ pub use self::svg::{SVGLength, SVGOpacity, SVGPaint, SVGPaintKind};
|
||||||
pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth};
|
pub use self::svg::{SVGPaintOrder, SVGStrokeDashArray, SVGWidth};
|
||||||
pub use self::table::XSpan;
|
pub use self::table::XSpan;
|
||||||
pub use self::text::{InitialLetter, LetterSpacing, LineHeight};
|
pub use self::text::{InitialLetter, LetterSpacing, LineHeight};
|
||||||
pub use self::text::{OverflowWrap, TextOverflow, WordSpacing, WordBreak};
|
pub use self::text::{OverflowWrap, TextOverflow, WordBreak, WordSpacing};
|
||||||
pub use self::text::{TextAlign, TextEmphasisPosition, TextEmphasisStyle};
|
pub use self::text::{TextAlign, TextEmphasisPosition, TextEmphasisStyle};
|
||||||
pub use self::time::Time;
|
pub use self::time::Time;
|
||||||
pub use self::transform::{Rotate, Scale, Transform, TransformOperation};
|
pub use self::transform::{Rotate, Scale, Transform, TransformOperation};
|
||||||
|
|
|
@ -57,9 +57,7 @@ impl SVGWidth {
|
||||||
/// `1px`.
|
/// `1px`.
|
||||||
pub fn one() -> Self {
|
pub fn one() -> Self {
|
||||||
use crate::values::generics::NonNegative;
|
use crate::values::generics::NonNegative;
|
||||||
generic::SVGLength::LengthPercentage(
|
generic::SVGLength::LengthPercentage(NonNegative(LengthPercentage::one()))
|
||||||
NonNegative(LengthPercentage::one()),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,9 @@ use crate::Zero;
|
||||||
use std::fmt::{self, Write};
|
use std::fmt::{self, Write};
|
||||||
use style_traits::{CssWriter, ToCss};
|
use style_traits::{CssWriter, ToCss};
|
||||||
|
|
||||||
pub use crate::values::specified::{OverflowWrap, WordBreak};
|
|
||||||
pub use crate::values::specified::TextAlignKeyword as TextAlign;
|
pub use crate::values::specified::TextAlignKeyword as TextAlign;
|
||||||
pub use crate::values::specified::TextEmphasisPosition;
|
pub use crate::values::specified::TextEmphasisPosition;
|
||||||
|
pub use crate::values::specified::{OverflowWrap, WordBreak};
|
||||||
|
|
||||||
/// A computed value for the `initial-letter` property.
|
/// A computed value for the `initial-letter` property.
|
||||||
pub type InitialLetter = GenericInitialLetter<CSSFloat, CSSInteger>;
|
pub type InitialLetter = GenericInitialLetter<CSSFloat, CSSInteger>;
|
||||||
|
|
|
@ -592,9 +592,7 @@ impl Translate {
|
||||||
/// Convert Translate to TransformOperation.
|
/// Convert Translate to TransformOperation.
|
||||||
pub fn from_transform_operation(operation: &TransformOperation) -> Translate {
|
pub fn from_transform_operation(operation: &TransformOperation) -> Translate {
|
||||||
match *operation {
|
match *operation {
|
||||||
generic::TransformOperation::Translate(tx, ty) => {
|
generic::TransformOperation::Translate(tx, ty) => generic::Translate::Translate(tx, ty),
|
||||||
generic::Translate::Translate(tx, ty)
|
|
||||||
},
|
|
||||||
generic::TransformOperation::Translate3D(tx, ty, tz) => {
|
generic::TransformOperation::Translate3D(tx, ty, tz) => {
|
||||||
generic::Translate::Translate3D(tx, ty, tz)
|
generic::Translate::Translate3D(tx, ty, tz)
|
||||||
},
|
},
|
||||||
|
|
|
@ -215,7 +215,19 @@ pub struct GreaterThanOrEqualToOne<T>(pub T);
|
||||||
|
|
||||||
/// A clip rect for clip and image-region
|
/// A clip rect for clip and image-region
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToAnimatedValue, ToAnimatedZero, ToComputedValue, ToCss)]
|
#[derive(
|
||||||
|
Clone,
|
||||||
|
ComputeSquaredDistance,
|
||||||
|
Copy,
|
||||||
|
Debug,
|
||||||
|
MallocSizeOf,
|
||||||
|
PartialEq,
|
||||||
|
SpecifiedValueInfo,
|
||||||
|
ToAnimatedValue,
|
||||||
|
ToAnimatedZero,
|
||||||
|
ToComputedValue,
|
||||||
|
ToCss,
|
||||||
|
)]
|
||||||
#[css(function = "rect", comma)]
|
#[css(function = "rect", comma)]
|
||||||
pub struct ClipRect<LengthOrAuto> {
|
pub struct ClipRect<LengthOrAuto> {
|
||||||
pub top: LengthOrAuto,
|
pub top: LengthOrAuto,
|
||||||
|
|
|
@ -29,9 +29,7 @@ impl<N, I> InitialLetter<N, I> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A generic spacing value for the `letter-spacing` and `word-spacing` properties.
|
/// A generic spacing value for the `letter-spacing` and `word-spacing` properties.
|
||||||
#[derive(
|
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
|
||||||
Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss,
|
|
||||||
)]
|
|
||||||
pub enum Spacing<Value> {
|
pub enum Spacing<Value> {
|
||||||
/// `normal`
|
/// `normal`
|
||||||
Normal,
|
Normal,
|
||||||
|
|
|
@ -137,7 +137,10 @@ where
|
||||||
SkewY(Angle),
|
SkewY(Angle),
|
||||||
/// translate(x, y) or translate(x)
|
/// translate(x, y) or translate(x)
|
||||||
#[css(comma, function)]
|
#[css(comma, function)]
|
||||||
Translate(LengthPercentage, #[css(skip_if = "Zero::is_zero")] LengthPercentage),
|
Translate(
|
||||||
|
LengthPercentage,
|
||||||
|
#[css(skip_if = "Zero::is_zero")] LengthPercentage,
|
||||||
|
),
|
||||||
/// translateX(x)
|
/// translateX(x)
|
||||||
#[css(function = "translateX")]
|
#[css(function = "translateX")]
|
||||||
TranslateX(LengthPercentage),
|
TranslateX(LengthPercentage),
|
||||||
|
@ -637,7 +640,14 @@ impl<Number: ToCss + PartialEq> ToCss for Scale<Number> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToAnimatedZero, ToComputedValue, ToCss
|
Clone,
|
||||||
|
Debug,
|
||||||
|
MallocSizeOf,
|
||||||
|
PartialEq,
|
||||||
|
SpecifiedValueInfo,
|
||||||
|
ToAnimatedZero,
|
||||||
|
ToComputedValue,
|
||||||
|
ToCss,
|
||||||
)]
|
)]
|
||||||
/// A value of the `translate` property
|
/// A value of the `translate` property
|
||||||
///
|
///
|
||||||
|
@ -660,7 +670,10 @@ where
|
||||||
/// 'none'
|
/// 'none'
|
||||||
None,
|
None,
|
||||||
/// '<length-percentage>' or '<length-percentage> <length-percentage>'
|
/// '<length-percentage>' or '<length-percentage> <length-percentage>'
|
||||||
Translate(LengthPercentage, #[css(skip_if = "Zero::is_zero")] LengthPercentage),
|
Translate(
|
||||||
|
LengthPercentage,
|
||||||
|
#[css(skip_if = "Zero::is_zero")] LengthPercentage,
|
||||||
|
),
|
||||||
/// '<length-percentage> <length-percentage> <length>'
|
/// '<length-percentage> <length-percentage> <length>'
|
||||||
Translate3D(LengthPercentage, LengthPercentage, Length),
|
Translate3D(LengthPercentage, LengthPercentage, Length),
|
||||||
}
|
}
|
||||||
|
|
|
@ -652,7 +652,12 @@ impl ClipRect {
|
||||||
left = parse_argument(context, input, allow_quirks)?;
|
left = parse_argument(context, input, allow_quirks)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(ClipRect { top, right, bottom, left })
|
Ok(ClipRect {
|
||||||
|
top,
|
||||||
|
right,
|
||||||
|
bottom,
|
||||||
|
left,
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
|
|
||||||
use crate::parser::{Parse, ParserContext};
|
use crate::parser::{Parse, ParserContext};
|
||||||
use crate::values::generics::svg as generic;
|
use crate::values::generics::svg as generic;
|
||||||
use crate::values::specified::AllowQuirks;
|
|
||||||
use crate::values::specified::color::Color;
|
use crate::values::specified::color::Color;
|
||||||
use crate::values::specified::url::SpecifiedUrl;
|
use crate::values::specified::url::SpecifiedUrl;
|
||||||
|
use crate::values::specified::AllowQuirks;
|
||||||
use crate::values::specified::LengthPercentage;
|
use crate::values::specified::LengthPercentage;
|
||||||
use crate::values::specified::{NonNegativeLengthPercentage, Opacity};
|
use crate::values::specified::{NonNegativeLengthPercentage, Opacity};
|
||||||
use crate::values::CustomIdent;
|
use crate::values::CustomIdent;
|
||||||
|
@ -52,10 +52,9 @@ macro_rules! parse_svg_length {
|
||||||
context: &ParserContext,
|
context: &ParserContext,
|
||||||
input: &mut Parser<'i, 't>,
|
input: &mut Parser<'i, 't>,
|
||||||
) -> Result<Self, ParseError<'i>> {
|
) -> Result<Self, ParseError<'i>> {
|
||||||
if let Ok(lp) = input.try(|i| {
|
if let Ok(lp) = input.try(|i| <$lp>::parse_quirky(context, i, AllowQuirks::Always))
|
||||||
<$lp>::parse_quirky(context, i, AllowQuirks::Always)
|
{
|
||||||
}) {
|
return Ok(generic::SVGLength::LengthPercentage(lp));
|
||||||
return Ok(generic::SVGLength::LengthPercentage(lp))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try_match_ident_ignore_ascii_case! { input,
|
try_match_ident_ignore_ascii_case! { input,
|
||||||
|
@ -65,7 +64,7 @@ macro_rules! parse_svg_length {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_svg_length!(SVGLength, LengthPercentage);
|
parse_svg_length!(SVGLength, LengthPercentage);
|
||||||
|
@ -78,11 +77,7 @@ impl Parse for SVGStrokeDashArray {
|
||||||
) -> Result<Self, ParseError<'i>> {
|
) -> Result<Self, ParseError<'i>> {
|
||||||
if let Ok(values) = input.try(|i| {
|
if let Ok(values) = input.try(|i| {
|
||||||
CommaWithSpace::parse(i, |i| {
|
CommaWithSpace::parse(i, |i| {
|
||||||
NonNegativeLengthPercentage::parse_quirky(
|
NonNegativeLengthPercentage::parse_quirky(context, i, AllowQuirks::Always)
|
||||||
context,
|
|
||||||
i,
|
|
||||||
AllowQuirks::Always,
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
}) {
|
}) {
|
||||||
return Ok(generic::SVGStrokeDashArray::Values(values));
|
return Ok(generic::SVGStrokeDashArray::Values(values));
|
||||||
|
|
|
@ -70,9 +70,9 @@ pub fn propagate_clauses_to_output_type(
|
||||||
for bound in extra_bounds {
|
for bound in extra_bounds {
|
||||||
let ty = bound.bounded_ty;
|
let ty = bound.bounded_ty;
|
||||||
let bounds = bound.bounds;
|
let bounds = bound.bounds;
|
||||||
where_clause.predicates.push(
|
where_clause
|
||||||
parse_quote!(<#ty as #trait_path>::#trait_output: #bounds),
|
.predicates
|
||||||
)
|
.push(parse_quote!(<#ty as #trait_path>::#trait_output: #bounds))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue