mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Measure heap memory usage for more types. Fixes #6951
This commit is contained in:
parent
94c8dcd575
commit
45145108da
175 changed files with 669 additions and 94 deletions
|
@ -30,6 +30,12 @@ features = [ "nightly" ]
|
|||
version = "0.3"
|
||||
features = [ "serde-serialization" ]
|
||||
|
||||
[dependencies.plugins]
|
||||
path = "../plugins"
|
||||
|
||||
[dependencies.util]
|
||||
path = "../util"
|
||||
|
||||
[dependencies]
|
||||
euclid = "0.1"
|
||||
serde_macros = "0.5"
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#![feature(custom_derive)]
|
||||
#![feature(nonzero)]
|
||||
#![feature(plugin)]
|
||||
#![plugin(serde_macros)]
|
||||
#![plugin(serde_macros, plugins)]
|
||||
|
||||
extern crate core;
|
||||
extern crate azure;
|
||||
|
@ -19,6 +19,7 @@ extern crate ipc_channel;
|
|||
extern crate layers;
|
||||
extern crate offscreen_gl_context;
|
||||
extern crate serde;
|
||||
extern crate util;
|
||||
|
||||
use azure::azure::{AzFloat, AzColor};
|
||||
use azure::azure_hl::{DrawTarget, Pattern, ColorPattern};
|
||||
|
@ -37,6 +38,7 @@ use layers::platform::surface::NativeSurface;
|
|||
use offscreen_gl_context::GLContextAttributes;
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
use core::nonzero::NonZero;
|
||||
use util::mem::HeapSizeOf;
|
||||
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
pub enum CanvasMsg {
|
||||
|
@ -159,7 +161,7 @@ pub enum CanvasWebGLMsg {
|
|||
DrawingBufferHeight(IpcSender<i32>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Deserialize, Serialize)]
|
||||
#[derive(Clone, Copy, PartialEq, Deserialize, Serialize, HeapSizeOf)]
|
||||
pub enum WebGLError {
|
||||
InvalidEnum,
|
||||
InvalidOperation,
|
||||
|
@ -183,13 +185,13 @@ pub enum WebGLShaderParameter {
|
|||
Invalid,
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
#[derive(Clone, Deserialize, Serialize, HeapSizeOf)]
|
||||
pub struct CanvasGradientStop {
|
||||
pub offset: f64,
|
||||
pub color: RGBA,
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
#[derive(Clone, Deserialize, Serialize, HeapSizeOf)]
|
||||
pub struct LinearGradientStyle {
|
||||
pub x0: f64,
|
||||
pub y0: f64,
|
||||
|
@ -211,7 +213,7 @@ impl LinearGradientStyle {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
#[derive(Clone, Deserialize, Serialize, HeapSizeOf)]
|
||||
pub struct RadialGradientStyle {
|
||||
pub x0: f64,
|
||||
pub y0: f64,
|
||||
|
@ -321,7 +323,7 @@ impl FillOrStrokeStyle {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Deserialize, Serialize)]
|
||||
#[derive(Copy, Clone, PartialEq, Deserialize, Serialize, HeapSizeOf)]
|
||||
pub enum LineCapStyle {
|
||||
Butt = 0,
|
||||
Round = 1,
|
||||
|
@ -347,7 +349,7 @@ impl LineCapStyle {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Deserialize, Serialize)]
|
||||
#[derive(Copy, Clone, PartialEq, Deserialize, Serialize, HeapSizeOf)]
|
||||
pub enum LineJoinStyle {
|
||||
Round = 0,
|
||||
Bevel = 1,
|
||||
|
@ -393,7 +395,7 @@ impl RepetitionStyle {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Deserialize, Serialize)]
|
||||
#[derive(Copy, Clone, PartialEq, Deserialize, Serialize, HeapSizeOf)]
|
||||
pub enum CompositionStyle {
|
||||
SrcIn,
|
||||
SrcOut,
|
||||
|
@ -459,7 +461,7 @@ impl CompositionStyle {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Deserialize, Serialize)]
|
||||
#[derive(Copy, Clone, PartialEq, Deserialize, Serialize, HeapSizeOf)]
|
||||
pub enum BlendingStyle {
|
||||
Multiply,
|
||||
Screen,
|
||||
|
@ -541,7 +543,7 @@ impl BlendingStyle {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Deserialize, Serialize)]
|
||||
#[derive(Copy, Clone, PartialEq, Deserialize, Serialize, HeapSizeOf)]
|
||||
pub enum CompositionOrBlending {
|
||||
Composition(CompositionStyle),
|
||||
Blending(BlendingStyle),
|
||||
|
|
|
@ -24,6 +24,9 @@ features = [ "serde_serialization" ]
|
|||
[dependencies.ipc-channel]
|
||||
git = "https://github.com/pcwalton/ipc-channel"
|
||||
|
||||
[dependencies.plugins]
|
||||
path = "../plugins"
|
||||
|
||||
[dependencies]
|
||||
time = "0.1"
|
||||
rustc-serialize = "0.3"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#![deny(unsafe_code)]
|
||||
|
||||
#![feature(custom_derive, plugin)]
|
||||
#![plugin(serde_macros)]
|
||||
#![plugin(serde_macros, plugins)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate bitflags;
|
||||
|
|
|
@ -19,6 +19,7 @@ use offscreen_gl_context::GLContextAttributes;
|
|||
use png::Image;
|
||||
use util::cursor::Cursor;
|
||||
use util::geometry::{PagePx, ViewportPx};
|
||||
use util::mem::HeapSizeOf;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::mpsc::{channel, Sender, Receiver};
|
||||
use style::viewport::ViewportConstraints;
|
||||
|
@ -69,7 +70,7 @@ pub enum KeyState {
|
|||
}
|
||||
|
||||
//N.B. Based on the glutin key enum
|
||||
#[derive(Debug, PartialEq, Eq, Copy, Clone, Deserialize, Serialize)]
|
||||
#[derive(Debug, PartialEq, Eq, Copy, Clone, Deserialize, Serialize, HeapSizeOf)]
|
||||
pub enum Key {
|
||||
Space,
|
||||
Apostrophe,
|
||||
|
|
|
@ -31,6 +31,9 @@ git = "https://github.com/pcwalton/ipc-channel"
|
|||
version = "0.2"
|
||||
features = [ "serde_serialization" ]
|
||||
|
||||
[dependencies.plugins]
|
||||
path = "../plugins"
|
||||
|
||||
[dependencies]
|
||||
log = "0.3"
|
||||
euclid = "0.1"
|
||||
|
|
|
@ -51,7 +51,7 @@ pub fn parse_hostsfile(hostsfile_content: &str) -> Box<HashMap<String, String>>
|
|||
if token.as_bytes()[0] == b'#' {
|
||||
break;
|
||||
}
|
||||
host_table.insert(token.to_owned().to_string(), address.clone());
|
||||
host_table.insert((*token).to_owned(), address.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,12 +6,13 @@ use ipc_channel::ipc::IpcSharedMemory;
|
|||
use png;
|
||||
use stb_image::image as stb_image2;
|
||||
use std::mem;
|
||||
use util::mem::HeapSizeOf;
|
||||
use util::vec::byte_swap;
|
||||
|
||||
// FIXME: Images must not be copied every frame. Instead we should atomically
|
||||
// reference count them.
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Deserialize, Serialize, HeapSizeOf)]
|
||||
pub enum PixelFormat {
|
||||
K8, // Luminance channel only
|
||||
KA8, // Luminance + alpha
|
||||
|
@ -19,11 +20,12 @@ pub enum PixelFormat {
|
|||
RGBA8, // RGB + alpha, 8 bits per channel
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
#[derive(Deserialize, Serialize, HeapSizeOf)]
|
||||
pub struct Image {
|
||||
pub width: u32,
|
||||
pub height: u32,
|
||||
pub format: PixelFormat,
|
||||
#[ignore_heap_size_of = "Defined in ipc-channel"]
|
||||
pub bytes: IpcSharedMemory,
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ use image::base::Image;
|
|||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use url::Url;
|
||||
use std::sync::Arc;
|
||||
use util::mem::HeapSizeOf;
|
||||
|
||||
/// This is optionally passed to the image cache when requesting
|
||||
/// and image, and returned to the specified event loop when the
|
||||
|
@ -37,7 +38,7 @@ pub enum ImageState {
|
|||
}
|
||||
|
||||
/// The returned image.
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
#[derive(Clone, Deserialize, Serialize, HeapSizeOf)]
|
||||
pub enum ImageResponse {
|
||||
/// The requested image was loaded.
|
||||
Loaded(Arc<Image>),
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
#![feature(slice_patterns)]
|
||||
#![feature(step_by)]
|
||||
#![feature(vec_push_all)]
|
||||
#![plugin(serde_macros)]
|
||||
#![feature(custom_attribute)]
|
||||
#![plugin(serde_macros, plugins)]
|
||||
|
||||
#![plugin(regex_macros)]
|
||||
|
||||
|
@ -35,6 +36,7 @@ use msg::constellation_msg::{PipelineId};
|
|||
use regex::Regex;
|
||||
use serde::{Deserializer, Serializer};
|
||||
use url::Url;
|
||||
use util::mem::HeapSizeOf;
|
||||
|
||||
use std::thread;
|
||||
|
||||
|
@ -56,12 +58,14 @@ pub mod image {
|
|||
pub mod base;
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
#[derive(Clone, Deserialize, Serialize, HeapSizeOf)]
|
||||
pub struct LoadData {
|
||||
pub url: Url,
|
||||
pub method: Method,
|
||||
#[ignore_heap_size_of = "Defined in hyper"]
|
||||
/// Headers that will apply to the initial request only
|
||||
pub headers: Headers,
|
||||
#[ignore_heap_size_of = "Defined in hyper"]
|
||||
/// Headers that will apply to the initial request and any redirects
|
||||
pub preserved_headers: Headers,
|
||||
pub data: Option<Vec<u8>>,
|
||||
|
@ -231,7 +235,7 @@ pub struct LoadResponse {
|
|||
pub progress_port: IpcReceiver<ProgressMsg>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
#[derive(Clone, Deserialize, Serialize, HeapSizeOf)]
|
||||
pub struct ResourceCORSData {
|
||||
/// CORS Preflight flag
|
||||
pub preflight: bool,
|
||||
|
@ -240,7 +244,7 @@ pub struct ResourceCORSData {
|
|||
}
|
||||
|
||||
/// Metadata about a loaded resource, such as is obtained from HTTP headers.
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
#[derive(Clone, Deserialize, Serialize, HeapSizeOf)]
|
||||
pub struct Metadata {
|
||||
/// Final URL after redirects.
|
||||
pub final_url: Url,
|
||||
|
@ -251,6 +255,7 @@ pub struct Metadata {
|
|||
/// Character set.
|
||||
pub charset: Option<String>,
|
||||
|
||||
#[ignore_heap_size_of = "Defined in hyper"]
|
||||
/// Headers
|
||||
pub headers: Option<Headers>,
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ use url::Url;
|
|||
|
||||
use util::str::DOMString;
|
||||
|
||||
#[derive(Copy, Clone, Deserialize, Serialize)]
|
||||
#[derive(Copy, Clone, Deserialize, Serialize, HeapSizeOf)]
|
||||
pub enum StorageType {
|
||||
Session,
|
||||
Local
|
||||
|
|
|
@ -32,6 +32,7 @@ use hyper::status::StatusClass::Success;
|
|||
|
||||
use unicase::UniCase;
|
||||
use url::{SchemeData, Url};
|
||||
use util::mem::HeapSizeOf;
|
||||
use util::task::spawn_named;
|
||||
|
||||
/// Interface for network listeners concerned with CORS checks. Proper network requests
|
||||
|
@ -40,12 +41,13 @@ pub trait AsyncCORSResponseListener {
|
|||
fn response_available(&self, response: CORSResponse);
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, HeapSizeOf)]
|
||||
pub struct CORSRequest {
|
||||
pub origin: Url,
|
||||
pub destination: Url,
|
||||
pub mode: RequestMode,
|
||||
pub method: Method,
|
||||
#[ignore_heap_size_of = "Defined in hyper"]
|
||||
pub headers: Headers,
|
||||
/// CORS preflight flag (https://fetch.spec.whatwg.org/#concept-http-fetch)
|
||||
/// Indicates that a CORS preflight request and/or cache check is to be performed
|
||||
|
@ -55,7 +57,7 @@ pub struct CORSRequest {
|
|||
/// https://fetch.spec.whatwg.org/#concept-request-mode
|
||||
/// This only covers some of the request modes. The
|
||||
/// `same-origin` and `no CORS` modes are unnecessary for XHR.
|
||||
#[derive(PartialEq, Copy, Clone)]
|
||||
#[derive(PartialEq, Copy, Clone, HeapSizeOf)]
|
||||
pub enum RequestMode {
|
||||
CORS, // CORS
|
||||
ForcedPreflight // CORS-with-forced-preflight
|
||||
|
|
|
@ -23,12 +23,13 @@ use std::cell::Ref;
|
|||
use std::mem;
|
||||
use std::ops::Deref;
|
||||
|
||||
#[derive(HeapSizeOf)]
|
||||
pub enum AttrSettingType {
|
||||
FirstSetAttr,
|
||||
ReplacedAttr,
|
||||
}
|
||||
|
||||
#[derive(JSTraceable, PartialEq, Clone)]
|
||||
#[derive(JSTraceable, PartialEq, Clone, HeapSizeOf)]
|
||||
pub enum AttrValue {
|
||||
String(DOMString),
|
||||
TokenList(DOMString, Vec<Atom>),
|
||||
|
@ -110,6 +111,7 @@ impl Deref for AttrValue {
|
|||
|
||||
// https://dom.spec.whatwg.org/#interface-attr
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct Attr {
|
||||
reflector_: Reflector,
|
||||
local_name: Atom,
|
||||
|
|
|
@ -9,6 +9,7 @@ use dom::bindings::conversions::ToJSValConvertible;
|
|||
use dom::bindings::global::GlobalRef;
|
||||
use dom::domexception::{DOMException, DOMErrorName};
|
||||
|
||||
use util::mem::HeapSizeOf;
|
||||
use util::str::DOMString;
|
||||
|
||||
use js::jsapi::{JSContext, JSObject, RootedValue};
|
||||
|
@ -24,7 +25,7 @@ use std::ptr;
|
|||
use std::mem;
|
||||
|
||||
/// DOM exceptions that can be thrown by a native DOM method.
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, HeapSizeOf)]
|
||||
pub enum Error {
|
||||
/// IndexSizeError DOMException
|
||||
IndexSize,
|
||||
|
|
|
@ -27,6 +27,8 @@ use js::jsapi::{GetGlobalForObjectCrossCompartment};
|
|||
use js::jsapi::{JSContext, JSObject, JS_GetClass, MutableHandleValue};
|
||||
use url::Url;
|
||||
|
||||
use util::mem::HeapSizeOf;
|
||||
|
||||
/// A freely-copyable reference to a rooted global object.
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum GlobalRef<'a> {
|
||||
|
@ -47,7 +49,7 @@ pub enum GlobalRoot {
|
|||
|
||||
/// A traced reference to a global object, for use in fields of traced Rust
|
||||
/// structures.
|
||||
#[derive(JSTraceable)]
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
#[must_root]
|
||||
pub enum GlobalField {
|
||||
/// A field for a `Window` object.
|
||||
|
|
|
@ -463,4 +463,3 @@ impl<T: Reflectable> Drop for Root<T> {
|
|||
unsafe { (*self.root_list).unroot(self); }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,8 +11,10 @@ use std::ops;
|
|||
use std::str;
|
||||
use std::str::FromStr;
|
||||
|
||||
use util::mem::HeapSizeOf;
|
||||
|
||||
/// Encapsulates the IDL `ByteString` type.
|
||||
#[derive(JSTraceable,Clone,Eq,PartialEq)]
|
||||
#[derive(JSTraceable, Clone, Eq, PartialEq, HeapSizeOf)]
|
||||
pub struct ByteString(Vec<u8>);
|
||||
|
||||
impl ByteString {
|
||||
|
|
|
@ -17,7 +17,7 @@ use std::borrow::ToOwned;
|
|||
use std::cmp::{min, max};
|
||||
use std::cell::{Cell};
|
||||
|
||||
#[derive(JSTraceable)]
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
pub enum BlobTypeId {
|
||||
Blob,
|
||||
File,
|
||||
|
@ -25,6 +25,7 @@ pub enum BlobTypeId {
|
|||
|
||||
// http://dev.w3.org/2006/webapi/FileAPI/#blob
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct Blob {
|
||||
reflector_: Reflector,
|
||||
type_: BlobTypeId,
|
||||
|
|
|
@ -16,13 +16,14 @@ use dom::canvasrenderingcontext2d::parse_color;
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#canvasgradient
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct CanvasGradient {
|
||||
reflector_: Reflector,
|
||||
style: CanvasGradientStyle,
|
||||
stops: DOMRefCell<Vec<CanvasGradientStop>>,
|
||||
}
|
||||
|
||||
#[derive(JSTraceable, Clone)]
|
||||
#[derive(JSTraceable, Clone, HeapSizeOf)]
|
||||
pub enum CanvasGradientStyle {
|
||||
Linear(LinearGradientStyle),
|
||||
Radial(RadialGradientStyle),
|
||||
|
|
|
@ -12,6 +12,7 @@ use euclid::size::Size2D;
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#canvaspattern
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct CanvasPattern {
|
||||
reflector_: Reflector,
|
||||
surface_data: Vec<u8>,
|
||||
|
|
|
@ -51,7 +51,7 @@ use url::Url;
|
|||
use util::vec::byte_swap;
|
||||
|
||||
#[must_root]
|
||||
#[derive(JSTraceable, Clone)]
|
||||
#[derive(JSTraceable, Clone, HeapSizeOf)]
|
||||
pub enum CanvasFillOrStrokeStyle {
|
||||
Color(RGBA),
|
||||
Gradient(JS<CanvasGradient>),
|
||||
|
@ -60,10 +60,12 @@ pub enum CanvasFillOrStrokeStyle {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#canvasrenderingcontext2d
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct CanvasRenderingContext2D {
|
||||
reflector_: Reflector,
|
||||
global: GlobalField,
|
||||
renderer_id: usize,
|
||||
#[ignore_heap_size_of = "Defined in ipc-channel"]
|
||||
ipc_renderer: IpcSender<CanvasMsg>,
|
||||
canvas: JS<HTMLCanvasElement>,
|
||||
state: RefCell<CanvasContextState>,
|
||||
|
@ -71,7 +73,7 @@ pub struct CanvasRenderingContext2D {
|
|||
}
|
||||
|
||||
#[must_root]
|
||||
#[derive(JSTraceable, Clone)]
|
||||
#[derive(JSTraceable, Clone, HeapSizeOf)]
|
||||
struct CanvasContextState {
|
||||
global_alpha: f64,
|
||||
global_composition: CompositionOrBlending,
|
||||
|
|
|
@ -16,6 +16,7 @@ use script_task::ScriptChan;
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct CloseEvent {
|
||||
event: Event,
|
||||
wasClean: bool,
|
||||
|
|
|
@ -16,6 +16,7 @@ use util::str::DOMString;
|
|||
|
||||
/// An HTML comment.
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct Comment {
|
||||
characterdata: CharacterData,
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use util::str::DOMString;
|
|||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Console
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct Console {
|
||||
reflector_: Reflector,
|
||||
global: GlobalField,
|
||||
|
|
|
@ -22,6 +22,7 @@ no_jsmanaged_fields!(OsRng);
|
|||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Crypto
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct Crypto {
|
||||
reflector_: Reflector,
|
||||
rng: DOMRefCell<OsRng>,
|
||||
|
|
|
@ -10,6 +10,7 @@ use util::str::DOMString;
|
|||
use cssparser::serialize_identifier;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct CSS {
|
||||
reflector_: Reflector,
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ use std::cell::Ref;
|
|||
|
||||
// http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct CSSStyleDeclaration {
|
||||
reflector_: Reflector,
|
||||
owner: JS<HTMLElement>,
|
||||
|
@ -32,7 +33,7 @@ pub struct CSSStyleDeclaration {
|
|||
pseudo: Option<PseudoElement>,
|
||||
}
|
||||
|
||||
#[derive(PartialEq)]
|
||||
#[derive(PartialEq, HeapSizeOf)]
|
||||
pub enum CSSModificationAccess {
|
||||
ReadWrite,
|
||||
Readonly
|
||||
|
|
|
@ -17,8 +17,10 @@ use util::str::DOMString;
|
|||
|
||||
// https://dom.spec.whatwg.org/#interface-customevent
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct CustomEvent {
|
||||
event: Event,
|
||||
#[ignore_heap_size_of = "Defined in rust-mozjs"]
|
||||
detail: MutHeapJSVal,
|
||||
}
|
||||
|
||||
|
|
|
@ -98,12 +98,17 @@ enum MixedMessage {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dedicatedworkerglobalscope
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct DedicatedWorkerGlobalScope {
|
||||
workerglobalscope: WorkerGlobalScope,
|
||||
id: PipelineId,
|
||||
#[ignore_heap_size_of = "Defined in std"]
|
||||
receiver: Receiver<(TrustedWorkerAddress, ScriptMsg)>,
|
||||
#[ignore_heap_size_of = "Defined in std"]
|
||||
own_sender: Sender<(TrustedWorkerAddress, ScriptMsg)>,
|
||||
#[ignore_heap_size_of = "Trusted<T> has unclear ownership like JS<T>"]
|
||||
worker: DOMRefCell<Option<TrustedWorkerAddress>>,
|
||||
#[ignore_heap_size_of = "Can't measure trait objects"]
|
||||
/// Sender to the parent thread.
|
||||
parent_sender: Box<ScriptChan+Send>,
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ use std::sync::mpsc::channel;
|
|||
use std::rc::Rc;
|
||||
use time;
|
||||
|
||||
#[derive(JSTraceable, PartialEq)]
|
||||
#[derive(JSTraceable, PartialEq, HeapSizeOf)]
|
||||
pub enum IsHTMLDocument {
|
||||
HTMLDocument,
|
||||
NonHTMLDocument,
|
||||
|
@ -171,7 +171,7 @@ impl DocumentDerived for EventTarget {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(JSTraceable)]
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
struct ImagesFilter;
|
||||
impl CollectionFilter for ImagesFilter {
|
||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||
|
@ -179,7 +179,7 @@ impl CollectionFilter for ImagesFilter {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(JSTraceable)]
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
struct EmbedsFilter;
|
||||
impl CollectionFilter for EmbedsFilter {
|
||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||
|
@ -187,7 +187,7 @@ impl CollectionFilter for EmbedsFilter {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(JSTraceable)]
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
struct LinksFilter;
|
||||
impl CollectionFilter for LinksFilter {
|
||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||
|
@ -196,7 +196,7 @@ impl CollectionFilter for LinksFilter {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(JSTraceable)]
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
struct FormsFilter;
|
||||
impl CollectionFilter for FormsFilter {
|
||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||
|
@ -204,7 +204,7 @@ impl CollectionFilter for FormsFilter {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(JSTraceable)]
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
struct ScriptsFilter;
|
||||
impl CollectionFilter for ScriptsFilter {
|
||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||
|
@ -212,7 +212,7 @@ impl CollectionFilter for ScriptsFilter {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(JSTraceable)]
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
struct AnchorsFilter;
|
||||
impl CollectionFilter for AnchorsFilter {
|
||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||
|
@ -220,7 +220,7 @@ impl CollectionFilter for AnchorsFilter {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(JSTraceable)]
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
struct AppletsFilter;
|
||||
impl CollectionFilter for AppletsFilter {
|
||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||
|
@ -1053,6 +1053,7 @@ impl<'a> DocumentHelpers<'a> for &'a Document {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf)]
|
||||
pub enum MouseEventType {
|
||||
Click,
|
||||
MouseDown,
|
||||
|
@ -1060,7 +1061,7 @@ pub enum MouseEventType {
|
|||
}
|
||||
|
||||
|
||||
#[derive(PartialEq)]
|
||||
#[derive(PartialEq, HeapSizeOf)]
|
||||
pub enum DocumentSource {
|
||||
FromParser,
|
||||
NotFromParser,
|
||||
|
@ -1827,7 +1828,7 @@ impl<'a> DocumentMethods for &'a Document {
|
|||
// https://html.spec.whatwg.org/multipage/#dom-tree-accessors:dom-document-nameditem-filter
|
||||
fn NamedGetter(self, _cx: *mut JSContext, name: DOMString, found: &mut bool)
|
||||
-> *mut JSObject {
|
||||
#[derive(JSTraceable)]
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
struct NamedElementFilter {
|
||||
name: Atom,
|
||||
}
|
||||
|
@ -1918,6 +1919,7 @@ fn is_scheme_host_port_tuple(url: &Url) -> bool {
|
|||
url.host().is_some() && url.port_or_default().is_some()
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf)]
|
||||
pub enum DocumentProgressTask {
|
||||
DOMContentLoaded,
|
||||
Load,
|
||||
|
|
|
@ -21,6 +21,7 @@ use util::str::DOMString;
|
|||
|
||||
// https://dom.spec.whatwg.org/#documentfragment
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct DocumentFragment {
|
||||
node: Node,
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ use std::borrow::ToOwned;
|
|||
// https://dom.spec.whatwg.org/#documenttype
|
||||
/// The `DOCTYPE` tag.
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct DocumentType {
|
||||
node: Node,
|
||||
name: DOMString,
|
||||
|
|
|
@ -13,7 +13,7 @@ use util::str::DOMString;
|
|||
use std::borrow::ToOwned;
|
||||
|
||||
#[repr(u16)]
|
||||
#[derive(JSTraceable, Copy, Clone, Debug)]
|
||||
#[derive(JSTraceable, Copy, Clone, Debug, HeapSizeOf)]
|
||||
pub enum DOMErrorName {
|
||||
IndexSizeError = DOMExceptionConstants::INDEX_SIZE_ERR,
|
||||
HierarchyRequestError = DOMExceptionConstants::HIERARCHY_REQUEST_ERR,
|
||||
|
@ -41,6 +41,7 @@ pub enum DOMErrorName {
|
|||
}
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct DOMException {
|
||||
reflector_: Reflector,
|
||||
code: DOMErrorName,
|
||||
|
|
|
@ -27,6 +27,7 @@ use std::borrow::ToOwned;
|
|||
|
||||
// https://dom.spec.whatwg.org/#domimplementation
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct DOMImplementation {
|
||||
reflector_: Reflector,
|
||||
document: JS<Document>,
|
||||
|
|
|
@ -21,6 +21,7 @@ use util::str::DOMString;
|
|||
use std::borrow::ToOwned;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct DOMParser {
|
||||
reflector_: Reflector,
|
||||
window: JS<Window>, //XXXjdm Document instead?
|
||||
|
|
|
@ -12,6 +12,7 @@ use dom::dompointreadonly::{DOMPointReadOnly, DOMPointWriteMethods};
|
|||
|
||||
// http://dev.w3.org/fxtf/geometry/Overview.html#dompoint
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct DOMPoint {
|
||||
point: DOMPointReadOnly
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ use std::cell::Cell;
|
|||
|
||||
// http://dev.w3.org/fxtf/geometry/Overview.html#dompointreadonly
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct DOMPointReadOnly {
|
||||
reflector_: Reflector,
|
||||
x: Cell<f64>,
|
||||
|
|
|
@ -12,6 +12,7 @@ use dom::window::Window;
|
|||
use util::geometry::Au;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct DOMRect {
|
||||
reflector_: Reflector,
|
||||
top: f32,
|
||||
|
|
|
@ -11,6 +11,7 @@ use dom::domrect::DOMRect;
|
|||
use dom::window::Window;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct DOMRectList {
|
||||
reflector_: Reflector,
|
||||
rects: Vec<JS<DOMRect>>,
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::htmlelement::{HTMLElement, HTMLElementCustomAttributeHelpers};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct DOMStringMap {
|
||||
reflector_: Reflector,
|
||||
element: JS<HTMLElement>,
|
||||
|
|
|
@ -19,6 +19,7 @@ use string_cache::Atom;
|
|||
use std::borrow::ToOwned;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct DOMTokenList {
|
||||
reflector_: Reflector,
|
||||
element: JS<Element>,
|
||||
|
|
|
@ -92,6 +92,7 @@ use std::mem;
|
|||
use std::sync::Arc;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct Element {
|
||||
node: Node,
|
||||
local_name: Atom,
|
||||
|
@ -125,7 +126,7 @@ pub enum ElementTypeId {
|
|||
Element,
|
||||
}
|
||||
|
||||
#[derive(PartialEq)]
|
||||
#[derive(PartialEq, HeapSizeOf)]
|
||||
pub enum ElementCreator {
|
||||
ParserCreated,
|
||||
ScriptCreated,
|
||||
|
@ -562,7 +563,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Copy, Clone)]
|
||||
#[derive(PartialEq, Eq, Copy, Clone, HeapSizeOf)]
|
||||
pub enum StylePriority {
|
||||
Important,
|
||||
Normal,
|
||||
|
|
|
@ -22,12 +22,14 @@ use std::cell::Cell;
|
|||
use js::jsval::JSVal;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct ErrorEvent {
|
||||
event: Event,
|
||||
message: DOMRefCell<DOMString>,
|
||||
filename: DOMRefCell<DOMString>,
|
||||
lineno: Cell<u32>,
|
||||
colno: Cell<u32>,
|
||||
#[ignore_heap_size_of = "Defined in rust-mozjs"]
|
||||
error: MutHeapJSVal,
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ use time;
|
|||
|
||||
#[derive(JSTraceable, Copy, Clone)]
|
||||
#[repr(u16)]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub enum EventPhase {
|
||||
None = EventConstants::NONE,
|
||||
Capturing = EventConstants::CAPTURING_PHASE,
|
||||
|
@ -27,7 +28,7 @@ pub enum EventPhase {
|
|||
Bubbling = EventConstants::BUBBLING_PHASE,
|
||||
}
|
||||
|
||||
#[derive(JSTraceable, PartialEq)]
|
||||
#[derive(JSTraceable, PartialEq, HeapSizeOf)]
|
||||
pub enum EventTypeId {
|
||||
CustomEvent,
|
||||
HTMLEvent,
|
||||
|
@ -41,19 +42,20 @@ pub enum EventTypeId {
|
|||
CloseEvent
|
||||
}
|
||||
|
||||
#[derive(PartialEq)]
|
||||
#[derive(PartialEq, HeapSizeOf)]
|
||||
pub enum EventBubbles {
|
||||
Bubbles,
|
||||
DoesNotBubble
|
||||
}
|
||||
|
||||
#[derive(PartialEq)]
|
||||
#[derive(PartialEq, HeapSizeOf)]
|
||||
pub enum EventCancelable {
|
||||
Cancelable,
|
||||
NotCancelable
|
||||
}
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct Event {
|
||||
reflector_: Reflector,
|
||||
type_id: EventTypeId,
|
||||
|
|
|
@ -11,6 +11,7 @@ use dom::blob::{Blob, BlobTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct File {
|
||||
blob: Blob,
|
||||
name: DOMString,
|
||||
|
|
|
@ -12,6 +12,7 @@ use dom::window::Window;
|
|||
|
||||
// https://w3c.github.io/FileAPI/#dfn-filelist
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct FileList {
|
||||
reflector_: Reflector,
|
||||
list: Vec<JS<File>>
|
||||
|
|
|
@ -29,7 +29,7 @@ use util::str::DOMString;
|
|||
use util::task::spawn_named;
|
||||
use rustc_serialize::base64::{Config, ToBase64, CharacterSet, Newline};
|
||||
|
||||
#[derive(PartialEq, Clone, Copy, JSTraceable)]
|
||||
#[derive(PartialEq, Clone, Copy, JSTraceable, HeapSizeOf)]
|
||||
pub enum FileReaderFunction {
|
||||
ReadAsText,
|
||||
ReadAsDataUrl,
|
||||
|
@ -37,7 +37,7 @@ pub enum FileReaderFunction {
|
|||
|
||||
pub type TrustedFileReader = Trusted<FileReader>;
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, HeapSizeOf)]
|
||||
pub struct ReadMetaData {
|
||||
pub blobtype: DOMString,
|
||||
pub label: Option<DOMString>,
|
||||
|
@ -55,11 +55,11 @@ impl ReadMetaData {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Clone, Copy, JSTraceable)]
|
||||
#[derive(PartialEq, Clone, Copy, JSTraceable, HeapSizeOf)]
|
||||
pub struct GenerationId(u32);
|
||||
|
||||
#[repr(u16)]
|
||||
#[derive(Copy, Clone, Debug, PartialEq, JSTraceable)]
|
||||
#[derive(Copy, Clone, Debug, PartialEq, JSTraceable, HeapSizeOf)]
|
||||
pub enum FileReaderReadyState {
|
||||
Empty = FileReaderConstants::EMPTY,
|
||||
Loading = FileReaderConstants::LOADING,
|
||||
|
@ -67,6 +67,7 @@ pub enum FileReaderReadyState {
|
|||
}
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct FileReader {
|
||||
eventtarget: EventTarget,
|
||||
global: GlobalField,
|
||||
|
|
|
@ -23,12 +23,14 @@ use std::collections::hash_map::Entry::{Occupied, Vacant};
|
|||
|
||||
#[derive(JSTraceable, Clone)]
|
||||
#[must_root]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub enum FormDatum {
|
||||
StringData(DOMString),
|
||||
FileData(JS<File>)
|
||||
}
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct FormData {
|
||||
reflector_: Reflector,
|
||||
data: DOMRefCell<HashMap<DOMString, Vec<FormDatum>>>,
|
||||
|
|
|
@ -33,6 +33,7 @@ use url::UrlParser;
|
|||
use std::default::Default;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLAnchorElement {
|
||||
htmlelement: HTMLElement,
|
||||
rel_list: MutNullableHeap<JS<DOMTokenList>>,
|
||||
|
|
|
@ -20,6 +20,7 @@ use string_cache::Atom;
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLAppletElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ use string_cache::Atom;
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLAreaElement {
|
||||
htmlelement: HTMLElement,
|
||||
rel_list: MutNullableHeap<JS<DOMTokenList>>,
|
||||
|
|
|
@ -14,6 +14,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLAudioElement {
|
||||
htmlmediaelement: HTMLMediaElement
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ use util::str::DOMString;
|
|||
use url::{Url, UrlParser};
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLBaseElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ use time;
|
|||
const INITIAL_REFLOW_DELAY: u64 = 200_000_000;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLBodyElement {
|
||||
htmlelement: HTMLElement,
|
||||
background_color: Cell<Option<RGBA>>,
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLBRElement {
|
||||
htmlelement: HTMLElement,
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ use std::cell::Cell;
|
|||
|
||||
#[derive(JSTraceable, PartialEq, Copy, Clone)]
|
||||
#[allow(dead_code)]
|
||||
#[derive(HeapSizeOf)]
|
||||
enum ButtonType {
|
||||
ButtonSubmit,
|
||||
ButtonReset,
|
||||
|
@ -37,6 +38,7 @@ enum ButtonType {
|
|||
}
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLButtonElement {
|
||||
htmlelement: HTMLElement,
|
||||
button_type: Cell<ButtonType>
|
||||
|
|
|
@ -38,7 +38,7 @@ const DEFAULT_WIDTH: u32 = 300;
|
|||
const DEFAULT_HEIGHT: u32 = 150;
|
||||
|
||||
#[must_root]
|
||||
#[derive(JSTraceable, Clone, Copy)]
|
||||
#[derive(JSTraceable, Clone, Copy, HeapSizeOf)]
|
||||
pub enum CanvasContext {
|
||||
Context2d(JS<CanvasRenderingContext2D>),
|
||||
WebGL(JS<WebGLRenderingContext>),
|
||||
|
@ -47,6 +47,7 @@ pub enum CanvasContext {
|
|||
impl HeapGCValue for CanvasContext {}
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLCanvasElement {
|
||||
htmlelement: HTMLElement,
|
||||
context: MutNullableHeap<CanvasContext>,
|
||||
|
|
|
@ -30,8 +30,10 @@ pub enum CollectionTypeId {
|
|||
}
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLCollection {
|
||||
reflector_: Reflector,
|
||||
#[ignore_heap_size_of = "Contains a trait object; can't measure due to #6870"]
|
||||
collection: CollectionTypeId,
|
||||
}
|
||||
|
||||
|
@ -57,7 +59,7 @@ impl HTMLCollection {
|
|||
|
||||
fn all_elements(window: &Window, root: &Node,
|
||||
namespace_filter: Option<Namespace>) -> Root<HTMLCollection> {
|
||||
#[derive(JSTraceable)]
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
struct AllElementFilter {
|
||||
namespace_filter: Option<Namespace>
|
||||
}
|
||||
|
@ -79,7 +81,7 @@ impl HTMLCollection {
|
|||
return HTMLCollection::all_elements(window, root, None);
|
||||
}
|
||||
|
||||
#[derive(JSTraceable)]
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
struct TagNameFilter {
|
||||
tag: Atom,
|
||||
ascii_lower_tag: Atom,
|
||||
|
@ -110,7 +112,7 @@ impl HTMLCollection {
|
|||
if tag == "*" {
|
||||
return HTMLCollection::all_elements(window, root, namespace_filter);
|
||||
}
|
||||
#[derive(JSTraceable)]
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
struct TagNameNSFilter {
|
||||
tag: Atom,
|
||||
namespace_filter: Option<Namespace>
|
||||
|
@ -135,7 +137,7 @@ impl HTMLCollection {
|
|||
|
||||
pub fn by_class_name(window: &Window, root: &Node, classes: DOMString)
|
||||
-> Root<HTMLCollection> {
|
||||
#[derive(JSTraceable)]
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
struct ClassNameFilter {
|
||||
classes: Vec<Atom>
|
||||
}
|
||||
|
@ -153,7 +155,7 @@ impl HTMLCollection {
|
|||
}
|
||||
|
||||
pub fn children(window: &Window, root: &Node) -> Root<HTMLCollection> {
|
||||
#[derive(JSTraceable)]
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
struct ElementChildFilter;
|
||||
impl CollectionFilter for ElementChildFilter {
|
||||
fn filter(&self, elem: &Element, root: &Node) -> bool {
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLDataElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ use dom::node::{Node, NodeTypeId, window_from_node};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLDataListElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
@ -51,7 +52,7 @@ impl HTMLDataListElement {
|
|||
impl<'a> HTMLDataListElementMethods for &'a HTMLDataListElement {
|
||||
// https://html.spec.whatwg.org/multipage/#dom-datalist-options
|
||||
fn Options(self) -> Root<HTMLCollection> {
|
||||
#[derive(JSTraceable)]
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
struct HTMLDataListOptionsFilter;
|
||||
impl CollectionFilter for HTMLDataListOptionsFilter {
|
||||
fn filter(&self, elem: &Element, _root: &Node) -> bool {
|
||||
|
|
|
@ -18,6 +18,7 @@ use util::str::DOMString;
|
|||
use std::borrow::ToOwned;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLDialogElement {
|
||||
htmlelement: HTMLElement,
|
||||
return_value: DOMRefCell<DOMString>,
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLDirectoryElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLDivElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLDListElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ use std::intrinsics;
|
|||
use std::rc::Rc;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLElement {
|
||||
element: Element,
|
||||
style_decl: MutNullableHeap<JS<CSSStyleDeclaration>>,
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLEmbedElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ use dom::virtualmethods::VirtualMethods;
|
|||
use util::str::{DOMString, StaticStringVec};
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLFieldSetElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
@ -56,7 +57,7 @@ impl HTMLFieldSetElement {
|
|||
impl<'a> HTMLFieldSetElementMethods for &'a HTMLFieldSetElement {
|
||||
// https://www.whatwg.org/html/#dom-fieldset-elements
|
||||
fn Elements(self) -> Root<HTMLCollection> {
|
||||
#[derive(JSTraceable)]
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
struct ElementsFilter;
|
||||
impl CollectionFilter for ElementsFilter {
|
||||
fn filter<'a>(&self, elem: &'a Element, _root: &'a Node) -> bool {
|
||||
|
|
|
@ -19,6 +19,7 @@ use cssparser::RGBA;
|
|||
use std::cell::Cell;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLFontElement {
|
||||
htmlelement: HTMLElement,
|
||||
color: Cell<Option<RGBA>>,
|
||||
|
|
|
@ -43,6 +43,7 @@ use std::borrow::ToOwned;
|
|||
use std::cell::Cell;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLFormElement {
|
||||
htmlelement: HTMLElement,
|
||||
marked_for_reset: Cell<bool>,
|
||||
|
@ -149,13 +150,13 @@ impl<'a> HTMLFormElementMethods for &'a HTMLFormElement {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
#[derive(Copy, Clone, HeapSizeOf)]
|
||||
pub enum SubmittedFrom {
|
||||
FromFormSubmitMethod,
|
||||
NotFromFormSubmitMethod
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
#[derive(Copy, Clone, HeapSizeOf)]
|
||||
pub enum ResetFrom {
|
||||
FromFormResetMethod,
|
||||
NotFromFormResetMethod
|
||||
|
@ -415,27 +416,28 @@ impl<'a> HTMLFormElementHelpers for &'a HTMLFormElement {
|
|||
}
|
||||
|
||||
// TODO: add file support
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct FormDatum {
|
||||
pub ty: DOMString,
|
||||
pub name: DOMString,
|
||||
pub value: DOMString
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
#[derive(Copy, Clone, HeapSizeOf)]
|
||||
pub enum FormEncType {
|
||||
TextPlainEncoded,
|
||||
UrlEncoded,
|
||||
FormDataEncoded
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
#[derive(Copy, Clone, HeapSizeOf)]
|
||||
pub enum FormMethod {
|
||||
FormGet,
|
||||
FormPost,
|
||||
FormDialog
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
#[derive(Copy, Clone, HeapSizeOf)]
|
||||
pub enum FormSubmitter<'a> {
|
||||
FormElement(&'a HTMLFormElement),
|
||||
InputElement(&'a HTMLInputElement),
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLFrameElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLFrameSetElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ use dom::virtualmethods::VirtualMethods;
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLHeadElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ use dom::htmlelement::{HTMLElement, HTMLElementTypeId};
|
|||
use dom::node::{Node, NodeTypeId};
|
||||
use util::str::DOMString;
|
||||
|
||||
#[derive(JSTraceable)]
|
||||
#[derive(JSTraceable, HeapSizeOf)]
|
||||
pub enum HeadingLevel {
|
||||
Heading1,
|
||||
Heading2,
|
||||
|
@ -23,6 +23,7 @@ pub enum HeadingLevel {
|
|||
}
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLHeadingElement {
|
||||
htmlelement: HTMLElement,
|
||||
level: HeadingLevel,
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLHRElement {
|
||||
htmlelement: HTMLElement,
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLHtmlElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ use util::str::{self, LengthOrPercentageOrAuto};
|
|||
use js::jsapi::{RootedValue, JSAutoRequest, JSAutoCompartment};
|
||||
use js::jsval::UndefinedValue;
|
||||
|
||||
#[derive(HeapSizeOf)]
|
||||
enum SandboxAllowance {
|
||||
AllowNothing = 0x00,
|
||||
AllowSameOrigin = 0x01,
|
||||
|
@ -54,6 +55,7 @@ enum SandboxAllowance {
|
|||
}
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLIFrameElement {
|
||||
htmlelement: HTMLElement,
|
||||
subpage_id: Cell<Option<SubpageId>>,
|
||||
|
|
|
@ -37,6 +37,7 @@ use std::borrow::ToOwned;
|
|||
use std::sync::Arc;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLImageElement {
|
||||
htmlelement: HTMLElement,
|
||||
url: DOMRefCell<Option<Url>>,
|
||||
|
|
|
@ -46,6 +46,7 @@ const DEFAULT_RESET_VALUE: &'static str = "Reset";
|
|||
|
||||
#[derive(JSTraceable, PartialEq, Copy, Clone)]
|
||||
#[allow(dead_code)]
|
||||
#[derive(HeapSizeOf)]
|
||||
enum InputType {
|
||||
InputSubmit,
|
||||
InputReset,
|
||||
|
@ -59,6 +60,7 @@ enum InputType {
|
|||
}
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLInputElement {
|
||||
htmlelement: HTMLElement,
|
||||
input_type: Cell<InputType>,
|
||||
|
@ -68,6 +70,7 @@ pub struct HTMLInputElement {
|
|||
indeterminate: Cell<bool>,
|
||||
value_changed: Cell<bool>,
|
||||
size: Cell<u32>,
|
||||
#[ignore_heap_size_of = "#7193"]
|
||||
textinput: DOMRefCell<TextInput<ConstellationChan>>,
|
||||
activation_state: DOMRefCell<InputActivationState>,
|
||||
}
|
||||
|
@ -80,6 +83,7 @@ impl PartialEq for HTMLInputElement {
|
|||
|
||||
#[derive(JSTraceable)]
|
||||
#[must_root]
|
||||
#[derive(HeapSizeOf)]
|
||||
struct InputActivationState {
|
||||
indeterminate: bool,
|
||||
checked: bool,
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLLabelElement {
|
||||
htmlelement: HTMLElement,
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLLegendElement {
|
||||
htmlelement: HTMLElement,
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLLIElement {
|
||||
htmlelement: HTMLElement,
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ use url::UrlParser;
|
|||
use string_cache::Atom;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLLinkElement {
|
||||
htmlelement: HTMLElement,
|
||||
rel_list: MutNullableHeap<JS<DOMTokenList>>,
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLMapElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ use dom::node::NodeTypeId;
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLMediaElement {
|
||||
htmlelement: HTMLElement,
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLMetaElement {
|
||||
htmlelement: HTMLElement,
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLMeterElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLModElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ use util::str::DOMString;
|
|||
use std::sync::Arc;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLObjectElement {
|
||||
htmlelement: HTMLElement,
|
||||
image: DOMRefCell<Option<Arc<Image>>>,
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLOListElement {
|
||||
htmlelement: HTMLElement,
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ use dom::virtualmethods::VirtualMethods;
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLOptGroupElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ use dom::virtualmethods::VirtualMethods;
|
|||
use util::str::{DOMString, split_html_space_chars};
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLOptionElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ use dom::validitystate::ValidityState;
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLOutputElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLParagraphElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLParamElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLPreElement {
|
||||
htmlelement: HTMLElement,
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLProgressElement {
|
||||
htmlelement: HTMLElement,
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLQuoteElement {
|
||||
htmlelement: HTMLElement,
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ use string_cache::Atom;
|
|||
use url::{Url, UrlParser};
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLScriptElement {
|
||||
htmlelement: HTMLElement,
|
||||
|
||||
|
@ -74,6 +75,7 @@ pub struct HTMLScriptElement {
|
|||
/// Document of the parser that created this element
|
||||
parser_document: JS<Document>,
|
||||
|
||||
#[ignore_heap_size_of = "Defined in rust-encoding"]
|
||||
/// https://html.spec.whatwg.org/multipage/#concept-script-encoding
|
||||
block_character_encoding: DOMRefCell<EncodingRef>,
|
||||
}
|
||||
|
@ -160,6 +162,7 @@ static SCRIPT_JS_MIMES: StaticStringVec = &[
|
|||
"text/x-javascript",
|
||||
];
|
||||
|
||||
#[derive(HeapSizeOf)]
|
||||
pub enum ScriptOrigin {
|
||||
Internal(String, Url),
|
||||
External(Result<(Metadata, Vec<u8>), String>),
|
||||
|
|
|
@ -25,6 +25,7 @@ use string_cache::Atom;
|
|||
use std::borrow::ToOwned;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLSelectElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ use dom::node::{Node, NodeTypeId};
|
|||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
#[derive(HeapSizeOf)]
|
||||
pub struct HTMLSourceElement {
|
||||
htmlelement: HTMLElement
|
||||
}
|
||||
|
|
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