mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Support arbitrary protos when wrapping DOM objects with constructors.
This commit is contained in:
parent
d9600ff50f
commit
dbff26bce0
197 changed files with 2028 additions and 586 deletions
|
@ -14,14 +14,14 @@ use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
||||||
use crate::dom::bindings::error::{Error, Fallible};
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::num::Finite;
|
use crate::dom::bindings::num::Finite;
|
||||||
use crate::dom::bindings::refcounted::Trusted;
|
use crate::dom::bindings::refcounted::Trusted;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use crate::task_source::TaskSource;
|
use crate::task_source::TaskSource;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use ipc_channel::ipc::{self, IpcReceiver};
|
use ipc_channel::ipc::{self, IpcReceiver};
|
||||||
use ipc_channel::router::ROUTER;
|
use ipc_channel::router::ROUTER;
|
||||||
use js::rust::CustomAutoRooterGuard;
|
use js::rust::{CustomAutoRooterGuard, HandleObject};
|
||||||
use js::typedarray::{Float32Array, Uint8Array};
|
use js::typedarray::{Float32Array, Uint8Array};
|
||||||
use servo_media::audio::analyser_node::AnalysisEngine;
|
use servo_media::audio::analyser_node::AnalysisEngine;
|
||||||
use servo_media::audio::block::Block;
|
use servo_media::audio::block::Block;
|
||||||
|
@ -89,14 +89,23 @@ impl AnalyserNode {
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
|
||||||
pub fn new(
|
pub fn new(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
context: &BaseAudioContext,
|
context: &BaseAudioContext,
|
||||||
options: &AnalyserOptions,
|
options: &AnalyserOptions,
|
||||||
|
) -> Fallible<DomRoot<AnalyserNode>> {
|
||||||
|
Self::new_with_proto(window, None, context, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unrooted_must_root)]
|
||||||
|
pub fn new_with_proto(
|
||||||
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
context: &BaseAudioContext,
|
||||||
|
options: &AnalyserOptions,
|
||||||
) -> Fallible<DomRoot<AnalyserNode>> {
|
) -> Fallible<DomRoot<AnalyserNode>> {
|
||||||
let (node, recv) = AnalyserNode::new_inherited(window, context, options)?;
|
let (node, recv) = AnalyserNode::new_inherited(window, context, options)?;
|
||||||
let object = reflect_dom_object(Box::new(node), window);
|
let object = reflect_dom_object2(Box::new(node), window, proto);
|
||||||
let (source, canceller) = window
|
let (source, canceller) = window
|
||||||
.task_manager()
|
.task_manager()
|
||||||
.dom_manipulation_task_source_with_canceller();
|
.dom_manipulation_task_source_with_canceller();
|
||||||
|
@ -122,10 +131,11 @@ impl AnalyserNode {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
context: &BaseAudioContext,
|
context: &BaseAudioContext,
|
||||||
options: &AnalyserOptions,
|
options: &AnalyserOptions,
|
||||||
) -> Fallible<DomRoot<AnalyserNode>> {
|
) -> Fallible<DomRoot<AnalyserNode>> {
|
||||||
AnalyserNode::new(window, context, options)
|
AnalyserNode::new_with_proto(window, proto, context, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn push_block(&self, block: Block) {
|
pub fn push_block(&self, block: Block) {
|
||||||
|
|
|
@ -8,12 +8,13 @@ use crate::dom::bindings::codegen::Bindings::AnimationEventBinding::{
|
||||||
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::num::Finite;
|
use crate::dom::bindings::num::Finite;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::event::Event;
|
use crate::dom::event::Event;
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -35,7 +36,11 @@ impl AnimationEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(window: &Window, type_: Atom, init: &AnimationEventInit) -> DomRoot<AnimationEvent> {
|
pub fn new(window: &Window, type_: Atom, init: &AnimationEventInit) -> DomRoot<AnimationEvent> {
|
||||||
let ev = reflect_dom_object(Box::new(AnimationEvent::new_inherited(init)), window);
|
Self::new_with_proto(window, None, type_, init)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(window: &Window, proto: Option<HandleObject>, type_: Atom, init: &AnimationEventInit) -> DomRoot<AnimationEvent> {
|
||||||
|
let ev = reflect_dom_object2(Box::new(AnimationEvent::new_inherited(init)), window, proto);
|
||||||
{
|
{
|
||||||
let event = ev.upcast::<Event>();
|
let event = ev.upcast::<Event>();
|
||||||
event.init_event(type_, init.parent.bubbles, init.parent.cancelable);
|
event.init_event(type_, init.parent.bubbles, init.parent.cancelable);
|
||||||
|
@ -46,10 +51,11 @@ impl AnimationEvent {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
init: &AnimationEventInit,
|
init: &AnimationEventInit,
|
||||||
) -> DomRoot<AnimationEvent> {
|
) -> DomRoot<AnimationEvent> {
|
||||||
AnimationEvent::new(window, Atom::from(type_), init)
|
AnimationEvent::new_with_proto(window, proto, Atom::from(type_), init)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ use crate::dom::bindings::codegen::Bindings::AudioBufferBinding::{
|
||||||
};
|
};
|
||||||
use crate::dom::bindings::error::{Error, Fallible};
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::num::Finite;
|
use crate::dom::bindings::num::Finite;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object2, Reflector};
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
|
@ -20,6 +20,7 @@ use js::jsapi::JS_GetArrayBufferViewBuffer;
|
||||||
use js::jsapi::{Heap, JSObject};
|
use js::jsapi::{Heap, JSObject};
|
||||||
use js::rust::wrappers::DetachArrayBuffer;
|
use js::rust::wrappers::DetachArrayBuffer;
|
||||||
use js::rust::CustomAutoRooterGuard;
|
use js::rust::CustomAutoRooterGuard;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use js::typedarray::{CreateWith, Float32Array};
|
use js::typedarray::{CreateWith, Float32Array};
|
||||||
use servo_media::audio::buffer_source_node::AudioBuffer as ServoMediaAudioBuffer;
|
use servo_media::audio::buffer_source_node::AudioBuffer as ServoMediaAudioBuffer;
|
||||||
use std::cmp::min;
|
use std::cmp::min;
|
||||||
|
@ -76,16 +77,27 @@ impl AudioBuffer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
|
||||||
pub fn new(
|
pub fn new(
|
||||||
global: &Window,
|
global: &Window,
|
||||||
number_of_channels: u32,
|
number_of_channels: u32,
|
||||||
length: u32,
|
length: u32,
|
||||||
sample_rate: f32,
|
sample_rate: f32,
|
||||||
initial_data: Option<&[Vec<f32>]>,
|
initial_data: Option<&[Vec<f32>]>,
|
||||||
|
) -> DomRoot<AudioBuffer> {
|
||||||
|
Self::new_with_proto(global, None, number_of_channels, length, sample_rate, initial_data)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unrooted_must_root)]
|
||||||
|
fn new_with_proto(
|
||||||
|
global: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
number_of_channels: u32,
|
||||||
|
length: u32,
|
||||||
|
sample_rate: f32,
|
||||||
|
initial_data: Option<&[Vec<f32>]>,
|
||||||
) -> DomRoot<AudioBuffer> {
|
) -> DomRoot<AudioBuffer> {
|
||||||
let buffer = AudioBuffer::new_inherited(number_of_channels, length, sample_rate);
|
let buffer = AudioBuffer::new_inherited(number_of_channels, length, sample_rate);
|
||||||
let buffer = reflect_dom_object(Box::new(buffer), global);
|
let buffer = reflect_dom_object2(Box::new(buffer), global, proto);
|
||||||
buffer.set_initial_data(initial_data);
|
buffer.set_initial_data(initial_data);
|
||||||
buffer
|
buffer
|
||||||
}
|
}
|
||||||
|
@ -94,6 +106,7 @@ impl AudioBuffer {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
options: &AudioBufferOptions,
|
options: &AudioBufferOptions,
|
||||||
) -> Fallible<DomRoot<AudioBuffer>> {
|
) -> Fallible<DomRoot<AudioBuffer>> {
|
||||||
if options.length <= 0 ||
|
if options.length <= 0 ||
|
||||||
|
@ -104,8 +117,9 @@ impl AudioBuffer {
|
||||||
{
|
{
|
||||||
return Err(Error::NotSupported);
|
return Err(Error::NotSupported);
|
||||||
}
|
}
|
||||||
Ok(AudioBuffer::new(
|
Ok(AudioBuffer::new_with_proto(
|
||||||
window,
|
window,
|
||||||
|
proto,
|
||||||
options.numberOfChannels,
|
options.numberOfChannels,
|
||||||
options.length,
|
options.length,
|
||||||
*options.sampleRate,
|
*options.sampleRate,
|
||||||
|
|
|
@ -13,10 +13,11 @@ use crate::dom::bindings::codegen::Bindings::AudioScheduledSourceNodeBinding::Au
|
||||||
use crate::dom::bindings::error::{Error, Fallible};
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::num::Finite;
|
use crate::dom::bindings::num::Finite;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
|
use crate::dom::bindings::root::{Dom, DomRoot, MutNullableDom};
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use servo_media::audio::buffer_source_node::AudioBufferSourceNodeMessage;
|
use servo_media::audio::buffer_source_node::AudioBufferSourceNodeMessage;
|
||||||
use servo_media::audio::buffer_source_node::AudioBufferSourceNodeOptions;
|
use servo_media::audio::buffer_source_node::AudioBufferSourceNodeOptions;
|
||||||
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage};
|
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage};
|
||||||
|
@ -92,23 +93,33 @@ impl AudioBufferSourceNode {
|
||||||
Ok(node)
|
Ok(node)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
|
||||||
pub fn new(
|
pub fn new(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
context: &BaseAudioContext,
|
context: &BaseAudioContext,
|
||||||
options: &AudioBufferSourceOptions,
|
options: &AudioBufferSourceOptions,
|
||||||
|
) -> Fallible<DomRoot<AudioBufferSourceNode>> {
|
||||||
|
Self::new_with_proto(window, None, context, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unrooted_must_root)]
|
||||||
|
fn new_with_proto(
|
||||||
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
context: &BaseAudioContext,
|
||||||
|
options: &AudioBufferSourceOptions,
|
||||||
) -> Fallible<DomRoot<AudioBufferSourceNode>> {
|
) -> Fallible<DomRoot<AudioBufferSourceNode>> {
|
||||||
let node = AudioBufferSourceNode::new_inherited(window, context, options)?;
|
let node = AudioBufferSourceNode::new_inherited(window, context, options)?;
|
||||||
Ok(reflect_dom_object(Box::new(node), window))
|
Ok(reflect_dom_object2(Box::new(node), window, proto))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
context: &BaseAudioContext,
|
context: &BaseAudioContext,
|
||||||
options: &AudioBufferSourceOptions,
|
options: &AudioBufferSourceOptions,
|
||||||
) -> Fallible<DomRoot<AudioBufferSourceNode>> {
|
) -> Fallible<DomRoot<AudioBufferSourceNode>> {
|
||||||
AudioBufferSourceNode::new(window, context, options)
|
AudioBufferSourceNode::new_with_proto(window, proto, context, options)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::num::Finite;
|
use crate::dom::bindings::num::Finite;
|
||||||
use crate::dom::bindings::refcounted::{Trusted, TrustedPromise};
|
use crate::dom::bindings::refcounted::{Trusted, TrustedPromise};
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
|
use crate::dom::bindings::reflector::{reflect_dom_object2, DomObject};
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::htmlmediaelement::HTMLMediaElement;
|
use crate::dom::htmlmediaelement::HTMLMediaElement;
|
||||||
use crate::dom::mediaelementaudiosourcenode::MediaElementAudioSourceNode;
|
use crate::dom::mediaelementaudiosourcenode::MediaElementAudioSourceNode;
|
||||||
|
@ -31,6 +31,7 @@ use crate::dom::window::Window;
|
||||||
use crate::realms::InRealm;
|
use crate::realms::InRealm;
|
||||||
use crate::task_source::TaskSource;
|
use crate::task_source::TaskSource;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use msg::constellation_msg::PipelineId;
|
use msg::constellation_msg::PipelineId;
|
||||||
use servo_media::audio::context::{LatencyCategory, ProcessingState, RealTimeAudioContextOptions};
|
use servo_media::audio::context::{LatencyCategory, ProcessingState, RealTimeAudioContextOptions};
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
@ -79,10 +80,10 @@ impl AudioContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(window: &Window, options: &AudioContextOptions) -> DomRoot<AudioContext> {
|
fn new(window: &Window, proto: Option<HandleObject>, options: &AudioContextOptions) -> DomRoot<AudioContext> {
|
||||||
let pipeline_id = window.pipeline_id();
|
let pipeline_id = window.pipeline_id();
|
||||||
let context = AudioContext::new_inherited(options, pipeline_id);
|
let context = AudioContext::new_inherited(options, pipeline_id);
|
||||||
let context = reflect_dom_object(Box::new(context), window);
|
let context = reflect_dom_object2(Box::new(context), window, proto);
|
||||||
context.resume();
|
context.resume();
|
||||||
context
|
context
|
||||||
}
|
}
|
||||||
|
@ -91,9 +92,10 @@ impl AudioContext {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
options: &AudioContextOptions,
|
options: &AudioContextOptions,
|
||||||
) -> Fallible<DomRoot<AudioContext>> {
|
) -> Fallible<DomRoot<AudioContext>> {
|
||||||
Ok(AudioContext::new(window, options))
|
Ok(AudioContext::new(window, proto, options))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resume(&self) {
|
fn resume(&self) {
|
||||||
|
|
|
@ -6147,9 +6147,7 @@ let global = DomRoot::downcast::<dom::types::%s>(global).unwrap();
|
||||||
else:
|
else:
|
||||||
name = self.constructor.identifier.name
|
name = self.constructor.identifier.name
|
||||||
nativeName = MakeNativeName(self.descriptor.binaryNameFor(name))
|
nativeName = MakeNativeName(self.descriptor.binaryNameFor(name))
|
||||||
args = ["&global"]
|
args = ["&global", "Some(desired_proto.handle())"]
|
||||||
if self.descriptor.interface.identifier.name == "EventTarget":
|
|
||||||
args += ["desired_proto.handle()"]
|
|
||||||
constructorCall = CGMethodCall(args, nativeName, True,
|
constructorCall = CGMethodCall(args, nativeName, True,
|
||||||
self.descriptor, self.constructor)
|
self.descriptor, self.constructor)
|
||||||
return CGList([preamble, constructorCall])
|
return CGList([preamble, constructorCall])
|
||||||
|
|
|
@ -225,10 +225,12 @@ unsafe fn html_constructor(
|
||||||
None => {
|
None => {
|
||||||
// Step 8.1
|
// Step 8.1
|
||||||
let name = QualName::new(None, ns!(html), definition.local_name.clone());
|
let name = QualName::new(None, ns!(html), definition.local_name.clone());
|
||||||
|
// Any prototype used to create these elements will be overwritten before returning
|
||||||
|
// from this function, so we don't bother overwriting the defaults here.
|
||||||
let element = if definition.is_autonomous() {
|
let element = if definition.is_autonomous() {
|
||||||
DomRoot::upcast(HTMLElement::new(name.local, None, &*document))
|
DomRoot::upcast(HTMLElement::new(name.local, None, &*document, None))
|
||||||
} else {
|
} else {
|
||||||
create_native_html_element(name, None, &*document, ElementCreator::ScriptCreated)
|
create_native_html_element(name, None, &*document, ElementCreator::ScriptCreated, None)
|
||||||
};
|
};
|
||||||
|
|
||||||
// Step 8.2 is performed in the generated caller code.
|
// Step 8.2 is performed in the generated caller code.
|
||||||
|
|
|
@ -26,13 +26,13 @@ where
|
||||||
unsafe { T::WRAP(GlobalScope::get_cx(), global_scope, None, obj) }
|
unsafe { T::WRAP(GlobalScope::get_cx(), global_scope, None, obj) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reflect_dom_object2<T, U>(obj: Box<T>, global: &U, proto: HandleObject) -> DomRoot<T>
|
pub fn reflect_dom_object2<T, U>(obj: Box<T>, global: &U, proto: Option<HandleObject>) -> DomRoot<T>
|
||||||
where
|
where
|
||||||
T: DomObject + DomObjectWrap,
|
T: DomObject + DomObjectWrap,
|
||||||
U: DerivedFrom<GlobalScope>,
|
U: DerivedFrom<GlobalScope>,
|
||||||
{
|
{
|
||||||
let global_scope = global.upcast();
|
let global_scope = global.upcast();
|
||||||
unsafe { T::WRAP(GlobalScope::get_cx(), global_scope, Some(proto), obj) }
|
unsafe { T::WRAP(GlobalScope::get_cx(), global_scope, proto, obj) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A struct to store a reference to the reflector of a DOM object.
|
/// A struct to store a reference to the reflector of a DOM object.
|
||||||
|
|
|
@ -13,10 +13,11 @@ use crate::dom::bindings::codegen::Bindings::BiquadFilterNodeBinding::BiquadFilt
|
||||||
use crate::dom::bindings::codegen::Bindings::BiquadFilterNodeBinding::BiquadFilterOptions;
|
use crate::dom::bindings::codegen::Bindings::BiquadFilterNodeBinding::BiquadFilterOptions;
|
||||||
use crate::dom::bindings::codegen::Bindings::BiquadFilterNodeBinding::BiquadFilterType;
|
use crate::dom::bindings::codegen::Bindings::BiquadFilterNodeBinding::BiquadFilterType;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use servo_media::audio::biquad_filter_node::BiquadFilterNodeMessage;
|
use servo_media::audio::biquad_filter_node::BiquadFilterNodeMessage;
|
||||||
use servo_media::audio::biquad_filter_node::{BiquadFilterNodeOptions, FilterType};
|
use servo_media::audio::biquad_filter_node::{BiquadFilterNodeOptions, FilterType};
|
||||||
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage};
|
use servo_media::audio::node::{AudioNodeInit, AudioNodeMessage};
|
||||||
|
@ -104,23 +105,33 @@ impl BiquadFilterNode {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
|
||||||
pub fn new(
|
pub fn new(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
context: &BaseAudioContext,
|
context: &BaseAudioContext,
|
||||||
options: &BiquadFilterOptions,
|
options: &BiquadFilterOptions,
|
||||||
|
) -> Fallible<DomRoot<BiquadFilterNode>> {
|
||||||
|
Self::new_with_proto(window, None, context, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unrooted_must_root)]
|
||||||
|
fn new_with_proto(
|
||||||
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
context: &BaseAudioContext,
|
||||||
|
options: &BiquadFilterOptions,
|
||||||
) -> Fallible<DomRoot<BiquadFilterNode>> {
|
) -> Fallible<DomRoot<BiquadFilterNode>> {
|
||||||
let node = BiquadFilterNode::new_inherited(window, context, options)?;
|
let node = BiquadFilterNode::new_inherited(window, context, options)?;
|
||||||
Ok(reflect_dom_object(Box::new(node), window))
|
Ok(reflect_dom_object2(Box::new(node), window, proto))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
context: &BaseAudioContext,
|
context: &BaseAudioContext,
|
||||||
options: &BiquadFilterOptions,
|
options: &BiquadFilterOptions,
|
||||||
) -> Fallible<DomRoot<BiquadFilterNode>> {
|
) -> Fallible<DomRoot<BiquadFilterNode>> {
|
||||||
BiquadFilterNode::new(window, context, options)
|
BiquadFilterNode::new_with_proto(window, proto, context, options)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ use crate::dom::bindings::codegen::Bindings::BlobBinding;
|
||||||
use crate::dom::bindings::codegen::Bindings::BlobBinding::BlobMethods;
|
use crate::dom::bindings::codegen::Bindings::BlobBinding::BlobMethods;
|
||||||
use crate::dom::bindings::codegen::UnionTypes::ArrayBufferOrArrayBufferViewOrBlobOrString;
|
use crate::dom::bindings::codegen::UnionTypes::ArrayBufferOrArrayBufferViewOrBlobOrString;
|
||||||
use crate::dom::bindings::error::{Error, Fallible};
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object2, DomObject, Reflector};
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::serializable::{Serializable, StorageKey};
|
use crate::dom::bindings::serializable::{Serializable, StorageKey};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
|
@ -20,6 +20,7 @@ use crate::script_runtime::JSContext;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use encoding_rs::UTF_8;
|
use encoding_rs::UTF_8;
|
||||||
use js::jsapi::JSObject;
|
use js::jsapi::JSObject;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use msg::constellation_msg::{BlobId, BlobIndex, PipelineNamespaceId};
|
use msg::constellation_msg::{BlobId, BlobIndex, PipelineNamespaceId};
|
||||||
use net_traits::filemanager_thread::RelativePos;
|
use net_traits::filemanager_thread::RelativePos;
|
||||||
use script_traits::serializable::BlobImpl;
|
use script_traits::serializable::BlobImpl;
|
||||||
|
@ -38,7 +39,11 @@ pub struct Blob {
|
||||||
|
|
||||||
impl Blob {
|
impl Blob {
|
||||||
pub fn new(global: &GlobalScope, blob_impl: BlobImpl) -> DomRoot<Blob> {
|
pub fn new(global: &GlobalScope, blob_impl: BlobImpl) -> DomRoot<Blob> {
|
||||||
let dom_blob = reflect_dom_object(Box::new(Blob::new_inherited(&blob_impl)), global);
|
Self::new_with_proto(global, None, blob_impl)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(global: &GlobalScope, proto: Option<HandleObject>, blob_impl: BlobImpl) -> DomRoot<Blob> {
|
||||||
|
let dom_blob = reflect_dom_object2(Box::new(Blob::new_inherited(&blob_impl)), global, proto);
|
||||||
global.track_blob(&dom_blob, blob_impl);
|
global.track_blob(&dom_blob, blob_impl);
|
||||||
dom_blob
|
dom_blob
|
||||||
}
|
}
|
||||||
|
@ -55,6 +60,7 @@ impl Blob {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
blobParts: Option<Vec<ArrayBufferOrArrayBufferViewOrBlobOrString>>,
|
blobParts: Option<Vec<ArrayBufferOrArrayBufferViewOrBlobOrString>>,
|
||||||
blobPropertyBag: &BlobBinding::BlobPropertyBag,
|
blobPropertyBag: &BlobBinding::BlobPropertyBag,
|
||||||
) -> Fallible<DomRoot<Blob>> {
|
) -> Fallible<DomRoot<Blob>> {
|
||||||
|
@ -69,7 +75,7 @@ impl Blob {
|
||||||
let type_string = normalize_type_string(&blobPropertyBag.type_.to_string());
|
let type_string = normalize_type_string(&blobPropertyBag.type_.to_string());
|
||||||
let blob_impl = BlobImpl::new_from_bytes(bytes, type_string);
|
let blob_impl = BlobImpl::new_from_bytes(bytes, type_string);
|
||||||
|
|
||||||
Ok(Blob::new(global, blob_impl))
|
Ok(Blob::new_with_proto(global, proto, blob_impl))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get a slice to inner data, this might incur synchronous read and caching
|
/// Get a slice to inner data, this might incur synchronous read and caching
|
||||||
|
|
|
@ -7,7 +7,7 @@ use crate::dom::bindings::codegen::Bindings::BluetoothAdvertisingEventBinding::B
|
||||||
use crate::dom::bindings::codegen::Bindings::EventBinding::EventBinding::EventMethods;
|
use crate::dom::bindings::codegen::Bindings::EventBinding::EventBinding::EventMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::bluetoothdevice::BluetoothDevice;
|
use crate::dom::bluetoothdevice::BluetoothDevice;
|
||||||
|
@ -15,6 +15,7 @@ use crate::dom::event::{Event, EventBubbles, EventCancelable};
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
|
|
||||||
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothadvertisingevent
|
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothadvertisingevent
|
||||||
|
@ -47,8 +48,9 @@ impl BluetoothAdvertisingEvent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(
|
fn new(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
type_: Atom,
|
type_: Atom,
|
||||||
bubbles: EventBubbles,
|
bubbles: EventBubbles,
|
||||||
cancelable: EventCancelable,
|
cancelable: EventCancelable,
|
||||||
|
@ -58,11 +60,12 @@ impl BluetoothAdvertisingEvent {
|
||||||
txPower: Option<i8>,
|
txPower: Option<i8>,
|
||||||
rssi: Option<i8>,
|
rssi: Option<i8>,
|
||||||
) -> DomRoot<BluetoothAdvertisingEvent> {
|
) -> DomRoot<BluetoothAdvertisingEvent> {
|
||||||
let ev = reflect_dom_object(
|
let ev = reflect_dom_object2(
|
||||||
Box::new(BluetoothAdvertisingEvent::new_inherited(
|
Box::new(BluetoothAdvertisingEvent::new_inherited(
|
||||||
device, name, appearance, txPower, rssi,
|
device, name, appearance, txPower, rssi,
|
||||||
)),
|
)),
|
||||||
global,
|
global,
|
||||||
|
proto,
|
||||||
);
|
);
|
||||||
{
|
{
|
||||||
let event = ev.upcast::<Event>();
|
let event = ev.upcast::<Event>();
|
||||||
|
@ -74,6 +77,7 @@ impl BluetoothAdvertisingEvent {
|
||||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothadvertisingevent-bluetoothadvertisingevent
|
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothadvertisingevent-bluetoothadvertisingevent
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
init: &BluetoothAdvertisingEventInit,
|
init: &BluetoothAdvertisingEventInit,
|
||||||
) -> Fallible<DomRoot<BluetoothAdvertisingEvent>> {
|
) -> Fallible<DomRoot<BluetoothAdvertisingEvent>> {
|
||||||
|
@ -86,6 +90,7 @@ impl BluetoothAdvertisingEvent {
|
||||||
let cancelable = EventCancelable::from(init.parent.cancelable);
|
let cancelable = EventCancelable::from(init.parent.cancelable);
|
||||||
Ok(BluetoothAdvertisingEvent::new(
|
Ok(BluetoothAdvertisingEvent::new(
|
||||||
global,
|
global,
|
||||||
|
proto,
|
||||||
Atom::from(type_),
|
Atom::from(type_),
|
||||||
bubbles,
|
bubbles,
|
||||||
cancelable,
|
cancelable,
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
use crate::dom::bindings::codegen::Bindings::BroadcastChannelBinding::BroadcastChannelMethods;
|
use crate::dom::bindings::codegen::Bindings::BroadcastChannelBinding::BroadcastChannelMethods;
|
||||||
use crate::dom::bindings::error::{Error, ErrorResult};
|
use crate::dom::bindings::error::{Error, ErrorResult};
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
|
use crate::dom::bindings::reflector::{reflect_dom_object2, DomObject};
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::bindings::structuredclone;
|
use crate::dom::bindings::structuredclone;
|
||||||
|
@ -12,7 +12,7 @@ use crate::dom::eventtarget::EventTarget;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::script_runtime::JSContext as SafeJSContext;
|
use crate::script_runtime::JSContext as SafeJSContext;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use js::rust::HandleValue;
|
use js::rust::{HandleValue, HandleObject};
|
||||||
use script_traits::BroadcastMsg;
|
use script_traits::BroadcastMsg;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
@ -28,12 +28,12 @@ pub struct BroadcastChannel {
|
||||||
impl BroadcastChannel {
|
impl BroadcastChannel {
|
||||||
/// <https://html.spec.whatwg.org/multipage/#broadcastchannel>
|
/// <https://html.spec.whatwg.org/multipage/#broadcastchannel>
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(global: &GlobalScope, name: DOMString) -> DomRoot<BroadcastChannel> {
|
pub fn Constructor(global: &GlobalScope, proto: Option<HandleObject>, name: DOMString) -> DomRoot<BroadcastChannel> {
|
||||||
BroadcastChannel::new(global, name)
|
BroadcastChannel::new(global, proto, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(global: &GlobalScope, name: DOMString) -> DomRoot<BroadcastChannel> {
|
fn new(global: &GlobalScope, proto: Option<HandleObject>, name: DOMString) -> DomRoot<BroadcastChannel> {
|
||||||
let channel = reflect_dom_object(Box::new(BroadcastChannel::new_inherited(name)), global);
|
let channel = reflect_dom_object2(Box::new(BroadcastChannel::new_inherited(name)), global, proto);
|
||||||
global.track_broadcast_channel(&*channel);
|
global.track_broadcast_channel(&*channel);
|
||||||
channel
|
channel
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,11 @@ use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
||||||
};
|
};
|
||||||
use crate::dom::bindings::codegen::Bindings::ChannelMergerNodeBinding::ChannelMergerOptions;
|
use crate::dom::bindings::codegen::Bindings::ChannelMergerNodeBinding::ChannelMergerOptions;
|
||||||
use crate::dom::bindings::error::{Error, Fallible};
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use servo_media::audio::channel_node::ChannelNodeOptions;
|
use servo_media::audio::channel_node::ChannelNodeOptions;
|
||||||
use servo_media::audio::node::AudioNodeInit;
|
use servo_media::audio::node::AudioNodeInit;
|
||||||
|
|
||||||
|
@ -52,23 +53,33 @@ impl ChannelMergerNode {
|
||||||
Ok(ChannelMergerNode { node })
|
Ok(ChannelMergerNode { node })
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
|
||||||
pub fn new(
|
pub fn new(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
context: &BaseAudioContext,
|
context: &BaseAudioContext,
|
||||||
options: &ChannelMergerOptions,
|
options: &ChannelMergerOptions,
|
||||||
|
) -> Fallible<DomRoot<ChannelMergerNode>> {
|
||||||
|
Self::new_with_proto(window, None, context, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unrooted_must_root)]
|
||||||
|
fn new_with_proto(
|
||||||
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
context: &BaseAudioContext,
|
||||||
|
options: &ChannelMergerOptions,
|
||||||
) -> Fallible<DomRoot<ChannelMergerNode>> {
|
) -> Fallible<DomRoot<ChannelMergerNode>> {
|
||||||
let node = ChannelMergerNode::new_inherited(window, context, options)?;
|
let node = ChannelMergerNode::new_inherited(window, context, options)?;
|
||||||
Ok(reflect_dom_object(Box::new(node), window))
|
Ok(reflect_dom_object2(Box::new(node), window, proto))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
context: &BaseAudioContext,
|
context: &BaseAudioContext,
|
||||||
options: &ChannelMergerOptions,
|
options: &ChannelMergerOptions,
|
||||||
) -> Fallible<DomRoot<ChannelMergerNode>> {
|
) -> Fallible<DomRoot<ChannelMergerNode>> {
|
||||||
ChannelMergerNode::new(window, context, options)
|
ChannelMergerNode::new_with_proto(window, proto, context, options)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,11 @@ use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
||||||
};
|
};
|
||||||
use crate::dom::bindings::codegen::Bindings::ChannelSplitterNodeBinding::ChannelSplitterOptions;
|
use crate::dom::bindings::codegen::Bindings::ChannelSplitterNodeBinding::ChannelSplitterOptions;
|
||||||
use crate::dom::bindings::error::{Error, Fallible};
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use servo_media::audio::node::AudioNodeInit;
|
use servo_media::audio::node::AudioNodeInit;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -54,22 +55,32 @@ impl ChannelSplitterNode {
|
||||||
Ok(ChannelSplitterNode { node })
|
Ok(ChannelSplitterNode { node })
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
|
||||||
pub fn new(
|
pub fn new(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
context: &BaseAudioContext,
|
context: &BaseAudioContext,
|
||||||
options: &ChannelSplitterOptions,
|
options: &ChannelSplitterOptions,
|
||||||
|
) -> Fallible<DomRoot<ChannelSplitterNode>> {
|
||||||
|
Self::new_with_proto(window, None, context, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unrooted_must_root)]
|
||||||
|
fn new_with_proto(
|
||||||
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
context: &BaseAudioContext,
|
||||||
|
options: &ChannelSplitterOptions,
|
||||||
) -> Fallible<DomRoot<ChannelSplitterNode>> {
|
) -> Fallible<DomRoot<ChannelSplitterNode>> {
|
||||||
let node = ChannelSplitterNode::new_inherited(window, context, options)?;
|
let node = ChannelSplitterNode::new_inherited(window, context, options)?;
|
||||||
Ok(reflect_dom_object(Box::new(node), window))
|
Ok(reflect_dom_object2(Box::new(node), window, proto))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
context: &BaseAudioContext,
|
context: &BaseAudioContext,
|
||||||
options: &ChannelSplitterOptions,
|
options: &ChannelSplitterOptions,
|
||||||
) -> Fallible<DomRoot<ChannelSplitterNode>> {
|
) -> Fallible<DomRoot<ChannelSplitterNode>> {
|
||||||
ChannelSplitterNode::new(window, context, options)
|
ChannelSplitterNode::new_with_proto(window, proto, context, options)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ impl CharacterData {
|
||||||
pub fn clone_with_data(&self, data: DOMString, document: &Document) -> DomRoot<Node> {
|
pub fn clone_with_data(&self, data: DOMString, document: &Document) -> DomRoot<Node> {
|
||||||
match self.upcast::<Node>().type_id() {
|
match self.upcast::<Node>().type_id() {
|
||||||
NodeTypeId::CharacterData(CharacterDataTypeId::Comment) => {
|
NodeTypeId::CharacterData(CharacterDataTypeId::Comment) => {
|
||||||
DomRoot::upcast(Comment::new(data, &document))
|
DomRoot::upcast(Comment::new(data, &document, None))
|
||||||
},
|
},
|
||||||
NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction) => {
|
NodeTypeId::CharacterData(CharacterDataTypeId::ProcessingInstruction) => {
|
||||||
let pi = self.downcast::<ProcessingInstruction>().unwrap();
|
let pi = self.downcast::<ProcessingInstruction>().unwrap();
|
||||||
|
|
|
@ -7,12 +7,13 @@ use crate::dom::bindings::codegen::Bindings::CloseEventBinding::CloseEventMethod
|
||||||
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::event::{Event, EventBubbles, EventCancelable};
|
use crate::dom::event::{Event, EventBubbles, EventCancelable};
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -42,9 +43,31 @@ impl CloseEvent {
|
||||||
wasClean: bool,
|
wasClean: bool,
|
||||||
code: u16,
|
code: u16,
|
||||||
reason: DOMString,
|
reason: DOMString,
|
||||||
|
) -> DomRoot<CloseEvent> {
|
||||||
|
Self::new_with_proto(
|
||||||
|
global,
|
||||||
|
None,
|
||||||
|
type_,
|
||||||
|
bubbles,
|
||||||
|
cancelable,
|
||||||
|
wasClean,
|
||||||
|
code,
|
||||||
|
reason,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(
|
||||||
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
type_: Atom,
|
||||||
|
bubbles: EventBubbles,
|
||||||
|
cancelable: EventCancelable,
|
||||||
|
wasClean: bool,
|
||||||
|
code: u16,
|
||||||
|
reason: DOMString,
|
||||||
) -> DomRoot<CloseEvent> {
|
) -> DomRoot<CloseEvent> {
|
||||||
let event = Box::new(CloseEvent::new_inherited(wasClean, code, reason));
|
let event = Box::new(CloseEvent::new_inherited(wasClean, code, reason));
|
||||||
let ev = reflect_dom_object(event, global);
|
let ev = reflect_dom_object2(event, global, proto);
|
||||||
{
|
{
|
||||||
let event = ev.upcast::<Event>();
|
let event = ev.upcast::<Event>();
|
||||||
event.init_event(type_, bool::from(bubbles), bool::from(cancelable));
|
event.init_event(type_, bool::from(bubbles), bool::from(cancelable));
|
||||||
|
@ -54,13 +77,15 @@ impl CloseEvent {
|
||||||
|
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
init: &CloseEventBinding::CloseEventInit,
|
init: &CloseEventBinding::CloseEventInit,
|
||||||
) -> Fallible<DomRoot<CloseEvent>> {
|
) -> Fallible<DomRoot<CloseEvent>> {
|
||||||
let bubbles = EventBubbles::from(init.parent.bubbles);
|
let bubbles = EventBubbles::from(init.parent.bubbles);
|
||||||
let cancelable = EventCancelable::from(init.parent.cancelable);
|
let cancelable = EventCancelable::from(init.parent.cancelable);
|
||||||
Ok(CloseEvent::new(
|
Ok(CloseEvent::new_with_proto(
|
||||||
global,
|
global,
|
||||||
|
proto,
|
||||||
Atom::from(type_),
|
Atom::from(type_),
|
||||||
bubbles,
|
bubbles,
|
||||||
cancelable,
|
cancelable,
|
||||||
|
|
|
@ -11,6 +11,7 @@ use crate::dom::document::Document;
|
||||||
use crate::dom::node::Node;
|
use crate::dom::node::Node;
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
/// An HTML comment.
|
/// An HTML comment.
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -25,13 +26,13 @@ impl Comment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(text: DOMString, document: &Document) -> DomRoot<Comment> {
|
pub fn new(text: DOMString, document: &Document, proto: Option<HandleObject>) -> DomRoot<Comment> {
|
||||||
Node::reflect_node(Box::new(Comment::new_inherited(text, document)), document)
|
Node::reflect_node_with_proto(Box::new(Comment::new_inherited(text, document)), document, proto)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(window: &Window, data: DOMString) -> Fallible<DomRoot<Comment>> {
|
pub fn Constructor(window: &Window, proto: Option<HandleObject>, data: DOMString) -> Fallible<DomRoot<Comment>> {
|
||||||
let document = window.Document();
|
let document = window.Document();
|
||||||
Ok(Comment::new(data, &document))
|
Ok(Comment::new(data, &document, proto))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,12 +7,13 @@ use crate::dom::bindings::codegen::Bindings::CompositionEventBinding::{
|
||||||
};
|
};
|
||||||
use crate::dom::bindings::codegen::Bindings::UIEventBinding::UIEventBinding::UIEventMethods;
|
use crate::dom::bindings::codegen::Bindings::UIEventBinding::UIEventBinding::UIEventMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::{reflect_dom_object, reflect_dom_object2};
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::uievent::UIEvent;
|
use crate::dom::uievent::UIEvent;
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct CompositionEvent {
|
pub struct CompositionEvent {
|
||||||
|
@ -41,12 +42,35 @@ impl CompositionEvent {
|
||||||
detail: i32,
|
detail: i32,
|
||||||
data: DOMString,
|
data: DOMString,
|
||||||
) -> DomRoot<CompositionEvent> {
|
) -> DomRoot<CompositionEvent> {
|
||||||
let ev = reflect_dom_object(
|
Self::new_with_proto(
|
||||||
|
window,
|
||||||
|
None,
|
||||||
|
type_,
|
||||||
|
can_bubble,
|
||||||
|
cancelable,
|
||||||
|
view,
|
||||||
|
detail,
|
||||||
|
data,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(
|
||||||
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
type_: DOMString,
|
||||||
|
can_bubble: bool,
|
||||||
|
cancelable: bool,
|
||||||
|
view: Option<&Window>,
|
||||||
|
detail: i32,
|
||||||
|
data: DOMString,
|
||||||
|
) -> DomRoot<CompositionEvent> {
|
||||||
|
let ev = reflect_dom_object2(
|
||||||
Box::new(CompositionEvent {
|
Box::new(CompositionEvent {
|
||||||
uievent: UIEvent::new_inherited(),
|
uievent: UIEvent::new_inherited(),
|
||||||
data: data,
|
data: data,
|
||||||
}),
|
}),
|
||||||
window,
|
window,
|
||||||
|
proto,
|
||||||
);
|
);
|
||||||
ev.uievent
|
ev.uievent
|
||||||
.InitUIEvent(type_, can_bubble, cancelable, view, detail);
|
.InitUIEvent(type_, can_bubble, cancelable, view, detail);
|
||||||
|
@ -56,11 +80,13 @@ impl CompositionEvent {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
init: &CompositionEventBinding::CompositionEventInit,
|
init: &CompositionEventBinding::CompositionEventInit,
|
||||||
) -> Fallible<DomRoot<CompositionEvent>> {
|
) -> Fallible<DomRoot<CompositionEvent>> {
|
||||||
let event = CompositionEvent::new(
|
let event = CompositionEvent::new_with_proto(
|
||||||
window,
|
window,
|
||||||
|
proto,
|
||||||
type_,
|
type_,
|
||||||
init.parent.parent.bubbles,
|
init.parent.parent.bubbles,
|
||||||
init.parent.parent.cancelable,
|
init.parent.parent.cancelable,
|
||||||
|
|
|
@ -9,10 +9,11 @@ use crate::dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate;
|
||||||
use crate::dom::bindings::codegen::Bindings::ConstantSourceNodeBinding::ConstantSourceNodeMethods;
|
use crate::dom::bindings::codegen::Bindings::ConstantSourceNodeBinding::ConstantSourceNodeMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::ConstantSourceNodeBinding::ConstantSourceOptions;
|
use crate::dom::bindings::codegen::Bindings::ConstantSourceNodeBinding::ConstantSourceOptions;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use servo_media::audio::constant_source_node::ConstantSourceNodeOptions as ServoMediaConstantSourceOptions;
|
use servo_media::audio::constant_source_node::ConstantSourceNodeOptions as ServoMediaConstantSourceOptions;
|
||||||
use servo_media::audio::node::AudioNodeInit;
|
use servo_media::audio::node::AudioNodeInit;
|
||||||
use servo_media::audio::param::ParamType;
|
use servo_media::audio::param::ParamType;
|
||||||
|
@ -57,23 +58,33 @@ impl ConstantSourceNode {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
|
||||||
pub fn new(
|
pub fn new(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
context: &BaseAudioContext,
|
context: &BaseAudioContext,
|
||||||
options: &ConstantSourceOptions,
|
options: &ConstantSourceOptions,
|
||||||
|
) -> Fallible<DomRoot<ConstantSourceNode>> {
|
||||||
|
Self::new_with_proto(window, None, context, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unrooted_must_root)]
|
||||||
|
fn new_with_proto(
|
||||||
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
context: &BaseAudioContext,
|
||||||
|
options: &ConstantSourceOptions,
|
||||||
) -> Fallible<DomRoot<ConstantSourceNode>> {
|
) -> Fallible<DomRoot<ConstantSourceNode>> {
|
||||||
let node = ConstantSourceNode::new_inherited(window, context, options)?;
|
let node = ConstantSourceNode::new_inherited(window, context, options)?;
|
||||||
Ok(reflect_dom_object(Box::new(node), window))
|
Ok(reflect_dom_object2(Box::new(node), window, proto))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
context: &BaseAudioContext,
|
context: &BaseAudioContext,
|
||||||
options: &ConstantSourceOptions,
|
options: &ConstantSourceOptions,
|
||||||
) -> Fallible<DomRoot<ConstantSourceNode>> {
|
) -> Fallible<DomRoot<ConstantSourceNode>> {
|
||||||
ConstantSourceNode::new(window, context, options)
|
ConstantSourceNode::new_with_proto(window, proto, context, options)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,28 +85,30 @@ use crate::dom::svgsvgelement::SVGSVGElement;
|
||||||
use crate::realms::{enter_realm, InRealm};
|
use crate::realms::{enter_realm, InRealm};
|
||||||
use crate::script_thread::ScriptThread;
|
use crate::script_thread::ScriptThread;
|
||||||
use html5ever::{LocalName, Prefix, QualName};
|
use html5ever::{LocalName, Prefix, QualName};
|
||||||
|
use js::rust::HandleObject;
|
||||||
use servo_config::pref;
|
use servo_config::pref;
|
||||||
|
|
||||||
fn create_svg_element(
|
fn create_svg_element(
|
||||||
name: QualName,
|
name: QualName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<Element> {
|
) -> DomRoot<Element> {
|
||||||
assert_eq!(name.ns, ns!(svg));
|
assert_eq!(name.ns, ns!(svg));
|
||||||
|
|
||||||
macro_rules! make(
|
macro_rules! make(
|
||||||
($ctor:ident) => ({
|
($ctor:ident) => ({
|
||||||
let obj = $ctor::new(name.local, prefix, document);
|
let obj = $ctor::new(name.local, prefix, document, proto);
|
||||||
DomRoot::upcast(obj)
|
DomRoot::upcast(obj)
|
||||||
});
|
});
|
||||||
($ctor:ident, $($arg:expr),+) => ({
|
($ctor:ident, $($arg:expr),+) => ({
|
||||||
let obj = $ctor::new(name.local, prefix, document, $($arg),+);
|
let obj = $ctor::new(name.local, prefix, document, proto, $($arg),+);
|
||||||
DomRoot::upcast(obj)
|
DomRoot::upcast(obj)
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
if !pref!(dom.svg.enabled) {
|
if !pref!(dom.svg.enabled) {
|
||||||
return Element::new(name.local, name.ns, prefix, document);
|
return Element::new(name.local, name.ns, prefix, document, proto);
|
||||||
}
|
}
|
||||||
|
|
||||||
match name.local {
|
match name.local {
|
||||||
|
@ -124,6 +126,7 @@ fn create_html_element(
|
||||||
document: &Document,
|
document: &Document,
|
||||||
creator: ElementCreator,
|
creator: ElementCreator,
|
||||||
mode: CustomElementCreationMode,
|
mode: CustomElementCreationMode,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<Element> {
|
) -> DomRoot<Element> {
|
||||||
assert_eq!(name.ns, ns!(html));
|
assert_eq!(name.ns, ns!(html));
|
||||||
|
|
||||||
|
@ -138,6 +141,7 @@ fn create_html_element(
|
||||||
name.local.clone(),
|
name.local.clone(),
|
||||||
prefix.clone(),
|
prefix.clone(),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
));
|
));
|
||||||
result.set_custom_element_state(CustomElementState::Undefined);
|
result.set_custom_element_state(CustomElementState::Undefined);
|
||||||
ScriptThread::enqueue_upgrade_reaction(&*result, definition);
|
ScriptThread::enqueue_upgrade_reaction(&*result, definition);
|
||||||
|
@ -145,6 +149,7 @@ fn create_html_element(
|
||||||
},
|
},
|
||||||
CustomElementCreationMode::Synchronous => {
|
CustomElementCreationMode::Synchronous => {
|
||||||
let local_name = name.local.clone();
|
let local_name = name.local.clone();
|
||||||
|
//TODO(jdm) Pass proto to create_element?
|
||||||
return match definition.create_element(document, prefix.clone()) {
|
return match definition.create_element(document, prefix.clone()) {
|
||||||
Ok(element) => {
|
Ok(element) => {
|
||||||
element.set_custom_element_definition(definition.clone());
|
element.set_custom_element_definition(definition.clone());
|
||||||
|
@ -165,7 +170,7 @@ fn create_html_element(
|
||||||
|
|
||||||
// Step 6.1.2
|
// Step 6.1.2
|
||||||
let element = DomRoot::upcast::<Element>(HTMLUnknownElement::new(
|
let element = DomRoot::upcast::<Element>(HTMLUnknownElement::new(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document, proto,
|
||||||
));
|
));
|
||||||
element.set_custom_element_state(CustomElementState::Failed);
|
element.set_custom_element_state(CustomElementState::Failed);
|
||||||
element
|
element
|
||||||
|
@ -175,7 +180,7 @@ fn create_html_element(
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Steps 5.1-5.2
|
// Steps 5.1-5.2
|
||||||
let element = create_native_html_element(name, prefix, document, creator);
|
let element = create_native_html_element(name, prefix, document, creator, proto);
|
||||||
element.set_is(definition.name.clone());
|
element.set_is(definition.name.clone());
|
||||||
element.set_custom_element_state(CustomElementState::Undefined);
|
element.set_custom_element_state(CustomElementState::Undefined);
|
||||||
match mode {
|
match mode {
|
||||||
|
@ -191,7 +196,7 @@ fn create_html_element(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Steps 7.1-7.3
|
// Steps 7.1-7.3
|
||||||
let result = create_native_html_element(name.clone(), prefix, document, creator);
|
let result = create_native_html_element(name.clone(), prefix, document, creator, proto);
|
||||||
match is {
|
match is {
|
||||||
Some(is) => {
|
Some(is) => {
|
||||||
result.set_is(is);
|
result.set_is(is);
|
||||||
|
@ -215,16 +220,17 @@ pub fn create_native_html_element(
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
creator: ElementCreator,
|
creator: ElementCreator,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<Element> {
|
) -> DomRoot<Element> {
|
||||||
assert_eq!(name.ns, ns!(html));
|
assert_eq!(name.ns, ns!(html));
|
||||||
|
|
||||||
macro_rules! make(
|
macro_rules! make(
|
||||||
($ctor:ident) => ({
|
($ctor:ident) => ({
|
||||||
let obj = $ctor::new(name.local, prefix, document);
|
let obj = $ctor::new(name.local, prefix, document, proto);
|
||||||
DomRoot::upcast(obj)
|
DomRoot::upcast(obj)
|
||||||
});
|
});
|
||||||
($ctor:ident, $($arg:expr),+) => ({
|
($ctor:ident, $($arg:expr),+) => ({
|
||||||
let obj = $ctor::new(name.local, prefix, document, $($arg),+);
|
let obj = $ctor::new(name.local, prefix, document, proto, $($arg),+);
|
||||||
DomRoot::upcast(obj)
|
DomRoot::upcast(obj)
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -386,11 +392,12 @@ pub fn create_element(
|
||||||
document: &Document,
|
document: &Document,
|
||||||
creator: ElementCreator,
|
creator: ElementCreator,
|
||||||
mode: CustomElementCreationMode,
|
mode: CustomElementCreationMode,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<Element> {
|
) -> DomRoot<Element> {
|
||||||
let prefix = name.prefix.clone();
|
let prefix = name.prefix.clone();
|
||||||
match name.ns {
|
match name.ns {
|
||||||
ns!(html) => create_html_element(name, prefix, is, document, creator, mode),
|
ns!(html) => create_html_element(name, prefix, is, document, creator, mode, proto),
|
||||||
ns!(svg) => create_svg_element(name, prefix, document),
|
ns!(svg) => create_svg_element(name, prefix, document, proto),
|
||||||
_ => Element::new(name.local, name.ns, prefix, document),
|
_ => Element::new(name.local, name.ns, prefix, document, proto),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ use crate::dom::bindings::codegen::Bindings::CustomEventBinding::CustomEventMeth
|
||||||
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::bindings::trace::RootedTraceableBox;
|
use crate::dom::bindings::trace::RootedTraceableBox;
|
||||||
|
@ -17,6 +17,7 @@ use crate::script_runtime::JSContext;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use js::jsapi::Heap;
|
use js::jsapi::Heap;
|
||||||
use js::jsval::JSVal;
|
use js::jsval::JSVal;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use js::rust::HandleValue;
|
use js::rust::HandleValue;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
|
|
||||||
|
@ -37,16 +38,22 @@ impl CustomEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_uninitialized(global: &GlobalScope) -> DomRoot<CustomEvent> {
|
pub fn new_uninitialized(global: &GlobalScope) -> DomRoot<CustomEvent> {
|
||||||
reflect_dom_object(Box::new(CustomEvent::new_inherited()), global)
|
Self::new_uninitialized_with_proto(global, None)
|
||||||
}
|
}
|
||||||
pub fn new(
|
|
||||||
|
fn new_uninitialized_with_proto(global: &GlobalScope, proto: Option<HandleObject>) -> DomRoot<CustomEvent> {
|
||||||
|
reflect_dom_object2(Box::new(CustomEvent::new_inherited()), global, proto)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
type_: Atom,
|
type_: Atom,
|
||||||
bubbles: bool,
|
bubbles: bool,
|
||||||
cancelable: bool,
|
cancelable: bool,
|
||||||
detail: HandleValue,
|
detail: HandleValue,
|
||||||
) -> DomRoot<CustomEvent> {
|
) -> DomRoot<CustomEvent> {
|
||||||
let ev = CustomEvent::new_uninitialized(global);
|
let ev = CustomEvent::new_uninitialized_with_proto(global, proto);
|
||||||
ev.init_custom_event(type_, bubbles, cancelable, detail);
|
ev.init_custom_event(type_, bubbles, cancelable, detail);
|
||||||
ev
|
ev
|
||||||
}
|
}
|
||||||
|
@ -54,11 +61,13 @@ impl CustomEvent {
|
||||||
#[allow(unsafe_code, non_snake_case)]
|
#[allow(unsafe_code, non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
init: RootedTraceableBox<CustomEventBinding::CustomEventInit>,
|
init: RootedTraceableBox<CustomEventBinding::CustomEventInit>,
|
||||||
) -> Fallible<DomRoot<CustomEvent>> {
|
) -> Fallible<DomRoot<CustomEvent>> {
|
||||||
Ok(CustomEvent::new(
|
Ok(CustomEvent::new(
|
||||||
global,
|
global,
|
||||||
|
proto,
|
||||||
Atom::from(type_),
|
Atom::from(type_),
|
||||||
init.parent.bubbles,
|
init.parent.bubbles,
|
||||||
init.parent.cancelable,
|
init.parent.cancelable,
|
||||||
|
|
|
@ -31,7 +31,7 @@ use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||||
use crate::dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
|
use crate::dom::bindings::inheritance::{Castable, ElementTypeId, HTMLElementTypeId, NodeTypeId};
|
||||||
use crate::dom::bindings::num::Finite;
|
use crate::dom::bindings::num::Finite;
|
||||||
use crate::dom::bindings::refcounted::{Trusted, TrustedPromise};
|
use crate::dom::bindings::refcounted::{Trusted, TrustedPromise};
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
|
use crate::dom::bindings::reflector::{reflect_dom_object2, DomObject};
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot, DomSlice, LayoutDom, MutNullableDom};
|
use crate::dom::bindings::root::{Dom, DomRoot, DomSlice, LayoutDom, MutNullableDom};
|
||||||
use crate::dom::bindings::str::{DOMString, USVString};
|
use crate::dom::bindings::str::{DOMString, USVString};
|
||||||
use crate::dom::bindings::xmlname::XMLName::InvalidXMLName;
|
use crate::dom::bindings::xmlname::XMLName::InvalidXMLName;
|
||||||
|
@ -123,6 +123,7 @@ use html5ever::{LocalName, Namespace, QualName};
|
||||||
use hyper_serde::Serde;
|
use hyper_serde::Serde;
|
||||||
use ipc_channel::ipc::{self, IpcSender};
|
use ipc_channel::ipc::{self, IpcSender};
|
||||||
use js::jsapi::JSObject;
|
use js::jsapi::JSObject;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use keyboard_types::{Code, Key, KeyState};
|
use keyboard_types::{Code, Key, KeyState};
|
||||||
use metrics::{
|
use metrics::{
|
||||||
InteractiveFlag, InteractiveMetrics, InteractiveWindow, ProfilerMetadataFactory,
|
InteractiveFlag, InteractiveMetrics, InteractiveWindow, ProfilerMetadataFactory,
|
||||||
|
@ -3248,11 +3249,12 @@ impl Document {
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#dom-document-document
|
// https://dom.spec.whatwg.org/#dom-document-document
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(window: &Window) -> Fallible<DomRoot<Document>> {
|
pub fn Constructor(window: &Window, proto: Option<HandleObject>) -> Fallible<DomRoot<Document>> {
|
||||||
let doc = window.Document();
|
let doc = window.Document();
|
||||||
let docloader = DocumentLoader::new(&*doc.loader());
|
let docloader = DocumentLoader::new(&*doc.loader());
|
||||||
Ok(Document::new(
|
Ok(Document::new_with_proto(
|
||||||
window,
|
window,
|
||||||
|
proto,
|
||||||
HasBrowsingContext::No,
|
HasBrowsingContext::No,
|
||||||
None,
|
None,
|
||||||
doc.origin().clone(),
|
doc.origin().clone(),
|
||||||
|
@ -3283,7 +3285,41 @@ impl Document {
|
||||||
referrer_policy: Option<ReferrerPolicy>,
|
referrer_policy: Option<ReferrerPolicy>,
|
||||||
canceller: FetchCanceller,
|
canceller: FetchCanceller,
|
||||||
) -> DomRoot<Document> {
|
) -> DomRoot<Document> {
|
||||||
let document = reflect_dom_object(
|
Self::new_with_proto(
|
||||||
|
window,
|
||||||
|
None,
|
||||||
|
has_browsing_context,
|
||||||
|
url,
|
||||||
|
origin,
|
||||||
|
doctype,
|
||||||
|
content_type,
|
||||||
|
last_modified,
|
||||||
|
activity,
|
||||||
|
source,
|
||||||
|
doc_loader,
|
||||||
|
referrer,
|
||||||
|
referrer_policy,
|
||||||
|
canceller,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(
|
||||||
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
has_browsing_context: HasBrowsingContext,
|
||||||
|
url: Option<ServoUrl>,
|
||||||
|
origin: MutableOrigin,
|
||||||
|
doctype: IsHTMLDocument,
|
||||||
|
content_type: Option<Mime>,
|
||||||
|
last_modified: Option<String>,
|
||||||
|
activity: DocumentActivity,
|
||||||
|
source: DocumentSource,
|
||||||
|
doc_loader: DocumentLoader,
|
||||||
|
referrer: Option<String>,
|
||||||
|
referrer_policy: Option<ReferrerPolicy>,
|
||||||
|
canceller: FetchCanceller,
|
||||||
|
) -> DomRoot<Document> {
|
||||||
|
let document = reflect_dom_object2(
|
||||||
Box::new(Document::new_inherited(
|
Box::new(Document::new_inherited(
|
||||||
window,
|
window,
|
||||||
has_browsing_context,
|
has_browsing_context,
|
||||||
|
@ -3300,6 +3336,7 @@ impl Document {
|
||||||
canceller,
|
canceller,
|
||||||
)),
|
)),
|
||||||
window,
|
window,
|
||||||
|
proto,
|
||||||
);
|
);
|
||||||
{
|
{
|
||||||
let node = document.upcast::<Node>();
|
let node = document.upcast::<Node>();
|
||||||
|
@ -4143,6 +4180,7 @@ impl DocumentMethods for Document {
|
||||||
self,
|
self,
|
||||||
ElementCreator::ScriptCreated,
|
ElementCreator::ScriptCreated,
|
||||||
CustomElementCreationMode::Synchronous,
|
CustomElementCreationMode::Synchronous,
|
||||||
|
None,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4167,6 +4205,7 @@ impl DocumentMethods for Document {
|
||||||
self,
|
self,
|
||||||
ElementCreator::ScriptCreated,
|
ElementCreator::ScriptCreated,
|
||||||
CustomElementCreationMode::Synchronous,
|
CustomElementCreationMode::Synchronous,
|
||||||
|
None,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4241,7 +4280,7 @@ impl DocumentMethods for Document {
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#dom-document-createcomment
|
// https://dom.spec.whatwg.org/#dom-document-createcomment
|
||||||
fn CreateComment(&self, data: DOMString) -> DomRoot<Comment> {
|
fn CreateComment(&self, data: DOMString) -> DomRoot<Comment> {
|
||||||
Comment::new(data, self)
|
Comment::new(data, self, None)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction
|
// https://dom.spec.whatwg.org/#dom-document-createprocessinginstruction
|
||||||
|
@ -4361,7 +4400,7 @@ impl DocumentMethods for Document {
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#dom-document-createrange
|
// https://dom.spec.whatwg.org/#dom-document-createrange
|
||||||
fn CreateRange(&self) -> DomRoot<Range> {
|
fn CreateRange(&self) -> DomRoot<Range> {
|
||||||
Range::new_with_doc(self)
|
Range::new_with_doc(self, None)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#dom-document-createnodeiteratorroot-whattoshow-filter
|
// https://dom.spec.whatwg.org/#dom-document-createnodeiteratorroot-whattoshow-filter
|
||||||
|
@ -4434,6 +4473,7 @@ impl DocumentMethods for Document {
|
||||||
self,
|
self,
|
||||||
ElementCreator::ScriptCreated,
|
ElementCreator::ScriptCreated,
|
||||||
CustomElementCreationMode::Synchronous,
|
CustomElementCreationMode::Synchronous,
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
let parent = root.upcast::<Node>();
|
let parent = root.upcast::<Node>();
|
||||||
let child = elem.upcast::<Node>();
|
let child = elem.upcast::<Node>();
|
||||||
|
@ -4458,6 +4498,7 @@ impl DocumentMethods for Document {
|
||||||
self,
|
self,
|
||||||
ElementCreator::ScriptCreated,
|
ElementCreator::ScriptCreated,
|
||||||
CustomElementCreationMode::Synchronous,
|
CustomElementCreationMode::Synchronous,
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
head.upcast::<Node>().AppendChild(elem.upcast()).unwrap()
|
head.upcast::<Node>().AppendChild(elem.upcast()).unwrap()
|
||||||
},
|
},
|
||||||
|
|
|
@ -17,6 +17,7 @@ use crate::dom::node::{window_from_node, Node};
|
||||||
use crate::dom::nodelist::NodeList;
|
use crate::dom::nodelist::NodeList;
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
@ -38,17 +39,22 @@ impl DocumentFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(document: &Document) -> DomRoot<DocumentFragment> {
|
pub fn new(document: &Document) -> DomRoot<DocumentFragment> {
|
||||||
Node::reflect_node(
|
Self::new_with_proto(document, None)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(document: &Document, proto: Option<HandleObject>) -> DomRoot<DocumentFragment> {
|
||||||
|
Node::reflect_node_with_proto(
|
||||||
Box::new(DocumentFragment::new_inherited(document)),
|
Box::new(DocumentFragment::new_inherited(document)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(window: &Window) -> Fallible<DomRoot<DocumentFragment>> {
|
pub fn Constructor(window: &Window, proto: Option<HandleObject>) -> Fallible<DomRoot<DocumentFragment>> {
|
||||||
let document = window.Document();
|
let document = window.Document();
|
||||||
|
|
||||||
Ok(DocumentFragment::new(&document))
|
Ok(DocumentFragment::new_with_proto(&document, proto))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn id_map(&self) -> &DomRefCell<HashMap<Atom, Vec<Dom<Element>>>> {
|
pub fn id_map(&self) -> &DomRefCell<HashMap<Atom, Vec<Dom<Element>>>> {
|
||||||
|
|
|
@ -5,11 +5,12 @@
|
||||||
use crate::dom::bindings::codegen::Bindings::DOMExceptionBinding::DOMExceptionConstants;
|
use crate::dom::bindings::codegen::Bindings::DOMExceptionBinding::DOMExceptionConstants;
|
||||||
use crate::dom::bindings::codegen::Bindings::DOMExceptionBinding::DOMExceptionMethods;
|
use crate::dom::bindings::codegen::Bindings::DOMExceptionBinding::DOMExceptionMethods;
|
||||||
use crate::dom::bindings::error::Error;
|
use crate::dom::bindings::error::Error;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object, reflect_dom_object2, Reflector};
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[repr(u16)]
|
#[repr(u16)]
|
||||||
#[derive(Clone, Copy, Debug, Eq, JSTraceable, MallocSizeOf, Ord, PartialEq, PartialOrd)]
|
#[derive(Clone, Copy, Debug, Eq, JSTraceable, MallocSizeOf, Ord, PartialEq, PartialOrd)]
|
||||||
|
@ -139,12 +140,14 @@ impl DOMException {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
message: DOMString,
|
message: DOMString,
|
||||||
name: DOMString,
|
name: DOMString,
|
||||||
) -> Result<DomRoot<DOMException>, Error> {
|
) -> Result<DomRoot<DOMException>, Error> {
|
||||||
Ok(reflect_dom_object(
|
Ok(reflect_dom_object2(
|
||||||
Box::new(DOMException::new_inherited(message, name)),
|
Box::new(DOMException::new_inherited(message, name)),
|
||||||
global,
|
global,
|
||||||
|
proto,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,13 +168,13 @@ impl DOMImplementationMethods for DOMImplementation {
|
||||||
// Step 4.
|
// Step 4.
|
||||||
let doc_node = doc.upcast::<Node>();
|
let doc_node = doc.upcast::<Node>();
|
||||||
let doc_html =
|
let doc_html =
|
||||||
DomRoot::upcast::<Node>(HTMLHtmlElement::new(local_name!("html"), None, &doc));
|
DomRoot::upcast::<Node>(HTMLHtmlElement::new(local_name!("html"), None, &doc, None));
|
||||||
doc_node.AppendChild(&doc_html).expect("Appending failed");
|
doc_node.AppendChild(&doc_html).expect("Appending failed");
|
||||||
|
|
||||||
{
|
{
|
||||||
// Step 5.
|
// Step 5.
|
||||||
let doc_head =
|
let doc_head =
|
||||||
DomRoot::upcast::<Node>(HTMLHeadElement::new(local_name!("head"), None, &doc));
|
DomRoot::upcast::<Node>(HTMLHeadElement::new(local_name!("head"), None, &doc, None));
|
||||||
doc_html.AppendChild(&doc_head).unwrap();
|
doc_html.AppendChild(&doc_head).unwrap();
|
||||||
|
|
||||||
// Step 6.
|
// Step 6.
|
||||||
|
@ -184,6 +184,7 @@ impl DOMImplementationMethods for DOMImplementation {
|
||||||
local_name!("title"),
|
local_name!("title"),
|
||||||
None,
|
None,
|
||||||
&doc,
|
&doc,
|
||||||
|
None,
|
||||||
));
|
));
|
||||||
doc_head.AppendChild(&doc_title).unwrap();
|
doc_head.AppendChild(&doc_title).unwrap();
|
||||||
|
|
||||||
|
@ -194,7 +195,7 @@ impl DOMImplementationMethods for DOMImplementation {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 7.
|
// Step 7.
|
||||||
let doc_body = HTMLBodyElement::new(local_name!("body"), None, &doc);
|
let doc_body = HTMLBodyElement::new(local_name!("body"), None, &doc, None);
|
||||||
doc_html.AppendChild(doc_body.upcast()).unwrap();
|
doc_html.AppendChild(doc_body.upcast()).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ use crate::dom::bindings::codegen::UnionTypes::StringOrUnrestrictedDoubleSequenc
|
||||||
use crate::dom::bindings::error;
|
use crate::dom::bindings::error;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::dommatrixreadonly::{
|
use crate::dom::dommatrixreadonly::{
|
||||||
dommatrixinit_to_matrix, entries_to_matrix, transform_to_matrix, DOMMatrixReadOnly,
|
dommatrixinit_to_matrix, entries_to_matrix, transform_to_matrix, DOMMatrixReadOnly,
|
||||||
|
@ -17,7 +17,7 @@ use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use euclid::default::Transform3D;
|
use euclid::default::Transform3D;
|
||||||
use js::rust::CustomAutoRooterGuard;
|
use js::rust::{CustomAutoRooterGuard, HandleObject};
|
||||||
use js::typedarray::{Float32Array, Float64Array};
|
use js::typedarray::{Float32Array, Float64Array};
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -27,10 +27,14 @@ pub struct DOMMatrix {
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
impl DOMMatrix {
|
impl DOMMatrix {
|
||||||
#[allow(unrooted_must_root)]
|
|
||||||
pub fn new(global: &GlobalScope, is2D: bool, matrix: Transform3D<f64>) -> DomRoot<Self> {
|
pub fn new(global: &GlobalScope, is2D: bool, matrix: Transform3D<f64>) -> DomRoot<Self> {
|
||||||
|
Self::new_with_proto(global, None, is2D, matrix)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unrooted_must_root)]
|
||||||
|
fn new_with_proto(global: &GlobalScope, proto: Option<HandleObject>, is2D: bool, matrix: Transform3D<f64>) -> DomRoot<Self> {
|
||||||
let dommatrix = Self::new_inherited(is2D, matrix);
|
let dommatrix = Self::new_inherited(is2D, matrix);
|
||||||
reflect_dom_object(Box::new(dommatrix), global)
|
reflect_dom_object2(Box::new(dommatrix), global, proto)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_inherited(is2D: bool, matrix: Transform3D<f64>) -> Self {
|
pub fn new_inherited(is2D: bool, matrix: Transform3D<f64>) -> Self {
|
||||||
|
@ -42,10 +46,11 @@ impl DOMMatrix {
|
||||||
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-dommatrixreadonly
|
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-dommatrixreadonly
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
init: Option<StringOrUnrestrictedDoubleSequence>,
|
init: Option<StringOrUnrestrictedDoubleSequence>,
|
||||||
) -> Fallible<DomRoot<Self>> {
|
) -> Fallible<DomRoot<Self>> {
|
||||||
if init.is_none() {
|
if init.is_none() {
|
||||||
return Ok(Self::new(global, true, Transform3D::identity()));
|
return Ok(Self::new_with_proto(global, proto, true, Transform3D::identity()));
|
||||||
}
|
}
|
||||||
match init.unwrap() {
|
match init.unwrap() {
|
||||||
StringOrUnrestrictedDoubleSequence::String(ref s) => {
|
StringOrUnrestrictedDoubleSequence::String(ref s) => {
|
||||||
|
@ -58,11 +63,11 @@ impl DOMMatrix {
|
||||||
return Ok(Self::new(global, true, Transform3D::identity()));
|
return Ok(Self::new(global, true, Transform3D::identity()));
|
||||||
}
|
}
|
||||||
transform_to_matrix(s.to_string())
|
transform_to_matrix(s.to_string())
|
||||||
.map(|(is2D, matrix)| Self::new(global, is2D, matrix))
|
.map(|(is2D, matrix)| Self::new_with_proto(global, proto, is2D, matrix))
|
||||||
},
|
},
|
||||||
StringOrUnrestrictedDoubleSequence::UnrestrictedDoubleSequence(ref entries) => {
|
StringOrUnrestrictedDoubleSequence::UnrestrictedDoubleSequence(ref entries) => {
|
||||||
entries_to_matrix(&entries[..])
|
entries_to_matrix(&entries[..])
|
||||||
.map(|(is2D, matrix)| Self::new(global, is2D, matrix))
|
.map(|(is2D, matrix)| Self::new_with_proto(global, proto, is2D, matrix))
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,6 +89,7 @@ impl DOMMatrix {
|
||||||
let vec: Vec<f64> = array.to_vec().iter().map(|&x| x as f64).collect();
|
let vec: Vec<f64> = array.to_vec().iter().map(|&x| x as f64).collect();
|
||||||
DOMMatrix::Constructor(
|
DOMMatrix::Constructor(
|
||||||
global,
|
global,
|
||||||
|
None,
|
||||||
Some(StringOrUnrestrictedDoubleSequence::UnrestrictedDoubleSequence(vec)),
|
Some(StringOrUnrestrictedDoubleSequence::UnrestrictedDoubleSequence(vec)),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -96,6 +102,7 @@ impl DOMMatrix {
|
||||||
let vec: Vec<f64> = array.to_vec();
|
let vec: Vec<f64> = array.to_vec();
|
||||||
DOMMatrix::Constructor(
|
DOMMatrix::Constructor(
|
||||||
global,
|
global,
|
||||||
|
None,
|
||||||
Some(StringOrUnrestrictedDoubleSequence::UnrestrictedDoubleSequence(vec)),
|
Some(StringOrUnrestrictedDoubleSequence::UnrestrictedDoubleSequence(vec)),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ use crate::dom::bindings::codegen::UnionTypes::StringOrUnrestrictedDoubleSequenc
|
||||||
use crate::dom::bindings::error;
|
use crate::dom::bindings::error;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object2, DomObject, Reflector};
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::dommatrix::DOMMatrix;
|
use crate::dom::dommatrix::DOMMatrix;
|
||||||
use crate::dom::dompoint::DOMPoint;
|
use crate::dom::dompoint::DOMPoint;
|
||||||
|
@ -21,7 +21,7 @@ use cssparser::{Parser, ParserInput};
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use euclid::{default::Transform3D, Angle};
|
use euclid::{default::Transform3D, Angle};
|
||||||
use js::jsapi::JSObject;
|
use js::jsapi::JSObject;
|
||||||
use js::rust::CustomAutoRooterGuard;
|
use js::rust::{CustomAutoRooterGuard, HandleObject};
|
||||||
use js::typedarray::CreateWith;
|
use js::typedarray::CreateWith;
|
||||||
use js::typedarray::{Float32Array, Float64Array};
|
use js::typedarray::{Float32Array, Float64Array};
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
@ -40,10 +40,14 @@ pub struct DOMMatrixReadOnly {
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
impl DOMMatrixReadOnly {
|
impl DOMMatrixReadOnly {
|
||||||
#[allow(unrooted_must_root)]
|
|
||||||
pub fn new(global: &GlobalScope, is2D: bool, matrix: Transform3D<f64>) -> DomRoot<Self> {
|
pub fn new(global: &GlobalScope, is2D: bool, matrix: Transform3D<f64>) -> DomRoot<Self> {
|
||||||
|
Self::new_with_proto(global, None, is2D, matrix)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unrooted_must_root)]
|
||||||
|
fn new_with_proto(global: &GlobalScope, proto: Option<HandleObject>, is2D: bool, matrix: Transform3D<f64>) -> DomRoot<Self> {
|
||||||
let dommatrix = Self::new_inherited(is2D, matrix);
|
let dommatrix = Self::new_inherited(is2D, matrix);
|
||||||
reflect_dom_object(Box::new(dommatrix), global)
|
reflect_dom_object2(Box::new(dommatrix), global, proto)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_inherited(is2D: bool, matrix: Transform3D<f64>) -> Self {
|
pub fn new_inherited(is2D: bool, matrix: Transform3D<f64>) -> Self {
|
||||||
|
@ -57,10 +61,11 @@ impl DOMMatrixReadOnly {
|
||||||
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-dommatrixreadonly
|
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-dommatrixreadonly
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
init: Option<StringOrUnrestrictedDoubleSequence>,
|
init: Option<StringOrUnrestrictedDoubleSequence>,
|
||||||
) -> Fallible<DomRoot<Self>> {
|
) -> Fallible<DomRoot<Self>> {
|
||||||
if init.is_none() {
|
if init.is_none() {
|
||||||
return Ok(Self::new(global, true, Transform3D::identity()));
|
return Ok(Self::new_with_proto(global, proto, true, Transform3D::identity()));
|
||||||
}
|
}
|
||||||
match init.unwrap() {
|
match init.unwrap() {
|
||||||
StringOrUnrestrictedDoubleSequence::String(ref s) => {
|
StringOrUnrestrictedDoubleSequence::String(ref s) => {
|
||||||
|
@ -73,11 +78,11 @@ impl DOMMatrixReadOnly {
|
||||||
return Ok(Self::new(global, true, Transform3D::identity()));
|
return Ok(Self::new(global, true, Transform3D::identity()));
|
||||||
}
|
}
|
||||||
transform_to_matrix(s.to_string())
|
transform_to_matrix(s.to_string())
|
||||||
.map(|(is2D, matrix)| Self::new(global, is2D, matrix))
|
.map(|(is2D, matrix)| Self::new_with_proto(global, proto, is2D, matrix))
|
||||||
},
|
},
|
||||||
StringOrUnrestrictedDoubleSequence::UnrestrictedDoubleSequence(ref entries) => {
|
StringOrUnrestrictedDoubleSequence::UnrestrictedDoubleSequence(ref entries) => {
|
||||||
entries_to_matrix(&entries[..])
|
entries_to_matrix(&entries[..])
|
||||||
.map(|(is2D, matrix)| Self::new(global, is2D, matrix))
|
.map(|(is2D, matrix)| Self::new_with_proto(global, proto, is2D, matrix))
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -392,6 +397,7 @@ impl DOMMatrixReadOnly {
|
||||||
let vec: Vec<f64> = array.to_vec().iter().map(|&x| x as f64).collect();
|
let vec: Vec<f64> = array.to_vec().iter().map(|&x| x as f64).collect();
|
||||||
DOMMatrixReadOnly::Constructor(
|
DOMMatrixReadOnly::Constructor(
|
||||||
global,
|
global,
|
||||||
|
None,
|
||||||
Some(StringOrUnrestrictedDoubleSequence::UnrestrictedDoubleSequence(vec)),
|
Some(StringOrUnrestrictedDoubleSequence::UnrestrictedDoubleSequence(vec)),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -405,6 +411,7 @@ impl DOMMatrixReadOnly {
|
||||||
let vec: Vec<f64> = array.to_vec();
|
let vec: Vec<f64> = array.to_vec();
|
||||||
DOMMatrixReadOnly::Constructor(
|
DOMMatrixReadOnly::Constructor(
|
||||||
global,
|
global,
|
||||||
|
None,
|
||||||
Some(StringOrUnrestrictedDoubleSequence::UnrestrictedDoubleSequence(vec)),
|
Some(StringOrUnrestrictedDoubleSequence::UnrestrictedDoubleSequence(vec)),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ use crate::dom::bindings::codegen::Bindings::DOMParserBinding::SupportedType::Te
|
||||||
use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentReadyState;
|
use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentReadyState;
|
||||||
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
|
use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object2, Reflector};
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::document::DocumentSource;
|
use crate::dom::document::DocumentSource;
|
||||||
|
@ -20,6 +20,7 @@ use crate::dom::document::{Document, HasBrowsingContext, IsHTMLDocument};
|
||||||
use crate::dom::servoparser::ServoParser;
|
use crate::dom::servoparser::ServoParser;
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use script_traits::DocumentActivity;
|
use script_traits::DocumentActivity;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -36,13 +37,13 @@ impl DOMParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(window: &Window) -> DomRoot<DOMParser> {
|
fn new(window: &Window, proto: Option<HandleObject>) -> DomRoot<DOMParser> {
|
||||||
reflect_dom_object(Box::new(DOMParser::new_inherited(window)), window)
|
reflect_dom_object2(Box::new(DOMParser::new_inherited(window)), window, proto)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(window: &Window) -> Fallible<DomRoot<DOMParser>> {
|
pub fn Constructor(window: &Window, proto: Option<HandleObject>) -> Fallible<DomRoot<DOMParser>> {
|
||||||
Ok(DOMParser::new(window))
|
Ok(DOMParser::new(window, proto))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,12 @@
|
||||||
use crate::dom::bindings::codegen::Bindings::DOMPointBinding::{DOMPointInit, DOMPointMethods};
|
use crate::dom::bindings::codegen::Bindings::DOMPointBinding::{DOMPointInit, DOMPointMethods};
|
||||||
use crate::dom::bindings::codegen::Bindings::DOMPointReadOnlyBinding::DOMPointReadOnlyMethods;
|
use crate::dom::bindings::codegen::Bindings::DOMPointReadOnlyBinding::DOMPointReadOnlyMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::dompointreadonly::{DOMPointReadOnly, DOMPointWriteMethods};
|
use crate::dom::dompointreadonly::{DOMPointReadOnly, DOMPointWriteMethods};
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
// http://dev.w3.org/fxtf/geometry/Overview.html#dompoint
|
// http://dev.w3.org/fxtf/geometry/Overview.html#dompoint
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -26,17 +27,22 @@ impl DOMPoint {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(global: &GlobalScope, x: f64, y: f64, z: f64, w: f64) -> DomRoot<DOMPoint> {
|
pub fn new(global: &GlobalScope, x: f64, y: f64, z: f64, w: f64) -> DomRoot<DOMPoint> {
|
||||||
reflect_dom_object(Box::new(DOMPoint::new_inherited(x, y, z, w)), global)
|
Self::new_with_proto(global, None, x, y, z, w)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(global: &GlobalScope, proto: Option<HandleObject>, x: f64, y: f64, z: f64, w: f64) -> DomRoot<DOMPoint> {
|
||||||
|
reflect_dom_object2(Box::new(DOMPoint::new_inherited(x, y, z, w)), global, proto)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
x: f64,
|
x: f64,
|
||||||
y: f64,
|
y: f64,
|
||||||
z: f64,
|
z: f64,
|
||||||
w: f64,
|
w: f64,
|
||||||
) -> Fallible<DomRoot<DOMPoint>> {
|
) -> Fallible<DomRoot<DOMPoint>> {
|
||||||
Ok(DOMPoint::new(global, x, y, z, w))
|
Ok(DOMPoint::new_with_proto(global, proto, x, y, z, w))
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://drafts.fxtf.org/geometry/#dom-dompoint-frompoint
|
// https://drafts.fxtf.org/geometry/#dom-dompoint-frompoint
|
||||||
|
|
|
@ -5,10 +5,11 @@
|
||||||
use crate::dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit;
|
use crate::dom::bindings::codegen::Bindings::DOMPointBinding::DOMPointInit;
|
||||||
use crate::dom::bindings::codegen::Bindings::DOMPointReadOnlyBinding::DOMPointReadOnlyMethods;
|
use crate::dom::bindings::codegen::Bindings::DOMPointReadOnlyBinding::DOMPointReadOnlyMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object2, Reflector};
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
|
||||||
// http://dev.w3.org/fxtf/geometry/Overview.html#dompointreadonly
|
// http://dev.w3.org/fxtf/geometry/Overview.html#dompointreadonly
|
||||||
|
@ -34,20 +35,26 @@ impl DOMPointReadOnly {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(global: &GlobalScope, x: f64, y: f64, z: f64, w: f64) -> DomRoot<DOMPointReadOnly> {
|
pub fn new(global: &GlobalScope, x: f64, y: f64, z: f64, w: f64) -> DomRoot<DOMPointReadOnly> {
|
||||||
reflect_dom_object(
|
Self::new_with_proto(global, None, x, y, z, w)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(global: &GlobalScope, proto: Option<HandleObject>, x: f64, y: f64, z: f64, w: f64) -> DomRoot<DOMPointReadOnly> {
|
||||||
|
reflect_dom_object2(
|
||||||
Box::new(DOMPointReadOnly::new_inherited(x, y, z, w)),
|
Box::new(DOMPointReadOnly::new_inherited(x, y, z, w)),
|
||||||
global,
|
global,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
x: f64,
|
x: f64,
|
||||||
y: f64,
|
y: f64,
|
||||||
z: f64,
|
z: f64,
|
||||||
w: f64,
|
w: f64,
|
||||||
) -> Fallible<DomRoot<DOMPointReadOnly>> {
|
) -> Fallible<DomRoot<DOMPointReadOnly>> {
|
||||||
Ok(DOMPointReadOnly::new(global, x, y, z, w))
|
Ok(DOMPointReadOnly::new_with_proto(global, proto, x, y, z, w))
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://drafts.fxtf.org/geometry/#dom-dompointreadonly-frompoint
|
// https://drafts.fxtf.org/geometry/#dom-dompointreadonly-frompoint
|
||||||
|
|
|
@ -6,12 +6,13 @@ use crate::dom::bindings::codegen::Bindings::DOMPointBinding::{DOMPointInit, DOM
|
||||||
use crate::dom::bindings::codegen::Bindings::DOMQuadBinding::{DOMQuadInit, DOMQuadMethods};
|
use crate::dom::bindings::codegen::Bindings::DOMQuadBinding::{DOMQuadInit, DOMQuadMethods};
|
||||||
use crate::dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::DOMRectInit;
|
use crate::dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::DOMRectInit;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object2, DomObject, Reflector};
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
use crate::dom::dompoint::DOMPoint;
|
use crate::dom::dompoint::DOMPoint;
|
||||||
use crate::dom::domrect::DOMRect;
|
use crate::dom::domrect::DOMRect;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
// https://drafts.fxtf.org/geometry/#DOMQuad
|
// https://drafts.fxtf.org/geometry/#DOMQuad
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -42,18 +43,31 @@ impl DOMQuad {
|
||||||
p3: &DOMPoint,
|
p3: &DOMPoint,
|
||||||
p4: &DOMPoint,
|
p4: &DOMPoint,
|
||||||
) -> DomRoot<DOMQuad> {
|
) -> DomRoot<DOMQuad> {
|
||||||
reflect_dom_object(Box::new(DOMQuad::new_inherited(p1, p2, p3, p4)), global)
|
Self::new_with_proto(global, None, p1, p2, p3, p4)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(
|
||||||
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
p1: &DOMPoint,
|
||||||
|
p2: &DOMPoint,
|
||||||
|
p3: &DOMPoint,
|
||||||
|
p4: &DOMPoint,
|
||||||
|
) -> DomRoot<DOMQuad> {
|
||||||
|
reflect_dom_object2(Box::new(DOMQuad::new_inherited(p1, p2, p3, p4)), global, proto)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
p1: &DOMPointInit,
|
p1: &DOMPointInit,
|
||||||
p2: &DOMPointInit,
|
p2: &DOMPointInit,
|
||||||
p3: &DOMPointInit,
|
p3: &DOMPointInit,
|
||||||
p4: &DOMPointInit,
|
p4: &DOMPointInit,
|
||||||
) -> Fallible<DomRoot<DOMQuad>> {
|
) -> Fallible<DomRoot<DOMQuad>> {
|
||||||
Ok(DOMQuad::new(
|
Ok(DOMQuad::new_with_proto(
|
||||||
global,
|
global,
|
||||||
|
proto,
|
||||||
&*DOMPoint::new_from_init(global, p1),
|
&*DOMPoint::new_from_init(global, p1),
|
||||||
&*DOMPoint::new_from_init(global, p2),
|
&*DOMPoint::new_from_init(global, p2),
|
||||||
&*DOMPoint::new_from_init(global, p3),
|
&*DOMPoint::new_from_init(global, p3),
|
||||||
|
|
|
@ -5,11 +5,12 @@
|
||||||
use crate::dom::bindings::codegen::Bindings::DOMRectBinding::DOMRectMethods;
|
use crate::dom::bindings::codegen::Bindings::DOMRectBinding::DOMRectMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::DOMRectReadOnlyMethods;
|
use crate::dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::DOMRectReadOnlyMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::domrectreadonly::DOMRectReadOnly;
|
use crate::dom::domrectreadonly::DOMRectReadOnly;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct DOMRect {
|
pub struct DOMRect {
|
||||||
|
@ -24,21 +25,27 @@ impl DOMRect {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(global: &GlobalScope, x: f64, y: f64, width: f64, height: f64) -> DomRoot<DOMRect> {
|
pub fn new(global: &GlobalScope, x: f64, y: f64, width: f64, height: f64) -> DomRoot<DOMRect> {
|
||||||
reflect_dom_object(
|
Self::new_with_proto(global, None, x, y, width, height)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(global: &GlobalScope, proto: Option<HandleObject>, x: f64, y: f64, width: f64, height: f64) -> DomRoot<DOMRect> {
|
||||||
|
reflect_dom_object2(
|
||||||
Box::new(DOMRect::new_inherited(x, y, width, height)),
|
Box::new(DOMRect::new_inherited(x, y, width, height)),
|
||||||
global,
|
global,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
x: f64,
|
x: f64,
|
||||||
y: f64,
|
y: f64,
|
||||||
width: f64,
|
width: f64,
|
||||||
height: f64,
|
height: f64,
|
||||||
) -> Fallible<DomRoot<DOMRect>> {
|
) -> Fallible<DomRoot<DOMRect>> {
|
||||||
Ok(DOMRect::new(global, x, y, width, height))
|
Ok(DOMRect::new_with_proto(global, proto, x, y, width, height))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,11 @@
|
||||||
|
|
||||||
use crate::dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::DOMRectReadOnlyMethods;
|
use crate::dom::bindings::codegen::Bindings::DOMRectReadOnlyBinding::DOMRectReadOnlyMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object2, Reflector};
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -30,28 +31,31 @@ impl DOMRectReadOnly {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(
|
fn new(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
x: f64,
|
x: f64,
|
||||||
y: f64,
|
y: f64,
|
||||||
width: f64,
|
width: f64,
|
||||||
height: f64,
|
height: f64,
|
||||||
) -> DomRoot<DOMRectReadOnly> {
|
) -> DomRoot<DOMRectReadOnly> {
|
||||||
reflect_dom_object(
|
reflect_dom_object2(
|
||||||
Box::new(DOMRectReadOnly::new_inherited(x, y, width, height)),
|
Box::new(DOMRectReadOnly::new_inherited(x, y, width, height)),
|
||||||
global,
|
global,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
x: f64,
|
x: f64,
|
||||||
y: f64,
|
y: f64,
|
||||||
width: f64,
|
width: f64,
|
||||||
height: f64,
|
height: f64,
|
||||||
) -> Fallible<DomRoot<DOMRectReadOnly>> {
|
) -> Fallible<DomRoot<DOMRectReadOnly>> {
|
||||||
Ok(DOMRectReadOnly::new(global, x, y, width, height))
|
Ok(DOMRectReadOnly::new(global, proto, x, y, width, height))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_x(&self, value: f64) {
|
pub fn set_x(&self, value: f64) {
|
||||||
|
|
|
@ -95,6 +95,7 @@ use html5ever::serialize::TraversalScope::{ChildrenOnly, IncludeNode};
|
||||||
use html5ever::{LocalName, Namespace, Prefix, QualName};
|
use html5ever::{LocalName, Namespace, Prefix, QualName};
|
||||||
use js::jsapi::Heap;
|
use js::jsapi::Heap;
|
||||||
use js::jsval::JSVal;
|
use js::jsval::JSVal;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use msg::constellation_msg::InputMethodType;
|
use msg::constellation_msg::InputMethodType;
|
||||||
use net_traits::request::CorsSettings;
|
use net_traits::request::CorsSettings;
|
||||||
use net_traits::ReferrerPolicy;
|
use net_traits::ReferrerPolicy;
|
||||||
|
@ -241,8 +242,9 @@ impl Element {
|
||||||
document: &Document,
|
document: &Document,
|
||||||
creator: ElementCreator,
|
creator: ElementCreator,
|
||||||
mode: CustomElementCreationMode,
|
mode: CustomElementCreationMode,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<Element> {
|
) -> DomRoot<Element> {
|
||||||
create_element(name, is, document, creator, mode)
|
create_element(name, is, document, creator, mode, proto)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_inherited(
|
pub fn new_inherited(
|
||||||
|
@ -290,12 +292,14 @@ impl Element {
|
||||||
namespace: Namespace,
|
namespace: Namespace,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<Element> {
|
) -> DomRoot<Element> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(Element::new_inherited(
|
Box::new(Element::new_inherited(
|
||||||
local_name, namespace, prefix, document,
|
local_name, namespace, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1817,7 +1821,7 @@ impl Element {
|
||||||
{
|
{
|
||||||
DomRoot::from_ref(elem)
|
DomRoot::from_ref(elem)
|
||||||
},
|
},
|
||||||
_ => DomRoot::upcast(HTMLBodyElement::new(local_name!("body"), None, owner_doc)),
|
_ => DomRoot::upcast(HTMLBodyElement::new(local_name!("body"), None, owner_doc, None)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2588,6 +2592,7 @@ impl ElementMethods for Element {
|
||||||
&context_document,
|
&context_document,
|
||||||
ElementCreator::ScriptCreated,
|
ElementCreator::ScriptCreated,
|
||||||
CustomElementCreationMode::Synchronous,
|
CustomElementCreationMode::Synchronous,
|
||||||
|
None,
|
||||||
);
|
);
|
||||||
DomRoot::upcast(body_elem)
|
DomRoot::upcast(body_elem)
|
||||||
},
|
},
|
||||||
|
|
|
@ -8,7 +8,7 @@ use crate::dom::bindings::codegen::Bindings::ErrorEventBinding::ErrorEventMethod
|
||||||
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
use crate::dom::bindings::codegen::Bindings::EventBinding::EventMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::bindings::trace::RootedTraceableBox;
|
use crate::dom::bindings::trace::RootedTraceableBox;
|
||||||
|
@ -18,7 +18,7 @@ use crate::script_runtime::JSContext;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use js::jsapi::Heap;
|
use js::jsapi::Heap;
|
||||||
use js::jsval::JSVal;
|
use js::jsval::JSVal;
|
||||||
use js::rust::HandleValue;
|
use js::rust::{HandleObject, HandleValue};
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
|
||||||
|
@ -45,8 +45,8 @@ impl ErrorEvent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_uninitialized(global: &GlobalScope) -> DomRoot<ErrorEvent> {
|
fn new_uninitialized(global: &GlobalScope, proto: Option<HandleObject>) -> DomRoot<ErrorEvent> {
|
||||||
reflect_dom_object(Box::new(ErrorEvent::new_inherited()), global)
|
reflect_dom_object2(Box::new(ErrorEvent::new_inherited()), global, proto)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(
|
pub fn new(
|
||||||
|
@ -60,7 +60,33 @@ impl ErrorEvent {
|
||||||
colno: u32,
|
colno: u32,
|
||||||
error: HandleValue,
|
error: HandleValue,
|
||||||
) -> DomRoot<ErrorEvent> {
|
) -> DomRoot<ErrorEvent> {
|
||||||
let ev = ErrorEvent::new_uninitialized(global);
|
Self::new_with_proto(
|
||||||
|
global,
|
||||||
|
None,
|
||||||
|
type_,
|
||||||
|
bubbles,
|
||||||
|
cancelable,
|
||||||
|
message,
|
||||||
|
filename,
|
||||||
|
lineno,
|
||||||
|
colno,
|
||||||
|
error,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(
|
||||||
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
type_: Atom,
|
||||||
|
bubbles: EventBubbles,
|
||||||
|
cancelable: EventCancelable,
|
||||||
|
message: DOMString,
|
||||||
|
filename: DOMString,
|
||||||
|
lineno: u32,
|
||||||
|
colno: u32,
|
||||||
|
error: HandleValue,
|
||||||
|
) -> DomRoot<ErrorEvent> {
|
||||||
|
let ev = ErrorEvent::new_uninitialized(global, proto);
|
||||||
{
|
{
|
||||||
let event = ev.upcast::<Event>();
|
let event = ev.upcast::<Event>();
|
||||||
event.init_event(type_, bool::from(bubbles), bool::from(cancelable));
|
event.init_event(type_, bool::from(bubbles), bool::from(cancelable));
|
||||||
|
@ -76,6 +102,7 @@ impl ErrorEvent {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
init: RootedTraceableBox<ErrorEventBinding::ErrorEventInit>,
|
init: RootedTraceableBox<ErrorEventBinding::ErrorEventInit>,
|
||||||
) -> Fallible<DomRoot<ErrorEvent>> {
|
) -> Fallible<DomRoot<ErrorEvent>> {
|
||||||
|
@ -97,8 +124,9 @@ impl ErrorEvent {
|
||||||
|
|
||||||
let cancelable = EventCancelable::from(init.parent.cancelable);
|
let cancelable = EventCancelable::from(init.parent.cancelable);
|
||||||
|
|
||||||
let event = ErrorEvent::new(
|
let event = ErrorEvent::new_with_proto(
|
||||||
global,
|
global,
|
||||||
|
proto,
|
||||||
Atom::from(type_),
|
Atom::from(type_),
|
||||||
bubbles,
|
bubbles,
|
||||||
cancelable,
|
cancelable,
|
||||||
|
|
|
@ -12,7 +12,7 @@ use crate::dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::refcounted::Trusted;
|
use crate::dom::bindings::refcounted::Trusted;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object2, DomObject, Reflector};
|
||||||
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::document::Document;
|
use crate::dom::document::Document;
|
||||||
|
@ -28,6 +28,7 @@ use crate::dom::window::Window;
|
||||||
use crate::task::TaskOnce;
|
use crate::task::TaskOnce;
|
||||||
use devtools_traits::{TimelineMarker, TimelineMarkerType};
|
use devtools_traits::{TimelineMarker, TimelineMarkerType};
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use metrics::ToMs;
|
use metrics::ToMs;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
@ -72,7 +73,11 @@ impl Event {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_uninitialized(global: &GlobalScope) -> DomRoot<Event> {
|
pub fn new_uninitialized(global: &GlobalScope) -> DomRoot<Event> {
|
||||||
reflect_dom_object(Box::new(Event::new_inherited()), global)
|
Self::new_uninitialized_with_proto(global, None)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn new_uninitialized_with_proto(global: &GlobalScope, proto: Option<HandleObject>) -> DomRoot<Event> {
|
||||||
|
reflect_dom_object2(Box::new(Event::new_inherited()), global, proto)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(
|
pub fn new(
|
||||||
|
@ -81,7 +86,17 @@ impl Event {
|
||||||
bubbles: EventBubbles,
|
bubbles: EventBubbles,
|
||||||
cancelable: EventCancelable,
|
cancelable: EventCancelable,
|
||||||
) -> DomRoot<Event> {
|
) -> DomRoot<Event> {
|
||||||
let event = Event::new_uninitialized(global);
|
Self::new_with_proto(global, None, type_, bubbles, cancelable)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(
|
||||||
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
type_: Atom,
|
||||||
|
bubbles: EventBubbles,
|
||||||
|
cancelable: EventCancelable,
|
||||||
|
) -> DomRoot<Event> {
|
||||||
|
let event = Event::new_uninitialized_with_proto(global, proto);
|
||||||
event.init_event(type_, bool::from(bubbles), bool::from(cancelable));
|
event.init_event(type_, bool::from(bubbles), bool::from(cancelable));
|
||||||
event
|
event
|
||||||
}
|
}
|
||||||
|
@ -89,12 +104,13 @@ impl Event {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
init: &EventBinding::EventInit,
|
init: &EventBinding::EventInit,
|
||||||
) -> Fallible<DomRoot<Event>> {
|
) -> Fallible<DomRoot<Event>> {
|
||||||
let bubbles = EventBubbles::from(init.bubbles);
|
let bubbles = EventBubbles::from(init.bubbles);
|
||||||
let cancelable = EventCancelable::from(init.cancelable);
|
let cancelable = EventCancelable::from(init.cancelable);
|
||||||
Ok(Event::new(global, Atom::from(type_), bubbles, cancelable))
|
Ok(Event::new_with_proto(global, proto, Atom::from(type_), bubbles, cancelable))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn init_event(&self, type_: Atom, bubbles: bool, cancelable: bool) {
|
pub fn init_event(&self, type_: Atom, bubbles: bool, cancelable: bool) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ use crate::dom::bindings::codegen::Bindings::EventSourceBinding::{
|
||||||
use crate::dom::bindings::error::{Error, Fallible};
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::refcounted::Trusted;
|
use crate::dom::bindings::refcounted::Trusted;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
|
use crate::dom::bindings::reflector::{reflect_dom_object2, DomObject};
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::event::Event;
|
use crate::dom::event::Event;
|
||||||
|
@ -30,6 +30,7 @@ use ipc_channel::ipc;
|
||||||
use ipc_channel::router::ROUTER;
|
use ipc_channel::router::ROUTER;
|
||||||
use js::conversions::ToJSValConvertible;
|
use js::conversions::ToJSValConvertible;
|
||||||
use js::jsval::UndefinedValue;
|
use js::jsval::UndefinedValue;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use mime::{self, Mime};
|
use mime::{self, Mime};
|
||||||
use net_traits::request::{CacheMode, CorsSettings, Destination, RequestBuilder};
|
use net_traits::request::{CacheMode, CorsSettings, Destination, RequestBuilder};
|
||||||
use net_traits::{CoreResourceMsg, FetchChannels, FetchMetadata, FilteredMetadata};
|
use net_traits::{CoreResourceMsg, FetchChannels, FetchMetadata, FilteredMetadata};
|
||||||
|
@ -459,10 +460,11 @@ impl EventSource {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new(global: &GlobalScope, url: ServoUrl, with_credentials: bool) -> DomRoot<EventSource> {
|
fn new(global: &GlobalScope, proto: Option<HandleObject>, url: ServoUrl, with_credentials: bool) -> DomRoot<EventSource> {
|
||||||
reflect_dom_object(
|
reflect_dom_object2(
|
||||||
Box::new(EventSource::new_inherited(url, with_credentials)),
|
Box::new(EventSource::new_inherited(url, with_credentials)),
|
||||||
global,
|
global,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,6 +503,7 @@ impl EventSource {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
url: DOMString,
|
url: DOMString,
|
||||||
event_source_init: &EventSourceInit,
|
event_source_init: &EventSourceInit,
|
||||||
) -> Fallible<DomRoot<EventSource>> {
|
) -> Fallible<DomRoot<EventSource>> {
|
||||||
|
@ -515,6 +518,7 @@ impl EventSource {
|
||||||
// Step 1, 5
|
// Step 1, 5
|
||||||
let ev = EventSource::new(
|
let ev = EventSource::new(
|
||||||
global,
|
global,
|
||||||
|
proto,
|
||||||
url_record.clone(),
|
url_record.clone(),
|
||||||
event_source_init.withCredentials,
|
event_source_init.withCredentials,
|
||||||
);
|
);
|
||||||
|
|
|
@ -21,7 +21,7 @@ use crate::dom::bindings::codegen::UnionTypes::EventListenerOptionsOrBoolean;
|
||||||
use crate::dom::bindings::codegen::UnionTypes::EventOrString;
|
use crate::dom::bindings::codegen::UnionTypes::EventOrString;
|
||||||
use crate::dom::bindings::error::{report_pending_exception, Error, Fallible};
|
use crate::dom::bindings::error::{report_pending_exception, Error, Fallible};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, reflect_dom_object2, DomObject, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object2, DomObject, Reflector};
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::element::Element;
|
use crate::dom::element::Element;
|
||||||
|
@ -355,13 +355,13 @@ impl EventTarget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new(global: &GlobalScope) -> DomRoot<EventTarget> {
|
fn new(global: &GlobalScope, proto: Option<HandleObject>) -> DomRoot<EventTarget> {
|
||||||
reflect_dom_object(Box::new(EventTarget::new_inherited()), global)
|
reflect_dom_object2(Box::new(EventTarget::new_inherited()), global, proto)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(global: &GlobalScope, proto: HandleObject) -> Fallible<DomRoot<EventTarget>> {
|
pub fn Constructor(global: &GlobalScope, proto: Option<HandleObject>) -> Fallible<DomRoot<EventTarget>> {
|
||||||
Ok(reflect_dom_object2(Box::new(EventTarget::new_inherited()), global, proto))
|
Ok(EventTarget::new(global, proto))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn has_listeners_for(&self, type_: &Atom) -> bool {
|
pub fn has_listeners_for(&self, type_: &Atom) -> bool {
|
||||||
|
|
|
@ -6,14 +6,14 @@ use crate::dom::bindings::codegen::Bindings::EventBinding::{self, EventMethods};
|
||||||
use crate::dom::bindings::codegen::Bindings::ExtendableEventBinding;
|
use crate::dom::bindings::codegen::Bindings::ExtendableEventBinding;
|
||||||
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
|
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::event::Event;
|
use crate::dom::event::Event;
|
||||||
use crate::dom::serviceworkerglobalscope::ServiceWorkerGlobalScope;
|
use crate::dom::serviceworkerglobalscope::ServiceWorkerGlobalScope;
|
||||||
use crate::script_runtime::JSContext;
|
use crate::script_runtime::JSContext;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use js::rust::HandleValue;
|
use js::rust::{HandleObject, HandleValue};
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
|
|
||||||
// https://w3c.github.io/ServiceWorker/#extendable-event
|
// https://w3c.github.io/ServiceWorker/#extendable-event
|
||||||
|
@ -31,13 +31,24 @@ impl ExtendableEvent {
|
||||||
extensions_allowed: true,
|
extensions_allowed: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(
|
pub fn new(
|
||||||
worker: &ServiceWorkerGlobalScope,
|
worker: &ServiceWorkerGlobalScope,
|
||||||
type_: Atom,
|
type_: Atom,
|
||||||
bubbles: bool,
|
bubbles: bool,
|
||||||
cancelable: bool,
|
cancelable: bool,
|
||||||
) -> DomRoot<ExtendableEvent> {
|
) -> DomRoot<ExtendableEvent> {
|
||||||
let ev = reflect_dom_object(Box::new(ExtendableEvent::new_inherited()), worker);
|
Self::new_with_proto(worker, None, type_, bubbles, cancelable)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(
|
||||||
|
worker: &ServiceWorkerGlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
type_: Atom,
|
||||||
|
bubbles: bool,
|
||||||
|
cancelable: bool,
|
||||||
|
) -> DomRoot<ExtendableEvent> {
|
||||||
|
let ev = reflect_dom_object2(Box::new(ExtendableEvent::new_inherited()), worker, proto);
|
||||||
{
|
{
|
||||||
let event = ev.upcast::<Event>();
|
let event = ev.upcast::<Event>();
|
||||||
event.init_event(type_, bubbles, cancelable);
|
event.init_event(type_, bubbles, cancelable);
|
||||||
|
@ -47,11 +58,13 @@ impl ExtendableEvent {
|
||||||
|
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
worker: &ServiceWorkerGlobalScope,
|
worker: &ServiceWorkerGlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
init: &ExtendableEventBinding::ExtendableEventInit,
|
init: &ExtendableEventBinding::ExtendableEventInit,
|
||||||
) -> Fallible<DomRoot<ExtendableEvent>> {
|
) -> Fallible<DomRoot<ExtendableEvent>> {
|
||||||
Ok(ExtendableEvent::new(
|
Ok(ExtendableEvent::new_with_proto(
|
||||||
worker,
|
worker,
|
||||||
|
proto,
|
||||||
Atom::from(type_),
|
Atom::from(type_),
|
||||||
init.parent.bubbles,
|
init.parent.bubbles,
|
||||||
init.parent.cancelable,
|
init.parent.cancelable,
|
||||||
|
|
|
@ -7,7 +7,7 @@ use crate::dom::bindings::codegen::Bindings::ExtendableMessageEventBinding;
|
||||||
use crate::dom::bindings::codegen::Bindings::ExtendableMessageEventBinding::ExtendableMessageEventMethods;
|
use crate::dom::bindings::codegen::Bindings::ExtendableMessageEventBinding::ExtendableMessageEventMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::bindings::trace::RootedTraceableBox;
|
use crate::dom::bindings::trace::RootedTraceableBox;
|
||||||
|
@ -22,7 +22,7 @@ use crate::script_runtime::JSContext;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use js::jsapi::Heap;
|
use js::jsapi::Heap;
|
||||||
use js::jsval::JSVal;
|
use js::jsval::JSVal;
|
||||||
use js::rust::HandleValue;
|
use js::rust::{HandleObject, HandleValue};
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -72,13 +72,37 @@ impl ExtendableMessageEvent {
|
||||||
origin: DOMString,
|
origin: DOMString,
|
||||||
lastEventId: DOMString,
|
lastEventId: DOMString,
|
||||||
ports: Vec<DomRoot<MessagePort>>,
|
ports: Vec<DomRoot<MessagePort>>,
|
||||||
|
) -> DomRoot<ExtendableMessageEvent> {
|
||||||
|
Self::new_with_proto(
|
||||||
|
global,
|
||||||
|
None,
|
||||||
|
type_,
|
||||||
|
bubbles,
|
||||||
|
cancelable,
|
||||||
|
data,
|
||||||
|
origin,
|
||||||
|
lastEventId,
|
||||||
|
ports,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(
|
||||||
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
type_: Atom,
|
||||||
|
bubbles: bool,
|
||||||
|
cancelable: bool,
|
||||||
|
data: HandleValue,
|
||||||
|
origin: DOMString,
|
||||||
|
lastEventId: DOMString,
|
||||||
|
ports: Vec<DomRoot<MessagePort>>,
|
||||||
) -> DomRoot<ExtendableMessageEvent> {
|
) -> DomRoot<ExtendableMessageEvent> {
|
||||||
let ev = Box::new(ExtendableMessageEvent::new_inherited(
|
let ev = Box::new(ExtendableMessageEvent::new_inherited(
|
||||||
origin,
|
origin,
|
||||||
lastEventId,
|
lastEventId,
|
||||||
ports,
|
ports,
|
||||||
));
|
));
|
||||||
let ev = reflect_dom_object(ev, global);
|
let ev = reflect_dom_object2(ev, global, proto);
|
||||||
{
|
{
|
||||||
let event = ev.upcast::<Event>();
|
let event = ev.upcast::<Event>();
|
||||||
event.init_event(type_, bubbles, cancelable);
|
event.init_event(type_, bubbles, cancelable);
|
||||||
|
@ -90,12 +114,14 @@ impl ExtendableMessageEvent {
|
||||||
|
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
worker: &ServiceWorkerGlobalScope,
|
worker: &ServiceWorkerGlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
init: RootedTraceableBox<ExtendableMessageEventBinding::ExtendableMessageEventInit>,
|
init: RootedTraceableBox<ExtendableMessageEventBinding::ExtendableMessageEventInit>,
|
||||||
) -> Fallible<DomRoot<ExtendableMessageEvent>> {
|
) -> Fallible<DomRoot<ExtendableMessageEvent>> {
|
||||||
let global = worker.upcast::<GlobalScope>();
|
let global = worker.upcast::<GlobalScope>();
|
||||||
let ev = ExtendableMessageEvent::new(
|
let ev = ExtendableMessageEvent::new_with_proto(
|
||||||
global,
|
global,
|
||||||
|
proto,
|
||||||
Atom::from(type_),
|
Atom::from(type_),
|
||||||
init.parent.parent.bubbles,
|
init.parent.parent.bubbles,
|
||||||
init.parent.parent.cancelable,
|
init.parent.parent.cancelable,
|
||||||
|
|
|
@ -7,13 +7,14 @@ use crate::dom::bindings::codegen::Bindings::FileBinding::FileMethods;
|
||||||
use crate::dom::bindings::codegen::UnionTypes::ArrayBufferOrArrayBufferViewOrBlobOrString;
|
use crate::dom::bindings::codegen::UnionTypes::ArrayBufferOrArrayBufferViewOrBlobOrString;
|
||||||
use crate::dom::bindings::error::{Error, Fallible};
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::blob::{blob_parts_to_bytes, normalize_type_string, Blob};
|
use crate::dom::blob::{blob_parts_to_bytes, normalize_type_string, Blob};
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use net_traits::filemanager_thread::SelectedFile;
|
use net_traits::filemanager_thread::SelectedFile;
|
||||||
use script_traits::serializable::BlobImpl;
|
use script_traits::serializable::BlobImpl;
|
||||||
|
|
||||||
|
@ -41,16 +42,27 @@ impl File {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
|
||||||
pub fn new(
|
pub fn new(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
blob_impl: BlobImpl,
|
blob_impl: BlobImpl,
|
||||||
name: DOMString,
|
name: DOMString,
|
||||||
modified: Option<i64>,
|
modified: Option<i64>,
|
||||||
) -> DomRoot<File> {
|
) -> DomRoot<File> {
|
||||||
let file = reflect_dom_object(
|
Self::new_with_proto(global, None, blob_impl, name, modified)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unrooted_must_root)]
|
||||||
|
fn new_with_proto(
|
||||||
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
blob_impl: BlobImpl,
|
||||||
|
name: DOMString,
|
||||||
|
modified: Option<i64>,
|
||||||
|
) -> DomRoot<File> {
|
||||||
|
let file = reflect_dom_object2(
|
||||||
Box::new(File::new_inherited(&blob_impl, name, modified)),
|
Box::new(File::new_inherited(&blob_impl, name, modified)),
|
||||||
global,
|
global,
|
||||||
|
proto,
|
||||||
);
|
);
|
||||||
global.track_file(&file, blob_impl);
|
global.track_file(&file, blob_impl);
|
||||||
file
|
file
|
||||||
|
@ -82,6 +94,7 @@ impl File {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
fileBits: Vec<ArrayBufferOrArrayBufferViewOrBlobOrString>,
|
fileBits: Vec<ArrayBufferOrArrayBufferViewOrBlobOrString>,
|
||||||
filename: DOMString,
|
filename: DOMString,
|
||||||
filePropertyBag: &FileBinding::FilePropertyBag,
|
filePropertyBag: &FileBinding::FilePropertyBag,
|
||||||
|
@ -98,8 +111,9 @@ impl File {
|
||||||
// see https://github.com/w3c/FileAPI/issues/41
|
// see https://github.com/w3c/FileAPI/issues/41
|
||||||
let replaced_filename = DOMString::from_string(filename.replace("/", ":"));
|
let replaced_filename = DOMString::from_string(filename.replace("/", ":"));
|
||||||
let type_string = normalize_type_string(&blobPropertyBag.type_.to_string());
|
let type_string = normalize_type_string(&blobPropertyBag.type_.to_string());
|
||||||
Ok(File::new(
|
Ok(File::new_with_proto(
|
||||||
global,
|
global,
|
||||||
|
proto,
|
||||||
BlobImpl::new_from_bytes(bytes, type_string),
|
BlobImpl::new_from_bytes(bytes, type_string),
|
||||||
replaced_filename,
|
replaced_filename,
|
||||||
modified,
|
modified,
|
||||||
|
|
|
@ -11,7 +11,7 @@ use crate::dom::bindings::codegen::UnionTypes::StringOrObject;
|
||||||
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
|
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::refcounted::Trusted;
|
use crate::dom::bindings::refcounted::Trusted;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
|
use crate::dom::bindings::reflector::{reflect_dom_object2, DomObject};
|
||||||
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::bindings::trace::RootedTraceableBox;
|
use crate::dom::bindings::trace::RootedTraceableBox;
|
||||||
|
@ -31,6 +31,7 @@ use encoding_rs::{Encoding, UTF_8};
|
||||||
use js::jsapi::Heap;
|
use js::jsapi::Heap;
|
||||||
use js::jsapi::JSObject;
|
use js::jsapi::JSObject;
|
||||||
use js::jsval::{self, JSVal};
|
use js::jsval::{self, JSVal};
|
||||||
|
use js::rust::HandleObject;
|
||||||
use js::typedarray::{ArrayBuffer, CreateWith};
|
use js::typedarray::{ArrayBuffer, CreateWith};
|
||||||
use mime::{self, Mime};
|
use mime::{self, Mime};
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
|
@ -151,13 +152,13 @@ impl FileReader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(global: &GlobalScope) -> DomRoot<FileReader> {
|
fn new(global: &GlobalScope, proto: Option<HandleObject>) -> DomRoot<FileReader> {
|
||||||
reflect_dom_object(Box::new(FileReader::new_inherited()), global)
|
reflect_dom_object2(Box::new(FileReader::new_inherited()), global, proto)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(global: &GlobalScope) -> Fallible<DomRoot<FileReader>> {
|
pub fn Constructor(global: &GlobalScope, proto: Option<HandleObject>) -> Fallible<DomRoot<FileReader>> {
|
||||||
Ok(FileReader::new(global))
|
Ok(FileReader::new(global, proto))
|
||||||
}
|
}
|
||||||
|
|
||||||
//https://w3c.github.io/FileAPI/#dfn-error-steps
|
//https://w3c.github.io/FileAPI/#dfn-error-steps
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
use crate::dom::bindings::codegen::Bindings::BlobBinding::BlobMethods;
|
use crate::dom::bindings::codegen::Bindings::BlobBinding::BlobMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::FileReaderSyncBinding::FileReaderSyncMethods;
|
use crate::dom::bindings::codegen::Bindings::FileReaderSyncBinding::FileReaderSyncMethods;
|
||||||
use crate::dom::bindings::error::{Error, Fallible};
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object2, Reflector};
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::blob::Blob;
|
use crate::dom::blob::Blob;
|
||||||
|
@ -14,6 +14,7 @@ use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::script_runtime::JSContext;
|
use crate::script_runtime::JSContext;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use js::jsapi::JSObject;
|
use js::jsapi::JSObject;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use js::typedarray::{ArrayBuffer, CreateWith};
|
use js::typedarray::{ArrayBuffer, CreateWith};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::ptr::NonNull;
|
use std::ptr::NonNull;
|
||||||
|
@ -30,13 +31,13 @@ impl FileReaderSync {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(global: &GlobalScope) -> DomRoot<FileReaderSync> {
|
fn new(global: &GlobalScope, proto: Option<HandleObject>) -> DomRoot<FileReaderSync> {
|
||||||
reflect_dom_object(Box::new(FileReaderSync::new_inherited()), global)
|
reflect_dom_object2(Box::new(FileReaderSync::new_inherited()), global, proto)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(global: &GlobalScope) -> Fallible<DomRoot<FileReaderSync>> {
|
pub fn Constructor(global: &GlobalScope, proto: Option<HandleObject>) -> Fallible<DomRoot<FileReaderSync>> {
|
||||||
Ok(FileReaderSync::new(global))
|
Ok(FileReaderSync::new(global, proto))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_blob_bytes(blob: &Blob) -> Result<Vec<u8>, Error> {
|
fn get_blob_bytes(blob: &Blob) -> Result<Vec<u8>, Error> {
|
||||||
|
|
|
@ -7,7 +7,7 @@ use crate::dom::bindings::codegen::Bindings::FocusEventBinding::FocusEventMethod
|
||||||
use crate::dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
|
use crate::dom::bindings::codegen::Bindings::UIEventBinding::UIEventMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||||
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
use crate::dom::bindings::root::{DomRoot, MutNullableDom};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::event::{EventBubbles, EventCancelable};
|
use crate::dom::event::{EventBubbles, EventCancelable};
|
||||||
|
@ -15,6 +15,7 @@ use crate::dom::eventtarget::EventTarget;
|
||||||
use crate::dom::uievent::UIEvent;
|
use crate::dom::uievent::UIEvent;
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -32,7 +33,11 @@ impl FocusEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_uninitialized(window: &Window) -> DomRoot<FocusEvent> {
|
pub fn new_uninitialized(window: &Window) -> DomRoot<FocusEvent> {
|
||||||
reflect_dom_object(Box::new(FocusEvent::new_inherited()), window)
|
Self::new_uninitialized_with_proto(window, None)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn new_uninitialized_with_proto(window: &Window, proto: Option<HandleObject>) -> DomRoot<FocusEvent> {
|
||||||
|
reflect_dom_object2(Box::new(FocusEvent::new_inherited()), window, proto)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(
|
pub fn new(
|
||||||
|
@ -44,7 +49,29 @@ impl FocusEvent {
|
||||||
detail: i32,
|
detail: i32,
|
||||||
related_target: Option<&EventTarget>,
|
related_target: Option<&EventTarget>,
|
||||||
) -> DomRoot<FocusEvent> {
|
) -> DomRoot<FocusEvent> {
|
||||||
let ev = FocusEvent::new_uninitialized(window);
|
Self::new_with_proto(
|
||||||
|
window,
|
||||||
|
None,
|
||||||
|
type_,
|
||||||
|
can_bubble,
|
||||||
|
cancelable,
|
||||||
|
view,
|
||||||
|
detail,
|
||||||
|
related_target,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(
|
||||||
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
type_: DOMString,
|
||||||
|
can_bubble: EventBubbles,
|
||||||
|
cancelable: EventCancelable,
|
||||||
|
view: Option<&Window>,
|
||||||
|
detail: i32,
|
||||||
|
related_target: Option<&EventTarget>,
|
||||||
|
) -> DomRoot<FocusEvent> {
|
||||||
|
let ev = FocusEvent::new_uninitialized_with_proto(window, proto);
|
||||||
ev.upcast::<UIEvent>().InitUIEvent(
|
ev.upcast::<UIEvent>().InitUIEvent(
|
||||||
type_,
|
type_,
|
||||||
bool::from(can_bubble),
|
bool::from(can_bubble),
|
||||||
|
@ -59,13 +86,15 @@ impl FocusEvent {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
init: &FocusEventBinding::FocusEventInit,
|
init: &FocusEventBinding::FocusEventInit,
|
||||||
) -> Fallible<DomRoot<FocusEvent>> {
|
) -> Fallible<DomRoot<FocusEvent>> {
|
||||||
let bubbles = EventBubbles::from(init.parent.parent.bubbles);
|
let bubbles = EventBubbles::from(init.parent.parent.bubbles);
|
||||||
let cancelable = EventCancelable::from(init.parent.parent.cancelable);
|
let cancelable = EventCancelable::from(init.parent.parent.cancelable);
|
||||||
let event = FocusEvent::new(
|
let event = FocusEvent::new_with_proto(
|
||||||
window,
|
window,
|
||||||
|
proto,
|
||||||
type_,
|
type_,
|
||||||
bubbles,
|
bubbles,
|
||||||
cancelable,
|
cancelable,
|
||||||
|
|
|
@ -8,7 +8,7 @@ use crate::dom::bindings::codegen::UnionTypes::FileOrUSVString;
|
||||||
use crate::dom::bindings::error::{Error, Fallible};
|
use crate::dom::bindings::error::{Error, Fallible};
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::iterable::Iterable;
|
use crate::dom::bindings::iterable::Iterable;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object2, DomObject, Reflector};
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::{DOMString, USVString};
|
use crate::dom::bindings::str::{DOMString, USVString};
|
||||||
use crate::dom::blob::Blob;
|
use crate::dom::blob::Blob;
|
||||||
|
@ -17,6 +17,7 @@ use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::htmlformelement::{FormDatum, FormDatumValue, HTMLFormElement};
|
use crate::dom::htmlformelement::{FormDatum, FormDatumValue, HTMLFormElement};
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::LocalName;
|
use html5ever::LocalName;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use script_traits::serializable::BlobImpl;
|
use script_traits::serializable::BlobImpl;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -42,23 +43,28 @@ impl FormData {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(form_datums: Option<Vec<FormDatum>>, global: &GlobalScope) -> DomRoot<FormData> {
|
pub fn new(form_datums: Option<Vec<FormDatum>>, global: &GlobalScope) -> DomRoot<FormData> {
|
||||||
reflect_dom_object(Box::new(FormData::new_inherited(form_datums)), global)
|
Self::new_with_proto(form_datums, global, None)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(form_datums: Option<Vec<FormDatum>>, global: &GlobalScope, proto: Option<HandleObject>) -> DomRoot<FormData> {
|
||||||
|
reflect_dom_object2(Box::new(FormData::new_inherited(form_datums)), global, proto)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://xhr.spec.whatwg.org/#dom-formdata
|
// https://xhr.spec.whatwg.org/#dom-formdata
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
form: Option<&HTMLFormElement>,
|
form: Option<&HTMLFormElement>,
|
||||||
) -> Fallible<DomRoot<FormData>> {
|
) -> Fallible<DomRoot<FormData>> {
|
||||||
if let Some(opt_form) = form {
|
if let Some(opt_form) = form {
|
||||||
return match opt_form.get_form_dataset(None, None) {
|
return match opt_form.get_form_dataset(None, None) {
|
||||||
Some(form_datums) => Ok(FormData::new(Some(form_datums), global)),
|
Some(form_datums) => Ok(FormData::new_with_proto(Some(form_datums), global, proto)),
|
||||||
None => Err(Error::InvalidState),
|
None => Err(Error::InvalidState),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(FormData::new(None, global))
|
Ok(FormData::new_with_proto(None, global, proto))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ use crate::dom::bindings::codegen::Bindings::FormDataEventBinding;
|
||||||
use crate::dom::bindings::codegen::Bindings::FormDataEventBinding::FormDataEventMethods;
|
use crate::dom::bindings::codegen::Bindings::FormDataEventBinding::FormDataEventMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
|
use crate::dom::bindings::reflector::{reflect_dom_object2, DomObject};
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::event::Event;
|
use crate::dom::event::Event;
|
||||||
|
@ -16,6 +16,7 @@ use crate::dom::formdata::FormData;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -32,12 +33,31 @@ impl FormDataEvent {
|
||||||
cancelable: EventCancelable,
|
cancelable: EventCancelable,
|
||||||
form_data: &FormData,
|
form_data: &FormData,
|
||||||
) -> DomRoot<FormDataEvent> {
|
) -> DomRoot<FormDataEvent> {
|
||||||
let ev = reflect_dom_object(
|
Self::new_with_proto(
|
||||||
|
global,
|
||||||
|
None,
|
||||||
|
type_,
|
||||||
|
can_bubble,
|
||||||
|
cancelable,
|
||||||
|
form_data,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(
|
||||||
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
type_: Atom,
|
||||||
|
can_bubble: EventBubbles,
|
||||||
|
cancelable: EventCancelable,
|
||||||
|
form_data: &FormData,
|
||||||
|
) -> DomRoot<FormDataEvent> {
|
||||||
|
let ev = reflect_dom_object2(
|
||||||
Box::new(FormDataEvent {
|
Box::new(FormDataEvent {
|
||||||
event: Event::new_inherited(),
|
event: Event::new_inherited(),
|
||||||
form_data: Dom::from_ref(form_data),
|
form_data: Dom::from_ref(form_data),
|
||||||
}),
|
}),
|
||||||
global,
|
global,
|
||||||
|
proto,
|
||||||
);
|
);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -50,14 +70,16 @@ impl FormDataEvent {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
init: &FormDataEventBinding::FormDataEventInit,
|
init: &FormDataEventBinding::FormDataEventInit,
|
||||||
) -> Fallible<DomRoot<FormDataEvent>> {
|
) -> Fallible<DomRoot<FormDataEvent>> {
|
||||||
let bubbles = EventBubbles::from(init.parent.bubbles);
|
let bubbles = EventBubbles::from(init.parent.bubbles);
|
||||||
let cancelable = EventCancelable::from(init.parent.cancelable);
|
let cancelable = EventCancelable::from(init.parent.cancelable);
|
||||||
|
|
||||||
let event = FormDataEvent::new(
|
let event = FormDataEvent::new_with_proto(
|
||||||
&window.global(),
|
&window.global(),
|
||||||
|
proto,
|
||||||
Atom::from(type_),
|
Atom::from(type_),
|
||||||
bubbles,
|
bubbles,
|
||||||
cancelable,
|
cancelable,
|
||||||
|
|
|
@ -11,10 +11,11 @@ use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
|
||||||
use crate::dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate;
|
use crate::dom::bindings::codegen::Bindings::AudioParamBinding::AutomationRate;
|
||||||
use crate::dom::bindings::codegen::Bindings::GainNodeBinding::{GainNodeMethods, GainOptions};
|
use crate::dom::bindings::codegen::Bindings::GainNodeBinding::{GainNodeMethods, GainOptions};
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use servo_media::audio::gain_node::GainNodeOptions;
|
use servo_media::audio::gain_node::GainNodeOptions;
|
||||||
use servo_media::audio::node::AudioNodeInit;
|
use servo_media::audio::node::AudioNodeInit;
|
||||||
use servo_media::audio::param::ParamType;
|
use servo_media::audio::param::ParamType;
|
||||||
|
@ -60,23 +61,33 @@ impl GainNode {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unrooted_must_root)]
|
|
||||||
pub fn new(
|
pub fn new(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
context: &BaseAudioContext,
|
context: &BaseAudioContext,
|
||||||
options: &GainOptions,
|
options: &GainOptions,
|
||||||
|
) -> Fallible<DomRoot<GainNode>> {
|
||||||
|
Self::new_with_proto(window, None, context, options)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(unrooted_must_root)]
|
||||||
|
fn new_with_proto(
|
||||||
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
context: &BaseAudioContext,
|
||||||
|
options: &GainOptions,
|
||||||
) -> Fallible<DomRoot<GainNode>> {
|
) -> Fallible<DomRoot<GainNode>> {
|
||||||
let node = GainNode::new_inherited(window, context, options)?;
|
let node = GainNode::new_inherited(window, context, options)?;
|
||||||
Ok(reflect_dom_object(Box::new(node), window))
|
Ok(reflect_dom_object2(Box::new(node), window, proto))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
context: &BaseAudioContext,
|
context: &BaseAudioContext,
|
||||||
options: &GainOptions,
|
options: &GainOptions,
|
||||||
) -> Fallible<DomRoot<GainNode>> {
|
) -> Fallible<DomRoot<GainNode>> {
|
||||||
GainNode::new(window, context, options)
|
GainNode::new_with_proto(window, proto, context, options)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ use crate::dom::bindings::codegen::Bindings::GamepadEventBinding;
|
||||||
use crate::dom::bindings::codegen::Bindings::GamepadEventBinding::GamepadEventMethods;
|
use crate::dom::bindings::codegen::Bindings::GamepadEventBinding::GamepadEventMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, DomObject};
|
use crate::dom::bindings::reflector::{reflect_dom_object2, DomObject};
|
||||||
use crate::dom::bindings::root::{Dom, DomRoot};
|
use crate::dom::bindings::root::{Dom, DomRoot};
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::event::Event;
|
use crate::dom::event::Event;
|
||||||
|
@ -15,6 +15,7 @@ use crate::dom::gamepad::Gamepad;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -43,7 +44,18 @@ impl GamepadEvent {
|
||||||
cancelable: bool,
|
cancelable: bool,
|
||||||
gamepad: &Gamepad,
|
gamepad: &Gamepad,
|
||||||
) -> DomRoot<GamepadEvent> {
|
) -> DomRoot<GamepadEvent> {
|
||||||
let ev = reflect_dom_object(Box::new(GamepadEvent::new_inherited(&gamepad)), global);
|
Self::new_with_proto(global, None, type_, bubbles, cancelable, gamepad)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(
|
||||||
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
type_: Atom,
|
||||||
|
bubbles: bool,
|
||||||
|
cancelable: bool,
|
||||||
|
gamepad: &Gamepad,
|
||||||
|
) -> DomRoot<GamepadEvent> {
|
||||||
|
let ev = reflect_dom_object2(Box::new(GamepadEvent::new_inherited(&gamepad)), global, proto);
|
||||||
{
|
{
|
||||||
let event = ev.upcast::<Event>();
|
let event = ev.upcast::<Event>();
|
||||||
event.init_event(type_, bubbles, cancelable);
|
event.init_event(type_, bubbles, cancelable);
|
||||||
|
@ -68,11 +80,13 @@ impl GamepadEvent {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
init: &GamepadEventBinding::GamepadEventInit,
|
init: &GamepadEventBinding::GamepadEventInit,
|
||||||
) -> Fallible<DomRoot<GamepadEvent>> {
|
) -> Fallible<DomRoot<GamepadEvent>> {
|
||||||
Ok(GamepadEvent::new(
|
Ok(GamepadEvent::new_with_proto(
|
||||||
&window.global(),
|
&window.global(),
|
||||||
|
proto,
|
||||||
Atom::from(type_),
|
Atom::from(type_),
|
||||||
init.parent.bubbles,
|
init.parent.bubbles,
|
||||||
init.parent.cancelable,
|
init.parent.cancelable,
|
||||||
|
|
|
@ -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::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object2, Reflector};
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct GPUOutOfMemoryError {
|
pub struct GPUOutOfMemoryError {
|
||||||
|
@ -20,12 +21,16 @@ impl GPUOutOfMemoryError {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(global: &GlobalScope) -> DomRoot<Self> {
|
pub fn new(global: &GlobalScope) -> DomRoot<Self> {
|
||||||
reflect_dom_object(Box::new(GPUOutOfMemoryError::new_inherited()), global)
|
Self::new_with_proto(global, None)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(global: &GlobalScope, proto: Option<HandleObject>) -> DomRoot<Self> {
|
||||||
|
reflect_dom_object2(Box::new(GPUOutOfMemoryError::new_inherited()), global, proto)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuoutofmemoryerror-gpuoutofmemoryerror
|
/// https://gpuweb.github.io/gpuweb/#dom-gpuoutofmemoryerror-gpuoutofmemoryerror
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(global: &GlobalScope) -> DomRoot<Self> {
|
pub fn Constructor(global: &GlobalScope, proto: Option<HandleObject>) -> DomRoot<Self> {
|
||||||
GPUOutOfMemoryError::new(global)
|
GPUOutOfMemoryError::new_with_proto(global, proto)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,12 +7,13 @@ use crate::dom::bindings::codegen::Bindings::GPUUncapturedErrorEventBinding::{
|
||||||
GPUUncapturedErrorEventInit, GPUUncapturedErrorEventMethods,
|
GPUUncapturedErrorEventInit, GPUUncapturedErrorEventMethods,
|
||||||
};
|
};
|
||||||
use crate::dom::bindings::codegen::Bindings::GPUValidationErrorBinding::GPUError;
|
use crate::dom::bindings::codegen::Bindings::GPUValidationErrorBinding::GPUError;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::event::Event;
|
use crate::dom::event::Event;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -35,9 +36,19 @@ impl GPUUncapturedErrorEvent {
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
init: &GPUUncapturedErrorEventInit,
|
init: &GPUUncapturedErrorEventInit,
|
||||||
) -> DomRoot<Self> {
|
) -> DomRoot<Self> {
|
||||||
let ev = reflect_dom_object(
|
Self::new_with_proto(global, None, type_, init)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(
|
||||||
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
type_: DOMString,
|
||||||
|
init: &GPUUncapturedErrorEventInit,
|
||||||
|
) -> DomRoot<Self> {
|
||||||
|
let ev = reflect_dom_object2(
|
||||||
Box::new(GPUUncapturedErrorEvent::new_inherited(init)),
|
Box::new(GPUUncapturedErrorEvent::new_inherited(init)),
|
||||||
global,
|
global,
|
||||||
|
proto,
|
||||||
);
|
);
|
||||||
ev.event.init_event(
|
ev.event.init_event(
|
||||||
Atom::from(type_),
|
Atom::from(type_),
|
||||||
|
@ -51,10 +62,11 @@ impl GPUUncapturedErrorEvent {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
init: &GPUUncapturedErrorEventInit,
|
init: &GPUUncapturedErrorEventInit,
|
||||||
) -> DomRoot<Self> {
|
) -> DomRoot<Self> {
|
||||||
GPUUncapturedErrorEvent::new(global, type_, init)
|
GPUUncapturedErrorEvent::new_with_proto(global, proto, type_, init)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,11 +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::dom::bindings::codegen::Bindings::GPUValidationErrorBinding::GPUValidationErrorMethods;
|
use crate::dom::bindings::codegen::Bindings::GPUValidationErrorBinding::GPUValidationErrorMethods;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object2, Reflector};
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::DOMString;
|
use crate::dom::bindings::str::DOMString;
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct GPUValidationError {
|
pub struct GPUValidationError {
|
||||||
|
@ -24,13 +25,17 @@ impl GPUValidationError {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(global: &GlobalScope, message: DOMString) -> DomRoot<Self> {
|
pub fn new(global: &GlobalScope, message: DOMString) -> DomRoot<Self> {
|
||||||
reflect_dom_object(Box::new(GPUValidationError::new_inherited(message)), global)
|
Self::new_with_proto(global, None, message)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(global: &GlobalScope, proto: Option<HandleObject>, message: DOMString) -> DomRoot<Self> {
|
||||||
|
reflect_dom_object2(Box::new(GPUValidationError::new_inherited(message)), global, proto)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// https://gpuweb.github.io/gpuweb/#dom-gpuvalidationerror-gpuvalidationerror
|
/// https://gpuweb.github.io/gpuweb/#dom-gpuvalidationerror-gpuvalidationerror
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(global: &GlobalScope, message: DOMString) -> DomRoot<Self> {
|
pub fn Constructor(global: &GlobalScope, proto: Option<HandleObject>, message: DOMString) -> DomRoot<Self> {
|
||||||
GPUValidationError::new(global, message)
|
GPUValidationError::new_with_proto(global, proto, message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,13 @@ use crate::dom::bindings::codegen::Bindings::HashChangeEventBinding;
|
||||||
use crate::dom::bindings::codegen::Bindings::HashChangeEventBinding::HashChangeEventMethods;
|
use crate::dom::bindings::codegen::Bindings::HashChangeEventBinding::HashChangeEventMethods;
|
||||||
use crate::dom::bindings::error::Fallible;
|
use crate::dom::bindings::error::Fallible;
|
||||||
use crate::dom::bindings::inheritance::Castable;
|
use crate::dom::bindings::inheritance::Castable;
|
||||||
use crate::dom::bindings::reflector::reflect_dom_object;
|
use crate::dom::bindings::reflector::reflect_dom_object2;
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::{DOMString, USVString};
|
use crate::dom::bindings::str::{DOMString, USVString};
|
||||||
use crate::dom::event::Event;
|
use crate::dom::event::Event;
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#hashchangeevent
|
// https://html.spec.whatwg.org/multipage/#hashchangeevent
|
||||||
|
@ -33,9 +34,14 @@ impl HashChangeEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_uninitialized(window: &Window) -> DomRoot<HashChangeEvent> {
|
pub fn new_uninitialized(window: &Window) -> DomRoot<HashChangeEvent> {
|
||||||
reflect_dom_object(
|
Self::new_uninitialized_with_proto(window, None)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_uninitialized_with_proto(window: &Window, proto: Option<HandleObject>) -> DomRoot<HashChangeEvent> {
|
||||||
|
reflect_dom_object2(
|
||||||
Box::new(HashChangeEvent::new_inherited(String::new(), String::new())),
|
Box::new(HashChangeEvent::new_inherited(String::new(), String::new())),
|
||||||
window,
|
window,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,9 +53,22 @@ impl HashChangeEvent {
|
||||||
old_url: String,
|
old_url: String,
|
||||||
new_url: String,
|
new_url: String,
|
||||||
) -> DomRoot<HashChangeEvent> {
|
) -> DomRoot<HashChangeEvent> {
|
||||||
let ev = reflect_dom_object(
|
Self::new_with_proto(window, None, type_, bubbles, cancelable, old_url, new_url)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(
|
||||||
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
|
type_: Atom,
|
||||||
|
bubbles: bool,
|
||||||
|
cancelable: bool,
|
||||||
|
old_url: String,
|
||||||
|
new_url: String,
|
||||||
|
) -> DomRoot<HashChangeEvent> {
|
||||||
|
let ev = reflect_dom_object2(
|
||||||
Box::new(HashChangeEvent::new_inherited(old_url, new_url)),
|
Box::new(HashChangeEvent::new_inherited(old_url, new_url)),
|
||||||
window,
|
window,
|
||||||
|
proto,
|
||||||
);
|
);
|
||||||
{
|
{
|
||||||
let event = ev.upcast::<Event>();
|
let event = ev.upcast::<Event>();
|
||||||
|
@ -61,11 +80,13 @@ impl HashChangeEvent {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
type_: DOMString,
|
type_: DOMString,
|
||||||
init: &HashChangeEventBinding::HashChangeEventInit,
|
init: &HashChangeEventBinding::HashChangeEventInit,
|
||||||
) -> Fallible<DomRoot<HashChangeEvent>> {
|
) -> Fallible<DomRoot<HashChangeEvent>> {
|
||||||
Ok(HashChangeEvent::new(
|
Ok(HashChangeEvent::new_with_proto(
|
||||||
window,
|
window,
|
||||||
|
proto,
|
||||||
Atom::from(type_),
|
Atom::from(type_),
|
||||||
init.parent.bubbles,
|
init.parent.bubbles,
|
||||||
init.parent.cancelable,
|
init.parent.cancelable,
|
||||||
|
|
|
@ -6,13 +6,14 @@ use crate::dom::bindings::cell::DomRefCell;
|
||||||
use crate::dom::bindings::codegen::Bindings::HeadersBinding::{HeadersInit, HeadersMethods};
|
use crate::dom::bindings::codegen::Bindings::HeadersBinding::{HeadersInit, HeadersMethods};
|
||||||
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
|
use crate::dom::bindings::error::{Error, ErrorResult, Fallible};
|
||||||
use crate::dom::bindings::iterable::Iterable;
|
use crate::dom::bindings::iterable::Iterable;
|
||||||
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
|
use crate::dom::bindings::reflector::{reflect_dom_object2, Reflector};
|
||||||
use crate::dom::bindings::root::DomRoot;
|
use crate::dom::bindings::root::DomRoot;
|
||||||
use crate::dom::bindings::str::{is_token, ByteString};
|
use crate::dom::bindings::str::{is_token, ByteString};
|
||||||
use crate::dom::globalscope::GlobalScope;
|
use crate::dom::globalscope::GlobalScope;
|
||||||
use data_url::mime::Mime as DataUrlMime;
|
use data_url::mime::Mime as DataUrlMime;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use http::header::{HeaderMap as HyperHeaders, HeaderName, HeaderValue};
|
use http::header::{HeaderMap as HyperHeaders, HeaderName, HeaderValue};
|
||||||
|
use js::rust::HandleObject;
|
||||||
use net_traits::{
|
use net_traits::{
|
||||||
fetch::headers::get_value_from_header_list, request::is_cors_safelisted_request_header,
|
fetch::headers::get_value_from_header_list, request::is_cors_safelisted_request_header,
|
||||||
};
|
};
|
||||||
|
@ -47,16 +48,21 @@ impl Headers {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(global: &GlobalScope) -> DomRoot<Headers> {
|
pub fn new(global: &GlobalScope) -> DomRoot<Headers> {
|
||||||
reflect_dom_object(Box::new(Headers::new_inherited()), global)
|
Self::new_with_proto(global, None)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_with_proto(global: &GlobalScope, proto: Option<HandleObject>) -> DomRoot<Headers> {
|
||||||
|
reflect_dom_object2(Box::new(Headers::new_inherited()), global, proto)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#dom-headers
|
// https://fetch.spec.whatwg.org/#dom-headers
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Constructor(
|
pub fn Constructor(
|
||||||
global: &GlobalScope,
|
global: &GlobalScope,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
init: Option<HeadersInit>,
|
init: Option<HeadersInit>,
|
||||||
) -> Fallible<DomRoot<Headers>> {
|
) -> Fallible<DomRoot<Headers>> {
|
||||||
let dom_headers_new = Headers::new(global);
|
let dom_headers_new = Headers::new_with_proto(global, proto);
|
||||||
dom_headers_new.fill(init)?;
|
dom_headers_new.fill(init)?;
|
||||||
Ok(dom_headers_new)
|
Ok(dom_headers_new)
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ use crate::dom::virtualmethods::VirtualMethods;
|
||||||
use crate::task_source::TaskSource;
|
use crate::task_source::TaskSource;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
use net_traits::request::Referrer;
|
use net_traits::request::Referrer;
|
||||||
use num_traits::ToPrimitive;
|
use num_traits::ToPrimitive;
|
||||||
use script_traits::{HistoryEntryReplacement, LoadData, LoadOrigin};
|
use script_traits::{HistoryEntryReplacement, LoadData, LoadOrigin};
|
||||||
|
@ -62,12 +63,14 @@ impl HTMLAnchorElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLAnchorElement> {
|
) -> DomRoot<HTMLAnchorElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLAnchorElement::new_inherited(
|
Box::new(HTMLAnchorElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ use crate::dom::virtualmethods::VirtualMethods;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use euclid::default::Point2D;
|
use euclid::default::Point2D;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::f32;
|
use std::f32;
|
||||||
|
@ -253,10 +254,12 @@ impl HTMLAreaElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLAreaElement> {
|
) -> DomRoot<HTMLAreaElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLAreaElement::new_inherited(local_name, prefix, document)),
|
Box::new(HTMLAreaElement::new_inherited(local_name, prefix, document)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ use crate::dom::node::Node;
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix, QualName};
|
use html5ever::{LocalName, Prefix, QualName};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct HTMLAudioElement {
|
pub struct HTMLAudioElement {
|
||||||
|
@ -37,24 +38,27 @@ impl HTMLAudioElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLAudioElement> {
|
) -> DomRoot<HTMLAudioElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLAudioElement::new_inherited(
|
Box::new(HTMLAudioElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-audio
|
// https://html.spec.whatwg.org/multipage/#dom-audio
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Audio(window: &Window, src: Option<DOMString>) -> Fallible<DomRoot<HTMLAudioElement>> {
|
pub fn Audio(window: &Window, proto: Option<HandleObject>, src: Option<DOMString>) -> Fallible<DomRoot<HTMLAudioElement>> {
|
||||||
let element = Element::create(
|
let element = Element::create(
|
||||||
QualName::new(None, ns!(html), local_name!("audio")),
|
QualName::new(None, ns!(html), local_name!("audio")),
|
||||||
None,
|
None,
|
||||||
&window.Document(),
|
&window.Document(),
|
||||||
ElementCreator::ScriptCreated,
|
ElementCreator::ScriptCreated,
|
||||||
CustomElementCreationMode::Synchronous,
|
CustomElementCreationMode::Synchronous,
|
||||||
|
proto,
|
||||||
);
|
);
|
||||||
|
|
||||||
let audio = DomRoot::downcast::<HTMLAudioElement>(element).unwrap();
|
let audio = DomRoot::downcast::<HTMLAudioElement>(element).unwrap();
|
||||||
|
|
|
@ -14,6 +14,7 @@ use crate::dom::node::{document_from_node, BindContext, Node, UnbindContext};
|
||||||
use crate::dom::virtualmethods::VirtualMethods;
|
use crate::dom::virtualmethods::VirtualMethods;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -37,10 +38,12 @@ impl HTMLBaseElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLBaseElement> {
|
) -> DomRoot<HTMLBaseElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLBaseElement::new_inherited(local_name, prefix, document)),
|
Box::new(HTMLBaseElement::new_inherited(local_name, prefix, document)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ use cssparser::RGBA;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use embedder_traits::EmbedderMsg;
|
use embedder_traits::EmbedderMsg;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
use style::attr::AttrValue;
|
use style::attr::AttrValue;
|
||||||
|
|
||||||
|
@ -46,10 +47,12 @@ impl HTMLBodyElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLBodyElement> {
|
) -> DomRoot<HTMLBodyElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLBodyElement::new_inherited(local_name, prefix, document)),
|
Box::new(HTMLBodyElement::new_inherited(local_name, prefix, document)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ use crate::dom::htmlelement::HTMLElement;
|
||||||
use crate::dom::node::Node;
|
use crate::dom::node::Node;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct HTMLBRElement {
|
pub struct HTMLBRElement {
|
||||||
|
@ -30,10 +31,12 @@ impl HTMLBRElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>
|
||||||
) -> DomRoot<HTMLBRElement> {
|
) -> DomRoot<HTMLBRElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLBRElement::new_inherited(local_name, prefix, document)),
|
Box::new(HTMLBRElement::new_inherited(local_name, prefix, document)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ use crate::dom::validitystate::ValidityState;
|
||||||
use crate::dom::virtualmethods::VirtualMethods;
|
use crate::dom::virtualmethods::VirtualMethods;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use style::element_state::ElementState;
|
use style::element_state::ElementState;
|
||||||
|
@ -69,12 +70,14 @@ impl HTMLButtonElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLButtonElement> {
|
) -> DomRoot<HTMLButtonElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLButtonElement::new_inherited(
|
Box::new(HTMLButtonElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ use image::codecs::png::PngEncoder;
|
||||||
use image::{ColorType, ImageEncoder};
|
use image::{ColorType, ImageEncoder};
|
||||||
use ipc_channel::ipc::{self as ipcchan, IpcSharedMemory};
|
use ipc_channel::ipc::{self as ipcchan, IpcSharedMemory};
|
||||||
use js::error::throw_type_error;
|
use js::error::throw_type_error;
|
||||||
use js::rust::HandleValue;
|
use js::rust::{HandleObject, HandleValue};
|
||||||
use profile_traits::ipc;
|
use profile_traits::ipc;
|
||||||
use script_layout_interface::{HTMLCanvasData, HTMLCanvasDataSource};
|
use script_layout_interface::{HTMLCanvasData, HTMLCanvasDataSource};
|
||||||
use script_traits::ScriptMsg;
|
use script_traits::ScriptMsg;
|
||||||
|
@ -84,12 +84,14 @@ impl HTMLCanvasElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLCanvasElement> {
|
) -> DomRoot<HTMLCanvasElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLCanvasElement::new_inherited(
|
Box::new(HTMLCanvasElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ use crate::dom::htmlelement::HTMLElement;
|
||||||
use crate::dom::node::Node;
|
use crate::dom::node::Node;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct HTMLDataElement {
|
pub struct HTMLDataElement {
|
||||||
|
@ -32,10 +33,12 @@ impl HTMLDataElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLDataElement> {
|
) -> DomRoot<HTMLDataElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLDataElement::new_inherited(local_name, prefix, document)),
|
Box::new(HTMLDataElement::new_inherited(local_name, prefix, document)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ use crate::dom::htmloptionelement::HTMLOptionElement;
|
||||||
use crate::dom::node::{window_from_node, Node};
|
use crate::dom::node::{window_from_node, Node};
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct HTMLDataListElement {
|
pub struct HTMLDataListElement {
|
||||||
|
@ -35,12 +36,14 @@ impl HTMLDataListElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLDataListElement> {
|
) -> DomRoot<HTMLDataListElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLDataListElement::new_inherited(
|
Box::new(HTMLDataListElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ use crate::dom::virtualmethods::VirtualMethods;
|
||||||
use crate::task_source::TaskSource;
|
use crate::task_source::TaskSource;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -41,12 +42,14 @@ impl HTMLDetailsElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLDetailsElement> {
|
) -> DomRoot<HTMLDetailsElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLDetailsElement::new_inherited(
|
Box::new(HTMLDetailsElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ use crate::dom::htmlelement::HTMLElement;
|
||||||
use crate::dom::node::{window_from_node, Node};
|
use crate::dom::node::{window_from_node, Node};
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct HTMLDialogElement {
|
pub struct HTMLDialogElement {
|
||||||
|
@ -38,12 +39,14 @@ impl HTMLDialogElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLDialogElement> {
|
) -> DomRoot<HTMLDialogElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLDialogElement::new_inherited(
|
Box::new(HTMLDialogElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ use crate::dom::htmlelement::HTMLElement;
|
||||||
use crate::dom::node::Node;
|
use crate::dom::node::Node;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct HTMLDirectoryElement {
|
pub struct HTMLDirectoryElement {
|
||||||
|
@ -30,12 +31,14 @@ impl HTMLDirectoryElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLDirectoryElement> {
|
) -> DomRoot<HTMLDirectoryElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLDirectoryElement::new_inherited(
|
Box::new(HTMLDirectoryElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ use crate::dom::htmlelement::HTMLElement;
|
||||||
use crate::dom::node::Node;
|
use crate::dom::node::Node;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct HTMLDivElement {
|
pub struct HTMLDivElement {
|
||||||
|
@ -32,10 +33,12 @@ impl HTMLDivElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLDivElement> {
|
) -> DomRoot<HTMLDivElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLDivElement::new_inherited(local_name, prefix, document)),
|
Box::new(HTMLDivElement::new_inherited(local_name, prefix, document)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ use crate::dom::htmlelement::HTMLElement;
|
||||||
use crate::dom::node::Node;
|
use crate::dom::node::Node;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct HTMLDListElement {
|
pub struct HTMLDListElement {
|
||||||
|
@ -30,12 +31,14 @@ impl HTMLDListElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLDListElement> {
|
) -> DomRoot<HTMLDListElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLDListElement::new_inherited(
|
Box::new(HTMLDListElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ use crate::dom::text::Text;
|
||||||
use crate::dom::virtualmethods::VirtualMethods;
|
use crate::dom::virtualmethods::VirtualMethods;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
use script_layout_interface::message::QueryMsg;
|
use script_layout_interface::message::QueryMsg;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
|
@ -83,10 +84,12 @@ impl HTMLElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLElement> {
|
) -> DomRoot<HTMLElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLElement::new_inherited(local_name, prefix, document)),
|
Box::new(HTMLElement::new_inherited(local_name, prefix, document)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,7 +490,7 @@ impl HTMLElementMethods for HTMLElement {
|
||||||
text = String::new();
|
text = String::new();
|
||||||
}
|
}
|
||||||
|
|
||||||
let br = HTMLBRElement::new(local_name!("br"), None, &document);
|
let br = HTMLBRElement::new(local_name!("br"), None, &document, None);
|
||||||
fragment.upcast::<Node>().AppendChild(&br.upcast()).unwrap();
|
fragment.upcast::<Node>().AppendChild(&br.upcast()).unwrap();
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
|
|
|
@ -8,6 +8,7 @@ use crate::dom::htmlelement::HTMLElement;
|
||||||
use crate::dom::node::Node;
|
use crate::dom::node::Node;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct HTMLEmbedElement {
|
pub struct HTMLEmbedElement {
|
||||||
|
@ -30,12 +31,14 @@ impl HTMLEmbedElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLEmbedElement> {
|
) -> DomRoot<HTMLEmbedElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLEmbedElement::new_inherited(
|
Box::new(HTMLEmbedElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ use crate::dom::validitystate::ValidityState;
|
||||||
use crate::dom::virtualmethods::VirtualMethods;
|
use crate::dom::virtualmethods::VirtualMethods;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use style::element_state::ElementState;
|
use style::element_state::ElementState;
|
||||||
|
|
||||||
|
@ -52,12 +53,14 @@ impl HTMLFieldSetElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLFieldSetElement> {
|
) -> DomRoot<HTMLFieldSetElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLFieldSetElement::new_inherited(
|
Box::new(HTMLFieldSetElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ use crate::dom::virtualmethods::VirtualMethods;
|
||||||
use cssparser::RGBA;
|
use cssparser::RGBA;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
use style::attr::AttrValue;
|
use style::attr::AttrValue;
|
||||||
use style::str::{read_numbers, HTML_SPACE_CHARACTERS};
|
use style::str::{read_numbers, HTML_SPACE_CHARACTERS};
|
||||||
|
@ -40,10 +41,12 @@ impl HTMLFontElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLFontElement> {
|
) -> DomRoot<HTMLFontElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLFontElement::new_inherited(local_name, prefix, document)),
|
Box::new(HTMLFontElement::new_inherited(local_name, prefix, document)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ use encoding_rs::{Encoding, UTF_8};
|
||||||
use headers::{ContentType, HeaderMapExt};
|
use headers::{ContentType, HeaderMapExt};
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
use http::Method;
|
use http::Method;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use mime::{self, Mime};
|
use mime::{self, Mime};
|
||||||
use net_traits::http_percent_encode;
|
use net_traits::http_percent_encode;
|
||||||
use net_traits::request::Referrer;
|
use net_traits::request::Referrer;
|
||||||
|
@ -120,10 +121,12 @@ impl HTMLFormElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLFormElement> {
|
) -> DomRoot<HTMLFormElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLFormElement::new_inherited(local_name, prefix, document)),
|
Box::new(HTMLFormElement::new_inherited(local_name, prefix, document)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ use crate::dom::htmlelement::HTMLElement;
|
||||||
use crate::dom::node::Node;
|
use crate::dom::node::Node;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct HTMLFrameElement {
|
pub struct HTMLFrameElement {
|
||||||
|
@ -30,12 +31,14 @@ impl HTMLFrameElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLFrameElement> {
|
) -> DomRoot<HTMLFrameElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLFrameElement::new_inherited(
|
Box::new(HTMLFrameElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ use crate::dom::htmlelement::HTMLElement;
|
||||||
use crate::dom::node::{document_from_node, Node};
|
use crate::dom::node::{document_from_node, Node};
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct HTMLFrameSetElement {
|
pub struct HTMLFrameSetElement {
|
||||||
|
@ -33,12 +34,14 @@ impl HTMLFrameSetElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLFrameSetElement> {
|
) -> DomRoot<HTMLFrameSetElement> {
|
||||||
let n = Node::reflect_node(
|
let n = Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLFrameSetElement::new_inherited(
|
Box::new(HTMLFrameSetElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
);
|
);
|
||||||
n.upcast::<Node>().set_weird_parser_insertion_mode();
|
n.upcast::<Node>().set_weird_parser_insertion_mode();
|
||||||
n
|
n
|
||||||
|
|
|
@ -14,6 +14,7 @@ use crate::dom::userscripts::load_script;
|
||||||
use crate::dom::virtualmethods::VirtualMethods;
|
use crate::dom::virtualmethods::VirtualMethods;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct HTMLHeadElement {
|
pub struct HTMLHeadElement {
|
||||||
|
@ -36,10 +37,12 @@ impl HTMLHeadElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLHeadElement> {
|
) -> DomRoot<HTMLHeadElement> {
|
||||||
let n = Node::reflect_node(
|
let n = Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLHeadElement::new_inherited(local_name, prefix, document)),
|
Box::new(HTMLHeadElement::new_inherited(local_name, prefix, document)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
);
|
);
|
||||||
|
|
||||||
n.upcast::<Node>().set_weird_parser_insertion_mode();
|
n.upcast::<Node>().set_weird_parser_insertion_mode();
|
||||||
|
|
|
@ -8,6 +8,7 @@ use crate::dom::htmlelement::HTMLElement;
|
||||||
use crate::dom::node::Node;
|
use crate::dom::node::Node;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[derive(JSTraceable, MallocSizeOf)]
|
#[derive(JSTraceable, MallocSizeOf)]
|
||||||
pub enum HeadingLevel {
|
pub enum HeadingLevel {
|
||||||
|
@ -43,13 +44,15 @@ impl HTMLHeadingElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
level: HeadingLevel,
|
level: HeadingLevel,
|
||||||
) -> DomRoot<HTMLHeadingElement> {
|
) -> DomRoot<HTMLHeadingElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLHeadingElement::new_inherited(
|
Box::new(HTMLHeadingElement::new_inherited(
|
||||||
local_name, prefix, document, level,
|
local_name, prefix, document, level,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ use crate::dom::virtualmethods::VirtualMethods;
|
||||||
use cssparser::RGBA;
|
use cssparser::RGBA;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
|
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -37,10 +38,12 @@ impl HTMLHRElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLHRElement> {
|
) -> DomRoot<HTMLHRElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLHRElement::new_inherited(local_name, prefix, document)),
|
Box::new(HTMLHRElement::new_inherited(local_name, prefix, document)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ use crate::dom::htmlelement::HTMLElement;
|
||||||
use crate::dom::node::Node;
|
use crate::dom::node::Node;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct HTMLHtmlElement {
|
pub struct HTMLHtmlElement {
|
||||||
|
@ -32,10 +33,12 @@ impl HTMLHtmlElement {
|
||||||
localName: LocalName,
|
localName: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLHtmlElement> {
|
) -> DomRoot<HTMLHtmlElement> {
|
||||||
let n = Node::reflect_node(
|
let n = Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLHtmlElement::new_inherited(localName, prefix, document)),
|
Box::new(HTMLHtmlElement::new_inherited(localName, prefix, document)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
);
|
);
|
||||||
|
|
||||||
n.upcast::<Node>().set_weird_parser_insertion_mode();
|
n.upcast::<Node>().set_weird_parser_insertion_mode();
|
||||||
|
|
|
@ -28,6 +28,7 @@ use crate::script_thread::ScriptThread;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
use ipc_channel::ipc;
|
use ipc_channel::ipc;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId};
|
use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId};
|
||||||
use profile_traits::ipc as ProfiledIpc;
|
use profile_traits::ipc as ProfiledIpc;
|
||||||
use script_layout_interface::message::ReflowGoal;
|
use script_layout_interface::message::ReflowGoal;
|
||||||
|
@ -441,12 +442,14 @@ impl HTMLIFrameElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLIFrameElement> {
|
) -> DomRoot<HTMLIFrameElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLIFrameElement::new_inherited(
|
Box::new(HTMLIFrameElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ use ipc_channel::ipc;
|
||||||
use ipc_channel::ipc::IpcSender;
|
use ipc_channel::ipc::IpcSender;
|
||||||
use ipc_channel::router::ROUTER;
|
use ipc_channel::router::ROUTER;
|
||||||
use js::jsapi::JSAutoRealm;
|
use js::jsapi::JSAutoRealm;
|
||||||
|
use js::rust::HandleObject;
|
||||||
use mime::{self, Mime};
|
use mime::{self, Mime};
|
||||||
use msg::constellation_msg::PipelineId;
|
use msg::constellation_msg::PipelineId;
|
||||||
use net_traits::image::base::{Image, ImageMetadata};
|
use net_traits::image::base::{Image, ImageMetadata};
|
||||||
|
@ -1246,17 +1247,20 @@ impl HTMLImageElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLImageElement> {
|
) -> DomRoot<HTMLImageElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLImageElement::new_inherited(
|
Box::new(HTMLImageElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn Image(
|
pub fn Image(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
width: Option<u32>,
|
width: Option<u32>,
|
||||||
height: Option<u32>,
|
height: Option<u32>,
|
||||||
) -> Fallible<DomRoot<HTMLImageElement>> {
|
) -> Fallible<DomRoot<HTMLImageElement>> {
|
||||||
|
@ -1266,6 +1270,7 @@ impl HTMLImageElement {
|
||||||
&window.Document(),
|
&window.Document(),
|
||||||
ElementCreator::ScriptCreated,
|
ElementCreator::ScriptCreated,
|
||||||
CustomElementCreationMode::Synchronous,
|
CustomElementCreationMode::Synchronous,
|
||||||
|
proto,
|
||||||
);
|
);
|
||||||
|
|
||||||
let image = DomRoot::downcast::<HTMLImageElement>(element).unwrap();
|
let image = DomRoot::downcast::<HTMLImageElement>(element).unwrap();
|
||||||
|
|
|
@ -330,12 +330,14 @@ impl HTMLInputElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLInputElement> {
|
) -> DomRoot<HTMLInputElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLInputElement::new_inherited(
|
Box::new(HTMLInputElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ use crate::dom::node::{Node, ShadowIncluding};
|
||||||
use crate::dom::virtualmethods::VirtualMethods;
|
use crate::dom::virtualmethods::VirtualMethods;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
use style::attr::AttrValue;
|
use style::attr::AttrValue;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -45,12 +46,14 @@ impl HTMLLabelElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLLabelElement> {
|
) -> DomRoot<HTMLLabelElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLLabelElement::new_inherited(
|
Box::new(HTMLLabelElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ use crate::dom::node::{BindContext, Node, UnbindContext};
|
||||||
use crate::dom::virtualmethods::VirtualMethods;
|
use crate::dom::virtualmethods::VirtualMethods;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct HTMLLegendElement {
|
pub struct HTMLLegendElement {
|
||||||
|
@ -39,12 +40,14 @@ impl HTMLLegendElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLLegendElement> {
|
) -> DomRoot<HTMLLegendElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLLegendElement::new_inherited(
|
Box::new(HTMLLegendElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ use crate::dom::node::Node;
|
||||||
use crate::dom::virtualmethods::VirtualMethods;
|
use crate::dom::virtualmethods::VirtualMethods;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
use style::attr::AttrValue;
|
use style::attr::AttrValue;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -35,10 +36,12 @@ impl HTMLLIElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLLIElement> {
|
) -> DomRoot<HTMLLIElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLLIElement::new_inherited(local_name, prefix, document)),
|
Box::new(HTMLLIElement::new_inherited(local_name, prefix, document)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ use cssparser::{Parser as CssParser, ParserInput};
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use embedder_traits::EmbedderMsg;
|
use embedder_traits::EmbedderMsg;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
use net_traits::ReferrerPolicy;
|
use net_traits::ReferrerPolicy;
|
||||||
use servo_arc::Arc;
|
use servo_arc::Arc;
|
||||||
use servo_atoms::Atom;
|
use servo_atoms::Atom;
|
||||||
|
@ -94,13 +95,15 @@ impl HTMLLinkElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
creator: ElementCreator,
|
creator: ElementCreator,
|
||||||
) -> DomRoot<HTMLLinkElement> {
|
) -> DomRoot<HTMLLinkElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLLinkElement::new_inherited(
|
Box::new(HTMLLinkElement::new_inherited(
|
||||||
local_name, prefix, document, creator,
|
local_name, prefix, document, creator,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ use crate::dom::htmlelement::HTMLElement;
|
||||||
use crate::dom::node::{Node, ShadowIncluding};
|
use crate::dom::node::{Node, ShadowIncluding};
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct HTMLMapElement {
|
pub struct HTMLMapElement {
|
||||||
|
@ -32,10 +33,12 @@ impl HTMLMapElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLMapElement> {
|
) -> DomRoot<HTMLMapElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLMapElement::new_inherited(local_name, prefix, document)),
|
Box::new(HTMLMapElement::new_inherited(local_name, prefix, document)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1865,6 +1865,7 @@ impl HTMLMediaElement {
|
||||||
local_name!("script"),
|
local_name!("script"),
|
||||||
None,
|
None,
|
||||||
&document,
|
&document,
|
||||||
|
None,
|
||||||
ElementCreator::ScriptCreated,
|
ElementCreator::ScriptCreated,
|
||||||
);
|
);
|
||||||
let mut media_controls_script = resources::read_string(EmbedderResource::MediaControlsJS);
|
let mut media_controls_script = resources::read_string(EmbedderResource::MediaControlsJS);
|
||||||
|
@ -1892,6 +1893,7 @@ impl HTMLMediaElement {
|
||||||
local_name!("script"),
|
local_name!("script"),
|
||||||
None,
|
None,
|
||||||
&document,
|
&document,
|
||||||
|
None,
|
||||||
ElementCreator::ScriptCreated,
|
ElementCreator::ScriptCreated,
|
||||||
);
|
);
|
||||||
style
|
style
|
||||||
|
|
|
@ -9,6 +9,7 @@ use crate::dom::htmlelement::HTMLElement;
|
||||||
use crate::dom::node::Node;
|
use crate::dom::node::Node;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct HTMLMenuElement {
|
pub struct HTMLMenuElement {
|
||||||
|
@ -31,10 +32,12 @@ impl HTMLMenuElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLMenuElement> {
|
) -> DomRoot<HTMLMenuElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLMenuElement::new_inherited(local_name, prefix, document)),
|
Box::new(HTMLMenuElement::new_inherited(local_name, prefix, document)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ use crate::dom::node::{
|
||||||
use crate::dom::virtualmethods::VirtualMethods;
|
use crate::dom::virtualmethods::VirtualMethods;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
use servo_arc::Arc;
|
use servo_arc::Arc;
|
||||||
use servo_config::pref;
|
use servo_config::pref;
|
||||||
use std::sync::atomic::AtomicBool;
|
use std::sync::atomic::AtomicBool;
|
||||||
|
@ -54,10 +55,12 @@ impl HTMLMetaElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLMetaElement> {
|
) -> DomRoot<HTMLMetaElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLMetaElement::new_inherited(local_name, prefix, document)),
|
Box::new(HTMLMetaElement::new_inherited(local_name, prefix, document)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ use crate::dom::node::Node;
|
||||||
use crate::dom::nodelist::NodeList;
|
use crate::dom::nodelist::NodeList;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct HTMLMeterElement {
|
pub struct HTMLMeterElement {
|
||||||
|
@ -35,12 +36,14 @@ impl HTMLMeterElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLMeterElement> {
|
) -> DomRoot<HTMLMeterElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLMeterElement::new_inherited(
|
Box::new(HTMLMeterElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ use crate::dom::htmlelement::HTMLElement;
|
||||||
use crate::dom::node::Node;
|
use crate::dom::node::Node;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct HTMLModElement {
|
pub struct HTMLModElement {
|
||||||
|
@ -30,10 +31,12 @@ impl HTMLModElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLModElement> {
|
) -> DomRoot<HTMLModElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLModElement::new_inherited(local_name, prefix, document)),
|
Box::new(HTMLModElement::new_inherited(local_name, prefix, document)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ use crate::dom::validitystate::ValidityState;
|
||||||
use crate::dom::virtualmethods::VirtualMethods;
|
use crate::dom::virtualmethods::VirtualMethods;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
use net_traits::image::base::Image;
|
use net_traits::image::base::Image;
|
||||||
use servo_arc::Arc;
|
use servo_arc::Arc;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
|
@ -50,12 +51,14 @@ impl HTMLObjectElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLObjectElement> {
|
) -> DomRoot<HTMLObjectElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLObjectElement::new_inherited(
|
Box::new(HTMLObjectElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ use crate::dom::htmlelement::HTMLElement;
|
||||||
use crate::dom::node::Node;
|
use crate::dom::node::Node;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct HTMLOListElement {
|
pub struct HTMLOListElement {
|
||||||
|
@ -30,12 +31,14 @@ impl HTMLOListElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLOListElement> {
|
) -> DomRoot<HTMLOListElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLOListElement::new_inherited(
|
Box::new(HTMLOListElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ use crate::dom::node::Node;
|
||||||
use crate::dom::virtualmethods::VirtualMethods;
|
use crate::dom::virtualmethods::VirtualMethods;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
use style::element_state::ElementState;
|
use style::element_state::ElementState;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
|
@ -42,12 +43,14 @@ impl HTMLOptGroupElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLOptGroupElement> {
|
) -> DomRoot<HTMLOptGroupElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLOptGroupElement::new_inherited(
|
Box::new(HTMLOptGroupElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ use crate::dom::virtualmethods::VirtualMethods;
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix, QualName};
|
use html5ever::{LocalName, Prefix, QualName};
|
||||||
|
use js::rust::HandleObject;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
use style::element_state::ElementState;
|
use style::element_state::ElementState;
|
||||||
|
@ -65,12 +66,14 @@ impl HTMLOptionElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLOptionElement> {
|
) -> DomRoot<HTMLOptionElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLOptionElement::new_inherited(
|
Box::new(HTMLOptionElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,6 +81,7 @@ impl HTMLOptionElement {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn Option(
|
pub fn Option(
|
||||||
window: &Window,
|
window: &Window,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
text: DOMString,
|
text: DOMString,
|
||||||
value: Option<DOMString>,
|
value: Option<DOMString>,
|
||||||
default_selected: bool,
|
default_selected: bool,
|
||||||
|
@ -89,6 +93,7 @@ impl HTMLOptionElement {
|
||||||
&window.Document(),
|
&window.Document(),
|
||||||
ElementCreator::ScriptCreated,
|
ElementCreator::ScriptCreated,
|
||||||
CustomElementCreationMode::Synchronous,
|
CustomElementCreationMode::Synchronous,
|
||||||
|
proto,
|
||||||
);
|
);
|
||||||
|
|
||||||
let option = DomRoot::downcast::<HTMLOptionElement>(element).unwrap();
|
let option = DomRoot::downcast::<HTMLOptionElement>(element).unwrap();
|
||||||
|
|
|
@ -54,7 +54,7 @@ impl HTMLOptionsCollection {
|
||||||
let document = document_from_node(&*root);
|
let document = document_from_node(&*root);
|
||||||
|
|
||||||
for _ in 0..count {
|
for _ in 0..count {
|
||||||
let element = HTMLOptionElement::new(local_name!("option"), None, &document);
|
let element = HTMLOptionElement::new(local_name!("option"), None, &document, None);
|
||||||
let node = element.upcast::<Node>();
|
let node = element.upcast::<Node>();
|
||||||
root.AppendChild(node)?;
|
root.AppendChild(node)?;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ use crate::dom::validitystate::ValidityState;
|
||||||
use crate::dom::virtualmethods::VirtualMethods;
|
use crate::dom::virtualmethods::VirtualMethods;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct HTMLOutputElement {
|
pub struct HTMLOutputElement {
|
||||||
|
@ -49,12 +50,14 @@ impl HTMLOutputElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLOutputElement> {
|
) -> DomRoot<HTMLOutputElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLOutputElement::new_inherited(
|
Box::new(HTMLOutputElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ use crate::dom::htmlelement::HTMLElement;
|
||||||
use crate::dom::node::Node;
|
use crate::dom::node::Node;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct HTMLParagraphElement {
|
pub struct HTMLParagraphElement {
|
||||||
|
@ -30,12 +31,14 @@ impl HTMLParagraphElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLParagraphElement> {
|
) -> DomRoot<HTMLParagraphElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLParagraphElement::new_inherited(
|
Box::new(HTMLParagraphElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ use crate::dom::htmlelement::HTMLElement;
|
||||||
use crate::dom::node::Node;
|
use crate::dom::node::Node;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
|
use js::rust::HandleObject;
|
||||||
|
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct HTMLParamElement {
|
pub struct HTMLParamElement {
|
||||||
|
@ -30,12 +31,14 @@ impl HTMLParamElement {
|
||||||
local_name: LocalName,
|
local_name: LocalName,
|
||||||
prefix: Option<Prefix>,
|
prefix: Option<Prefix>,
|
||||||
document: &Document,
|
document: &Document,
|
||||||
|
proto: Option<HandleObject>,
|
||||||
) -> DomRoot<HTMLParamElement> {
|
) -> DomRoot<HTMLParamElement> {
|
||||||
Node::reflect_node(
|
Node::reflect_node_with_proto(
|
||||||
Box::new(HTMLParamElement::new_inherited(
|
Box::new(HTMLParamElement::new_inherited(
|
||||||
local_name, prefix, document,
|
local_name, prefix, document,
|
||||||
)),
|
)),
|
||||||
document,
|
document,
|
||||||
|
proto,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
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