mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
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:
parent
468f9cf014
commit
e956f3124c
383 changed files with 550 additions and 385 deletions
|
@ -64,7 +64,7 @@ impl AbstractRange {
|
|||
}
|
||||
}
|
||||
|
||||
impl AbstractRangeMethods for AbstractRange {
|
||||
impl AbstractRangeMethods<crate::DomTypeHolder> for AbstractRange {
|
||||
/// <https://dom.spec.whatwg.org/#dom-range-startcontainer>
|
||||
fn StartContainer(&self) -> DomRoot<Node> {
|
||||
self.start.node.get()
|
||||
|
|
|
@ -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>
|
||||
fn Constructor(
|
||||
window: &Window,
|
||||
|
|
|
@ -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
|
||||
fn Constructor(
|
||||
window: &Window,
|
||||
|
|
|
@ -97,7 +97,7 @@ impl Attr {
|
|||
}
|
||||
}
|
||||
|
||||
impl AttrMethods for Attr {
|
||||
impl AttrMethods<crate::DomTypeHolder> for Attr {
|
||||
// https://dom.spec.whatwg.org/#dom-attr-localname
|
||||
fn LocalName(&self) -> DOMString {
|
||||
// FIXME(ajeffrey): convert directly from LocalName to DOMString
|
||||
|
|
|
@ -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
|
||||
fn Constructor(
|
||||
window: &Window,
|
||||
|
|
|
@ -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
|
||||
fn Constructor(
|
||||
window: &Window,
|
||||
|
|
|
@ -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
|
||||
fn Constructor(
|
||||
window: &Window,
|
||||
|
|
|
@ -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
|
||||
fn MaxChannelCount(&self) -> u32 {
|
||||
MAX_CHANNEL_COUNT
|
||||
|
|
|
@ -160,7 +160,7 @@ impl AudioListener {
|
|||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
impl AudioListenerMethods for AudioListener {
|
||||
impl AudioListenerMethods<crate::DomTypeHolder> for AudioListener {
|
||||
// https://webaudio.github.io/web-audio-api/#dom-audiolistener-positionx
|
||||
fn PositionX(&self) -> DomRoot<AudioParam> {
|
||||
DomRoot::from_ref(&self.position_x)
|
||||
|
|
|
@ -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
|
||||
fn Connect(
|
||||
&self,
|
||||
|
|
|
@ -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
|
||||
fn AutomationRate(&self) -> AutomationRate {
|
||||
self.automation_rate.get()
|
||||
|
|
|
@ -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
|
||||
event_handler!(ended, GetOnended, SetOnended);
|
||||
|
||||
|
|
|
@ -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
|
||||
fn Id(&self) -> DOMString {
|
||||
self.id()
|
||||
|
|
|
@ -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
|
||||
fn Length(&self) -> u32 {
|
||||
self.len() as u32
|
||||
|
|
|
@ -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>
|
||||
fn SampleRate(&self) -> Finite<f32> {
|
||||
Finite::wrap(self.sample_rate)
|
||||
|
|
|
@ -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
|
||||
fn ReturnValue(&self) -> DOMString {
|
||||
self.return_value.borrow().clone()
|
||||
|
|
|
@ -540,6 +540,12 @@ def union_native_type(t):
|
|||
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():
|
||||
"""
|
||||
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)
|
||||
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
|
||||
# wrong type of value.
|
||||
def onFailureNotAnObject(failureCode):
|
||||
|
@ -2621,6 +2622,7 @@ def UnionTypes(descriptors, dictionaries, callbacks, typedefs, config):
|
|||
imports = [
|
||||
'crate::dom',
|
||||
'crate::dom::bindings::import::base::*',
|
||||
'crate::dom::bindings::codegen::DomTypes::DomTypes',
|
||||
'crate::dom::bindings::conversions::windowproxy_from_handlevalue',
|
||||
'crate::dom::bindings::record::Record',
|
||||
'crate::dom::types::*',
|
||||
|
@ -2658,6 +2660,108 @@ def UnionTypes(descriptors, dictionaries, callbacks, typedefs, 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():
|
||||
"""
|
||||
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 for codegen of an implementation of the IDLInterface trait.
|
||||
|
@ -6495,7 +6605,7 @@ class CGInterfaceTrait(CGThing):
|
|||
|
||||
if 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="}")
|
||||
else:
|
||||
self.cgRoot = CGGeneric("")
|
||||
|
@ -8150,6 +8260,36 @@ impl {base} {{
|
|||
# Done.
|
||||
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
|
||||
def SupportedDomApis(config):
|
||||
descriptors = config.getDescriptors(isExposedConditionally=False)
|
||||
|
|
|
@ -48,6 +48,8 @@ def main():
|
|||
("InheritTypes", "InheritTypes.rs"),
|
||||
("Bindings", "Bindings/mod.rs"),
|
||||
("UnionTypes", "UnionTypes.rs"),
|
||||
("DomTypes", "DomTypes.rs"),
|
||||
("DomTypeHolder", "DomTypeHolder.rs"),
|
||||
]:
|
||||
generate(config, name, os.path.join(out_dir, filename))
|
||||
make_dir(doc_servo)
|
||||
|
|
|
@ -25,6 +25,7 @@ pub mod base {
|
|||
ChannelCountMode, ChannelCountModeValues, ChannelInterpretation,
|
||||
ChannelInterpretationValues,
|
||||
};
|
||||
pub use crate::dom::bindings::codegen::DomTypes::DomTypes;
|
||||
pub use crate::dom::bindings::codegen::UnionTypes;
|
||||
pub use crate::dom::bindings::conversions::{
|
||||
root_from_handlevalue, ConversionBehavior, ConversionResult, FromJSValConvertible,
|
||||
|
|
|
@ -170,6 +170,12 @@ pub mod xmlname;
|
|||
/// Generated JS-Rust bindings.
|
||||
#[allow(missing_docs, non_snake_case)]
|
||||
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)]
|
||||
pub mod Bindings {
|
||||
include!(concat!(env!("OUT_DIR"), "/Bindings/mod.rs"));
|
||||
|
|
|
@ -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
|
||||
fn Constructor(
|
||||
window: &Window,
|
||||
|
|
|
@ -202,7 +202,7 @@ pub fn blob_parts_to_bytes(
|
|||
Ok(ret)
|
||||
}
|
||||
|
||||
impl BlobMethods for Blob {
|
||||
impl BlobMethods<crate::DomTypeHolder> for Blob {
|
||||
// https://w3c.github.io/FileAPI/#constructorBlob
|
||||
#[allow(non_snake_case)]
|
||||
fn Constructor(
|
||||
|
|
|
@ -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
|
||||
fn RequestDevice(
|
||||
&self,
|
||||
|
|
|
@ -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
|
||||
#[allow(non_snake_case)]
|
||||
fn Constructor(
|
||||
|
|
|
@ -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
|
||||
fn Broadcast(&self) -> bool {
|
||||
self.broadcast
|
||||
|
|
|
@ -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
|
||||
fn Id(&self) -> DOMString {
|
||||
self.id.clone()
|
||||
|
|
|
@ -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
|
||||
fn Devices(&self) -> Vec<DomRoot<BluetoothDevice>> {
|
||||
let device_vec: Vec<DomRoot<BluetoothDevice>> = self
|
||||
|
|
|
@ -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
|
||||
fn Properties(&self) -> DomRoot<BluetoothCharacteristicProperties> {
|
||||
DomRoot::from_ref(&self.properties)
|
||||
|
|
|
@ -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
|
||||
fn Characteristic(&self) -> DomRoot<BluetoothRemoteGATTCharacteristic> {
|
||||
DomRoot::from_ref(&self.characteristic)
|
||||
|
|
|
@ -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
|
||||
fn Device(&self) -> DomRoot<BluetoothDevice> {
|
||||
DomRoot::from_ref(&self.device)
|
||||
|
|
|
@ -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
|
||||
fn Device(&self) -> DomRoot<BluetoothDevice> {
|
||||
DomRoot::from_ref(&self.device)
|
||||
|
|
|
@ -584,7 +584,7 @@ const CHARACTERISTIC_ERROR_MESSAGE: &str =
|
|||
const DESCRIPTOR_ERROR_MESSAGE: &str = "https://developer.bluetooth.org/gatt/descriptors/Pages/\
|
||||
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
|
||||
fn CanonicalUUID(_: &Window, alias: u32) -> UUID {
|
||||
canonical_uuid(alias)
|
||||
|
|
|
@ -66,7 +66,7 @@ impl BroadcastChannel {
|
|||
}
|
||||
}
|
||||
|
||||
impl BroadcastChannelMethods for BroadcastChannel {
|
||||
impl BroadcastChannelMethods<crate::DomTypeHolder> for BroadcastChannel {
|
||||
/// <https://html.spec.whatwg.org/multipage/#broadcastchannel>
|
||||
fn Constructor(
|
||||
global: &GlobalScope,
|
||||
|
|
|
@ -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
|
||||
fn AddColorStop(&self, offset: Finite<f64>, color: DOMString, can_gc: CanGc) -> ErrorResult {
|
||||
if *offset < 0f64 || *offset > 1f64 {
|
||||
|
|
|
@ -154,7 +154,7 @@ impl LayoutCanvasRenderingContext2DHelpers for LayoutDom<'_, CanvasRenderingCont
|
|||
// 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.
|
||||
impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {
|
||||
impl CanvasRenderingContext2DMethods<crate::DomTypeHolder> for CanvasRenderingContext2D {
|
||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-canvas
|
||||
fn Canvas(&self) -> DomRoot<HTMLCanvasElement> {
|
||||
// This method is not called from a paint worklet rendering context,
|
||||
|
|
|
@ -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>
|
||||
fn Constructor(
|
||||
window: &Window,
|
||||
|
|
|
@ -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>
|
||||
fn Constructor(
|
||||
window: &Window,
|
||||
|
|
|
@ -107,7 +107,7 @@ impl CharacterData {
|
|||
}
|
||||
}
|
||||
|
||||
impl CharacterDataMethods for CharacterData {
|
||||
impl CharacterDataMethods<crate::DomTypeHolder> for CharacterData {
|
||||
// https://dom.spec.whatwg.org/#dom-characterdata-data
|
||||
fn Data(&self) -> DOMString {
|
||||
self.data.borrow().clone()
|
||||
|
|
|
@ -56,7 +56,7 @@ impl Client {
|
|||
}
|
||||
}
|
||||
|
||||
impl ClientMethods for Client {
|
||||
impl ClientMethods<crate::DomTypeHolder> for Client {
|
||||
// https://w3c.github.io/ServiceWorker/#client-url-attribute
|
||||
fn Url(&self) -> USVString {
|
||||
USVString(self.url.as_str().to_owned())
|
||||
|
|
|
@ -75,7 +75,7 @@ impl CloseEvent {
|
|||
}
|
||||
}
|
||||
|
||||
impl CloseEventMethods for CloseEvent {
|
||||
impl CloseEventMethods<crate::DomTypeHolder> for CloseEvent {
|
||||
// https://websockets.spec.whatwg.org/#the-closeevent-interface
|
||||
fn Constructor(
|
||||
global: &GlobalScope,
|
||||
|
|
|
@ -44,7 +44,7 @@ impl Comment {
|
|||
}
|
||||
}
|
||||
|
||||
impl CommentMethods for Comment {
|
||||
impl CommentMethods<crate::DomTypeHolder> for Comment {
|
||||
/// <https://dom.spec.whatwg.org/#dom-comment-comment>
|
||||
fn Constructor(
|
||||
window: &Window,
|
||||
|
|
|
@ -82,7 +82,7 @@ impl CompositionEvent {
|
|||
}
|
||||
}
|
||||
|
||||
impl CompositionEventMethods for CompositionEvent {
|
||||
impl CompositionEventMethods<crate::DomTypeHolder> for CompositionEvent {
|
||||
// https://w3c.github.io/uievents/#dom-compositionevent-compositionevent
|
||||
fn Constructor(
|
||||
window: &Window,
|
||||
|
|
|
@ -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
|
||||
fn Log(_cx: JSContext, global: &GlobalScope, messages: Vec<HandleValue>) {
|
||||
console_messages(global, messages, LogLevel::Log)
|
||||
|
|
|
@ -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
|
||||
fn Constructor(
|
||||
window: &Window,
|
||||
|
|
|
@ -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>
|
||||
fn Subtle(&self) -> DomRoot<SubtleCrypto> {
|
||||
self.subtle.or_init(|| SubtleCrypto::new(&self.global()))
|
||||
|
|
|
@ -116,7 +116,7 @@ impl CryptoKey {
|
|||
}
|
||||
}
|
||||
|
||||
impl CryptoKeyMethods for CryptoKey {
|
||||
impl CryptoKeyMethods<crate::DomTypeHolder> for CryptoKey {
|
||||
/// <https://w3c.github.io/webcrypto/#dom-cryptokey-type>
|
||||
fn Type(&self) -> KeyType {
|
||||
self.key_type
|
||||
|
|
|
@ -25,7 +25,7 @@ pub struct CSS {
|
|||
reflector_: Reflector,
|
||||
}
|
||||
|
||||
impl CSSMethods for CSS {
|
||||
impl CSSMethods<crate::DomTypeHolder> for CSS {
|
||||
/// <https://drafts.csswg.org/cssom/#the-css.escape()-method>
|
||||
fn Escape(_: &Window, ident: DOMString) -> Fallible<DOMString> {
|
||||
let mut escaped = String::new();
|
||||
|
|
|
@ -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>
|
||||
fn ConditionText(&self) -> DOMString {
|
||||
if let Some(rule) = self.downcast::<CSSMediaRule>() {
|
||||
|
|
|
@ -58,7 +58,7 @@ impl CSSGroupingRule {
|
|||
}
|
||||
}
|
||||
|
||||
impl CSSGroupingRuleMethods for CSSGroupingRule {
|
||||
impl CSSGroupingRuleMethods<crate::DomTypeHolder> for CSSGroupingRule {
|
||||
// https://drafts.csswg.org/cssom/#dom-cssgroupingrule-cssrules
|
||||
fn CssRules(&self) -> DomRoot<CSSRuleList> {
|
||||
// XXXManishearth check origin clean flag
|
||||
|
|
|
@ -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>
|
||||
fn GetLayerName(&self) -> Option<DOMString> {
|
||||
let guard = self.cssrule.shared_lock().read();
|
||||
|
|
|
@ -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
|
||||
fn Style(&self) -> DomRoot<CSSStyleDeclaration> {
|
||||
self.style_decl.or_init(|| {
|
||||
|
|
|
@ -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
|
||||
fn CssRules(&self) -> DomRoot<CSSRuleList> {
|
||||
self.rulelist()
|
||||
|
|
|
@ -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>
|
||||
fn Name(&self) -> DOMString {
|
||||
if let Some(name) = &self.layerblockrule.name {
|
||||
|
|
|
@ -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>
|
||||
fn NameList(&self, cx: SafeJSContext, retval: MutableHandleValue) {
|
||||
let names: Vec<DOMString> = self
|
||||
|
|
|
@ -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
|
||||
fn Media(&self) -> DomRoot<MediaList> {
|
||||
self.medialist()
|
||||
|
|
|
@ -50,7 +50,7 @@ impl CSSNamespaceRule {
|
|||
}
|
||||
}
|
||||
|
||||
impl CSSNamespaceRuleMethods for CSSNamespaceRule {
|
||||
impl CSSNamespaceRuleMethods<crate::DomTypeHolder> for CSSNamespaceRule {
|
||||
// https://drafts.csswg.org/cssom/#dom-cssnamespacerule-prefix
|
||||
fn Prefix(&self) -> DOMString {
|
||||
self.namespacerule
|
||||
|
|
|
@ -148,7 +148,7 @@ impl CSSRule {
|
|||
}
|
||||
}
|
||||
|
||||
impl CSSRuleMethods for CSSRule {
|
||||
impl CSSRuleMethods<crate::DomTypeHolder> for CSSRule {
|
||||
// https://drafts.csswg.org/cssom/#dom-cssrule-type
|
||||
fn Type(&self) -> u16 {
|
||||
let rule_type = self.as_specific().ty() as u16;
|
||||
|
|
|
@ -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
|
||||
fn Item(&self, idx: u32) -> Option<DomRoot<CSSRule>> {
|
||||
self.item(idx)
|
||||
|
|
|
@ -383,7 +383,7 @@ pub static ENABLED_LONGHAND_PROPERTIES: LazyLock<Vec<LonghandId>> = LazyLock::ne
|
|||
enabled_longhands
|
||||
});
|
||||
|
||||
impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
|
||||
impl CSSStyleDeclarationMethods<crate::DomTypeHolder> for CSSStyleDeclaration {
|
||||
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-length
|
||||
fn Length(&self) -> u32 {
|
||||
if self.readonly {
|
||||
|
|
|
@ -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
|
||||
fn Style(&self) -> DomRoot<CSSStyleDeclaration> {
|
||||
self.style_decl.or_init(|| {
|
||||
|
|
|
@ -114,7 +114,7 @@ impl CSSStyleSheet {
|
|||
}
|
||||
}
|
||||
|
||||
impl CSSStyleSheetMethods for CSSStyleSheet {
|
||||
impl CSSStyleSheetMethods<crate::DomTypeHolder> for CSSStyleSheet {
|
||||
// https://drafts.csswg.org/cssom/#dom-cssstylesheet-cssrules
|
||||
fn GetCssRules(&self) -> Fallible<DomRoot<CSSRuleList>> {
|
||||
if !self.origin_clean.get() {
|
||||
|
|
|
@ -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>
|
||||
fn Stringifier(&self) -> DOMString {
|
||||
DOMString::from(&*self.value)
|
||||
|
|
|
@ -332,7 +332,7 @@ fn get_callback(
|
|||
}
|
||||
}
|
||||
|
||||
impl CustomElementRegistryMethods for CustomElementRegistry {
|
||||
impl CustomElementRegistryMethods<crate::DomTypeHolder> for CustomElementRegistry {
|
||||
#[allow(unsafe_code, crown::unrooted_must_root)]
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-customelementregistry-define>
|
||||
fn Define(
|
||||
|
|
|
@ -84,7 +84,7 @@ impl CustomEvent {
|
|||
}
|
||||
}
|
||||
|
||||
impl CustomEventMethods for CustomEvent {
|
||||
impl CustomEventMethods<crate::DomTypeHolder> for CustomEvent {
|
||||
// https://dom.spec.whatwg.org/#dom-customevent-customevent
|
||||
fn Constructor(
|
||||
global: &GlobalScope,
|
||||
|
|
|
@ -646,7 +646,7 @@ unsafe extern "C" fn interrupt_callback(cx: *mut JSContext) -> bool {
|
|||
!worker.is_closing()
|
||||
}
|
||||
|
||||
impl DedicatedWorkerGlobalScopeMethods for DedicatedWorkerGlobalScope {
|
||||
impl DedicatedWorkerGlobalScopeMethods<crate::DomTypeHolder> for DedicatedWorkerGlobalScope {
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-dedicatedworkerglobalscope-postmessage>
|
||||
fn PostMessage(
|
||||
&self,
|
||||
|
|
|
@ -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
|
||||
fn GetHref(&self) -> Fallible<USVString> {
|
||||
Err(Error::Security)
|
||||
|
|
|
@ -79,7 +79,7 @@ impl DissimilarOriginWindow {
|
|||
}
|
||||
}
|
||||
|
||||
impl DissimilarOriginWindowMethods for DissimilarOriginWindow {
|
||||
impl DissimilarOriginWindowMethods<crate::DomTypeHolder> for DissimilarOriginWindow {
|
||||
// https://html.spec.whatwg.org/multipage/#dom-window
|
||||
fn Window(&self) -> DomRoot<WindowProxy> {
|
||||
self.window_proxy()
|
||||
|
|
|
@ -4269,7 +4269,7 @@ impl ProfilerMetadataFactory for Document {
|
|||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
impl DocumentMethods for Document {
|
||||
impl DocumentMethods<crate::DomTypeHolder> for Document {
|
||||
// https://dom.spec.whatwg.org/#dom-document-document
|
||||
fn Constructor(
|
||||
window: &Window,
|
||||
|
|
|
@ -62,7 +62,7 @@ impl DocumentFragment {
|
|||
}
|
||||
}
|
||||
|
||||
impl DocumentFragmentMethods for DocumentFragment {
|
||||
impl DocumentFragmentMethods<crate::DomTypeHolder> for DocumentFragment {
|
||||
// https://dom.spec.whatwg.org/#dom-documentfragment-documentfragment
|
||||
fn Constructor(
|
||||
window: &Window,
|
||||
|
|
|
@ -71,7 +71,7 @@ impl DocumentType {
|
|||
}
|
||||
}
|
||||
|
||||
impl DocumentTypeMethods for DocumentType {
|
||||
impl DocumentTypeMethods<crate::DomTypeHolder> for DocumentType {
|
||||
// https://dom.spec.whatwg.org/#dom-documenttype-name
|
||||
fn Name(&self) -> DOMString {
|
||||
self.name.clone()
|
||||
|
|
|
@ -157,7 +157,7 @@ impl DOMException {
|
|||
}
|
||||
}
|
||||
|
||||
impl DOMExceptionMethods for DOMException {
|
||||
impl DOMExceptionMethods<crate::DomTypeHolder> for DOMException {
|
||||
// https://webidl.spec.whatwg.org/#dom-domexception-domexception
|
||||
fn Constructor(
|
||||
global: &GlobalScope,
|
||||
|
|
|
@ -52,7 +52,7 @@ impl 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
|
||||
fn CreateDocumentType(
|
||||
&self,
|
||||
|
|
|
@ -66,7 +66,7 @@ impl DOMMatrix {
|
|||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
impl DOMMatrixMethods for DOMMatrix {
|
||||
impl DOMMatrixMethods<crate::DomTypeHolder> for DOMMatrix {
|
||||
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-dommatrixreadonly
|
||||
fn Constructor(
|
||||
global: &GlobalScope,
|
||||
|
|
|
@ -433,7 +433,7 @@ impl DOMMatrixReadOnly {
|
|||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
impl DOMMatrixReadOnlyMethods for DOMMatrixReadOnly {
|
||||
impl DOMMatrixReadOnlyMethods<crate::DomTypeHolder> for DOMMatrixReadOnly {
|
||||
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-dommatrixreadonly
|
||||
fn Constructor(
|
||||
global: &GlobalScope,
|
||||
|
|
|
@ -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>
|
||||
fn Constructor(
|
||||
window: &Window,
|
||||
|
|
|
@ -65,7 +65,7 @@ impl DOMPoint {
|
|||
}
|
||||
}
|
||||
|
||||
impl DOMPointMethods for DOMPoint {
|
||||
impl DOMPointMethods<crate::DomTypeHolder> for DOMPoint {
|
||||
// https://drafts.fxtf.org/geometry/#dom-dompointreadonly-dompointreadonly
|
||||
fn Constructor(
|
||||
global: &GlobalScope,
|
||||
|
|
|
@ -67,7 +67,7 @@ impl DOMPointReadOnly {
|
|||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
impl DOMPointReadOnlyMethods for DOMPointReadOnly {
|
||||
impl DOMPointReadOnlyMethods<crate::DomTypeHolder> for DOMPointReadOnly {
|
||||
// https://drafts.fxtf.org/geometry/#dom-dompoint-dompoint
|
||||
fn Constructor(
|
||||
global: &GlobalScope,
|
||||
|
|
|
@ -66,7 +66,7 @@ impl DOMQuad {
|
|||
}
|
||||
}
|
||||
|
||||
impl DOMQuadMethods for DOMQuad {
|
||||
impl DOMQuadMethods<crate::DomTypeHolder> for DOMQuad {
|
||||
// https://drafts.fxtf.org/geometry/#dom-domquad-domquad
|
||||
fn Constructor(
|
||||
global: &GlobalScope,
|
||||
|
|
|
@ -57,7 +57,7 @@ impl DOMRect {
|
|||
}
|
||||
}
|
||||
|
||||
impl DOMRectMethods for DOMRect {
|
||||
impl DOMRectMethods<crate::DomTypeHolder> for DOMRect {
|
||||
// https://drafts.fxtf.org/geometry/#dom-domrect-domrect
|
||||
fn Constructor(
|
||||
global: &GlobalScope,
|
||||
|
|
|
@ -48,7 +48,7 @@ impl DOMRectList {
|
|||
}
|
||||
}
|
||||
|
||||
impl DOMRectListMethods for DOMRectList {
|
||||
impl DOMRectListMethods<crate::DomTypeHolder> for DOMRectList {
|
||||
/// <https://drafts.fxtf.org/geometry/#DOMRectList>
|
||||
fn Item(&self, index: u32) -> Option<DomRoot<DOMRect>> {
|
||||
self.rects.borrow().get(index as usize).map(Dom::as_rooted)
|
||||
|
|
|
@ -72,7 +72,7 @@ impl DOMRectReadOnly {
|
|||
}
|
||||
}
|
||||
|
||||
impl DOMRectReadOnlyMethods for DOMRectReadOnly {
|
||||
impl DOMRectReadOnlyMethods<crate::DomTypeHolder> for DOMRectReadOnly {
|
||||
// https://drafts.fxtf.org/geometry/#dom-domrectreadonly-domrectreadonly
|
||||
fn Constructor(
|
||||
global: &GlobalScope,
|
||||
|
|
|
@ -32,7 +32,7 @@ impl 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
|
||||
fn Length(&self) -> u32 {
|
||||
self.strings.len() as u32
|
||||
|
|
|
@ -34,7 +34,7 @@ impl 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
|
||||
fn NamedDeleter(&self, name: DOMString) {
|
||||
self.element.delete_custom_attr(name)
|
||||
|
|
|
@ -101,7 +101,7 @@ impl 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>
|
||||
fn Length(&self) -> u32 {
|
||||
self.attribute()
|
||||
|
|
|
@ -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()
|
||||
fn Promise(&self) -> Rc<Promise> {
|
||||
self.promise.clone()
|
||||
|
|
|
@ -2081,7 +2081,7 @@ impl Element {
|
|||
}
|
||||
}
|
||||
|
||||
impl ElementMethods for Element {
|
||||
impl ElementMethods<crate::DomTypeHolder> for Element {
|
||||
// https://dom.spec.whatwg.org/#dom-element-namespaceuri
|
||||
fn GetNamespaceURI(&self) -> Option<DOMString> {
|
||||
Node::namespace_to_string(self.namespace.clone())
|
||||
|
|
|
@ -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>
|
||||
fn SetFormValue(
|
||||
&self,
|
||||
|
|
|
@ -102,7 +102,7 @@ impl ErrorEvent {
|
|||
}
|
||||
}
|
||||
|
||||
impl ErrorEventMethods for ErrorEvent {
|
||||
impl ErrorEventMethods<crate::DomTypeHolder> for ErrorEvent {
|
||||
// https://html.spec.whatwg.org/multipage/#errorevent
|
||||
fn Constructor(
|
||||
global: &GlobalScope,
|
||||
|
|
|
@ -387,7 +387,7 @@ impl Event {
|
|||
}
|
||||
}
|
||||
|
||||
impl EventMethods for Event {
|
||||
impl EventMethods<crate::DomTypeHolder> for Event {
|
||||
/// <https://dom.spec.whatwg.org/#dom-event-event>
|
||||
fn Constructor(
|
||||
global: &GlobalScope,
|
||||
|
|
|
@ -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
|
||||
fn Constructor(
|
||||
global: &GlobalScope,
|
||||
|
|
|
@ -783,7 +783,7 @@ impl EventTarget {
|
|||
}
|
||||
}
|
||||
|
||||
impl EventTargetMethods for EventTarget {
|
||||
impl EventTargetMethods<crate::DomTypeHolder> for EventTarget {
|
||||
// https://dom.spec.whatwg.org/#dom-eventtarget-eventtarget
|
||||
fn Constructor(
|
||||
global: &GlobalScope,
|
||||
|
|
|
@ -67,7 +67,7 @@ impl ExtendableEvent {
|
|||
}
|
||||
}
|
||||
|
||||
impl ExtendableEventMethods for ExtendableEvent {
|
||||
impl ExtendableEventMethods<crate::DomTypeHolder> for ExtendableEvent {
|
||||
// https://w3c.github.io/ServiceWorker/#dom-extendableevent-extendableevent
|
||||
fn Constructor(
|
||||
worker: &ServiceWorkerGlobalScope,
|
||||
|
|
|
@ -161,7 +161,7 @@ impl ExtendableMessageEvent {
|
|||
}
|
||||
}
|
||||
|
||||
impl ExtendableMessageEventMethods for ExtendableMessageEvent {
|
||||
impl ExtendableMessageEventMethods<crate::DomTypeHolder> for ExtendableMessageEvent {
|
||||
/// <https://w3c.github.io/ServiceWorker/#dom-extendablemessageevent-extendablemessageevent>
|
||||
fn Constructor(
|
||||
worker: &ServiceWorkerGlobalScope,
|
||||
|
|
|
@ -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>
|
||||
fn SetViews(
|
||||
&self,
|
||||
|
|
|
@ -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>
|
||||
fn SetPointerOrigin(&self, origin: &FakeXRRigidTransformInit, _emulated: bool) -> Fallible<()> {
|
||||
self.send_message(MockInputMsg::SetPointerOrigin(Some(get_origin(origin)?)));
|
||||
|
|
|
@ -102,7 +102,7 @@ impl File {
|
|||
}
|
||||
}
|
||||
|
||||
impl FileMethods for File {
|
||||
impl FileMethods<crate::DomTypeHolder> for File {
|
||||
// https://w3c.github.io/FileAPI/#file-constructor
|
||||
#[allow(non_snake_case)]
|
||||
fn Constructor(
|
||||
|
|
|
@ -43,7 +43,7 @@ impl FileList {
|
|||
}
|
||||
}
|
||||
|
||||
impl FileListMethods for FileList {
|
||||
impl FileListMethods<crate::DomTypeHolder> for FileList {
|
||||
// https://w3c.github.io/FileAPI/#dfn-length
|
||||
fn Length(&self) -> u32 {
|
||||
self.list.len() as u32
|
||||
|
|
|
@ -326,7 +326,7 @@ impl FileReader {
|
|||
}
|
||||
}
|
||||
|
||||
impl FileReaderMethods for FileReader {
|
||||
impl FileReaderMethods<crate::DomTypeHolder> for FileReader {
|
||||
// https://w3c.github.io/FileAPI/#filereaderConstrctr
|
||||
fn Constructor(
|
||||
global: &GlobalScope,
|
||||
|
|
|
@ -51,7 +51,7 @@ impl FileReaderSync {
|
|||
}
|
||||
}
|
||||
|
||||
impl FileReaderSyncMethods for FileReaderSync {
|
||||
impl FileReaderSyncMethods<crate::DomTypeHolder> for FileReaderSync {
|
||||
/// <https://w3c.github.io/FileAPI/#filereadersyncConstrctr>
|
||||
fn Constructor(
|
||||
global: &GlobalScope,
|
||||
|
|
|
@ -96,7 +96,7 @@ impl FocusEvent {
|
|||
}
|
||||
}
|
||||
|
||||
impl FocusEventMethods for FocusEvent {
|
||||
impl FocusEventMethods<crate::DomTypeHolder> for FocusEvent {
|
||||
// https://w3c.github.io/uievents/#dom-focusevent-focusevent
|
||||
fn Constructor(
|
||||
window: &Window,
|
||||
|
|
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