mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Make #[dom_struct] a proc_macro attribute
This commit is contained in:
parent
64885c4213
commit
31e9d81c0f
251 changed files with 298 additions and 35 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -629,6 +629,13 @@ dependencies = [
|
|||
"time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dom_struct"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"quote 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "domobject_derive"
|
||||
version = "0.0.1"
|
||||
|
@ -2204,6 +2211,7 @@ dependencies = [
|
|||
"cssparser 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"deny_public_fields 0.0.1",
|
||||
"devtools_traits 0.0.1",
|
||||
"dom_struct 0.0.1",
|
||||
"domobject_derive 0.0.1",
|
||||
"encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
13
components/dom_struct/Cargo.toml
Normal file
13
components/dom_struct/Cargo.toml
Normal file
|
@ -0,0 +1,13 @@
|
|||
[package]
|
||||
name = "dom_struct"
|
||||
version = "0.0.1"
|
||||
authors = ["The Servo Project Developers"]
|
||||
license = "MPL-2.0"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
||||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
quote = "0.3"
|
28
components/dom_struct/lib.rs
Normal file
28
components/dom_struct/lib.rs
Normal file
|
@ -0,0 +1,28 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![feature(proc_macro)]
|
||||
|
||||
extern crate proc_macro;
|
||||
#[macro_use] extern crate quote;
|
||||
|
||||
use proc_macro::TokenStream;
|
||||
|
||||
#[proc_macro_attribute]
|
||||
pub fn dom_struct(args: TokenStream, input: TokenStream) -> TokenStream {
|
||||
if !args.to_string().is_empty() {
|
||||
panic!("#[dom_struct] takes no arguments");
|
||||
}
|
||||
expand_string(&input.to_string()).parse().unwrap()
|
||||
}
|
||||
|
||||
fn expand_string(input: &str) -> String {
|
||||
let mut tokens = quote! {
|
||||
#[derive(DenyPublicFields, DomObject, HeapSizeOf, JSTraceable)]
|
||||
#[must_root]
|
||||
#[repr(C)]
|
||||
};
|
||||
tokens.append(input);
|
||||
tokens.to_string()
|
||||
}
|
|
@ -37,6 +37,7 @@ cookie = {version = "0.2.5", features = ["serialize-rustc"]}
|
|||
cssparser = {version = "0.10", features = ["heapsize", "serde"]}
|
||||
deny_public_fields = {path = "../deny_public_fields"}
|
||||
devtools_traits = {path = "../devtools_traits"}
|
||||
dom_struct = {path = "../dom_struct"}
|
||||
domobject_derive = {path = "../domobject_derive"}
|
||||
encoding = "0.2"
|
||||
euclid = "0.11"
|
||||
|
|
|
@ -138,6 +138,8 @@ Let's look at [Servo's implementation][document-rs] of the DOM's
|
|||
[document-mdn]: https://developer.mozilla.org/en-US/docs/Web/API/document
|
||||
|
||||
```rust
|
||||
use dom_struct::dom_struct;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct Document {
|
||||
node: Node,
|
||||
|
|
|
@ -12,6 +12,7 @@ use dom::bindings::str::DOMString;
|
|||
use dom::element::{AttributeMutation, Element};
|
||||
use dom::virtualmethods::vtable_for;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever_atoms::{Prefix, LocalName, Namespace};
|
||||
use servo_atoms::Atom;
|
||||
use std::borrow::ToOwned;
|
||||
|
|
|
@ -14,6 +14,7 @@ use dom::bindings::reflector::reflect_dom_object;
|
|||
use dom::bindings::str::DOMString;
|
||||
use dom::event::{Event, EventBubbles, EventCancelable};
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use servo_atoms::Atom;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#beforeunloadevent
|
||||
|
|
|
@ -14,6 +14,7 @@ use dom::bindings::js::{JS, Root};
|
|||
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
|
||||
use dom::bindings::trace::JSTraceable;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use js::conversions::ToJSValConvertible;
|
||||
use js::jsapi::{HandleValue, Heap, JSContext, JSObject, MutableHandleObject};
|
||||
use js::jsval::UndefinedValue;
|
||||
|
|
|
@ -11,6 +11,7 @@ use dom::bindings::js::{JS, Root};
|
|||
use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
|
||||
use dom::bindings::str::DOMString;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use encoding::all::UTF_8;
|
||||
use encoding::types::{EncoderTrap, Encoding};
|
||||
use ipc_channel::ipc;
|
||||
|
|
|
@ -30,6 +30,7 @@ use dom::eventtarget::EventTarget;
|
|||
use dom::globalscope::GlobalScope;
|
||||
use dom::permissions::{get_descriptor_permission_state, PermissionAlgorithm};
|
||||
use dom::promise::Promise;
|
||||
use dom_struct::dom_struct;
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use ipc_channel::router::ROUTER;
|
||||
use js::conversions::ConversionResult;
|
||||
|
|
|
@ -14,6 +14,7 @@ use dom::bluetoothdevice::BluetoothDevice;
|
|||
use dom::event::{Event, EventBubbles, EventCancelable};
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use servo_atoms::Atom;
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothadvertisingevent
|
||||
|
|
|
@ -8,6 +8,7 @@ use dom::bindings::codegen::Bindings::BluetoothCharacteristicPropertiesBinding::
|
|||
use dom::bindings::js::Root;
|
||||
use dom::bindings::reflector::{Reflector, reflect_dom_object};
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#characteristicproperties
|
||||
#[dom_struct]
|
||||
|
|
|
@ -24,6 +24,7 @@ use dom::bluetoothremotegattservice::BluetoothRemoteGATTService;
|
|||
use dom::eventtarget::EventTarget;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom::promise::Promise;
|
||||
use dom_struct::dom_struct;
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use js::jsapi::JSContext;
|
||||
use std::cell::Cell;
|
||||
|
|
|
@ -18,6 +18,7 @@ use dom::bluetoothdevice::BluetoothDevice;
|
|||
use dom::globalscope::GlobalScope;
|
||||
use dom::permissionstatus::PermissionStatus;
|
||||
use dom::promise::Promise;
|
||||
use dom_struct::dom_struct;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use js::jsapi::JSContext;
|
||||
use std::rc::Rc;
|
||||
|
|
|
@ -25,6 +25,7 @@ use dom::bluetoothuuid::{BluetoothDescriptorUUID, BluetoothUUID};
|
|||
use dom::eventtarget::EventTarget;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom::promise::Promise;
|
||||
use dom_struct::dom_struct;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use js::jsapi::JSContext;
|
||||
use std::rc::Rc;
|
||||
|
|
|
@ -19,6 +19,7 @@ use dom::bluetooth::{AsyncBluetoothListener, response_async};
|
|||
use dom::bluetoothremotegattcharacteristic::{BluetoothRemoteGATTCharacteristic, MAXIMUM_ATTRIBUTE_LENGTH};
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom::promise::Promise;
|
||||
use dom_struct::dom_struct;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use js::jsapi::JSContext;
|
||||
use std::rc::Rc;
|
||||
|
|
|
@ -15,6 +15,7 @@ use dom::bluetoothdevice::BluetoothDevice;
|
|||
use dom::bluetoothuuid::{BluetoothServiceUUID, BluetoothUUID};
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom::promise::Promise;
|
||||
use dom_struct::dom_struct;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use js::jsapi::JSContext;
|
||||
use std::cell::Cell;
|
||||
|
|
|
@ -17,6 +17,7 @@ use dom::bluetoothuuid::{BluetoothCharacteristicUUID, BluetoothServiceUUID, Blue
|
|||
use dom::eventtarget::EventTarget;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom::promise::Promise;
|
||||
use dom_struct::dom_struct;
|
||||
use js::jsapi::JSContext;
|
||||
use std::rc::Rc;
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ use dom::bindings::error::Fallible;
|
|||
use dom::bindings::reflector::Reflector;
|
||||
use dom::bindings::str::DOMString;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use regex::Regex;
|
||||
|
||||
pub type UUID = DOMString;
|
||||
|
|
|
@ -15,6 +15,7 @@ use dom::dissimilaroriginwindow::DissimilarOriginWindow;
|
|||
use dom::element::Element;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use js::JSCLASS_IS_GLOBAL;
|
||||
use js::glue::{CreateWrapperProxyHandler, ProxyTraps, NewWindowProxy};
|
||||
use js::glue::{GetProxyPrivate, SetProxyExtra, GetProxyExtra};
|
||||
|
|
|
@ -14,6 +14,7 @@ use dom::bindings::num::Finite;
|
|||
use dom::bindings::reflector::{Reflector, reflect_dom_object};
|
||||
use dom::bindings::str::DOMString;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#canvasgradient
|
||||
#[dom_struct]
|
||||
|
|
|
@ -8,6 +8,7 @@ use dom::bindings::js::Root;
|
|||
use dom::bindings::reflector::{Reflector, reflect_dom_object};
|
||||
use dom::canvasgradient::ToFillOrStrokeStyle;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use euclid::size::Size2D;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#canvaspattern
|
||||
|
|
|
@ -33,6 +33,7 @@ use dom::htmlcanvaselement::utils as canvas_utils;
|
|||
use dom::htmlimageelement::HTMLImageElement;
|
||||
use dom::imagedata::ImageData;
|
||||
use dom::node::{Node, NodeDamage, window_from_node};
|
||||
use dom_struct::dom_struct;
|
||||
use euclid::matrix2d::Matrix2D;
|
||||
use euclid::point::Point2D;
|
||||
use euclid::rect::Rect;
|
||||
|
|
|
@ -19,6 +19,7 @@ use dom::element::Element;
|
|||
use dom::node::{Node, NodeDamage};
|
||||
use dom::processinginstruction::ProcessingInstruction;
|
||||
use dom::text::Text;
|
||||
use dom_struct::dom_struct;
|
||||
use servo_config::opts;
|
||||
use std::cell::Ref;
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ use dom::bindings::reflector::{Reflector, reflect_dom_object};
|
|||
use dom::bindings::str::{DOMString, USVString};
|
||||
use dom::serviceworker::ServiceWorker;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use servo_url::ServoUrl;
|
||||
use std::default::Default;
|
||||
use uuid::Uuid;
|
||||
|
|
|
@ -12,6 +12,7 @@ use dom::bindings::reflector::reflect_dom_object;
|
|||
use dom::bindings::str::DOMString;
|
||||
use dom::event::{Event, EventBubbles, EventCancelable};
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use servo_atoms::Atom;
|
||||
|
||||
#[dom_struct]
|
||||
|
|
|
@ -11,6 +11,7 @@ use dom::characterdata::CharacterData;
|
|||
use dom::document::Document;
|
||||
use dom::node::Node;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
|
||||
/// An HTML comment.
|
||||
#[dom_struct]
|
||||
|
|
|
@ -10,6 +10,7 @@ use dom::bindings::error::{Error, Fallible};
|
|||
use dom::bindings::js::Root;
|
||||
use dom::bindings::reflector::{Reflector, reflect_dom_object};
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use js::jsapi::{JSContext, JSObject};
|
||||
use js::jsapi::Type;
|
||||
use servo_rand::{ServoRng, Rng};
|
||||
|
|
|
@ -8,6 +8,7 @@ use dom::bindings::error::Fallible;
|
|||
use dom::bindings::reflector::Reflector;
|
||||
use dom::bindings::str::DOMString;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use style::parser::ParserContext;
|
||||
use style::supports::{Declaration, parse_condition_or_declaration};
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ use dom::cssgroupingrule::CSSGroupingRule;
|
|||
use dom::cssmediarule::CSSMediaRule;
|
||||
use dom::cssstylesheet::CSSStyleSheet;
|
||||
use dom::csssupportsrule::CSSSupportsRule;
|
||||
use dom_struct::dom_struct;
|
||||
use parking_lot::RwLock;
|
||||
use std::sync::Arc;
|
||||
use style::stylesheets::CssRules as StyleCssRules;
|
||||
|
|
|
@ -9,6 +9,7 @@ use dom::bindings::str::DOMString;
|
|||
use dom::cssrule::{CSSRule, SpecificCSSRule};
|
||||
use dom::cssstylesheet::CSSStyleSheet;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use parking_lot::RwLock;
|
||||
use std::sync::Arc;
|
||||
use style::font_face::FontFaceRule;
|
||||
|
|
|
@ -11,6 +11,7 @@ use dom::bindings::str::DOMString;
|
|||
use dom::cssrule::CSSRule;
|
||||
use dom::cssrulelist::{CSSRuleList, RulesSource};
|
||||
use dom::cssstylesheet::CSSStyleSheet;
|
||||
use dom_struct::dom_struct;
|
||||
use parking_lot::RwLock;
|
||||
use std::sync::Arc;
|
||||
use style::stylesheets::CssRules as StyleCssRules;
|
||||
|
|
|
@ -9,6 +9,7 @@ use dom::bindings::str::DOMString;
|
|||
use dom::cssrule::{CSSRule, SpecificCSSRule};
|
||||
use dom::cssstylesheet::CSSStyleSheet;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use parking_lot::RwLock;
|
||||
use std::sync::Arc;
|
||||
use style::stylesheets::ImportRule;
|
||||
|
|
|
@ -11,6 +11,7 @@ use dom::cssrule::{CSSRule, SpecificCSSRule};
|
|||
use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner};
|
||||
use dom::cssstylesheet::CSSStyleSheet;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use parking_lot::RwLock;
|
||||
use std::sync::Arc;
|
||||
use style::keyframes::Keyframe;
|
||||
|
|
|
@ -15,6 +15,7 @@ use dom::cssrule::{CSSRule, SpecificCSSRule};
|
|||
use dom::cssrulelist::{CSSRuleList, RulesSource};
|
||||
use dom::cssstylesheet::CSSStyleSheet;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use parking_lot::RwLock;
|
||||
use servo_atoms::Atom;
|
||||
use std::sync::Arc;
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::cssrule::SpecificCSSRule;
|
|||
use dom::cssstylesheet::CSSStyleSheet;
|
||||
use dom::medialist::MediaList;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use parking_lot::RwLock;
|
||||
use std::sync::Arc;
|
||||
use style::media_queries::parse_media_query_list;
|
||||
|
|
|
@ -10,6 +10,7 @@ use dom::bindings::str::DOMString;
|
|||
use dom::cssrule::{CSSRule, SpecificCSSRule};
|
||||
use dom::cssstylesheet::CSSStyleSheet;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use parking_lot::RwLock;
|
||||
use std::sync::Arc;
|
||||
use style::stylesheets::NamespaceRule;
|
||||
|
|
|
@ -18,6 +18,7 @@ use dom::cssstylesheet::CSSStyleSheet;
|
|||
use dom::csssupportsrule::CSSSupportsRule;
|
||||
use dom::cssviewportrule::CSSViewportRule;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use std::cell::Cell;
|
||||
use style::stylesheets::CssRule as StyleCssRule;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ use dom::csskeyframerule::CSSKeyframeRule;
|
|||
use dom::cssrule::CSSRule;
|
||||
use dom::cssstylesheet::CSSStyleSheet;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use parking_lot::RwLock;
|
||||
use std::sync::Arc;
|
||||
use style::stylesheets::{CssRules, KeyframesRule, RulesMutateError};
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::cssrule::CSSRule;
|
|||
use dom::element::Element;
|
||||
use dom::node::{Node, window_from_node};
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use parking_lot::RwLock;
|
||||
use servo_url::ServoUrl;
|
||||
use std::ascii::AsciiExt;
|
||||
|
|
|
@ -11,6 +11,7 @@ use dom::cssrule::{CSSRule, SpecificCSSRule};
|
|||
use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSStyleOwner};
|
||||
use dom::cssstylesheet::CSSStyleSheet;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use parking_lot::RwLock;
|
||||
use std::sync::Arc;
|
||||
use style::stylesheets::StyleRule;
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::cssrulelist::{CSSRuleList, RulesSource};
|
|||
use dom::element::Element;
|
||||
use dom::stylesheet::StyleSheet;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use std::cell::Cell;
|
||||
use std::sync::Arc;
|
||||
use style::stylesheets::Stylesheet as StyleStyleSheet;
|
||||
|
|
|
@ -12,6 +12,7 @@ use dom::cssconditionrule::CSSConditionRule;
|
|||
use dom::cssrule::SpecificCSSRule;
|
||||
use dom::cssstylesheet::CSSStyleSheet;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use parking_lot::RwLock;
|
||||
use std::sync::Arc;
|
||||
use style::parser::ParserContext;
|
||||
|
|
|
@ -9,6 +9,7 @@ use dom::bindings::str::DOMString;
|
|||
use dom::cssrule::{CSSRule, SpecificCSSRule};
|
||||
use dom::cssstylesheet::CSSStyleSheet;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use parking_lot::RwLock;
|
||||
use std::sync::Arc;
|
||||
use style::viewport::ViewportRule;
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::bindings::str::DOMString;
|
|||
use dom::bindings::trace::RootedTraceableBox;
|
||||
use dom::event::Event;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use js::jsapi::{HandleValue, JSContext};
|
||||
use js::jsval::JSVal;
|
||||
use servo_atoms::Atom;
|
||||
|
|
|
@ -20,6 +20,7 @@ use dom::globalscope::GlobalScope;
|
|||
use dom::messageevent::MessageEvent;
|
||||
use dom::worker::{TrustedWorkerAddress, WorkerErrorHandler, WorkerMessageHandler};
|
||||
use dom::workerglobalscope::WorkerGlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
||||
use ipc_channel::router::ROUTER;
|
||||
use js::jsapi::{HandleValue, JS_SetInterruptCallback};
|
||||
|
|
|
@ -11,6 +11,7 @@ use dom::bindings::reflector::reflect_dom_object;
|
|||
use dom::bindings::str::DOMString;
|
||||
use dom::bindings::str::USVString;
|
||||
use dom::dissimilaroriginwindow::DissimilarOriginWindow;
|
||||
use dom_struct::dom_struct;
|
||||
|
||||
/// Represents a dissimilar-origin `Location` that exists in another script thread.
|
||||
///
|
||||
|
|
|
@ -10,6 +10,7 @@ use dom::bindings::str::DOMString;
|
|||
use dom::browsingcontext::BrowsingContext;
|
||||
use dom::dissimilaroriginlocation::DissimilarOriginLocation;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use ipc_channel::ipc;
|
||||
use js::jsapi::{JSContext, HandleValue};
|
||||
use js::jsval::{JSVal, UndefinedValue};
|
||||
|
|
|
@ -87,6 +87,7 @@ use dom::treewalker::TreeWalker;
|
|||
use dom::uievent::UIEvent;
|
||||
use dom::webglcontextevent::WebGLContextEvent;
|
||||
use dom::window::{ReflowReason, Window};
|
||||
use dom_struct::dom_struct;
|
||||
use encoding::EncodingRef;
|
||||
use encoding::all::UTF_8;
|
||||
use euclid::point::Point2D;
|
||||
|
|
|
@ -16,6 +16,7 @@ use dom::htmlcollection::HTMLCollection;
|
|||
use dom::node::{Node, window_from_node};
|
||||
use dom::nodelist::NodeList;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use servo_atoms::Atom;
|
||||
|
||||
// https://dom.spec.whatwg.org/#documentfragment
|
||||
|
|
|
@ -11,6 +11,7 @@ use dom::bindings::js::Root;
|
|||
use dom::bindings::str::DOMString;
|
||||
use dom::document::Document;
|
||||
use dom::node::Node;
|
||||
use dom_struct::dom_struct;
|
||||
|
||||
// https://dom.spec.whatwg.org/#documenttype
|
||||
/// The `DOCTYPE` tag.
|
||||
|
|
|
@ -9,6 +9,7 @@ use dom::bindings::js::Root;
|
|||
use dom::bindings::reflector::{Reflector, reflect_dom_object};
|
||||
use dom::bindings::str::DOMString;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
|
||||
#[repr(u16)]
|
||||
#[derive(JSTraceable, Copy, Clone, Debug, HeapSizeOf)]
|
||||
|
|
|
@ -23,6 +23,7 @@ use dom::htmltitleelement::HTMLTitleElement;
|
|||
use dom::node::Node;
|
||||
use dom::text::Text;
|
||||
use dom::xmldocument::XMLDocument;
|
||||
use dom_struct::dom_struct;
|
||||
use script_traits::DocumentActivity;
|
||||
|
||||
// https://dom.spec.whatwg.org/#domimplementation
|
||||
|
|
|
@ -10,6 +10,7 @@ use dom::bindings::js::Root;
|
|||
use dom::bindings::reflector::reflect_dom_object;
|
||||
use dom::dommatrixreadonly::{dommatrixinit_to_matrix, DOMMatrixReadOnly, entries_to_matrix};
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use euclid::Matrix4D;
|
||||
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
|||
use dom::dommatrix::DOMMatrix;
|
||||
use dom::dompoint::DOMPoint;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use euclid::{Matrix4D, Point4D, Radians};
|
||||
use std::cell::{Cell, Ref};
|
||||
use std::f64;
|
||||
|
|
|
@ -19,6 +19,7 @@ use dom::document::{Document, HasBrowsingContext, IsHTMLDocument};
|
|||
use dom::document::DocumentSource;
|
||||
use dom::servoparser::ServoParser;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use script_traits::DocumentActivity;
|
||||
|
||||
#[dom_struct]
|
||||
|
|
|
@ -9,6 +9,7 @@ use dom::bindings::js::Root;
|
|||
use dom::bindings::reflector::reflect_dom_object;
|
||||
use dom::dompointreadonly::{DOMPointReadOnly, DOMPointWriteMethods};
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
|
||||
// http://dev.w3.org/fxtf/geometry/Overview.html#dompoint
|
||||
#[dom_struct]
|
||||
|
|
|
@ -7,6 +7,7 @@ use dom::bindings::error::Fallible;
|
|||
use dom::bindings::js::Root;
|
||||
use dom::bindings::reflector::{Reflector, reflect_dom_object};
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use std::cell::Cell;
|
||||
|
||||
// http://dev.w3.org/fxtf/geometry/Overview.html#dompointreadonly
|
||||
|
|
|
@ -11,6 +11,7 @@ use dom::bindings::reflector::{DomObject, Reflector, reflect_dom_object};
|
|||
use dom::dompoint::DOMPoint;
|
||||
use dom::domrect::DOMRect;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
|
||||
// https://drafts.fxtf.org/geometry/#DOMQuad
|
||||
#[dom_struct]
|
||||
|
|
|
@ -10,6 +10,7 @@ use dom::bindings::js::Root;
|
|||
use dom::bindings::reflector::reflect_dom_object;
|
||||
use dom::domrectreadonly::DOMRectReadOnly;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct DOMRect {
|
||||
|
|
|
@ -8,6 +8,7 @@ use dom::bindings::js::{JS, Root};
|
|||
use dom::bindings::reflector::{Reflector, reflect_dom_object};
|
||||
use dom::domrect::DOMRect;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct DOMRectList {
|
||||
|
|
|
@ -7,6 +7,7 @@ use dom::bindings::error::Fallible;
|
|||
use dom::bindings::js::Root;
|
||||
use dom::bindings::reflector::{Reflector, reflect_dom_object};
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use std::cell::Cell;
|
||||
|
||||
#[dom_struct]
|
||||
|
|
|
@ -10,6 +10,7 @@ use dom::bindings::reflector::{Reflector, reflect_dom_object};
|
|||
use dom::bindings::str::DOMString;
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::window_from_node;
|
||||
use dom_struct::dom_struct;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct DOMStringMap {
|
||||
|
|
|
@ -11,6 +11,7 @@ use dom::bindings::reflector::{Reflector, reflect_dom_object};
|
|||
use dom::bindings::str::DOMString;
|
||||
use dom::element::Element;
|
||||
use dom::node::window_from_node;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever_atoms::LocalName;
|
||||
use servo_atoms::Atom;
|
||||
use style::str::HTML_SPACE_CHARACTERS;
|
||||
|
|
|
@ -72,6 +72,7 @@ use dom::text::Text;
|
|||
use dom::validation::Validatable;
|
||||
use dom::virtualmethods::{VirtualMethods, vtable_for};
|
||||
use dom::window::ReflowReason;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever::serialize;
|
||||
use html5ever::serialize::SerializeOpts;
|
||||
use html5ever::serialize::TraversalScope;
|
||||
|
|
|
@ -14,6 +14,7 @@ use dom::bindings::str::DOMString;
|
|||
use dom::bindings::trace::RootedTraceableBox;
|
||||
use dom::event::{Event, EventBubbles, EventCancelable};
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use js::jsapi::{HandleValue, JSContext};
|
||||
use js::jsval::JSVal;
|
||||
use servo_atoms::Atom;
|
||||
|
|
|
@ -19,6 +19,7 @@ use dom::globalscope::GlobalScope;
|
|||
use dom::node::Node;
|
||||
use dom::virtualmethods::vtable_for;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use script_thread::Runnable;
|
||||
use servo_atoms::Atom;
|
||||
use std::cell::Cell;
|
||||
|
|
|
@ -15,6 +15,7 @@ use dom::event::Event;
|
|||
use dom::eventtarget::EventTarget;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom::messageevent::MessageEvent;
|
||||
use dom_struct::dom_struct;
|
||||
use encoding::Encoding;
|
||||
use encoding::all::UTF_8;
|
||||
use euclid::length::Length;
|
||||
|
|
|
@ -26,6 +26,7 @@ use dom::event::{Event, EventBubbles, EventCancelable, EventStatus};
|
|||
use dom::node::document_from_node;
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use fnv::FnvHasher;
|
||||
use heapsize::HeapSizeOf;
|
||||
use js::jsapi::{CompileFunction, JS_GetFunctionObject, JSAutoCompartment};
|
||||
|
|
|
@ -11,6 +11,7 @@ use dom::bindings::reflector::reflect_dom_object;
|
|||
use dom::bindings::str::DOMString;
|
||||
use dom::event::Event;
|
||||
use dom::serviceworkerglobalscope::ServiceWorkerGlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use js::jsapi::{HandleValue, JSContext};
|
||||
use servo_atoms::Atom;
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ use dom::eventtarget::EventTarget;
|
|||
use dom::extendableevent::ExtendableEvent;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom::serviceworkerglobalscope::ServiceWorkerGlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use js::jsapi::{HandleValue, Heap, JSContext};
|
||||
use js::jsval::JSVal;
|
||||
use servo_atoms::Atom;
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::bindings::str::DOMString;
|
|||
use dom::blob::{Blob, BlobImpl, blob_parts_to_bytes};
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use net_traits::filemanager_thread::SelectedFile;
|
||||
use time;
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ use dom::bindings::js::{JS, Root};
|
|||
use dom::bindings::reflector::{Reflector, reflect_dom_object};
|
||||
use dom::file::File;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use std::slice::Iter;
|
||||
|
||||
// https://w3c.github.io/FileAPI/#dfn-filelist
|
||||
|
|
|
@ -19,6 +19,7 @@ use dom::event::{Event, EventBubbles, EventCancelable};
|
|||
use dom::eventtarget::EventTarget;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom::progressevent::ProgressEvent;
|
||||
use dom_struct::dom_struct;
|
||||
use encoding::all::UTF_8;
|
||||
use encoding::label::encoding_from_whatwg_label;
|
||||
use encoding::types::{DecoderTrap, EncodingRef};
|
||||
|
|
|
@ -8,6 +8,7 @@ use dom::bindings::js::Root;
|
|||
use dom::bindings::reflector::reflect_dom_object;
|
||||
use dom::eventtarget::EventTarget;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct FileReaderSync {
|
||||
|
|
|
@ -14,6 +14,7 @@ use dom::event::{EventBubbles, EventCancelable};
|
|||
use dom::eventtarget::EventTarget;
|
||||
use dom::uievent::UIEvent;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use std::default::Default;
|
||||
|
||||
#[dom_struct]
|
||||
|
|
|
@ -12,6 +12,7 @@ use dom::bindings::reflector::reflect_dom_object;
|
|||
use dom::bindings::str::DOMString;
|
||||
use dom::uievent::UIEvent;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct ForceTouchEvent {
|
||||
|
|
|
@ -15,6 +15,7 @@ use dom::blob::{Blob, BlobImpl};
|
|||
use dom::file::File;
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom::htmlformelement::{HTMLFormElement, FormDatumValue, FormDatum};
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever_atoms::LocalName;
|
||||
use std::collections::HashMap;
|
||||
use std::collections::hash_map::Entry::{Occupied, Vacant};
|
||||
|
|
|
@ -19,6 +19,7 @@ use dom::event::{Event, EventBubbles, EventCancelable, EventStatus};
|
|||
use dom::eventtarget::EventTarget;
|
||||
use dom::window::Window;
|
||||
use dom::workerglobalscope::WorkerGlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL};
|
||||
use js::glue::{IsWrapper, UnwrapObject};
|
||||
|
|
|
@ -12,6 +12,7 @@ use dom::bindings::reflector::reflect_dom_object;
|
|||
use dom::bindings::str::{DOMString, USVString};
|
||||
use dom::event::Event;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use servo_atoms::Atom;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#hashchangeevent
|
||||
|
|
|
@ -10,6 +10,7 @@ use dom::bindings::js::Root;
|
|||
use dom::bindings::reflector::{Reflector, reflect_dom_object};
|
||||
use dom::bindings::str::{ByteString, is_token};
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom_struct::dom_struct;
|
||||
use hyper::header::Headers as HyperHeaders;
|
||||
use mime::{Mime, TopLevel, SubLevel};
|
||||
use std::cell::Cell;
|
||||
|
|
|
@ -11,6 +11,7 @@ use dom::bindings::js::{JS, Root};
|
|||
use dom::bindings::reflector::{Reflector, reflect_dom_object};
|
||||
use dom::globalscope::GlobalScope;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use ipc_channel::ipc;
|
||||
use msg::constellation_msg::TraversalDirection;
|
||||
use script_traits::ScriptMsg as ConstellationMsg;
|
||||
|
|
|
@ -24,6 +24,7 @@ use dom::mouseevent::MouseEvent;
|
|||
use dom::node::{Node, document_from_node};
|
||||
use dom::urlhelper::UrlHelper;
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever_atoms::LocalName;
|
||||
use net_traits::ReferrerPolicy;
|
||||
use num_traits::ToPrimitive;
|
||||
|
|
|
@ -11,6 +11,7 @@ use dom::document::Document;
|
|||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::Node;
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever_atoms::LocalName;
|
||||
use style::attr::AttrValue;
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ use dom::htmlanchorelement::follow_hyperlink;
|
|||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::{Node, document_from_node};
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use dom_struct::dom_struct;
|
||||
use euclid::point::Point2D;
|
||||
use html5ever_atoms::LocalName;
|
||||
use net_traits::ReferrerPolicy;
|
||||
|
|
|
@ -8,6 +8,7 @@ use dom::bindings::str::DOMString;
|
|||
use dom::document::Document;
|
||||
use dom::htmlmediaelement::HTMLMediaElement;
|
||||
use dom::node::Node;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever_atoms::LocalName;
|
||||
|
||||
#[dom_struct]
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::element::{AttributeMutation, Element};
|
|||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::{Node, UnbindContext, document_from_node};
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever_atoms::LocalName;
|
||||
use servo_url::ServoUrl;
|
||||
use style::attr::AttrValue;
|
||||
|
|
|
@ -17,6 +17,7 @@ use dom::globalscope::GlobalScope;
|
|||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::{Node, document_from_node, window_from_node};
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever_atoms::LocalName;
|
||||
use script_traits::ScriptMsg as ConstellationMsg;
|
||||
use servo_url::ServoUrl;
|
||||
|
|
|
@ -8,6 +8,7 @@ use dom::bindings::str::DOMString;
|
|||
use dom::document::Document;
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::Node;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever_atoms::LocalName;
|
||||
|
||||
#[dom_struct]
|
||||
|
|
|
@ -23,6 +23,7 @@ use dom::nodelist::NodeList;
|
|||
use dom::validation::Validatable;
|
||||
use dom::validitystate::{ValidityState, ValidationFlags};
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever_atoms::LocalName;
|
||||
use std::cell::Cell;
|
||||
use style::element_state::*;
|
||||
|
|
|
@ -24,6 +24,7 @@ use dom::htmlelement::HTMLElement;
|
|||
use dom::node::{Node, window_from_node};
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use dom::webglrenderingcontext::{LayoutCanvasWebGLRenderingContextHelpers, WebGLRenderingContext};
|
||||
use dom_struct::dom_struct;
|
||||
use euclid::size::Size2D;
|
||||
use html5ever_atoms::LocalName;
|
||||
use image::ColorType;
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::bindings::xmlname::namespace_from_domstring;
|
|||
use dom::element::Element;
|
||||
use dom::node::Node;
|
||||
use dom::window::Window;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever_atoms::{LocalName, QualName};
|
||||
use servo_atoms::Atom;
|
||||
use std::cell::Cell;
|
||||
|
|
|
@ -9,6 +9,7 @@ use dom::bindings::str::DOMString;
|
|||
use dom::document::Document;
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::Node;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever_atoms::LocalName;
|
||||
|
||||
#[dom_struct]
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::htmlcollection::{CollectionFilter, HTMLCollection};
|
|||
use dom::htmlelement::HTMLElement;
|
||||
use dom::htmloptionelement::HTMLOptionElement;
|
||||
use dom::node::{Node, window_from_node};
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever_atoms::LocalName;
|
||||
|
||||
#[dom_struct]
|
||||
|
|
|
@ -15,6 +15,7 @@ use dom::eventtarget::EventTarget;
|
|||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::{Node, window_from_node};
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever_atoms::LocalName;
|
||||
use script_thread::Runnable;
|
||||
use std::cell::Cell;
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::element::Element;
|
|||
use dom::eventtarget::EventTarget;
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::{Node, window_from_node};
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever_atoms::LocalName;
|
||||
|
||||
#[dom_struct]
|
||||
|
|
|
@ -8,6 +8,7 @@ use dom::bindings::str::DOMString;
|
|||
use dom::document::Document;
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::Node;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever_atoms::LocalName;
|
||||
|
||||
#[dom_struct]
|
||||
|
|
|
@ -8,6 +8,7 @@ use dom::bindings::str::DOMString;
|
|||
use dom::document::Document;
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::Node;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever_atoms::LocalName;
|
||||
|
||||
#[dom_struct]
|
||||
|
|
|
@ -8,6 +8,7 @@ use dom::bindings::str::DOMString;
|
|||
use dom::document::Document;
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::Node;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever_atoms::LocalName;
|
||||
|
||||
#[dom_struct]
|
||||
|
|
|
@ -29,6 +29,7 @@ use dom::node::{Node, SEQUENTIALLY_FOCUSABLE};
|
|||
use dom::node::{document_from_node, window_from_node};
|
||||
use dom::nodelist::NodeList;
|
||||
use dom::virtualmethods::VirtualMethods;
|
||||
use dom_struct::dom_struct;
|
||||
use html5ever_atoms::LocalName;
|
||||
use std::ascii::AsciiExt;
|
||||
use std::borrow::ToOwned;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue