mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Format component of style_traits
This commit is contained in:
parent
81655a9a99
commit
a2fc2ae517
4 changed files with 121 additions and 64 deletions
|
@ -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>,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue