mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Upgrade remaining components to edition 2018
This commit is contained in:
parent
fd79367491
commit
9c2cc05a8e
48 changed files with 102 additions and 160 deletions
|
@ -3,6 +3,7 @@ name = "derive_common"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
authors = ["The Servo Project Developers"]
|
authors = ["The Servo Project Developers"]
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
|
edition = "2018"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
use darling::{FromDeriveInput, FromField, FromVariant};
|
use darling::{FromDeriveInput, FromField, FromVariant};
|
||||||
use proc_macro2::{Span, TokenStream};
|
use proc_macro2::{Span, TokenStream};
|
||||||
use quote::TokenStreamExt;
|
use quote::{quote, TokenStreamExt};
|
||||||
use syn::{self, AngleBracketedGenericArguments, Binding, DeriveInput, Field};
|
use syn::{self, parse_quote, AngleBracketedGenericArguments, Binding, DeriveInput, Field};
|
||||||
use syn::{GenericArgument, GenericParam, Ident, Path};
|
use syn::{GenericArgument, GenericParam, Ident, Path};
|
||||||
use syn::{PathArguments, PathSegment, QSelf, Type, TypeArray, TypeGroup};
|
use syn::{PathArguments, PathSegment, QSelf, Type, TypeArray, TypeGroup};
|
||||||
use syn::{TypeParam, TypeParen, TypePath, TypeSlice, TypeTuple};
|
use syn::{TypeParam, TypeParen, TypePath, TypeSlice, TypeTuple};
|
||||||
|
|
|
@ -2,12 +2,4 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
extern crate darling;
|
|
||||||
extern crate proc_macro2;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate quote;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate syn;
|
|
||||||
extern crate synstructure;
|
|
||||||
|
|
||||||
pub mod cg;
|
pub mod cg;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
authors = ["The Servo Project Developers"]
|
authors = ["The Servo Project Developers"]
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
name = "dom_struct"
|
name = "dom_struct"
|
||||||
|
edition = "2018"
|
||||||
publish = false
|
publish = false
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
extern crate proc_macro;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate quote;
|
|
||||||
extern crate syn;
|
|
||||||
|
|
||||||
use proc_macro::TokenStream;
|
use proc_macro::TokenStream;
|
||||||
|
use quote::quote;
|
||||||
use syn::*;
|
use syn::*;
|
||||||
|
|
||||||
#[proc_macro_attribute]
|
#[proc_macro_attribute]
|
||||||
|
|
|
@ -3,6 +3,7 @@ name = "fallible"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
authors = ["The Servo Project Developers"]
|
authors = ["The Servo Project Developers"]
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
|
edition = "2018"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
extern crate hashglobe;
|
|
||||||
extern crate smallvec;
|
|
||||||
|
|
||||||
#[cfg(feature = "known_system_malloc")]
|
#[cfg(feature = "known_system_malloc")]
|
||||||
use hashglobe::alloc;
|
use hashglobe::alloc;
|
||||||
use hashglobe::FailedAllocationError;
|
use hashglobe::FailedAllocationError;
|
||||||
|
|
|
@ -7,6 +7,7 @@ description = "Fork of std::HashMap with stable fallible allocation."
|
||||||
documentation = "https://docs.rs/hashglobe"
|
documentation = "https://docs.rs/hashglobe"
|
||||||
repository = "https://github.com/Manishearth/hashglobe"
|
repository = "https://github.com/Manishearth/hashglobe"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
|
|
|
@ -2218,7 +2218,7 @@ mod test_map {
|
||||||
use super::Entry::{Occupied, Vacant};
|
use super::Entry::{Occupied, Vacant};
|
||||||
use super::HashMap;
|
use super::HashMap;
|
||||||
use super::RandomState;
|
use super::RandomState;
|
||||||
use cell::RefCell;
|
use std::cell::RefCell;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_zero_capacities() {
|
fn test_zero_capacities() {
|
||||||
|
|
|
@ -1577,7 +1577,7 @@ mod test_set {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_replace() {
|
fn test_replace() {
|
||||||
use hash;
|
use std::hash;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct Foo(&'static str, i32);
|
struct Foo(&'static str, i32);
|
||||||
|
|
|
@ -3,6 +3,7 @@ name = "malloc_size_of"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
authors = ["The Servo Project Developers"]
|
authors = ["The Servo Project Developers"]
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
|
edition = "2018"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
|
@ -46,45 +46,6 @@
|
||||||
//! Note: WebRender has a reduced fork of this crate, so that we can avoid
|
//! Note: WebRender has a reduced fork of this crate, so that we can avoid
|
||||||
//! publishing this crate on crates.io.
|
//! publishing this crate on crates.io.
|
||||||
|
|
||||||
#[cfg(feature = "servo")]
|
|
||||||
extern crate accountable_refcell;
|
|
||||||
extern crate app_units;
|
|
||||||
#[cfg(feature = "servo")]
|
|
||||||
extern crate content_security_policy;
|
|
||||||
#[cfg(feature = "servo")]
|
|
||||||
extern crate crossbeam_channel;
|
|
||||||
extern crate cssparser;
|
|
||||||
extern crate euclid;
|
|
||||||
extern crate hashglobe;
|
|
||||||
#[cfg(feature = "servo")]
|
|
||||||
extern crate http;
|
|
||||||
#[cfg(feature = "servo")]
|
|
||||||
extern crate hyper_serde;
|
|
||||||
#[cfg(feature = "servo")]
|
|
||||||
extern crate keyboard_types;
|
|
||||||
extern crate selectors;
|
|
||||||
#[cfg(feature = "servo")]
|
|
||||||
extern crate serde;
|
|
||||||
#[cfg(feature = "servo")]
|
|
||||||
extern crate serde_bytes;
|
|
||||||
extern crate servo_arc;
|
|
||||||
extern crate smallbitvec;
|
|
||||||
extern crate smallvec;
|
|
||||||
#[cfg(feature = "servo")]
|
|
||||||
extern crate string_cache;
|
|
||||||
extern crate thin_slice;
|
|
||||||
#[cfg(feature = "servo")]
|
|
||||||
extern crate time;
|
|
||||||
#[cfg(feature = "url")]
|
|
||||||
extern crate url;
|
|
||||||
#[cfg(feature = "servo")]
|
|
||||||
extern crate uuid;
|
|
||||||
extern crate void;
|
|
||||||
#[cfg(feature = "webrender_api")]
|
|
||||||
extern crate webrender_api;
|
|
||||||
#[cfg(feature = "servo")]
|
|
||||||
extern crate xml5ever;
|
|
||||||
|
|
||||||
#[cfg(feature = "servo")]
|
#[cfg(feature = "servo")]
|
||||||
use content_security_policy as csp;
|
use content_security_policy as csp;
|
||||||
#[cfg(feature = "servo")]
|
#[cfg(feature = "servo")]
|
||||||
|
|
|
@ -3,6 +3,7 @@ name = "script_plugins"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
authors = ["The Servo Project Developers"]
|
authors = ["The Servo Project Developers"]
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
|
edition = "2018"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
|
@ -9,6 +9,7 @@ readme = "README.md"
|
||||||
keywords = ["css", "selectors"]
|
keywords = ["css", "selectors"]
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "selectors"
|
name = "selectors"
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
use crate::parser::SelectorImpl;
|
use crate::parser::SelectorImpl;
|
||||||
use cssparser::ToCss;
|
use cssparser::ToCss;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
#[cfg(feature = "shmem")]
|
||||||
|
use to_shmem_derive::ToShmem;
|
||||||
|
|
||||||
#[derive(Clone, Eq, PartialEq)]
|
#[derive(Clone, Eq, PartialEq)]
|
||||||
#[cfg_attr(feature = "shmem", derive(ToShmem))]
|
#[cfg_attr(feature = "shmem", derive(ToShmem))]
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
extern crate phf_codegen;
|
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{BufWriter, Write};
|
use std::io::{BufWriter, Write};
|
||||||
|
|
|
@ -19,12 +19,16 @@
|
||||||
|
|
||||||
use crate::parser::{Combinator, Component, SelectorImpl};
|
use crate::parser::{Combinator, Component, SelectorImpl};
|
||||||
use crate::sink::Push;
|
use crate::sink::Push;
|
||||||
|
use bitflags::bitflags;
|
||||||
|
use derive_more::{Add, AddAssign};
|
||||||
use servo_arc::{Arc, HeaderWithLength, ThinArc};
|
use servo_arc::{Arc, HeaderWithLength, ThinArc};
|
||||||
use smallvec::{self, SmallVec};
|
use smallvec::{self, SmallVec};
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::iter;
|
use std::iter;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
|
#[cfg(feature = "shmem")]
|
||||||
|
use to_shmem_derive::ToShmem;
|
||||||
|
|
||||||
/// Top-level SelectorBuilder struct. This should be stack-allocated by the
|
/// Top-level SelectorBuilder struct. This should be stack-allocated by the
|
||||||
/// consumer and never moved (because it contains a lot of inline data that
|
/// consumer and never moved (because it contains a lot of inline data that
|
||||||
|
|
|
@ -5,25 +5,6 @@
|
||||||
// Make |cargo bench| work.
|
// Make |cargo bench| work.
|
||||||
#![cfg_attr(feature = "bench", feature(test))]
|
#![cfg_attr(feature = "bench", feature(test))]
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
extern crate bitflags;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate cssparser;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate derive_more;
|
|
||||||
extern crate fxhash;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate log;
|
|
||||||
extern crate phf;
|
|
||||||
extern crate precomputed_hash;
|
|
||||||
extern crate servo_arc;
|
|
||||||
extern crate smallvec;
|
|
||||||
#[cfg(feature = "shmem")]
|
|
||||||
extern crate to_shmem;
|
|
||||||
#[cfg(feature = "shmem")]
|
|
||||||
#[macro_use]
|
|
||||||
extern crate to_shmem_derive;
|
|
||||||
|
|
||||||
pub mod attr;
|
pub mod attr;
|
||||||
pub mod bloom;
|
pub mod bloom;
|
||||||
mod builder;
|
mod builder;
|
||||||
|
|
|
@ -8,6 +8,8 @@ use crate::nth_index_cache::NthIndexCacheInner;
|
||||||
use crate::parser::{AncestorHashes, Combinator, Component, LocalName};
|
use crate::parser::{AncestorHashes, Combinator, Component, LocalName};
|
||||||
use crate::parser::{NonTSPseudoClass, Selector, SelectorImpl, SelectorIter, SelectorList};
|
use crate::parser::{NonTSPseudoClass, Selector, SelectorImpl, SelectorIter, SelectorList};
|
||||||
use crate::tree::Element;
|
use crate::tree::Element;
|
||||||
|
use bitflags::bitflags;
|
||||||
|
use log::debug;
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
use std::iter;
|
use std::iter;
|
||||||
|
|
|
@ -10,7 +10,8 @@ use crate::builder::{SelectorBuilder, SelectorFlags, SpecificityAndFlags};
|
||||||
use crate::context::QuirksMode;
|
use crate::context::QuirksMode;
|
||||||
use crate::sink::Push;
|
use crate::sink::Push;
|
||||||
pub use crate::visitor::SelectorVisitor;
|
pub use crate::visitor::SelectorVisitor;
|
||||||
use cssparser::parse_nth;
|
use bitflags::bitflags;
|
||||||
|
use cssparser::{match_ignore_ascii_case, parse_nth, *};
|
||||||
use cssparser::{BasicParseError, BasicParseErrorKind, ParseError, ParseErrorKind};
|
use cssparser::{BasicParseError, BasicParseErrorKind, ParseError, ParseErrorKind};
|
||||||
use cssparser::{CowRcStr, Delimiter, SourceLocation};
|
use cssparser::{CowRcStr, Delimiter, SourceLocation};
|
||||||
use cssparser::{Parser as CssParser, ToCss, Token};
|
use cssparser::{Parser as CssParser, ToCss, Token};
|
||||||
|
@ -21,6 +22,8 @@ use std::borrow::{Borrow, Cow};
|
||||||
use std::fmt::{self, Debug};
|
use std::fmt::{self, Debug};
|
||||||
use std::iter::Rev;
|
use std::iter::Rev;
|
||||||
use std::slice;
|
use std::slice;
|
||||||
|
#[cfg(feature = "shmem")]
|
||||||
|
use to_shmem_derive::ToShmem;
|
||||||
|
|
||||||
/// A trait that represents a pseudo-element.
|
/// A trait that represents a pseudo-element.
|
||||||
pub trait PseudoElement: Sized + ToCss {
|
pub trait PseudoElement: Sized + ToCss {
|
||||||
|
|
|
@ -5,6 +5,7 @@ authors = ["The Servo Project Developers"]
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
repository = "https://github.com/servo/servo"
|
repository = "https://github.com/servo/servo"
|
||||||
description = "A fork of std::sync::Arc with some extra functionality and without weak references"
|
description = "A fork of std::sync::Arc with some extra functionality and without weak references"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "servo_arc"
|
name = "servo_arc"
|
||||||
|
|
|
@ -25,11 +25,6 @@
|
||||||
// duplicate those here.
|
// duplicate those here.
|
||||||
#![allow(missing_docs)]
|
#![allow(missing_docs)]
|
||||||
|
|
||||||
extern crate nodrop;
|
|
||||||
#[cfg(feature = "servo")]
|
|
||||||
extern crate serde;
|
|
||||||
extern crate stable_deref_trait;
|
|
||||||
|
|
||||||
use nodrop::NoDrop;
|
use nodrop::NoDrop;
|
||||||
#[cfg(feature = "servo")]
|
#[cfg(feature = "servo")]
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
|
@ -3,6 +3,7 @@ name = "size_of_test"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
authors = ["The Servo Project Developers"]
|
authors = ["The Servo Project Developers"]
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
|
edition = "2018"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
|
@ -3,6 +3,7 @@ name = "std_test_override"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
authors = ["The Servo Project Developers"]
|
authors = ["The Servo Project Developers"]
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
|
edition = "2018"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
#![feature(test)]
|
#![feature(test)]
|
||||||
|
|
||||||
extern crate embedder_traits;
|
|
||||||
extern crate test;
|
extern crate test;
|
||||||
|
|
||||||
pub use test::*;
|
pub use test::*;
|
||||||
|
|
|
@ -3,6 +3,7 @@ name = "style_derive"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
authors = ["The Servo Project Developers"]
|
authors = ["The Servo Project Developers"]
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
|
edition = "2018"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
|
@ -3,10 +3,14 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use darling::util::PathList;
|
use darling::util::PathList;
|
||||||
|
use darling::FromDeriveInput;
|
||||||
|
use darling::FromField;
|
||||||
|
use darling::FromVariant;
|
||||||
use derive_common::cg;
|
use derive_common::cg;
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
|
use quote::quote;
|
||||||
use quote::TokenStreamExt;
|
use quote::TokenStreamExt;
|
||||||
use syn::{DeriveInput, WhereClause};
|
use syn::{parse_quote, DeriveInput, WhereClause};
|
||||||
use synstructure::{Structure, VariantInfo};
|
use synstructure::{Structure, VariantInfo};
|
||||||
|
|
||||||
pub fn derive(mut input: DeriveInput) -> TokenStream {
|
pub fn derive(mut input: DeriveInput) -> TokenStream {
|
||||||
|
|
|
@ -3,10 +3,12 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use crate::animate::{AnimationFieldAttrs, AnimationInputAttrs, AnimationVariantAttrs};
|
use crate::animate::{AnimationFieldAttrs, AnimationInputAttrs, AnimationVariantAttrs};
|
||||||
|
use darling::FromField;
|
||||||
use derive_common::cg;
|
use derive_common::cg;
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
|
use quote::quote;
|
||||||
use quote::TokenStreamExt;
|
use quote::TokenStreamExt;
|
||||||
use syn::{DeriveInput, WhereClause};
|
use syn::{parse_quote, DeriveInput, WhereClause};
|
||||||
use synstructure;
|
use synstructure;
|
||||||
|
|
||||||
pub fn derive(mut input: DeriveInput) -> TokenStream {
|
pub fn derive(mut input: DeriveInput) -> TokenStream {
|
||||||
|
|
|
@ -4,17 +4,6 @@
|
||||||
|
|
||||||
#![recursion_limit = "128"]
|
#![recursion_limit = "128"]
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
extern crate darling;
|
|
||||||
extern crate derive_common;
|
|
||||||
extern crate proc_macro;
|
|
||||||
extern crate proc_macro2;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate quote;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate syn;
|
|
||||||
extern crate synstructure;
|
|
||||||
|
|
||||||
use proc_macro::TokenStream;
|
use proc_macro::TokenStream;
|
||||||
|
|
||||||
mod animate;
|
mod animate;
|
||||||
|
|
|
@ -3,8 +3,12 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use crate::to_css::CssVariantAttrs;
|
use crate::to_css::CssVariantAttrs;
|
||||||
|
use darling::FromField;
|
||||||
|
use darling::FromVariant;
|
||||||
use derive_common::cg;
|
use derive_common::cg;
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
|
use quote::quote;
|
||||||
|
use syn::parse_quote;
|
||||||
use syn::{self, DeriveInput, Path};
|
use syn::{self, DeriveInput, Path};
|
||||||
use synstructure::{Structure, VariantInfo};
|
use synstructure::{Structure, VariantInfo};
|
||||||
|
|
||||||
|
@ -54,7 +58,7 @@ fn parse_non_keyword_variant(
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
quote! {
|
quote! {
|
||||||
if let Ok(v) = input.try(|i| <#ty as crate::parser::Parse>::parse(context, i)) {
|
if let Ok(v) = input.r#try(|i| <#ty as crate::parser::Parse>::parse(context, i)) {
|
||||||
return Ok(#name::#variant_name(v));
|
return Ok(#name::#variant_name(v));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,14 @@
|
||||||
|
|
||||||
use crate::parse::ParseVariantAttrs;
|
use crate::parse::ParseVariantAttrs;
|
||||||
use crate::to_css::{CssFieldAttrs, CssInputAttrs, CssVariantAttrs};
|
use crate::to_css::{CssFieldAttrs, CssInputAttrs, CssVariantAttrs};
|
||||||
|
use darling::FromDeriveInput;
|
||||||
|
use darling::FromField;
|
||||||
|
use darling::FromVariant;
|
||||||
use derive_common::cg;
|
use derive_common::cg;
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
|
use quote::quote;
|
||||||
use quote::TokenStreamExt;
|
use quote::TokenStreamExt;
|
||||||
use syn::{Data, DeriveInput, Fields, Ident, Type};
|
use syn::{parse_quote, Data, DeriveInput, Fields, Ident, Type};
|
||||||
|
|
||||||
pub fn derive(mut input: DeriveInput) -> TokenStream {
|
pub fn derive(mut input: DeriveInput) -> TokenStream {
|
||||||
let css_attrs = cg::parse_input_attrs::<CssInputAttrs>(&input);
|
let css_attrs = cg::parse_input_attrs::<CssInputAttrs>(&input);
|
||||||
|
|
|
@ -2,10 +2,11 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use crate::to_computed_value;
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
use syn::DeriveInput;
|
use quote::quote;
|
||||||
|
use syn::{parse_quote, DeriveInput};
|
||||||
use synstructure::BindStyle;
|
use synstructure::BindStyle;
|
||||||
use to_computed_value;
|
|
||||||
|
|
||||||
pub fn derive(input: DeriveInput) -> TokenStream {
|
pub fn derive(input: DeriveInput) -> TokenStream {
|
||||||
let trait_impl = |from_body, to_body| {
|
let trait_impl = |from_body, to_body| {
|
||||||
|
|
|
@ -5,8 +5,9 @@
|
||||||
use crate::animate::{AnimationFieldAttrs, AnimationInputAttrs, AnimationVariantAttrs};
|
use crate::animate::{AnimationFieldAttrs, AnimationInputAttrs, AnimationVariantAttrs};
|
||||||
use derive_common::cg;
|
use derive_common::cg;
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
|
use quote::quote;
|
||||||
use quote::TokenStreamExt;
|
use quote::TokenStreamExt;
|
||||||
use syn;
|
use syn::{self, parse_quote};
|
||||||
use synstructure;
|
use synstructure;
|
||||||
|
|
||||||
pub fn derive(mut input: syn::DeriveInput) -> TokenStream {
|
pub fn derive(mut input: syn::DeriveInput) -> TokenStream {
|
||||||
|
|
|
@ -2,8 +2,11 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use darling::FromField;
|
||||||
use derive_common::cg;
|
use derive_common::cg;
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
|
use quote::quote;
|
||||||
|
use syn::parse_quote;
|
||||||
use syn::{DeriveInput, Ident, Path};
|
use syn::{DeriveInput, Ident, Path};
|
||||||
use synstructure::{BindStyle, BindingInfo};
|
use synstructure::{BindStyle, BindingInfo};
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,14 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use darling::util::Override;
|
use darling::util::Override;
|
||||||
|
use darling::FromDeriveInput;
|
||||||
|
use darling::FromField;
|
||||||
|
use darling::FromVariant;
|
||||||
use derive_common::cg;
|
use derive_common::cg;
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
|
use quote::quote;
|
||||||
use quote::{ToTokens, TokenStreamExt};
|
use quote::{ToTokens, TokenStreamExt};
|
||||||
|
use syn::parse_quote;
|
||||||
use syn::{self, Data, Path, WhereClause};
|
use syn::{self, Data, Path, WhereClause};
|
||||||
use synstructure::{BindingInfo, Structure, VariantInfo};
|
use synstructure::{BindingInfo, Structure, VariantInfo};
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,13 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use crate::to_computed_value;
|
||||||
|
use darling::FromField;
|
||||||
use derive_common::cg;
|
use derive_common::cg;
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
use syn::DeriveInput;
|
use quote::quote;
|
||||||
|
use syn::{parse_quote, DeriveInput};
|
||||||
use synstructure::BindStyle;
|
use synstructure::BindStyle;
|
||||||
use to_computed_value;
|
|
||||||
|
|
||||||
pub fn derive(input: DeriveInput) -> TokenStream {
|
pub fn derive(input: DeriveInput) -> TokenStream {
|
||||||
let trait_impl = |from_body, to_body| {
|
let trait_impl = |from_body, to_body| {
|
||||||
|
|
|
@ -3,6 +3,7 @@ name = "style_traits"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
authors = ["The Servo Project Developers"]
|
authors = ["The Servo Project Developers"]
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
|
edition = "2018"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
|
@ -4,12 +4,14 @@
|
||||||
|
|
||||||
//! A thin atomically-reference-counted slice.
|
//! A thin atomically-reference-counted slice.
|
||||||
|
|
||||||
|
use lazy_static::lazy_static;
|
||||||
use serde::de::{Deserialize, Deserializer};
|
use serde::de::{Deserialize, Deserializer};
|
||||||
use serde::ser::{Serialize, Serializer};
|
use serde::ser::{Serialize, Serializer};
|
||||||
use servo_arc::ThinArc;
|
use servo_arc::ThinArc;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::ptr::NonNull;
|
use std::ptr::NonNull;
|
||||||
use std::{iter, mem};
|
use std::{iter, mem};
|
||||||
|
use to_shmem_derive::ToShmem;
|
||||||
|
|
||||||
/// A canary that we stash in ArcSlices.
|
/// A canary that we stash in ArcSlices.
|
||||||
///
|
///
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
|
|
||||||
//! Types used to access the DOM from style calculation.
|
//! Types used to access the DOM from style calculation.
|
||||||
|
|
||||||
|
use malloc_size_of_derive::MallocSizeOf;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// An opaque handle to a node, which, unlike UnsafeNode, cannot be transformed
|
/// An opaque handle to a node, which, unlike UnsafeNode, cannot be transformed
|
||||||
/// back into a non-opaque representation. The only safe operation that can be
|
/// back into a non-opaque representation. The only safe operation that can be
|
||||||
/// performed on this node is to compare it to another opaque handle or to another
|
/// performed on this node is to compare it to another opaque handle or to another
|
||||||
|
|
|
@ -10,30 +10,9 @@
|
||||||
#![crate_type = "rlib"]
|
#![crate_type = "rlib"]
|
||||||
#![deny(unsafe_code, missing_docs)]
|
#![deny(unsafe_code, missing_docs)]
|
||||||
|
|
||||||
extern crate app_units;
|
use bitflags::bitflags;
|
||||||
#[macro_use]
|
use malloc_size_of_derive::MallocSizeOf;
|
||||||
extern crate bitflags;
|
use serde::{Deserialize, Serialize};
|
||||||
#[macro_use]
|
|
||||||
extern crate cssparser;
|
|
||||||
extern crate euclid;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate lazy_static;
|
|
||||||
extern crate malloc_size_of;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate malloc_size_of_derive;
|
|
||||||
extern crate selectors;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate serde;
|
|
||||||
extern crate servo_arc;
|
|
||||||
#[cfg(feature = "servo")]
|
|
||||||
extern crate servo_atoms;
|
|
||||||
#[cfg(feature = "servo")]
|
|
||||||
extern crate servo_url;
|
|
||||||
extern crate to_shmem;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate to_shmem_derive;
|
|
||||||
#[cfg(feature = "servo")]
|
|
||||||
extern crate webrender_api;
|
|
||||||
#[cfg(feature = "servo")]
|
#[cfg(feature = "servo")]
|
||||||
pub use webrender_api::units::DevicePixel;
|
pub use webrender_api::units::DevicePixel;
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,10 @@
|
||||||
//! A replacement for `Box<str>` that has a defined layout for FFI.
|
//! A replacement for `Box<str>` that has a defined layout for FFI.
|
||||||
|
|
||||||
use crate::owned_slice::OwnedSlice;
|
use crate::owned_slice::OwnedSlice;
|
||||||
|
use malloc_size_of_derive::MallocSizeOf;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
|
use to_shmem_derive::ToShmem;
|
||||||
|
|
||||||
/// A struct that basically replaces a Box<str>, but with a defined layout,
|
/// A struct that basically replaces a Box<str>, but with a defined layout,
|
||||||
/// suitable for FFI.
|
/// suitable for FFI.
|
||||||
|
|
|
@ -348,7 +348,7 @@ impl Separator for Space {
|
||||||
let mut results = vec![parse_one(input)?];
|
let mut results = vec![parse_one(input)?];
|
||||||
loop {
|
loop {
|
||||||
input.skip_whitespace(); // Unnecessary for correctness, but may help try() rewind less.
|
input.skip_whitespace(); // Unnecessary for correctness, but may help try() rewind less.
|
||||||
if let Ok(item) = input.try(&mut parse_one) {
|
if let Ok(item) = input.r#try(&mut parse_one) {
|
||||||
results.push(item);
|
results.push(item);
|
||||||
} else {
|
} else {
|
||||||
return Ok(results);
|
return Ok(results);
|
||||||
|
@ -374,9 +374,9 @@ impl Separator for CommaWithSpace {
|
||||||
loop {
|
loop {
|
||||||
input.skip_whitespace(); // Unnecessary for correctness, but may help try() rewind less.
|
input.skip_whitespace(); // Unnecessary for correctness, but may help try() rewind less.
|
||||||
let comma_location = input.current_source_location();
|
let comma_location = input.current_source_location();
|
||||||
let comma = input.try(|i| i.expect_comma()).is_ok();
|
let comma = input.r#try(|i| i.expect_comma()).is_ok();
|
||||||
input.skip_whitespace(); // Unnecessary for correctness, but may help try() rewind less.
|
input.skip_whitespace(); // Unnecessary for correctness, but may help try() rewind less.
|
||||||
if let Ok(item) = input.try(&mut parse_one) {
|
if let Ok(item) = input.r#try(&mut parse_one) {
|
||||||
results.push(item);
|
results.push(item);
|
||||||
} else if comma {
|
} else if comma {
|
||||||
return Err(comma_location.new_unexpected_token_error(Token::Comma));
|
return Err(comma_location.new_unexpected_token_error(Token::Comma));
|
||||||
|
@ -478,8 +478,9 @@ impl_to_css_for_predefined_type!(::cssparser::UnicodeRange);
|
||||||
macro_rules! define_css_keyword_enum {
|
macro_rules! define_css_keyword_enum {
|
||||||
(pub enum $name:ident { $($variant:ident = $css:expr,)+ }) => {
|
(pub enum $name:ident { $($variant:ident = $css:expr,)+ }) => {
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
#[cfg_attr(feature = "servo", derive(serde::Deserialize, serde::Serialize))]
|
||||||
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToShmem)]
|
#[derive(Clone, Copy, Debug, Eq, Hash,
|
||||||
|
malloc_size_of_derive::MallocSizeOf, PartialEq, to_shmem_derive::ToShmem)]
|
||||||
pub enum $name {
|
pub enum $name {
|
||||||
$($variant),+
|
$($variant),+
|
||||||
}
|
}
|
||||||
|
@ -506,7 +507,7 @@ macro_rules! define_css_keyword_enum {
|
||||||
|
|
||||||
/// Parse this property from an already-tokenized identifier.
|
/// Parse this property from an already-tokenized identifier.
|
||||||
pub fn from_ident(ident: &str) -> Result<$name, ()> {
|
pub fn from_ident(ident: &str) -> Result<$name, ()> {
|
||||||
match_ignore_ascii_case! { ident,
|
cssparser::match_ignore_ascii_case! { ident,
|
||||||
$($css => Ok($name::$variant),)+
|
$($css => Ok($name::$variant),)+
|
||||||
_ => Err(())
|
_ => Err(())
|
||||||
}
|
}
|
||||||
|
@ -532,11 +533,22 @@ macro_rules! define_css_keyword_enum {
|
||||||
/// Helper types for the handling of specified values.
|
/// Helper types for the handling of specified values.
|
||||||
pub mod specified {
|
pub mod specified {
|
||||||
use crate::ParsingMode;
|
use crate::ParsingMode;
|
||||||
|
use malloc_size_of_derive::MallocSizeOf;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Whether to allow negative lengths or not.
|
/// Whether to allow negative lengths or not.
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone, Copy, Debug, Deserialize, Eq, MallocSizeOf, PartialEq, PartialOrd, Serialize, ToShmem,
|
Clone,
|
||||||
|
Copy,
|
||||||
|
Debug,
|
||||||
|
Deserialize,
|
||||||
|
Eq,
|
||||||
|
MallocSizeOf,
|
||||||
|
PartialEq,
|
||||||
|
PartialOrd,
|
||||||
|
Serialize,
|
||||||
|
to_shmem_derive::ToShmem,
|
||||||
)]
|
)]
|
||||||
pub enum AllowedNumericType {
|
pub enum AllowedNumericType {
|
||||||
/// Allow all kind of numeric values.
|
/// Allow all kind of numeric values.
|
||||||
|
|
|
@ -5,9 +5,12 @@
|
||||||
//! Helper types for the `@viewport` rule.
|
//! Helper types for the `@viewport` rule.
|
||||||
|
|
||||||
use crate::{CSSPixel, CssWriter, ParseError, PinchZoomFactor, ToCss};
|
use crate::{CSSPixel, CssWriter, ParseError, PinchZoomFactor, ToCss};
|
||||||
use cssparser::Parser;
|
use cssparser::*;
|
||||||
use euclid::Size2D;
|
use euclid::Size2D;
|
||||||
|
use malloc_size_of_derive::MallocSizeOf;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
use std::fmt::{self, Write};
|
use std::fmt::{self, Write};
|
||||||
|
use to_shmem_derive::ToShmem;
|
||||||
|
|
||||||
define_css_keyword_enum! {
|
define_css_keyword_enum! {
|
||||||
pub enum UserZoom {
|
pub enum UserZoom {
|
||||||
|
@ -114,7 +117,6 @@ impl Zoom {
|
||||||
pub fn parse<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Zoom, ParseError<'i>> {
|
pub fn parse<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Zoom, ParseError<'i>> {
|
||||||
use crate::values::specified::AllowedNumericType::NonNegative;
|
use crate::values::specified::AllowedNumericType::NonNegative;
|
||||||
use crate::ParsingMode;
|
use crate::ParsingMode;
|
||||||
use cssparser::Token;
|
|
||||||
|
|
||||||
let location = input.current_source_location();
|
let location = input.current_source_location();
|
||||||
match *input.next()? {
|
match *input.next()? {
|
||||||
|
|
|
@ -3,6 +3,7 @@ name = "to_shmem"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
authors = ["The Servo Project Developers"]
|
authors = ["The Servo Project Developers"]
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
|
edition = "2018"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
|
@ -12,14 +12,6 @@
|
||||||
#![crate_name = "to_shmem"]
|
#![crate_name = "to_shmem"]
|
||||||
#![crate_type = "rlib"]
|
#![crate_type = "rlib"]
|
||||||
|
|
||||||
extern crate cssparser;
|
|
||||||
extern crate servo_arc;
|
|
||||||
extern crate smallbitvec;
|
|
||||||
extern crate smallvec;
|
|
||||||
#[cfg(feature = "string_cache")]
|
|
||||||
extern crate string_cache;
|
|
||||||
extern crate thin_slice;
|
|
||||||
|
|
||||||
use servo_arc::{Arc, ThinArc};
|
use servo_arc::{Arc, ThinArc};
|
||||||
use smallbitvec::{InternalStorage, SmallBitVec};
|
use smallbitvec::{InternalStorage, SmallBitVec};
|
||||||
use smallvec::{Array, SmallVec};
|
use smallvec::{Array, SmallVec};
|
||||||
|
|
|
@ -3,6 +3,7 @@ name = "to_shmem_derive"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
authors = ["The Servo Project Developers"]
|
authors = ["The Servo Project Developers"]
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
|
edition = "2018"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
|
@ -4,17 +4,6 @@
|
||||||
|
|
||||||
#![recursion_limit = "128"]
|
#![recursion_limit = "128"]
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
extern crate darling;
|
|
||||||
extern crate derive_common;
|
|
||||||
extern crate proc_macro;
|
|
||||||
extern crate proc_macro2;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate quote;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate syn;
|
|
||||||
extern crate synstructure;
|
|
||||||
|
|
||||||
use proc_macro::TokenStream;
|
use proc_macro::TokenStream;
|
||||||
|
|
||||||
mod to_shmem;
|
mod to_shmem;
|
||||||
|
|
|
@ -2,9 +2,11 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use darling::{FromDeriveInput, FromField};
|
||||||
use derive_common::cg;
|
use derive_common::cg;
|
||||||
use proc_macro2::TokenStream;
|
use proc_macro2::TokenStream;
|
||||||
use syn;
|
use quote::quote;
|
||||||
|
use syn::{self, parse_quote};
|
||||||
use synstructure::{BindStyle, Structure};
|
use synstructure::{BindStyle, Structure};
|
||||||
|
|
||||||
pub fn derive(mut input: syn::DeriveInput) -> TokenStream {
|
pub fn derive(mut input: syn::DeriveInput) -> TokenStream {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue