Generate a trait abstracting over all known DOM interfaces (#34357)

* script: Generate trait for all DOM interfaces and parameterize generated Methods traits over it.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* script: Update trait implementations with new generic type.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Formatting.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2024-11-24 02:35:14 -05:00 committed by GitHub
parent 468f9cf014
commit e956f3124c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
383 changed files with 550 additions and 385 deletions

View file

@ -64,7 +64,7 @@ impl AbstractRange {
} }
} }
impl AbstractRangeMethods for AbstractRange { impl AbstractRangeMethods<crate::DomTypeHolder> for AbstractRange {
/// <https://dom.spec.whatwg.org/#dom-range-startcontainer> /// <https://dom.spec.whatwg.org/#dom-range-startcontainer>
fn StartContainer(&self) -> DomRoot<Node> { fn StartContainer(&self) -> DomRoot<Node> {
self.start.node.get() self.start.node.get()

View file

@ -137,7 +137,7 @@ impl AnalyserNode {
} }
} }
impl AnalyserNodeMethods for AnalyserNode { impl AnalyserNodeMethods<crate::DomTypeHolder> for AnalyserNode {
/// <https://webaudio.github.io/web-audio-api/#dom-analysernode-analysernode> /// <https://webaudio.github.io/web-audio-api/#dom-analysernode-analysernode>
fn Constructor( fn Constructor(
window: &Window, window: &Window,

View file

@ -68,7 +68,7 @@ impl AnimationEvent {
} }
} }
impl AnimationEventMethods for AnimationEvent { impl AnimationEventMethods<crate::DomTypeHolder> for AnimationEvent {
// https://drafts.csswg.org/css-animations/#dom-animationevent-animationevent // https://drafts.csswg.org/css-animations/#dom-animationevent-animationevent
fn Constructor( fn Constructor(
window: &Window, window: &Window,

View file

@ -97,7 +97,7 @@ impl Attr {
} }
} }
impl AttrMethods for Attr { impl AttrMethods<crate::DomTypeHolder> for Attr {
// https://dom.spec.whatwg.org/#dom-attr-localname // https://dom.spec.whatwg.org/#dom-attr-localname
fn LocalName(&self) -> DOMString { fn LocalName(&self) -> DOMString {
// FIXME(ajeffrey): convert directly from LocalName to DOMString // FIXME(ajeffrey): convert directly from LocalName to DOMString

View file

@ -183,7 +183,7 @@ impl AudioBuffer {
} }
} }
impl AudioBufferMethods for AudioBuffer { impl AudioBufferMethods<crate::DomTypeHolder> for AudioBuffer {
// https://webaudio.github.io/web-audio-api/#dom-audiobuffer-audiobuffer // https://webaudio.github.io/web-audio-api/#dom-audiobuffer-audiobuffer
fn Constructor( fn Constructor(
window: &Window, window: &Window,

View file

@ -123,7 +123,7 @@ impl AudioBufferSourceNode {
} }
} }
impl AudioBufferSourceNodeMethods for AudioBufferSourceNode { impl AudioBufferSourceNodeMethods<crate::DomTypeHolder> for AudioBufferSourceNode {
// https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-audiobuffersourcenode // https://webaudio.github.io/web-audio-api/#dom-audiobuffersourcenode-audiobuffersourcenode
fn Constructor( fn Constructor(
window: &Window, window: &Window,

View file

@ -109,7 +109,7 @@ impl AudioContext {
} }
} }
impl AudioContextMethods for AudioContext { impl AudioContextMethods<crate::DomTypeHolder> for AudioContext {
// https://webaudio.github.io/web-audio-api/#AudioContext-constructors // https://webaudio.github.io/web-audio-api/#AudioContext-constructors
fn Constructor( fn Constructor(
window: &Window, window: &Window,

View file

@ -48,7 +48,7 @@ impl AudioDestinationNode {
} }
} }
impl AudioDestinationNodeMethods for AudioDestinationNode { impl AudioDestinationNodeMethods<crate::DomTypeHolder> for AudioDestinationNode {
// https://webaudio.github.io/web-audio-api/#dom-audiodestinationnode-maxchannelcount // https://webaudio.github.io/web-audio-api/#dom-audiodestinationnode-maxchannelcount
fn MaxChannelCount(&self) -> u32 { fn MaxChannelCount(&self) -> u32 {
MAX_CHANNEL_COUNT MAX_CHANNEL_COUNT

View file

@ -160,7 +160,7 @@ impl AudioListener {
} }
#[allow(non_snake_case)] #[allow(non_snake_case)]
impl AudioListenerMethods for AudioListener { impl AudioListenerMethods<crate::DomTypeHolder> for AudioListener {
// https://webaudio.github.io/web-audio-api/#dom-audiolistener-positionx // https://webaudio.github.io/web-audio-api/#dom-audiolistener-positionx
fn PositionX(&self) -> DomRoot<AudioParam> { fn PositionX(&self) -> DomRoot<AudioParam> {
DomRoot::from_ref(&self.position_x) DomRoot::from_ref(&self.position_x)

View file

@ -106,7 +106,7 @@ impl AudioNode {
} }
} }
impl AudioNodeMethods for AudioNode { impl AudioNodeMethods<crate::DomTypeHolder> for AudioNode {
// https://webaudio.github.io/web-audio-api/#dom-audionode-connect // https://webaudio.github.io/web-audio-api/#dom-audionode-connect
fn Connect( fn Connect(
&self, &self,

View file

@ -110,7 +110,7 @@ impl AudioParam {
} }
} }
impl AudioParamMethods for AudioParam { impl AudioParamMethods<crate::DomTypeHolder> for AudioParam {
// https://webaudio.github.io/web-audio-api/#dom-audioparam-automationrate // https://webaudio.github.io/web-audio-api/#dom-audioparam-automationrate
fn AutomationRate(&self) -> AutomationRate { fn AutomationRate(&self) -> AutomationRate {
self.automation_rate.get() self.automation_rate.get()

View file

@ -57,7 +57,7 @@ impl AudioScheduledSourceNode {
} }
} }
impl AudioScheduledSourceNodeMethods for AudioScheduledSourceNode { impl AudioScheduledSourceNodeMethods<crate::DomTypeHolder> for AudioScheduledSourceNode {
// https://webaudio.github.io/web-audio-api/#dom-audioscheduledsourcenode-onended // https://webaudio.github.io/web-audio-api/#dom-audioscheduledsourcenode-onended
event_handler!(ended, GetOnended, SetOnended); event_handler!(ended, GetOnended, SetOnended);

View file

@ -85,7 +85,7 @@ impl AudioTrack {
} }
} }
impl AudioTrackMethods for AudioTrack { impl AudioTrackMethods<crate::DomTypeHolder> for AudioTrack {
// https://html.spec.whatwg.org/multipage/#dom-audiotrack-id // https://html.spec.whatwg.org/multipage/#dom-audiotrack-id
fn Id(&self) -> DOMString { fn Id(&self) -> DOMString {
self.id() self.id()

View file

@ -117,7 +117,7 @@ impl AudioTrackList {
} }
} }
impl AudioTrackListMethods for AudioTrackList { impl AudioTrackListMethods<crate::DomTypeHolder> for AudioTrackList {
// https://html.spec.whatwg.org/multipage/#dom-audiotracklist-length // https://html.spec.whatwg.org/multipage/#dom-audiotracklist-length
fn Length(&self) -> u32 { fn Length(&self) -> u32 {
self.len() as u32 self.len() as u32

View file

@ -276,7 +276,7 @@ impl BaseAudioContext {
} }
} }
impl BaseAudioContextMethods for BaseAudioContext { impl BaseAudioContextMethods<crate::DomTypeHolder> for BaseAudioContext {
/// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-samplerate> /// <https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-samplerate>
fn SampleRate(&self) -> Finite<f32> { fn SampleRate(&self) -> Finite<f32> {
Finite::wrap(self.sample_rate) Finite::wrap(self.sample_rate)

View file

@ -51,7 +51,7 @@ impl BeforeUnloadEvent {
} }
} }
impl BeforeUnloadEventMethods for BeforeUnloadEvent { impl BeforeUnloadEventMethods<crate::DomTypeHolder> for BeforeUnloadEvent {
// https://html.spec.whatwg.org/multipage/#dom-beforeunloadevent-returnvalue // https://html.spec.whatwg.org/multipage/#dom-beforeunloadevent-returnvalue
fn ReturnValue(&self) -> DOMString { fn ReturnValue(&self) -> DOMString {
self.return_value.borrow().clone() self.return_value.borrow().clone()

View file

@ -540,6 +540,12 @@ def union_native_type(t):
return f'UnionTypes::{name}' return f'UnionTypes::{name}'
# Unfortunately, .capitalize() on a string will lowercase things inside the
# string, which we do not want.
def firstCap(string):
return f"{string[0].upper()}{string[1:]}"
class JSToNativeConversionInfo(): class JSToNativeConversionInfo():
""" """
An object representing information about a JS-to-native conversion. An object representing information about a JS-to-native conversion.
@ -643,11 +649,6 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
assert (defaultValue is None) == (default is None) assert (defaultValue is None) == (default is None)
return JSToNativeConversionInfo(template, default, declType) return JSToNativeConversionInfo(template, default, declType)
# Unfortunately, .capitalize() on a string will lowercase things inside the
# string, which we do not want.
def firstCap(string):
return f"{string[0].upper()}{string[1:]}"
# Helper functions for dealing with failures due to the JS value being the # Helper functions for dealing with failures due to the JS value being the
# wrong type of value. # wrong type of value.
def onFailureNotAnObject(failureCode): def onFailureNotAnObject(failureCode):
@ -2621,6 +2622,7 @@ def UnionTypes(descriptors, dictionaries, callbacks, typedefs, config):
imports = [ imports = [
'crate::dom', 'crate::dom',
'crate::dom::bindings::import::base::*', 'crate::dom::bindings::import::base::*',
'crate::dom::bindings::codegen::DomTypes::DomTypes',
'crate::dom::bindings::conversions::windowproxy_from_handlevalue', 'crate::dom::bindings::conversions::windowproxy_from_handlevalue',
'crate::dom::bindings::record::Record', 'crate::dom::bindings::record::Record',
'crate::dom::types::*', 'crate::dom::types::*',
@ -2658,6 +2660,108 @@ def UnionTypes(descriptors, dictionaries, callbacks, typedefs, config):
typedefs=[], imports=imports, config=config) typedefs=[], imports=imports, config=config)
def DomTypes(descriptors, descriptorProvider, dictionaries, callbacks, typedefs, config):
traits = [
"js::rust::Trace",
"malloc_size_of::MallocSizeOf",
"Sized",
]
joinedTraits = ' + '.join(traits)
elements = [CGGeneric(f"pub trait DomTypes: {joinedTraits} where Self: 'static {{\n")]
for descriptor in descriptors:
iface_name = descriptor.interface.identifier.name
traits = []
chain = descriptor.prototypeChain
upcast = descriptor.hasDescendants()
if not upcast:
# No other interface will implement DeriveFrom<Foo> for this Foo, so avoid
# implementing it for itself.
chain = chain[:-1]
if chain:
traits += ["crate::dom::bindings::inheritance::Castable"]
for parent in chain:
traits += [f"crate::dom::bindings::conversions::DerivedFrom<Self::{parent}>"]
iterableDecl = descriptor.interface.maplikeOrSetlikeOrIterable
if iterableDecl:
if iterableDecl.isMaplike():
keytype = getRetvalDeclarationForType(iterableDecl.keyType, None).define()
valuetype = getRetvalDeclarationForType(iterableDecl.valueType, None).define()
traits += [f"crate::dom::bindings::like::Maplike<Key={keytype}, Value={valuetype}>"]
if iterableDecl.isSetlike():
keytype = getRetvalDeclarationForType(iterableDecl.keyType, None).define()
traits += [f"crate::dom::bindings::like::Setlike<Key={keytype}>"]
if iterableDecl.hasKeyType():
traits += [
"crate::dom::bindings::reflector::DomObjectIteratorWrap",
]
if descriptor.weakReferenceable:
traits += ["crate::dom::bindings::weakref::WeakReferenceable"]
if not descriptor.interface.isNamespace():
traits += [
"js::conversions::ToJSValConvertible",
"crate::dom::bindings::reflector::MutDomObject",
"crate::dom::bindings::reflector::DomObject",
]
if descriptor.register:
if (
(descriptor.concrete or descriptor.hasDescendants())
and not descriptor.interface.isNamespace()
and not descriptor.interface.isIteratorInterface()
):
traits += [
"crate::dom::bindings::conversions::IDLInterface",
"PartialEq",
]
if descriptor.concrete and not descriptor.isGlobal():
traits += ["crate::dom::bindings::reflector::DomObjectWrap"]
if not descriptor.interface.isCallback() and not descriptor.interface.isIteratorInterface():
nonConstMembers = [m for m in descriptor.interface.members if not m.isConst()]
ctor = descriptor.interface.ctor()
if (
nonConstMembers
or (ctor and not ctor.isHTMLConstructor())
or descriptor.interface.legacyFactoryFunctions
):
namespace = f"{toBindingPath(descriptor)}"
traits += [f"crate::dom::bindings::codegen::Bindings::{namespace}::{iface_name}Methods<Self>"]
isPromise = firstCap(iface_name) == "Promise"
elements += [
CGGeneric(" #[crown::unrooted_must_root_lint::must_root]\n"),
CGGeneric(" #[crown::unrooted_must_root_lint::allow_unrooted_in_rc]\n" if isPromise else ""),
CGGeneric(f" type {firstCap(iface_name)}: {' + '.join(traits)};\n")
]
elements += [CGGeneric("}\n")]
return CGList([CGGeneric("use crate::dom::bindings::str::DOMString;\n")] + elements)
def DomTypeHolder(descriptors, descriptorProvider, dictionaries, callbacks, typedefs, config):
elements = [
CGGeneric(
"#[derive(JSTraceable, MallocSizeOf, PartialEq)]\n"
"pub struct DomTypeHolder;\n"
"impl crate::DomTypes for DomTypeHolder {\n"
),
]
for descriptor in descriptors:
if descriptor.interface.isCallback() or descriptor.interface.isIteratorInterface():
continue
iface_name = descriptor.interface.identifier.name
path = f"crate::dom::{iface_name.lower()}::{firstCap(iface_name)}"
elements.append(CGGeneric(f" type {firstCap(iface_name)} = {path};\n"))
elements.append(CGGeneric("}\n"))
return CGList(elements)
class Argument(): class Argument():
""" """
A class for outputting the type and name of an argument A class for outputting the type and name of an argument
@ -3061,6 +3165,12 @@ DomRoot::from_ref(&*root)\
""") """)
def toBindingPath(descriptor):
module = toBindingModuleFileFromDescriptor(descriptor)
namespace = toBindingNamespace(descriptor.interface.identifier.name)
return f"{module}::{namespace}"
class CGIDLInterface(CGThing): class CGIDLInterface(CGThing):
""" """
Class for codegen of an implementation of the IDLInterface trait. Class for codegen of an implementation of the IDLInterface trait.
@ -6495,7 +6605,7 @@ class CGInterfaceTrait(CGThing):
if methods: if methods:
self.cgRoot = CGWrapper(CGIndenter(CGList(methods, "")), self.cgRoot = CGWrapper(CGIndenter(CGList(methods, "")),
pre=f"pub trait {descriptor.interface.identifier.name}Methods {{\n", pre=f"pub trait {descriptor.interface.identifier.name}Methods<D: DomTypes> {{\n",
post="}") post="}")
else: else:
self.cgRoot = CGGeneric("") self.cgRoot = CGGeneric("")
@ -8150,6 +8260,36 @@ impl {base} {{
# Done. # Done.
return curr return curr
@staticmethod
def DomTypes(config):
curr = DomTypes(config.getDescriptors(),
config.getDescriptorProvider(),
config.getDictionaries(),
config.getCallbacks(),
config.typedefs,
config)
# Add the auto-generated comment.
curr = CGWrapper(curr, pre=AUTOGENERATED_WARNING_COMMENT)
# Done.
return curr
@staticmethod
def DomTypeHolder(config):
curr = DomTypeHolder(config.getDescriptors(),
config.getDescriptorProvider(),
config.getDictionaries(),
config.getCallbacks(),
config.typedefs,
config)
# Add the auto-generated comment.
curr = CGWrapper(curr, pre=AUTOGENERATED_WARNING_COMMENT)
# Done.
return curr
@staticmethod @staticmethod
def SupportedDomApis(config): def SupportedDomApis(config):
descriptors = config.getDescriptors(isExposedConditionally=False) descriptors = config.getDescriptors(isExposedConditionally=False)

View file

@ -48,6 +48,8 @@ def main():
("InheritTypes", "InheritTypes.rs"), ("InheritTypes", "InheritTypes.rs"),
("Bindings", "Bindings/mod.rs"), ("Bindings", "Bindings/mod.rs"),
("UnionTypes", "UnionTypes.rs"), ("UnionTypes", "UnionTypes.rs"),
("DomTypes", "DomTypes.rs"),
("DomTypeHolder", "DomTypeHolder.rs"),
]: ]:
generate(config, name, os.path.join(out_dir, filename)) generate(config, name, os.path.join(out_dir, filename))
make_dir(doc_servo) make_dir(doc_servo)

View file

@ -25,6 +25,7 @@ pub mod base {
ChannelCountMode, ChannelCountModeValues, ChannelInterpretation, ChannelCountMode, ChannelCountModeValues, ChannelInterpretation,
ChannelInterpretationValues, ChannelInterpretationValues,
}; };
pub use crate::dom::bindings::codegen::DomTypes::DomTypes;
pub use crate::dom::bindings::codegen::UnionTypes; pub use crate::dom::bindings::codegen::UnionTypes;
pub use crate::dom::bindings::conversions::{ pub use crate::dom::bindings::conversions::{
root_from_handlevalue, ConversionBehavior, ConversionResult, FromJSValConvertible, root_from_handlevalue, ConversionBehavior, ConversionResult, FromJSValConvertible,

View file

@ -170,6 +170,12 @@ pub mod xmlname;
/// Generated JS-Rust bindings. /// Generated JS-Rust bindings.
#[allow(missing_docs, non_snake_case)] #[allow(missing_docs, non_snake_case)]
pub mod codegen { pub mod codegen {
pub mod DomTypeHolder {
include!(concat!(env!("OUT_DIR"), "/DomTypeHolder.rs"));
}
pub mod DomTypes {
include!(concat!(env!("OUT_DIR"), "/DomTypes.rs"));
}
#[allow(dead_code)] #[allow(dead_code)]
pub mod Bindings { pub mod Bindings {
include!(concat!(env!("OUT_DIR"), "/Bindings/mod.rs")); include!(concat!(env!("OUT_DIR"), "/Bindings/mod.rs"));

View file

@ -140,7 +140,7 @@ impl BiquadFilterNode {
} }
} }
impl BiquadFilterNodeMethods for BiquadFilterNode { impl BiquadFilterNodeMethods<crate::DomTypeHolder> for BiquadFilterNode {
// https://webaudio.github.io/web-audio-api/#dom-biquadfilternode-biquadfilternode-context-options // https://webaudio.github.io/web-audio-api/#dom-biquadfilternode-biquadfilternode-context-options
fn Constructor( fn Constructor(
window: &Window, window: &Window,

View file

@ -202,7 +202,7 @@ pub fn blob_parts_to_bytes(
Ok(ret) Ok(ret)
} }
impl BlobMethods for Blob { impl BlobMethods<crate::DomTypeHolder> for Blob {
// https://w3c.github.io/FileAPI/#constructorBlob // https://w3c.github.io/FileAPI/#constructorBlob
#[allow(non_snake_case)] #[allow(non_snake_case)]
fn Constructor( fn Constructor(

View file

@ -534,7 +534,7 @@ impl From<BluetoothError> for Error {
} }
} }
impl BluetoothMethods for Bluetooth { impl BluetoothMethods<crate::DomTypeHolder> for Bluetooth {
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-requestdevice // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-requestdevice
fn RequestDevice( fn RequestDevice(
&self, &self,

View file

@ -81,7 +81,7 @@ impl BluetoothAdvertisingEvent {
} }
} }
impl BluetoothAdvertisingEventMethods for BluetoothAdvertisingEvent { impl BluetoothAdvertisingEventMethods<crate::DomTypeHolder> for BluetoothAdvertisingEvent {
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothadvertisingevent-bluetoothadvertisingevent // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothadvertisingevent-bluetoothadvertisingevent
#[allow(non_snake_case)] #[allow(non_snake_case)]
fn Constructor( fn Constructor(

View file

@ -82,7 +82,9 @@ impl BluetoothCharacteristicProperties {
} }
} }
impl BluetoothCharacteristicPropertiesMethods for BluetoothCharacteristicProperties { impl BluetoothCharacteristicPropertiesMethods<crate::DomTypeHolder>
for BluetoothCharacteristicProperties
{
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothcharacteristicproperties-broadcast // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothcharacteristicproperties-broadcast
fn Broadcast(&self) -> bool { fn Broadcast(&self) -> bool {
self.broadcast self.broadcast

View file

@ -253,7 +253,7 @@ impl BluetoothDevice {
} }
} }
impl BluetoothDeviceMethods for BluetoothDevice { impl BluetoothDeviceMethods<crate::DomTypeHolder> for BluetoothDevice {
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-id // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-id
fn Id(&self) -> DOMString { fn Id(&self) -> DOMString {
self.id.clone() self.id.clone()

View file

@ -81,7 +81,7 @@ impl BluetoothPermissionResult {
} }
} }
impl BluetoothPermissionResultMethods for BluetoothPermissionResult { impl BluetoothPermissionResultMethods<crate::DomTypeHolder> for BluetoothPermissionResult {
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothpermissionresult-devices // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothpermissionresult-devices
fn Devices(&self) -> Vec<DomRoot<BluetoothDevice>> { fn Devices(&self) -> Vec<DomRoot<BluetoothDevice>> {
let device_vec: Vec<DomRoot<BluetoothDevice>> = self let device_vec: Vec<DomRoot<BluetoothDevice>> = self

View file

@ -91,7 +91,9 @@ impl BluetoothRemoteGATTCharacteristic {
} }
} }
impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteristic { impl BluetoothRemoteGATTCharacteristicMethods<crate::DomTypeHolder>
for BluetoothRemoteGATTCharacteristic
{
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-properties // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-properties
fn Properties(&self) -> DomRoot<BluetoothCharacteristicProperties> { fn Properties(&self) -> DomRoot<BluetoothCharacteristicProperties> {
DomRoot::from_ref(&self.properties) DomRoot::from_ref(&self.properties)

View file

@ -78,7 +78,7 @@ impl BluetoothRemoteGATTDescriptor {
} }
} }
impl BluetoothRemoteGATTDescriptorMethods for BluetoothRemoteGATTDescriptor { impl BluetoothRemoteGATTDescriptorMethods<crate::DomTypeHolder> for BluetoothRemoteGATTDescriptor {
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-characteristic // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattdescriptor-characteristic
fn Characteristic(&self) -> DomRoot<BluetoothRemoteGATTCharacteristic> { fn Characteristic(&self) -> DomRoot<BluetoothRemoteGATTCharacteristic> {
DomRoot::from_ref(&self.characteristic) DomRoot::from_ref(&self.characteristic)

View file

@ -58,7 +58,7 @@ impl BluetoothRemoteGATTServer {
} }
} }
impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer { impl BluetoothRemoteGATTServerMethods<crate::DomTypeHolder> for BluetoothRemoteGATTServer {
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-device // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-device
fn Device(&self) -> DomRoot<BluetoothDevice> { fn Device(&self) -> DomRoot<BluetoothDevice> {
DomRoot::from_ref(&self.device) DomRoot::from_ref(&self.device)

View file

@ -68,7 +68,7 @@ impl BluetoothRemoteGATTService {
} }
} }
impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService { impl BluetoothRemoteGATTServiceMethods<crate::DomTypeHolder> for BluetoothRemoteGATTService {
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-device // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-device
fn Device(&self) -> DomRoot<BluetoothDevice> { fn Device(&self) -> DomRoot<BluetoothDevice> {
DomRoot::from_ref(&self.device) DomRoot::from_ref(&self.device)

View file

@ -584,7 +584,7 @@ const CHARACTERISTIC_ERROR_MESSAGE: &str =
const DESCRIPTOR_ERROR_MESSAGE: &str = "https://developer.bluetooth.org/gatt/descriptors/Pages/\ const DESCRIPTOR_ERROR_MESSAGE: &str = "https://developer.bluetooth.org/gatt/descriptors/Pages/\
DescriptorsHomePage.aspx\ne.g. 'gatt.characteristic_presentation_format'."; DescriptorsHomePage.aspx\ne.g. 'gatt.characteristic_presentation_format'.";
impl BluetoothUUIDMethods for BluetoothUUID { impl BluetoothUUIDMethods<crate::DomTypeHolder> for BluetoothUUID {
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothuuid-canonicaluuid // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothuuid-canonicaluuid
fn CanonicalUUID(_: &Window, alias: u32) -> UUID { fn CanonicalUUID(_: &Window, alias: u32) -> UUID {
canonical_uuid(alias) canonical_uuid(alias)

View file

@ -66,7 +66,7 @@ impl BroadcastChannel {
} }
} }
impl BroadcastChannelMethods for BroadcastChannel { impl BroadcastChannelMethods<crate::DomTypeHolder> for BroadcastChannel {
/// <https://html.spec.whatwg.org/multipage/#broadcastchannel> /// <https://html.spec.whatwg.org/multipage/#broadcastchannel>
fn Constructor( fn Constructor(
global: &GlobalScope, global: &GlobalScope,

View file

@ -47,7 +47,7 @@ impl CanvasGradient {
} }
} }
impl CanvasGradientMethods for CanvasGradient { impl CanvasGradientMethods<crate::DomTypeHolder> for CanvasGradient {
// https://html.spec.whatwg.org/multipage/#dom-canvasgradient-addcolorstop // https://html.spec.whatwg.org/multipage/#dom-canvasgradient-addcolorstop
fn AddColorStop(&self, offset: Finite<f64>, color: DOMString, can_gc: CanGc) -> ErrorResult { fn AddColorStop(&self, offset: Finite<f64>, color: DOMString, can_gc: CanGc) -> ErrorResult {
if *offset < 0f64 || *offset > 1f64 { if *offset < 0f64 || *offset > 1f64 {

View file

@ -154,7 +154,7 @@ impl LayoutCanvasRenderingContext2DHelpers for LayoutDom<'_, CanvasRenderingCont
// Restricted values are guarded in glue code. Therefore we need not add a guard. // Restricted values are guarded in glue code. Therefore we need not add a guard.
// //
// FIXME: this behavior should might be generated by some annotattions to idl. // FIXME: this behavior should might be generated by some annotattions to idl.
impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D { impl CanvasRenderingContext2DMethods<crate::DomTypeHolder> for CanvasRenderingContext2D {
// https://html.spec.whatwg.org/multipage/#dom-context-2d-canvas // https://html.spec.whatwg.org/multipage/#dom-context-2d-canvas
fn Canvas(&self) -> DomRoot<HTMLCanvasElement> { fn Canvas(&self) -> DomRoot<HTMLCanvasElement> {
// This method is not called from a paint worklet rendering context, // This method is not called from a paint worklet rendering context,

View file

@ -84,7 +84,7 @@ impl ChannelMergerNode {
} }
} }
impl ChannelMergerNodeMethods for ChannelMergerNode { impl ChannelMergerNodeMethods<crate::DomTypeHolder> for ChannelMergerNode {
/// <https://webaudio.github.io/web-audio-api/#dom-channelmergernode-channelmergernode> /// <https://webaudio.github.io/web-audio-api/#dom-channelmergernode-channelmergernode>
fn Constructor( fn Constructor(
window: &Window, window: &Window,

View file

@ -86,7 +86,7 @@ impl ChannelSplitterNode {
} }
} }
impl ChannelSplitterNodeMethods for ChannelSplitterNode { impl ChannelSplitterNodeMethods<crate::DomTypeHolder> for ChannelSplitterNode {
/// <https://webaudio.github.io/web-audio-api/#dom-channelsplitternode-channelsplitternode> /// <https://webaudio.github.io/web-audio-api/#dom-channelsplitternode-channelsplitternode>
fn Constructor( fn Constructor(
window: &Window, window: &Window,

View file

@ -107,7 +107,7 @@ impl CharacterData {
} }
} }
impl CharacterDataMethods for CharacterData { impl CharacterDataMethods<crate::DomTypeHolder> for CharacterData {
// https://dom.spec.whatwg.org/#dom-characterdata-data // https://dom.spec.whatwg.org/#dom-characterdata-data
fn Data(&self) -> DOMString { fn Data(&self) -> DOMString {
self.data.borrow().clone() self.data.borrow().clone()

View file

@ -56,7 +56,7 @@ impl Client {
} }
} }
impl ClientMethods for Client { impl ClientMethods<crate::DomTypeHolder> for Client {
// https://w3c.github.io/ServiceWorker/#client-url-attribute // https://w3c.github.io/ServiceWorker/#client-url-attribute
fn Url(&self) -> USVString { fn Url(&self) -> USVString {
USVString(self.url.as_str().to_owned()) USVString(self.url.as_str().to_owned())

View file

@ -75,7 +75,7 @@ impl CloseEvent {
} }
} }
impl CloseEventMethods for CloseEvent { impl CloseEventMethods<crate::DomTypeHolder> for CloseEvent {
// https://websockets.spec.whatwg.org/#the-closeevent-interface // https://websockets.spec.whatwg.org/#the-closeevent-interface
fn Constructor( fn Constructor(
global: &GlobalScope, global: &GlobalScope,

View file

@ -44,7 +44,7 @@ impl Comment {
} }
} }
impl CommentMethods for Comment { impl CommentMethods<crate::DomTypeHolder> for Comment {
/// <https://dom.spec.whatwg.org/#dom-comment-comment> /// <https://dom.spec.whatwg.org/#dom-comment-comment>
fn Constructor( fn Constructor(
window: &Window, window: &Window,

View file

@ -82,7 +82,7 @@ impl CompositionEvent {
} }
} }
impl CompositionEventMethods for CompositionEvent { impl CompositionEventMethods<crate::DomTypeHolder> for CompositionEvent {
// https://w3c.github.io/uievents/#dom-compositionevent-compositionevent // https://w3c.github.io/uievents/#dom-compositionevent-compositionevent
fn Constructor( fn Constructor(
window: &Window, window: &Window,

View file

@ -227,7 +227,7 @@ fn console_message(global: &GlobalScope, message: DOMString, level: LogLevel) {
}) })
} }
impl consoleMethods for Console { impl consoleMethods<crate::DomTypeHolder> for Console {
// https://developer.mozilla.org/en-US/docs/Web/API/Console/log // https://developer.mozilla.org/en-US/docs/Web/API/Console/log
fn Log(_cx: JSContext, global: &GlobalScope, messages: Vec<HandleValue>) { fn Log(_cx: JSContext, global: &GlobalScope, messages: Vec<HandleValue>) {
console_messages(global, messages, LogLevel::Log) console_messages(global, messages, LogLevel::Log)

View file

@ -90,7 +90,7 @@ impl ConstantSourceNode {
} }
} }
impl ConstantSourceNodeMethods for ConstantSourceNode { impl ConstantSourceNodeMethods<crate::DomTypeHolder> for ConstantSourceNode {
// https://webaudio.github.io/web-audio-api/#dom-constantsourcenode-constantsourcenode // https://webaudio.github.io/web-audio-api/#dom-constantsourcenode-constantsourcenode
fn Constructor( fn Constructor(
window: &Window, window: &Window,

View file

@ -42,7 +42,7 @@ impl Crypto {
} }
} }
impl CryptoMethods for Crypto { impl CryptoMethods<crate::DomTypeHolder> for Crypto {
/// <https://w3c.github.io/webcrypto/#dfn-Crypto-attribute-subtle> /// <https://w3c.github.io/webcrypto/#dfn-Crypto-attribute-subtle>
fn Subtle(&self) -> DomRoot<SubtleCrypto> { fn Subtle(&self) -> DomRoot<SubtleCrypto> {
self.subtle.or_init(|| SubtleCrypto::new(&self.global())) self.subtle.or_init(|| SubtleCrypto::new(&self.global()))

View file

@ -116,7 +116,7 @@ impl CryptoKey {
} }
} }
impl CryptoKeyMethods for CryptoKey { impl CryptoKeyMethods<crate::DomTypeHolder> for CryptoKey {
/// <https://w3c.github.io/webcrypto/#dom-cryptokey-type> /// <https://w3c.github.io/webcrypto/#dom-cryptokey-type>
fn Type(&self) -> KeyType { fn Type(&self) -> KeyType {
self.key_type self.key_type

View file

@ -25,7 +25,7 @@ pub struct CSS {
reflector_: Reflector, reflector_: Reflector,
} }
impl CSSMethods for CSS { impl CSSMethods<crate::DomTypeHolder> for CSS {
/// <https://drafts.csswg.org/cssom/#the-css.escape()-method> /// <https://drafts.csswg.org/cssom/#the-css.escape()-method>
fn Escape(_: &Window, ident: DOMString) -> Fallible<DOMString> { fn Escape(_: &Window, ident: DOMString) -> Fallible<DOMString> {
let mut escaped = String::new(); let mut escaped = String::new();

View file

@ -39,7 +39,7 @@ impl CSSConditionRule {
} }
} }
impl CSSConditionRuleMethods for CSSConditionRule { impl CSSConditionRuleMethods<crate::DomTypeHolder> for CSSConditionRule {
/// <https://drafts.csswg.org/css-conditional-3/#dom-cssconditionrule-conditiontext> /// <https://drafts.csswg.org/css-conditional-3/#dom-cssconditionrule-conditiontext>
fn ConditionText(&self) -> DOMString { fn ConditionText(&self) -> DOMString {
if let Some(rule) = self.downcast::<CSSMediaRule>() { if let Some(rule) = self.downcast::<CSSMediaRule>() {

View file

@ -58,7 +58,7 @@ impl CSSGroupingRule {
} }
} }
impl CSSGroupingRuleMethods for CSSGroupingRule { impl CSSGroupingRuleMethods<crate::DomTypeHolder> for CSSGroupingRule {
// https://drafts.csswg.org/cssom/#dom-cssgroupingrule-cssrules // https://drafts.csswg.org/cssom/#dom-cssgroupingrule-cssrules
fn CssRules(&self) -> DomRoot<CSSRuleList> { fn CssRules(&self) -> DomRoot<CSSRuleList> {
// XXXManishearth check origin clean flag // XXXManishearth check origin clean flag

View file

@ -63,7 +63,7 @@ impl SpecificCSSRule for CSSImportRule {
} }
} }
impl CSSImportRuleMethods for CSSImportRule { impl CSSImportRuleMethods<crate::DomTypeHolder> for CSSImportRule {
/// <https://drafts.csswg.org/cssom-1/#dom-cssimportrule-layername> /// <https://drafts.csswg.org/cssom-1/#dom-cssimportrule-layername>
fn GetLayerName(&self) -> Option<DOMString> { fn GetLayerName(&self) -> Option<DOMString> {
let guard = self.cssrule.shared_lock().read(); let guard = self.cssrule.shared_lock().read();

View file

@ -55,7 +55,7 @@ impl CSSKeyframeRule {
} }
} }
impl CSSKeyframeRuleMethods for CSSKeyframeRule { impl CSSKeyframeRuleMethods<crate::DomTypeHolder> for CSSKeyframeRule {
// https://drafts.csswg.org/css-animations/#dom-csskeyframerule-style // https://drafts.csswg.org/css-animations/#dom-csskeyframerule-style
fn Style(&self) -> DomRoot<CSSStyleDeclaration> { fn Style(&self) -> DomRoot<CSSStyleDeclaration> {
self.style_decl.or_init(|| { self.style_decl.or_init(|| {

View file

@ -88,7 +88,7 @@ impl CSSKeyframesRule {
} }
} }
impl CSSKeyframesRuleMethods for CSSKeyframesRule { impl CSSKeyframesRuleMethods<crate::DomTypeHolder> for CSSKeyframesRule {
// https://drafts.csswg.org/css-animations/#dom-csskeyframesrule-cssrules // https://drafts.csswg.org/css-animations/#dom-csskeyframesrule-cssrules
fn CssRules(&self) -> DomRoot<CSSRuleList> { fn CssRules(&self) -> DomRoot<CSSRuleList> {
self.rulelist() self.rulelist()

View file

@ -66,7 +66,7 @@ impl SpecificCSSRule for CSSLayerBlockRule {
} }
} }
impl CSSLayerBlockRuleMethods for CSSLayerBlockRule { impl CSSLayerBlockRuleMethods<crate::DomTypeHolder> for CSSLayerBlockRule {
/// <https://drafts.csswg.org/css-cascade-5/#dom-csslayerblockrule-name> /// <https://drafts.csswg.org/css-cascade-5/#dom-csslayerblockrule-name>
fn Name(&self) -> DOMString { fn Name(&self) -> DOMString {
if let Some(name) = &self.layerblockrule.name { if let Some(name) = &self.layerblockrule.name {

View file

@ -65,7 +65,7 @@ impl SpecificCSSRule for CSSLayerStatementRule {
} }
} }
impl CSSLayerStatementRuleMethods for CSSLayerStatementRule { impl CSSLayerStatementRuleMethods<crate::DomTypeHolder> for CSSLayerStatementRule {
/// <https://drafts.csswg.org/css-cascade-5/#dom-csslayerstatementrule-namelist> /// <https://drafts.csswg.org/css-cascade-5/#dom-csslayerstatementrule-namelist>
fn NameList(&self, cx: SafeJSContext, retval: MutableHandleValue) { fn NameList(&self, cx: SafeJSContext, retval: MutableHandleValue) {
let names: Vec<DOMString> = self let names: Vec<DOMString> = self

View file

@ -78,7 +78,7 @@ impl SpecificCSSRule for CSSMediaRule {
} }
} }
impl CSSMediaRuleMethods for CSSMediaRule { impl CSSMediaRuleMethods<crate::DomTypeHolder> for CSSMediaRule {
// https://drafts.csswg.org/cssom/#dom-cssgroupingrule-media // https://drafts.csswg.org/cssom/#dom-cssgroupingrule-media
fn Media(&self) -> DomRoot<MediaList> { fn Media(&self) -> DomRoot<MediaList> {
self.medialist() self.medialist()

View file

@ -50,7 +50,7 @@ impl CSSNamespaceRule {
} }
} }
impl CSSNamespaceRuleMethods for CSSNamespaceRule { impl CSSNamespaceRuleMethods<crate::DomTypeHolder> for CSSNamespaceRule {
// https://drafts.csswg.org/cssom/#dom-cssnamespacerule-prefix // https://drafts.csswg.org/cssom/#dom-cssnamespacerule-prefix
fn Prefix(&self) -> DOMString { fn Prefix(&self) -> DOMString {
self.namespacerule self.namespacerule

View file

@ -148,7 +148,7 @@ impl CSSRule {
} }
} }
impl CSSRuleMethods for CSSRule { impl CSSRuleMethods<crate::DomTypeHolder> for CSSRule {
// https://drafts.csswg.org/cssom/#dom-cssrule-type // https://drafts.csswg.org/cssom/#dom-cssrule-type
fn Type(&self) -> u16 { fn Type(&self) -> u16 {
let rule_type = self.as_specific().ty() as u16; let rule_type = self.as_specific().ty() as u16;

View file

@ -207,7 +207,7 @@ impl CSSRuleList {
} }
} }
impl CSSRuleListMethods for CSSRuleList { impl CSSRuleListMethods<crate::DomTypeHolder> for CSSRuleList {
// https://drafts.csswg.org/cssom/#ref-for-dom-cssrulelist-item-1 // https://drafts.csswg.org/cssom/#ref-for-dom-cssrulelist-item-1
fn Item(&self, idx: u32) -> Option<DomRoot<CSSRule>> { fn Item(&self, idx: u32) -> Option<DomRoot<CSSRule>> {
self.item(idx) self.item(idx)

View file

@ -383,7 +383,7 @@ pub static ENABLED_LONGHAND_PROPERTIES: LazyLock<Vec<LonghandId>> = LazyLock::ne
enabled_longhands enabled_longhands
}); });
impl CSSStyleDeclarationMethods for CSSStyleDeclaration { impl CSSStyleDeclarationMethods<crate::DomTypeHolder> for CSSStyleDeclaration {
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-length // https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-length
fn Length(&self) -> u32 { fn Length(&self) -> u32 {
if self.readonly { if self.readonly {

View file

@ -71,7 +71,7 @@ impl SpecificCSSRule for CSSStyleRule {
} }
} }
impl CSSStyleRuleMethods for CSSStyleRule { impl CSSStyleRuleMethods<crate::DomTypeHolder> for CSSStyleRule {
// https://drafts.csswg.org/cssom/#dom-cssstylerule-style // https://drafts.csswg.org/cssom/#dom-cssstylerule-style
fn Style(&self) -> DomRoot<CSSStyleDeclaration> { fn Style(&self) -> DomRoot<CSSStyleDeclaration> {
self.style_decl.or_init(|| { self.style_decl.or_init(|| {

View file

@ -114,7 +114,7 @@ impl CSSStyleSheet {
} }
} }
impl CSSStyleSheetMethods for CSSStyleSheet { impl CSSStyleSheetMethods<crate::DomTypeHolder> for CSSStyleSheet {
// https://drafts.csswg.org/cssom/#dom-cssstylesheet-cssrules // https://drafts.csswg.org/cssom/#dom-cssstylesheet-cssrules
fn GetCssRules(&self) -> Fallible<DomRoot<CSSRuleList>> { fn GetCssRules(&self) -> Fallible<DomRoot<CSSRuleList>> {
if !self.origin_clean.get() { if !self.origin_clean.get() {

View file

@ -31,7 +31,7 @@ impl CSSStyleValue {
} }
} }
impl CSSStyleValueMethods for CSSStyleValue { impl CSSStyleValueMethods<crate::DomTypeHolder> for CSSStyleValue {
/// <https://drafts.css-houdini.org/css-typed-om-1/#CSSStyleValue-stringification-behavior> /// <https://drafts.css-houdini.org/css-typed-om-1/#CSSStyleValue-stringification-behavior>
fn Stringifier(&self) -> DOMString { fn Stringifier(&self) -> DOMString {
DOMString::from(&*self.value) DOMString::from(&*self.value)

View file

@ -332,7 +332,7 @@ fn get_callback(
} }
} }
impl CustomElementRegistryMethods for CustomElementRegistry { impl CustomElementRegistryMethods<crate::DomTypeHolder> for CustomElementRegistry {
#[allow(unsafe_code, crown::unrooted_must_root)] #[allow(unsafe_code, crown::unrooted_must_root)]
/// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define> /// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define>
fn Define( fn Define(

View file

@ -84,7 +84,7 @@ impl CustomEvent {
} }
} }
impl CustomEventMethods for CustomEvent { impl CustomEventMethods<crate::DomTypeHolder> for CustomEvent {
// https://dom.spec.whatwg.org/#dom-customevent-customevent // https://dom.spec.whatwg.org/#dom-customevent-customevent
fn Constructor( fn Constructor(
global: &GlobalScope, global: &GlobalScope,

View file

@ -646,7 +646,7 @@ unsafe extern "C" fn interrupt_callback(cx: *mut JSContext) -> bool {
!worker.is_closing() !worker.is_closing()
} }
impl DedicatedWorkerGlobalScopeMethods for DedicatedWorkerGlobalScope { impl DedicatedWorkerGlobalScopeMethods<crate::DomTypeHolder> for DedicatedWorkerGlobalScope {
/// <https://html.spec.whatwg.org/multipage/#dom-dedicatedworkerglobalscope-postmessage> /// <https://html.spec.whatwg.org/multipage/#dom-dedicatedworkerglobalscope-postmessage>
fn PostMessage( fn PostMessage(
&self, &self,

View file

@ -44,7 +44,7 @@ impl DissimilarOriginLocation {
} }
} }
impl DissimilarOriginLocationMethods for DissimilarOriginLocation { impl DissimilarOriginLocationMethods<crate::DomTypeHolder> for DissimilarOriginLocation {
// https://html.spec.whatwg.org/multipage/#dom-location-href // https://html.spec.whatwg.org/multipage/#dom-location-href
fn GetHref(&self) -> Fallible<USVString> { fn GetHref(&self) -> Fallible<USVString> {
Err(Error::Security) Err(Error::Security)

View file

@ -79,7 +79,7 @@ impl DissimilarOriginWindow {
} }
} }
impl DissimilarOriginWindowMethods for DissimilarOriginWindow { impl DissimilarOriginWindowMethods<crate::DomTypeHolder> for DissimilarOriginWindow {
// https://html.spec.whatwg.org/multipage/#dom-window // https://html.spec.whatwg.org/multipage/#dom-window
fn Window(&self) -> DomRoot<WindowProxy> { fn Window(&self) -> DomRoot<WindowProxy> {
self.window_proxy() self.window_proxy()

View file

@ -4269,7 +4269,7 @@ impl ProfilerMetadataFactory for Document {
} }
#[allow(non_snake_case)] #[allow(non_snake_case)]
impl DocumentMethods for Document { impl DocumentMethods<crate::DomTypeHolder> for Document {
// https://dom.spec.whatwg.org/#dom-document-document // https://dom.spec.whatwg.org/#dom-document-document
fn Constructor( fn Constructor(
window: &Window, window: &Window,

View file

@ -62,7 +62,7 @@ impl DocumentFragment {
} }
} }
impl DocumentFragmentMethods for DocumentFragment { impl DocumentFragmentMethods<crate::DomTypeHolder> for DocumentFragment {
// https://dom.spec.whatwg.org/#dom-documentfragment-documentfragment // https://dom.spec.whatwg.org/#dom-documentfragment-documentfragment
fn Constructor( fn Constructor(
window: &Window, window: &Window,

View file

@ -71,7 +71,7 @@ impl DocumentType {
} }
} }
impl DocumentTypeMethods for DocumentType { impl DocumentTypeMethods<crate::DomTypeHolder> for DocumentType {
// https://dom.spec.whatwg.org/#dom-documenttype-name // https://dom.spec.whatwg.org/#dom-documenttype-name
fn Name(&self) -> DOMString { fn Name(&self) -> DOMString {
self.name.clone() self.name.clone()

View file

@ -157,7 +157,7 @@ impl DOMException {
} }
} }
impl DOMExceptionMethods for DOMException { impl DOMExceptionMethods<crate::DomTypeHolder> for DOMException {
// https://webidl.spec.whatwg.org/#dom-domexception-domexception // https://webidl.spec.whatwg.org/#dom-domexception-domexception
fn Constructor( fn Constructor(
global: &GlobalScope, global: &GlobalScope,

View file

@ -52,7 +52,7 @@ impl DOMImplementation {
} }
// https://dom.spec.whatwg.org/#domimplementation // https://dom.spec.whatwg.org/#domimplementation
impl DOMImplementationMethods for DOMImplementation { impl DOMImplementationMethods<crate::DomTypeHolder> for DOMImplementation {
// https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype // https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype
fn CreateDocumentType( fn CreateDocumentType(
&self, &self,

View file

@ -66,7 +66,7 @@ impl DOMMatrix {
} }
#[allow(non_snake_case)] #[allow(non_snake_case)]
impl DOMMatrixMethods for DOMMatrix { impl DOMMatrixMethods<crate::DomTypeHolder> for DOMMatrix {
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-dommatrixreadonly // https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-dommatrixreadonly
fn Constructor( fn Constructor(
global: &GlobalScope, global: &GlobalScope,

View file

@ -433,7 +433,7 @@ impl DOMMatrixReadOnly {
} }
#[allow(non_snake_case)] #[allow(non_snake_case)]
impl DOMMatrixReadOnlyMethods for DOMMatrixReadOnly { impl DOMMatrixReadOnlyMethods<crate::DomTypeHolder> for DOMMatrixReadOnly {
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-dommatrixreadonly // https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-dommatrixreadonly
fn Constructor( fn Constructor(
global: &GlobalScope, global: &GlobalScope,

View file

@ -47,7 +47,7 @@ impl DOMParser {
} }
} }
impl DOMParserMethods for DOMParser { impl DOMParserMethods<crate::DomTypeHolder> for DOMParser {
/// <https://html.spec.whatwg.org/multipage/#dom-domparser-constructor> /// <https://html.spec.whatwg.org/multipage/#dom-domparser-constructor>
fn Constructor( fn Constructor(
window: &Window, window: &Window,

View file

@ -65,7 +65,7 @@ impl DOMPoint {
} }
} }
impl DOMPointMethods for DOMPoint { impl DOMPointMethods<crate::DomTypeHolder> for DOMPoint {
// https://drafts.fxtf.org/geometry/#dom-dompointreadonly-dompointreadonly // https://drafts.fxtf.org/geometry/#dom-dompointreadonly-dompointreadonly
fn Constructor( fn Constructor(
global: &GlobalScope, global: &GlobalScope,

View file

@ -67,7 +67,7 @@ impl DOMPointReadOnly {
} }
#[allow(non_snake_case)] #[allow(non_snake_case)]
impl DOMPointReadOnlyMethods for DOMPointReadOnly { impl DOMPointReadOnlyMethods<crate::DomTypeHolder> for DOMPointReadOnly {
// https://drafts.fxtf.org/geometry/#dom-dompoint-dompoint // https://drafts.fxtf.org/geometry/#dom-dompoint-dompoint
fn Constructor( fn Constructor(
global: &GlobalScope, global: &GlobalScope,

View file

@ -66,7 +66,7 @@ impl DOMQuad {
} }
} }
impl DOMQuadMethods for DOMQuad { impl DOMQuadMethods<crate::DomTypeHolder> for DOMQuad {
// https://drafts.fxtf.org/geometry/#dom-domquad-domquad // https://drafts.fxtf.org/geometry/#dom-domquad-domquad
fn Constructor( fn Constructor(
global: &GlobalScope, global: &GlobalScope,

View file

@ -57,7 +57,7 @@ impl DOMRect {
} }
} }
impl DOMRectMethods for DOMRect { impl DOMRectMethods<crate::DomTypeHolder> for DOMRect {
// https://drafts.fxtf.org/geometry/#dom-domrect-domrect // https://drafts.fxtf.org/geometry/#dom-domrect-domrect
fn Constructor( fn Constructor(
global: &GlobalScope, global: &GlobalScope,

View file

@ -48,7 +48,7 @@ impl DOMRectList {
} }
} }
impl DOMRectListMethods for DOMRectList { impl DOMRectListMethods<crate::DomTypeHolder> for DOMRectList {
/// <https://drafts.fxtf.org/geometry/#DOMRectList> /// <https://drafts.fxtf.org/geometry/#DOMRectList>
fn Item(&self, index: u32) -> Option<DomRoot<DOMRect>> { fn Item(&self, index: u32) -> Option<DomRoot<DOMRect>> {
self.rects.borrow().get(index as usize).map(Dom::as_rooted) self.rects.borrow().get(index as usize).map(Dom::as_rooted)

View file

@ -72,7 +72,7 @@ impl DOMRectReadOnly {
} }
} }
impl DOMRectReadOnlyMethods for DOMRectReadOnly { impl DOMRectReadOnlyMethods<crate::DomTypeHolder> for DOMRectReadOnly {
// https://drafts.fxtf.org/geometry/#dom-domrectreadonly-domrectreadonly // https://drafts.fxtf.org/geometry/#dom-domrectreadonly-domrectreadonly
fn Constructor( fn Constructor(
global: &GlobalScope, global: &GlobalScope,

View file

@ -32,7 +32,7 @@ impl DOMStringList {
} }
// https://html.spec.whatwg.org/multipage/#domstringlist // https://html.spec.whatwg.org/multipage/#domstringlist
impl DOMStringListMethods for DOMStringList { impl DOMStringListMethods<crate::DomTypeHolder> for DOMStringList {
// https://html.spec.whatwg.org/multipage/#dom-domstringlist-length // https://html.spec.whatwg.org/multipage/#dom-domstringlist-length
fn Length(&self) -> u32 { fn Length(&self) -> u32 {
self.strings.len() as u32 self.strings.len() as u32

View file

@ -34,7 +34,7 @@ impl DOMStringMap {
} }
// https://html.spec.whatwg.org/multipage/#domstringmap // https://html.spec.whatwg.org/multipage/#domstringmap
impl DOMStringMapMethods for DOMStringMap { impl DOMStringMapMethods<crate::DomTypeHolder> for DOMStringMap {
// https://html.spec.whatwg.org/multipage/#dom-domstringmap-removeitem // https://html.spec.whatwg.org/multipage/#dom-domstringmap-removeitem
fn NamedDeleter(&self, name: DOMString) { fn NamedDeleter(&self, name: DOMString) {
self.element.delete_custom_attr(name) self.element.delete_custom_attr(name)

View file

@ -101,7 +101,7 @@ impl DOMTokenList {
} }
/// <https://dom.spec.whatwg.org/#domtokenlist> /// <https://dom.spec.whatwg.org/#domtokenlist>
impl DOMTokenListMethods for DOMTokenList { impl DOMTokenListMethods<crate::DomTypeHolder> for DOMTokenList {
/// <https://dom.spec.whatwg.org/#dom-domtokenlist-length> /// <https://dom.spec.whatwg.org/#dom-domtokenlist-length>
fn Length(&self) -> u32 { fn Length(&self) -> u32 {
self.attribute() self.attribute()

View file

@ -48,7 +48,7 @@ impl DynamicModuleOwner {
} }
} }
impl DynamicModuleOwnerMethods for DynamicModuleOwner { impl DynamicModuleOwnerMethods<crate::DomTypeHolder> for DynamicModuleOwner {
// https://html.spec.whatwg.org/multipage/#integration-with-the-javascript-module-system:import() // https://html.spec.whatwg.org/multipage/#integration-with-the-javascript-module-system:import()
fn Promise(&self) -> Rc<Promise> { fn Promise(&self) -> Rc<Promise> {
self.promise.clone() self.promise.clone()

View file

@ -2081,7 +2081,7 @@ impl Element {
} }
} }
impl ElementMethods for Element { impl ElementMethods<crate::DomTypeHolder> for Element {
// https://dom.spec.whatwg.org/#dom-element-namespaceuri // https://dom.spec.whatwg.org/#dom-element-namespaceuri
fn GetNamespaceURI(&self) -> Option<DOMString> { fn GetNamespaceURI(&self) -> Option<DOMString> {
Node::namespace_to_string(self.namespace.clone()) Node::namespace_to_string(self.namespace.clone())

View file

@ -183,7 +183,7 @@ impl ElementInternals {
} }
} }
impl ElementInternalsMethods for ElementInternals { impl ElementInternalsMethods<crate::DomTypeHolder> for ElementInternals {
/// <https://html.spec.whatwg.org/multipage#dom-elementinternals-setformvalue> /// <https://html.spec.whatwg.org/multipage#dom-elementinternals-setformvalue>
fn SetFormValue( fn SetFormValue(
&self, &self,

View file

@ -102,7 +102,7 @@ impl ErrorEvent {
} }
} }
impl ErrorEventMethods for ErrorEvent { impl ErrorEventMethods<crate::DomTypeHolder> for ErrorEvent {
// https://html.spec.whatwg.org/multipage/#errorevent // https://html.spec.whatwg.org/multipage/#errorevent
fn Constructor( fn Constructor(
global: &GlobalScope, global: &GlobalScope,

View file

@ -387,7 +387,7 @@ impl Event {
} }
} }
impl EventMethods for Event { impl EventMethods<crate::DomTypeHolder> for Event {
/// <https://dom.spec.whatwg.org/#dom-event-event> /// <https://dom.spec.whatwg.org/#dom-event-event>
fn Constructor( fn Constructor(
global: &GlobalScope, global: &GlobalScope,

View file

@ -530,7 +530,7 @@ impl Drop for EventSource {
} }
} }
impl EventSourceMethods for EventSource { impl EventSourceMethods<crate::DomTypeHolder> for EventSource {
// https://html.spec.whatwg.org/multipage/#dom-eventsource // https://html.spec.whatwg.org/multipage/#dom-eventsource
fn Constructor( fn Constructor(
global: &GlobalScope, global: &GlobalScope,

View file

@ -783,7 +783,7 @@ impl EventTarget {
} }
} }
impl EventTargetMethods for EventTarget { impl EventTargetMethods<crate::DomTypeHolder> for EventTarget {
// https://dom.spec.whatwg.org/#dom-eventtarget-eventtarget // https://dom.spec.whatwg.org/#dom-eventtarget-eventtarget
fn Constructor( fn Constructor(
global: &GlobalScope, global: &GlobalScope,

View file

@ -67,7 +67,7 @@ impl ExtendableEvent {
} }
} }
impl ExtendableEventMethods for ExtendableEvent { impl ExtendableEventMethods<crate::DomTypeHolder> for ExtendableEvent {
// https://w3c.github.io/ServiceWorker/#dom-extendableevent-extendableevent // https://w3c.github.io/ServiceWorker/#dom-extendableevent-extendableevent
fn Constructor( fn Constructor(
worker: &ServiceWorkerGlobalScope, worker: &ServiceWorkerGlobalScope,

View file

@ -161,7 +161,7 @@ impl ExtendableMessageEvent {
} }
} }
impl ExtendableMessageEventMethods for ExtendableMessageEvent { impl ExtendableMessageEventMethods<crate::DomTypeHolder> for ExtendableMessageEvent {
/// <https://w3c.github.io/ServiceWorker/#dom-extendablemessageevent-extendablemessageevent> /// <https://w3c.github.io/ServiceWorker/#dom-extendablemessageevent-extendablemessageevent>
fn Constructor( fn Constructor(
worker: &ServiceWorkerGlobalScope, worker: &ServiceWorkerGlobalScope,

View file

@ -182,7 +182,7 @@ impl From<FakeXRRegionType> for EntityType {
} }
} }
impl FakeXRDeviceMethods for FakeXRDevice { impl FakeXRDeviceMethods<crate::DomTypeHolder> for FakeXRDevice {
/// <https://github.com/immersive-web/webxr-test-api/blob/master/explainer.md> /// <https://github.com/immersive-web/webxr-test-api/blob/master/explainer.md>
fn SetViews( fn SetViews(
&self, &self,

View file

@ -61,7 +61,7 @@ impl FakeXRInputController {
} }
} }
impl FakeXRInputControllerMethods for FakeXRInputController { impl FakeXRInputControllerMethods<crate::DomTypeHolder> for FakeXRInputController {
/// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-setpointerorigin> /// <https://immersive-web.github.io/webxr-test-api/#dom-fakexrinputcontroller-setpointerorigin>
fn SetPointerOrigin(&self, origin: &FakeXRRigidTransformInit, _emulated: bool) -> Fallible<()> { fn SetPointerOrigin(&self, origin: &FakeXRRigidTransformInit, _emulated: bool) -> Fallible<()> {
self.send_message(MockInputMsg::SetPointerOrigin(Some(get_origin(origin)?))); self.send_message(MockInputMsg::SetPointerOrigin(Some(get_origin(origin)?)));

View file

@ -102,7 +102,7 @@ impl File {
} }
} }
impl FileMethods for File { impl FileMethods<crate::DomTypeHolder> for File {
// https://w3c.github.io/FileAPI/#file-constructor // https://w3c.github.io/FileAPI/#file-constructor
#[allow(non_snake_case)] #[allow(non_snake_case)]
fn Constructor( fn Constructor(

View file

@ -43,7 +43,7 @@ impl FileList {
} }
} }
impl FileListMethods for FileList { impl FileListMethods<crate::DomTypeHolder> for FileList {
// https://w3c.github.io/FileAPI/#dfn-length // https://w3c.github.io/FileAPI/#dfn-length
fn Length(&self) -> u32 { fn Length(&self) -> u32 {
self.list.len() as u32 self.list.len() as u32

View file

@ -326,7 +326,7 @@ impl FileReader {
} }
} }
impl FileReaderMethods for FileReader { impl FileReaderMethods<crate::DomTypeHolder> for FileReader {
// https://w3c.github.io/FileAPI/#filereaderConstrctr // https://w3c.github.io/FileAPI/#filereaderConstrctr
fn Constructor( fn Constructor(
global: &GlobalScope, global: &GlobalScope,

View file

@ -51,7 +51,7 @@ impl FileReaderSync {
} }
} }
impl FileReaderSyncMethods for FileReaderSync { impl FileReaderSyncMethods<crate::DomTypeHolder> for FileReaderSync {
/// <https://w3c.github.io/FileAPI/#filereadersyncConstrctr> /// <https://w3c.github.io/FileAPI/#filereadersyncConstrctr>
fn Constructor( fn Constructor(
global: &GlobalScope, global: &GlobalScope,

View file

@ -96,7 +96,7 @@ impl FocusEvent {
} }
} }
impl FocusEventMethods for FocusEvent { impl FocusEventMethods<crate::DomTypeHolder> for FocusEvent {
// https://w3c.github.io/uievents/#dom-focusevent-focusevent // https://w3c.github.io/uievents/#dom-focusevent-focusevent
fn Constructor( fn Constructor(
window: &Window, window: &Window,

Some files were not shown because too many files have changed in this diff Show more