aboutsummaryrefslogtreecommitdiffstats
path: root/components/style_traits/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/style_traits/lib.rs')
-rw-r--r--components/style_traits/lib.rs59
1 files changed, 36 insertions, 23 deletions
diff --git a/components/style_traits/lib.rs b/components/style_traits/lib.rs
index 737450b5e05..fd80c648b31 100644
--- a/components/style_traits/lib.rs
+++ b/components/style_traits/lib.rs
@@ -8,27 +8,35 @@
#![crate_name = "style_traits"]
#![crate_type = "rlib"]
-
#![deny(unsafe_code, missing_docs)]
extern crate app_units;
-#[macro_use] extern crate bitflags;
-#[macro_use] extern crate cssparser;
+#[macro_use]
+extern crate bitflags;
+#[macro_use]
+extern crate cssparser;
extern crate euclid;
extern crate malloc_size_of;
-#[macro_use] extern crate malloc_size_of_derive;
+#[macro_use]
+extern crate malloc_size_of_derive;
extern crate selectors;
-#[cfg(feature = "servo")] #[macro_use] extern crate serde;
-#[cfg(feature = "servo")] extern crate webrender_api;
+#[cfg(feature = "servo")]
+#[macro_use]
+extern crate serde;
extern crate servo_arc;
-#[cfg(feature = "servo")] extern crate servo_atoms;
-#[cfg(feature = "servo")] extern crate servo_url;
-
-#[cfg(feature = "servo")] pub use webrender_api::DevicePixel;
+#[cfg(feature = "servo")]
+extern crate servo_atoms;
+#[cfg(feature = "servo")]
+extern crate servo_url;
+#[cfg(feature = "servo")]
+extern crate webrender_api;
+#[cfg(feature = "servo")]
+pub use webrender_api::DevicePixel;
use cssparser::{CowRcStr, Token};
use selectors::parser::SelectorParseErrorKind;
-#[cfg(feature = "servo")] use servo_atoms::Atom;
+#[cfg(feature = "servo")]
+use servo_atoms::Atom;
/// One hardware pixel.
///
@@ -40,7 +48,10 @@ pub enum DevicePixel {}
/// Represents a mobile style pinch zoom factor.
/// TODO(gw): Once WR supports pinch zoom, use a type directly from webrender_api.
#[derive(Clone, Copy, Debug, PartialEq)]
-#[cfg_attr(feature = "servo", derive(Deserialize, Serialize, MallocSizeOf))]
+#[cfg_attr(
+ feature = "servo",
+ derive(Deserialize, Serialize, MallocSizeOf)
+)]
pub struct PinchZoomFactor(f32);
impl PinchZoomFactor {
@@ -183,16 +194,14 @@ impl<'i> StyleParseErrorKind<'i> {
{
let name = name.into();
let variant = match value_error.kind {
- cssparser::ParseErrorKind::Custom(StyleParseErrorKind::ValueError(e)) => {
- match e {
- ValueParseErrorKind::InvalidColor(token) => {
- StyleParseErrorKind::InvalidColor(name, token)
- }
- ValueParseErrorKind::InvalidFilter(token) => {
- StyleParseErrorKind::InvalidFilter(name, token)
- }
- }
- }
+ cssparser::ParseErrorKind::Custom(StyleParseErrorKind::ValueError(e)) => match e {
+ ValueParseErrorKind::InvalidColor(token) => {
+ StyleParseErrorKind::InvalidColor(name, token)
+ },
+ ValueParseErrorKind::InvalidFilter(token) => {
+ StyleParseErrorKind::InvalidFilter(name, token)
+ },
+ },
_ => StyleParseErrorKind::OtherInvalidValue(name),
};
cssparser::ParseError {
@@ -236,5 +245,9 @@ impl ParsingMode {
/// Speculatively execute paint code in the worklet thread pool.
pub trait SpeculativePainter: Send + Sync {
/// <https://drafts.css-houdini.org/css-paint-api/#draw-a-paint-image>
- fn speculatively_draw_a_paint_image(&self, properties: Vec<(Atom, String)>, arguments: Vec<String>);
+ fn speculatively_draw_a_paint_image(
+ &self,
+ properties: Vec<(Atom, String)>,
+ arguments: Vec<String>,
+ );
}