script: Move code generation and webidl files to new script_bindings crate. (#35157)

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2025-01-24 15:47:43 -05:00 committed by GitHub
parent a88b59534f
commit af8d7c2de7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
469 changed files with 187 additions and 137 deletions

View file

@ -21,17 +21,12 @@ tracing = ["dep:tracing"]
webgl_backtrace = ["canvas_traits/webgl_backtrace"]
js_backtrace = []
refcell_backtrace = ["accountable-refcell"]
webxr = ["webxr-api"]
webgpu = []
webxr = ["webxr-api", "script_bindings/webxr"]
webgpu = ["script_bindings/webgpu"]
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(crown)'] }
[build-dependencies]
phf_codegen = "0.11"
phf_shared = "0.11"
serde_json = { workspace = true }
[dependencies]
aes = { workspace = true }
aes-kw = { workspace = true }
@ -99,6 +94,7 @@ range = { path = "../range" }
ref_filter_map = "1.0.1"
regex = { workspace = true }
ring = { workspace = true }
script_bindings = { path = "../script_bindings" }
script_layout_interface = { workspace = true }
script_traits = { workspace = true }
selectors = { workspace = true }

View file

@ -2,121 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
use std::process::Command;
use std::time::Instant;
use std::{env, fmt};
use phf_shared::{self, FmtConst};
use serde_json::{self, Value};
use std::env;
fn main() {
let start = Instant::now();
let style_out_dir = PathBuf::from(env::var_os("DEP_SERVO_STYLE_CRATE_OUT_DIR").unwrap());
let css_properties_json = style_out_dir.join("css-properties.json");
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
println!("cargo::rerun-if-changed=dom/webidls");
println!("cargo::rerun-if-changed=dom/bindings/codegen");
println!("cargo::rerun-if-changed={}", css_properties_json.display());
println!("cargo::rerun-if-changed=../../third_party/WebIDL/WebIDL.py");
// NB: We aren't handling changes in `third_party/ply` here.
let status = Command::new(find_python())
.arg("dom/bindings/codegen/run.py")
.arg(&css_properties_json)
.arg(&out_dir)
.status()
.unwrap();
if !status.success() {
std::process::exit(1)
}
println!("Binding generation completed in {:?}", start.elapsed());
let json = out_dir.join("InterfaceObjectMapData.json");
let json: Value = serde_json::from_reader(File::open(json).unwrap()).unwrap();
let mut map = phf_codegen::Map::new();
for (key, value) in json.as_object().unwrap() {
map.entry(Bytes(key), value.as_str().unwrap());
}
let phf = PathBuf::from(env::var_os("OUT_DIR").unwrap()).join("InterfaceObjectMapPhf.rs");
let mut phf = File::create(phf).unwrap();
writeln!(
&mut phf,
"pub(crate) static MAP: phf::Map<&'static [u8], fn(JSContext, HandleObject)> = {};",
map.build(),
)
.unwrap();
}
#[derive(Eq, Hash, PartialEq)]
struct Bytes<'a>(&'a str);
impl FmtConst for Bytes<'_> {
fn fmt_const(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
write!(formatter, "b\"{}\"", self.0)
}
}
impl phf_shared::PhfHash for Bytes<'_> {
fn phf_hash<H: std::hash::Hasher>(&self, hasher: &mut H) {
self.0.as_bytes().phf_hash(hasher)
}
}
/// Tries to find a suitable python
///
/// Algorithm
/// 1. Trying to find python3/python in $VIRTUAL_ENV (this should be from Servo's venv)
/// 2. Checking PYTHON3 (set by mach)
/// 3. Falling back to the system installation.
///
/// Note: This function should be kept in sync with the version in `components/servo/build.rs`
fn find_python() -> PathBuf {
let mut candidates = vec![];
if let Some(venv) = env::var_os("VIRTUAL_ENV") {
let bin_directory = PathBuf::from(venv).join("bin");
let python3 = bin_directory.join("python3");
if python3.exists() {
candidates.push(python3);
}
let python = bin_directory.join("python");
if python.exists() {
candidates.push(python);
}
};
if let Some(python3) = env::var_os("PYTHON3") {
let python3 = PathBuf::from(python3);
if python3.exists() {
candidates.push(python3);
}
}
let system_python = ["python3", "python"].map(PathBuf::from);
candidates.extend_from_slice(&system_python);
for name in &candidates {
// Command::new() allows us to omit the `.exe` suffix on windows
if Command::new(name)
.arg("--version")
.output()
.is_ok_and(|out| out.status.success())
{
return name.to_owned();
}
}
let candidates = candidates
.into_iter()
.map(|c| c.into_os_string())
.collect::<Vec<_>>();
panic!(
"Can't find python (tried {:?})! Try enabling Servo's Python venv, \
setting the PYTHON3 env var or adding python3 to PATH.",
candidates.join(", ".as_ref())
)
println!(
"cargo:rustc-env=BINDINGS_OUT_DIR={}",
env::var("DEP_SCRIPT_BINDINGS_CRATE_OUT_DIR").unwrap(),
);
}

View file

@ -1,615 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# DOM Bindings Configuration.
#
# The WebIDL interfaces are defined in dom/webidls. For each such interface,
# there is a corresponding entry in the configuration table below.
# The configuration table maps each interface name to a |descriptor|.
#
# Valid fields for all descriptors:
# * outerObjectHook: string to use in place of default value for outerObject and thisObject
# JS class hooks
DOMInterfaces = {
'AbstractRange': {
'weakReferenceable': True,
},
'AudioContext': {
'inRealms': ['Close', 'Suspend'],
'canGc':['CreateMediaStreamDestination', 'CreateMediaElementSource', 'CreateMediaStreamSource', 'CreateMediaStreamTrackSource', 'Suspend', 'Close'],
},
'BaseAudioContext': {
'inRealms': ['DecodeAudioData', 'Resume', 'ParseFromString', 'GetBounds', 'GetClientRects'],
'canGc': ['CreateChannelMerger', 'CreateOscillator', 'CreateStereoPanner', 'CreateGain', 'CreateIIRFilter', 'CreateBiquadFilter', 'CreateBufferSource', 'CreateAnalyser', 'CreatePanner', 'CreateChannelSplitter', 'CreateBuffer', 'CreateConstantSource', 'Resume', 'DecodeAudioData'],
},
'Blob': {
'weakReferenceable': True,
'canGc': ['Slice', 'Text', 'ArrayBuffer', 'Stream'],
},
'Bluetooth': {
'inRealms': ['GetAvailability', 'RequestDevice'],
'canGc': ['RequestDevice', 'GetAvailability'],
},
'BluetoothDevice': {
'inRealms': ['WatchAdvertisements'],
'canGc': ['WatchAdvertisements'],
},
'BluetoothRemoteGATTCharacteristic': {
'inRealms': ['ReadValue', 'StartNotifications', 'StopNotifications', 'WriteValue'],
'canGc': ['GetDescriptor', 'GetDescriptors', 'ReadValue', 'StartNotifications', 'StopNotifications', 'WriteValue'],
},
'BluetoothRemoteGATTDescriptor': {
'inRealms': ['ReadValue', 'WriteValue'],
'canGc': ['ReadValue', 'WriteValue'],
},
'BluetoothRemoteGATTServer': {
'inRealms': ['Connect'],
'canGc': ['GetPrimaryService', 'GetPrimaryServices', 'Connect', 'Disconnect'],
},
'BluetoothRemoteGATTService': {
'canGc': ['GetCharacteristic', 'GetCharacteristics', 'GetIncludedService', 'GetIncludedServices'],
},
'CanvasGradient': {
'canGc': ['AddColorStop'],
},
'CanvasRenderingContext2D': {
'canGc': ['GetTransform','GetImageData', 'CreateImageData', 'CreateImageData_', 'SetFont', 'FillText', 'MeasureText', 'SetStrokeStyle', 'SetFillStyle', 'SetShadowColor'],
},
'CharacterData': {
'canGc': ['Before', 'After', 'ReplaceWith']
},
'CSSStyleDeclaration': {
'canGc': ['RemoveProperty', 'SetCssText', 'GetPropertyValue', 'SetProperty', 'CssFloat', 'SetCssFloat']
},
'CustomElementRegistry': {
'inRealms': ['WhenDefined'],
'canGc': ['WhenDefined'],
},
'DataTransfer': {
'canGc': ['Files']
},
'DataTransferItem': {
'canGc': ['GetAsFile']
},
'DataTransferItemList': {
'canGc': ['IndexedGetter', 'Add', 'Add_']
},
'Document': {
'canGc': ['Close', 'CreateElement', 'CreateElementNS', 'ImportNode', 'SetTitle', 'Write', 'Writeln', 'CreateEvent', 'CreateRange', 'Open', 'Open_', 'CreateComment', 'CreateAttribute', 'CreateAttributeNS', 'CreateDocumentFragment', 'CreateTextNode', 'CreateCDATASection', 'CreateProcessingInstruction', 'Prepend', 'Append', 'ReplaceChildren', 'SetBgColor', 'SetFgColor', 'Fonts', 'ElementFromPoint', 'ElementsFromPoint', 'ExitFullscreen', 'CreateExpression', 'CreateNSResolver', 'Evaluate'],
},
'DocumentFragment': {
'canGc': ['Prepend', 'Append', 'ReplaceChildren']
},
'DocumentType': {
'canGc': ['Before', 'After', 'ReplaceWith']
},
'DOMImplementation': {
'canGc': ['CreateDocument', 'CreateHTMLDocument', 'CreateDocumentType'],
},
'DOMMatrix': {
'canGc': ['FromMatrix', 'FromFloat32Array', 'FromFloat64Array'],
},
'DOMMatrixReadOnly': {
'canGc': ['Multiply', 'Inverse', 'Scale', 'Translate', 'Rotate', 'RotateFromVector','FlipY', 'ScaleNonUniform', 'Scale3d', 'RotateAxisAngle', 'SkewX', 'SkewY', 'FlipX', 'TransformPoint', 'FromFloat32Array', 'FromFloat64Array','FromMatrix'],
},
'DOMParser': {
'canGc': ['ParseFromString'],
},
'DOMPoint': {
'canGc': ['FromPoint'],
},
'DOMPointReadOnly': {
'canGc': ['FromPoint'],
},
'DOMQuad': {
'canGc': ['FromRect', 'FromQuad', 'GetBounds'],
},
'DOMStringMap': {
'canGc': ['NamedSetter']
},
"DOMTokenList": {
'canGc': ['SetValue', 'Add', 'Remove', 'Toggle', 'Replace']
},
'DynamicModuleOwner': {
'inRealms': ['PromiseAttribute'],
},
'Element': {
'canGc': ['SetInnerHTML', 'SetOuterHTML', 'InsertAdjacentHTML', 'GetClientRects', 'GetBoundingClientRect', 'InsertAdjacentText', 'ToggleAttribute', 'SetAttribute', 'SetAttributeNS', 'SetId','SetClassName','Prepend','Append','ReplaceChildren','Before','After','ReplaceWith', 'SetRole', 'SetAriaAtomic', 'SetAriaAutoComplete', 'SetAriaBrailleLabel', 'SetAriaBrailleRoleDescription', 'SetAriaBusy', 'SetAriaChecked', 'SetAriaColCount', 'SetAriaColIndex', 'SetAriaColIndexText', 'SetAriaColSpan', 'SetAriaCurrent', 'SetAriaDescription', 'SetAriaDisabled', 'SetAriaExpanded', 'SetAriaHasPopup', 'SetAriaHidden', 'SetAriaInvalid', 'SetAriaKeyShortcuts', 'SetAriaLabel', 'SetAriaLevel', 'SetAriaLive', 'SetAriaModal', 'SetAriaMultiLine', 'SetAriaMultiSelectable', 'SetAriaOrientation', 'SetAriaPlaceholder', 'SetAriaPosInSet', 'SetAriaPressed','SetAriaReadOnly', 'SetAriaRelevant', 'SetAriaRequired', 'SetAriaRoleDescription', 'SetAriaRowCount', 'SetAriaRowIndex', 'SetAriaRowIndexText', 'SetAriaRowSpan', 'SetAriaSelected', 'SetAriaSetSize','SetAriaSort', 'SetAriaValueMax', 'SetAriaValueMin', 'SetAriaValueNow', 'SetAriaValueText', 'SetScrollTop', 'SetScrollLeft', 'Scroll', 'Scroll_', 'ScrollBy', 'ScrollBy_', 'ScrollWidth', 'ScrollHeight', 'ScrollTop', 'ScrollLeft', 'ClientTop', 'ClientLeft', 'ClientWidth', 'ClientHeight', 'RequestFullscreen'],
},
'ElementInternals': {
'canGc': ['CheckValidity', 'ReportValidity'],
},
'EventSource': {
'weakReferenceable': True,
},
'EventTarget': {
'canGc': ['DispatchEvent'],
},
'FakeXRDevice': {
'canGc': ['Disconnect'],
},
'File': {
'weakReferenceable': True,
},
'FileReader': {
'canGc': ['Abort'],
},
'GamepadHapticActuator': {
'inRealms': ['PlayEffect', 'Reset'],
'canGc': ['PlayEffect', 'Reset'],
},
'GPU': {
'inRealms': ['RequestAdapter'],
'canGc': ['RequestAdapter', 'WgslLanguageFeatures'],
},
'GPUAdapter': {
'inRealms': ['RequestAdapterInfo', 'RequestDevice'],
'canGc': ['RequestAdapterInfo', 'RequestDevice'],
},
'GPUBuffer': {
'inRealms': ['MapAsync'],
'canGc': ['MapAsync'],
},
'GPUCanvasContext': {
'weakReferenceable': True,
},
'GPUDevice': {
'inRealms': [
'CreateComputePipelineAsync',
'CreateRenderPipelineAsync',
'CreateShaderModule', # Creates promise for compilation info
'PopErrorScope'
],
'canGc': [
'CreateComputePipelineAsync',
'CreateRenderPipelineAsync',
'CreateShaderModule',
'PopErrorScope'
],
'weakReferenceable': True, # for usage in GlobalScope https://github.com/servo/servo/issues/32519
},
'GPUQueue': {
'canGc': ['OnSubmittedWorkDone'],
},
'History': {
'canGc': ['Go'],
},
"HTMLAnchorElement": {
"canGc": ["SetText","SetRel","SetHref", 'SetHash', 'SetHost', 'SetHostname', 'SetPassword', 'SetPathname', 'SetPort', 'SetProtocol', 'SetSearch', 'SetUsername']
},
"HTMLAreaElement": {
"canGc": ["SetRel"]
},
"HTMLBodyElement": {
"canGc": ["SetBackground"]
},
'HTMLButtonElement': {
'canGc': ['CheckValidity', 'ReportValidity','SetBackground'],
},
'HTMLCanvasElement': {
'canGc': ['CaptureStream', 'GetContext'],
},
'HTMLDialogElement': {
'canGc': ['Show'],
},
'HTMLElement': {
'canGc': ['Focus', 'Blur', 'Click', 'SetInnerText', 'SetOuterText', "SetTranslate", 'SetAutofocus', 'GetOffsetParent', 'OffsetTop', 'OffsetLeft', 'OffsetWidth', 'OffsetHeight', 'InnerText', 'GetOuterText', 'GetOnerror', 'GetOnload', 'GetOnblur', 'GetOnfocus', 'GetOnresize', 'GetOnscroll'],
},
'HTMLFieldSetElement': {
'canGc': ['CheckValidity', 'ReportValidity'],
},
'HTMLFontElement': {
'canGc': ['SetSize']
},
'HTMLFormElement': {
'canGc': ['CheckValidity', 'RequestSubmit', 'ReportValidity', 'Submit', 'Reset', 'SetRel'],
},
'HTMLImageElement': {
'canGc': ['RequestSubmit', 'ReportValidity', 'Reset','SetRel', 'Width', 'Height', 'Decode', 'SetCrossOrigin', 'SetWidth', 'SetHeight', 'SetReferrerPolicy'],
},
'HTMLInputElement': {
'canGc': ['ReportValidity', 'SetValue', 'SetValueAsNumber', 'SetValueAsDate', 'StepUp', 'StepDown', 'CheckValidity', 'ReportValidity', 'SelectFiles'],
},
'HTMLLinkElement': {
'canGc': ['SetRel', 'SetCrossOrigin'],
},
'HTMLMediaElement': {
'canGc': ['Load', 'Pause', 'Play', 'SetSrcObject', 'SetCrossOrigin'],
'inRealms': ['Play'],
},
'HTMLMeterElement': {
'canGc': ['SetValue', 'SetMin', 'SetMax', 'SetLow', 'SetHigh', 'SetOptimum', 'CheckValidity', 'ReportValidity']
},
'HTMLObjectElement': {
'canGc': ['CheckValidity', 'ReportValidity'],
},
'HTMLOptionElement': {
'canGc': ['SetText']
},
'HTMLOptionsCollection': {
'canGc': ['IndexedSetter', 'SetLength']
},
'HTMLOutputElement': {
'canGc': ['ReportValidity', 'SetDefaultValue', 'SetValue', 'CheckValidity'],
},
'HTMLProgressElement': {
'canGc': ['SetValue', 'SetMax']
},
'HTMLScriptElement': {
'canGc': ['SetAsync', 'SetCrossOrigin', 'SetText']
},
'HTMLSelectElement': {
'canGc': ['ReportValidity', 'SetLength', 'IndexedSetter', 'CheckValidity'],
},
'HTMLTableElement': {
'canGc': ['CreateCaption', 'CreateTBody', 'InsertRow', 'InsertCell', 'InsertRow', 'CreateTHead', 'CreateTFoot']
},
'HTMLTableRowElement': {
'canGc': ['InsertCell']
},
'HTMLTableSectionElement': {
'canGc': ['InsertRow']
},
'HTMLTemplateElement': {
'canGc': ['Content'],
},
'HTMLTextAreaElement': {
'canGc': ['ReportValidity', 'SetDefaultValue', 'CheckValidity'],
},
'HTMLTitleElement': {
'canGc': ['SetText']
},
'Location': {
'canGc': ['Assign', 'Reload', 'Replace', 'SetHash', 'SetHost', 'SetHostname', 'SetHref', 'SetPathname', 'SetPort', 'SetProtocol', 'SetSearch'],
},
'MediaDevices': {
'canGc': ['GetUserMedia', 'EnumerateDevices'],
'inRealms': ['GetUserMedia', 'GetClientRects', 'GetBoundingClientRect'],
},
'MediaQueryList': {
'weakReferenceable': True,
},
'MediaSession': {
'canGc': ['GetMetadata'],
},
'MediaStream': {
'canGc': ['Clone'],
},
'MessagePort': {
'weakReferenceable': True,
'canGc': ['GetOnmessage'],
},
'MouseEvent': {
'canGc': ['OffsetX', 'OffsetY'],
},
'NavigationPreloadManager': {
'inRealms': ['Disable', 'Enable', 'GetState', 'SetHeaderValue'],
'canGc': ['Disable', 'Enable', 'GetState', 'SetHeaderValue'],
},
'Navigator': {
'inRealms': ['GetVRDisplays'],
},
'Node': {
'canGc': ['CloneNode', 'SetTextContent'],
},
'OfflineAudioContext': {
'inRealms': ['StartRendering'],
'canGc': ['StartRendering'],
},
'OffscreenCanvasRenderingContext2D': {
'canGc': ['CreateImageData', 'CreateImageData_', 'GetImageData', 'GetTransform', 'SetFont', 'FillText', 'MeasureText', 'SetStrokeStyle', 'SetFillStyle', 'SetShadowColor'],
},
'PaintRenderingContext2D': {
'canGc': ['GetTransform', 'SetStrokeStyle', 'SetFillStyle', 'SetShadowColor'],
},
'Performance': {
'canGc': ['Mark', 'Measure'],
},
'Permissions': {
'canGc': ['Query', 'Request', 'Revoke'],
},
'Promise': {
'spiderMonkeyInterface': True,
},
'Range': {
'canGc': ['CloneContents', 'CloneRange', 'CreateContextualFragment', 'ExtractContents', 'SurroundContents', 'InsertNode'],
'weakReferenceable': True,
},
'Request': {
'canGc': ['Headers', 'Text', 'Blob', 'FormData', 'Json', 'ArrayBuffer', 'Clone'],
},
'Response': {
'canGc': ['Error', 'Redirect', 'Clone', 'Text', 'Blob', 'FormData', 'Json', 'ArrayBuffer', 'Headers'],
},
'RTCPeerConnection': {
'inRealms': ['AddIceCandidate', 'CreateAnswer', 'CreateOffer', 'SetLocalDescription', 'SetRemoteDescription'],
'canGc': ['Close', 'AddIceCandidate', 'CreateAnswer', 'CreateOffer', 'SetLocalDescription', 'SetRemoteDescription'],
},
'RTCRtpSender': {
'canGc': ['SetParameters'],
},
'Selection': {
'canGc': ['Collapse', 'CollapseToEnd', 'CollapseToStart', 'Extend', 'SelectAllChildren', 'SetBaseAndExtent', 'SetPosition'],
},
'ServiceWorkerContainer': {
'inRealms': ['Register'],
'canGc': ['Register'],
},
'ShadowRoot': {
'canGc': ['ElementFromPoint', 'ElementsFromPoint', 'SetInnerHTML'],
},
'StaticRange': {
'weakReferenceable': True,
},
'SubtleCrypto': {
'inRealms': ['Encrypt', 'Decrypt', 'Sign', 'Verify', 'GenerateKey', 'DeriveKey', 'DeriveBits', 'Digest', 'ImportKey', 'ExportKey', 'WrapKey', 'UnwrapKey'],
'canGc': ['Encrypt', 'Decrypt', 'Sign', 'Verify', 'GenerateKey', 'DeriveKey', 'DeriveBits', 'Digest', 'ImportKey', 'ExportKey', 'WrapKey', 'UnwrapKey'],
},
'SVGElement': {
'canGc': ['SetAutofocus']
},
#FIXME(jdm): This should be 'register': False, but then we don't generate enum types
'TestBinding': {
'inRealms': ['PromiseAttribute', 'PromiseNativeHandler'],
'canGc': ['InterfaceAttribute', 'GetInterfaceAttributeNullable', 'ReceiveInterface', 'ReceiveInterfaceSequence', 'ReceiveNullableInterface', 'PromiseAttribute', 'PromiseNativeHandler'],
},
'TestWorklet': {
'inRealms': ['AddModule'],
'canGc': ['AddModule'],
},
'Text': {
'canGc': ['SplitText']
},
'URL': {
'weakReferenceable': True,
'canGc': ['Parse', 'SearchParams'],
},
'WebGLRenderingContext': {
'canGc': ['MakeXRCompatible'],
},
'WebGL2RenderingContext': {
'canGc': ['MakeXRCompatible'],
},
'Window': {
'canGc': ['Stop', 'Fetch', 'Scroll', 'Scroll_','ScrollBy', 'ScrollBy_', 'Stop', 'Fetch', 'Open', 'CreateImageBitmap'],
'inRealms': ['Fetch', 'GetOpener'],
},
'WindowProxy' : {
'path': 'crate::dom::windowproxy::WindowProxy',
'register': False,
},
'WorkerGlobalScope': {
'inRealms': ['Fetch'],
'canGc': ['Fetch', 'CreateImageBitmap', 'ImportScripts'],
},
'Worklet': {
'inRealms': ['AddModule'],
'canGc': ['AddModule'],
},
'XMLHttpRequest': {
'canGc': ['Abort', 'GetResponseXML', 'Response', 'Send'],
},
'XPathEvaluator': {
'canGc': ['CreateExpression', 'Evaluate'],
},
'XPathExpression': {
'canGc': ['Evaluate'],
},
'XRBoundedReferenceSpace': {
'canGc': ['BoundsGeometry'],
},
'XRFrame': {
'canGc': ['GetViewerPose', 'GetPose', 'GetJointPose'],
},
'XRHitTestResult': {
'canGc': ['GetPose'],
},
'XRRay': {
'canGc': ['Origin', 'Direction'],
},
'XRReferenceSpace': {
'canGc': ['GetOffsetReferenceSpace'],
},
'XRRigidTransform': {
'canGc': ['Position', 'Orientation', 'Inverse'],
},
'XRSession': {
'inRealms': ['RequestReferenceSpace', 'UpdateRenderState', 'UpdateTargetFrameRate'],
'canGc': ['End', 'RequestReferenceSpace', 'UpdateTargetFrameRate', 'RequestHitTestSource'],
},
'XRSystem': {
'inRealms': ['RequestSession'],
'canGc': ['RequestSession', 'IsSessionSupported'],
},
'XRTest': {
'canGc': ['SimulateDeviceConnection', 'DisconnectAllDevices'],
},
'ReadableStream': {
'canGc': ['GetReader', 'Cancel', 'Tee'],
},
"ReadableStreamDefaultController": {
"canGc": ["Enqueue"]
},
"ReadableStreamBYOBReader": {
"canGc": ["Read", "Cancel"]
},
"ReadableStreamDefaultReader": {
"canGc": ["Read", "Cancel"]
},
}
Dictionaries = {
'GPUCanvasConfiguration': {
'derives': ['Clone']
},
'GPUExtent3DDict': {
'derives': ["MallocSizeOf"],
},
'GPUObjectDescriptorBase': {
'derives': ['MallocSizeOf']
},
'GPUTextureDescriptor': {
'derives': ["MallocSizeOf"],
},
'HeadersInit': {
'derives': ["Clone"],
},
}
Enums = {
'GPUFeatureName': {
'derives': ['Hash', 'Eq']
}
}
Unions = {
'ByteStringSequenceSequenceOrByteStringByteStringRecord': {
'derives': ['Clone']
},
'HTMLCanvasElementOrOffscreenCanvas': {
'derives': ['Clone', 'MallocSizeOf']
},
'RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict': {
'derives': ['MallocSizeOf']
},
'StringOrUnsignedLong': {
'derives': ['Clone'],
},
}

File diff suppressed because it is too large Load diff

View file

@ -1,553 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
import functools
import os
from WebIDL import IDLExternalInterface, IDLSequenceType, IDLWrapperType, WebIDLError
class Configuration:
"""
Represents global configuration state based on IDL parse data and
the configuration file.
"""
def __init__(self, filename, parseData):
# Read the configuration file.
glbl = {}
exec(compile(open(filename).read(), filename, 'exec'), glbl)
config = glbl['DOMInterfaces']
self.enumConfig = glbl['Enums']
self.dictConfig = glbl['Dictionaries']
self.unionConfig = glbl['Unions']
# Build descriptors for all the interfaces we have in the parse data.
# This allows callers to specify a subset of interfaces by filtering
# |parseData|.
self.descriptors = []
self.interfaces = {}
self.maxProtoChainLength = 0
for thing in parseData:
# Servo does not support external interfaces.
if isinstance(thing, IDLExternalInterface):
raise WebIDLError("Servo does not support external interfaces.",
[thing.location])
assert not thing.isType()
if not thing.isInterface() and not thing.isNamespace():
continue
iface = thing
self.interfaces[iface.identifier.name] = iface
if iface.identifier.name not in config:
entry = {}
else:
entry = config[iface.identifier.name]
if not isinstance(entry, list):
assert isinstance(entry, dict)
entry = [entry]
self.descriptors.extend(
[Descriptor(self, iface, x) for x in entry])
# Mark the descriptors for which only a single nativeType implements
# an interface.
for descriptor in self.descriptors:
interfaceName = descriptor.interface.identifier.name
otherDescriptors = [d for d in self.descriptors
if d.interface.identifier.name == interfaceName]
descriptor.uniqueImplementation = len(otherDescriptors) == 1
self.enums = [e for e in parseData if e.isEnum()]
self.typedefs = [e for e in parseData if e.isTypedef()]
self.dictionaries = [d for d in parseData if d.isDictionary()]
self.callbacks = [c for c in parseData if
c.isCallback() and not c.isInterface()]
# Keep the descriptor list sorted for determinism.
def cmp(x, y):
return (x > y) - (x < y)
self.descriptors.sort(key=functools.cmp_to_key(lambda x, y: cmp(x.name, y.name)))
def getInterface(self, ifname):
return self.interfaces[ifname]
def getDescriptors(self, **filters):
"""Gets the descriptors that match the given filters."""
curr = self.descriptors
for key, val in filters.items():
if key == 'webIDLFile':
def getter(x):
return x.interface.location.filename
elif key == 'hasInterfaceObject':
def getter(x):
return x.interface.hasInterfaceObject()
elif key == 'isCallback':
def getter(x):
return x.interface.isCallback()
elif key == 'isNamespace':
def getter(x):
return x.interface.isNamespace()
elif key == 'isJSImplemented':
def getter(x):
return x.interface.isJSImplemented()
elif key == 'isGlobal':
def getter(x):
return x.isGlobal()
elif key == 'isInline':
def getter(x):
return x.interface.getExtendedAttribute('Inline') is not None
elif key == 'isExposedConditionally':
def getter(x):
return x.interface.isExposedConditionally()
elif key == 'isIteratorInterface':
def getter(x):
return x.interface.isIteratorInterface()
else:
def getter(x):
return getattr(x, key)
curr = [x for x in curr if getter(x) == val]
return curr
def getEnums(self, webIDLFile):
return [e for e in self.enums if e.filename == webIDLFile]
def getEnumConfig(self, name):
return self.enumConfig.get(name, {})
def getTypedefs(self, webIDLFile):
return [e for e in self.typedefs if e.filename == webIDLFile]
@staticmethod
def _filterForFile(items, webIDLFile=""):
"""Gets the items that match the given filters."""
if not webIDLFile:
return items
return [x for x in items if x.filename == webIDLFile]
def getUnionConfig(self, name):
return self.unionConfig.get(name, {})
def getDictionaries(self, webIDLFile=""):
return self._filterForFile(self.dictionaries, webIDLFile=webIDLFile)
def getDictConfig(self, name):
return self.dictConfig.get(name, {})
def getCallbacks(self, webIDLFile=""):
return self._filterForFile(self.callbacks, webIDLFile=webIDLFile)
def getDescriptor(self, interfaceName):
"""
Gets the appropriate descriptor for the given interface name.
"""
iface = self.getInterface(interfaceName)
descriptors = self.getDescriptors(interface=iface)
# We should have exactly one result.
if len(descriptors) != 1:
raise NoSuchDescriptorError("For " + interfaceName + " found "
+ str(len(descriptors)) + " matches")
return descriptors[0]
def getDescriptorProvider(self):
"""
Gets a descriptor provider that can provide descriptors as needed.
"""
return DescriptorProvider(self)
class NoSuchDescriptorError(TypeError):
def __init__(self, str):
TypeError.__init__(self, str)
class DescriptorProvider:
"""
A way of getting descriptors for interface names
"""
def __init__(self, config):
self.config = config
def getDescriptor(self, interfaceName):
"""
Gets the appropriate descriptor for the given interface name given the
context of the current descriptor.
"""
return self.config.getDescriptor(interfaceName)
def MemberIsLegacyUnforgeable(member, descriptor):
return ((member.isAttr() or member.isMethod())
and not member.isStatic()
and (member.isLegacyUnforgeable()
or bool(descriptor.interface.getExtendedAttribute("LegacyUnforgeable"))))
class Descriptor(DescriptorProvider):
"""
Represents a single descriptor for an interface. See Bindings.conf.
"""
def __init__(self, config, interface, desc):
DescriptorProvider.__init__(self, config)
self.interface = interface
if not self.isExposedConditionally():
if interface.parent and interface.parent.isExposedConditionally():
raise TypeError("%s is not conditionally exposed but inherits from "
"%s which is" %
(interface.identifier.name, interface.parent.identifier.name))
# Read the desc, and fill in the relevant defaults.
ifaceName = self.interface.identifier.name
nativeTypeDefault = ifaceName
# For generated iterator interfaces for other iterable interfaces, we
# just use IterableIterator as the native type, templated on the
# nativeType of the iterable interface. That way we can have a
# templated implementation for all the duplicated iterator
# functionality.
if self.interface.isIteratorInterface():
itrName = self.interface.iterableInterface.identifier.name
itrDesc = self.getDescriptor(itrName)
nativeTypeDefault = iteratorNativeType(itrDesc)
typeName = desc.get('nativeType', nativeTypeDefault)
spiderMonkeyInterface = desc.get('spiderMonkeyInterface', False)
# Callback and SpiderMonkey types do not use JS smart pointers, so we should not use the
# built-in rooting mechanisms for them.
if spiderMonkeyInterface:
self.returnType = 'Rc<%s>' % typeName
self.argumentType = '&%s' % typeName
self.nativeType = typeName
pathDefault = 'crate::dom::types::%s' % typeName
elif self.interface.isCallback():
ty = 'crate::dom::bindings::codegen::Bindings::%sBinding::%s' % (ifaceName, ifaceName)
pathDefault = ty
self.returnType = "Rc<%s>" % ty
self.argumentType = "???"
self.nativeType = ty
else:
self.returnType = "DomRoot<%s>" % typeName
self.argumentType = "&%s" % typeName
self.nativeType = "*const %s" % typeName
if self.interface.isIteratorInterface():
pathDefault = 'crate::dom::bindings::iterable::IterableIterator'
else:
pathDefault = 'crate::dom::types::%s' % MakeNativeName(typeName)
self.concreteType = typeName
self.register = desc.get('register', True)
self.path = desc.get('path', pathDefault)
self.inRealmMethods = [name for name in desc.get('inRealms', [])]
self.canGcMethods = [name for name in desc.get('canGc', [])]
self.bindingPath = f"{getModuleFromObject(self.interface)}::{ifaceName}_Binding"
self.outerObjectHook = desc.get('outerObjectHook', 'None')
self.proxy = False
self.weakReferenceable = desc.get('weakReferenceable', False)
# If we're concrete, we need to crawl our ancestor interfaces and mark
# them as having a concrete descendant.
self.concrete = (not self.interface.isCallback()
and not self.interface.isNamespace()
and not self.interface.getExtendedAttribute("Abstract")
and not self.interface.getExtendedAttribute("Inline")
and not spiderMonkeyInterface)
self.hasLegacyUnforgeableMembers = (self.concrete
and any(MemberIsLegacyUnforgeable(m, self) for m in
self.interface.members))
self.operations = {
'IndexedGetter': None,
'IndexedSetter': None,
'IndexedDeleter': None,
'NamedGetter': None,
'NamedSetter': None,
'NamedDeleter': None,
'Stringifier': None,
}
self.hasDefaultToJSON = False
def addOperation(operation, m):
if not self.operations[operation]:
self.operations[operation] = m
# Since stringifiers go on the prototype, we only need to worry
# about our own stringifier, not those of our ancestor interfaces.
for m in self.interface.members:
if m.isMethod() and m.isStringifier():
addOperation('Stringifier', m)
if m.isMethod() and m.isDefaultToJSON():
self.hasDefaultToJSON = True
if self.concrete:
iface = self.interface
while iface:
for m in iface.members:
if not m.isMethod():
continue
def addIndexedOrNamedOperation(operation, m):
if not self.isGlobal():
self.proxy = True
if m.isIndexed():
operation = 'Indexed' + operation
else:
assert m.isNamed()
operation = 'Named' + operation
addOperation(operation, m)
if m.isGetter():
addIndexedOrNamedOperation('Getter', m)
if m.isSetter():
addIndexedOrNamedOperation('Setter', m)
if m.isDeleter():
addIndexedOrNamedOperation('Deleter', m)
iface = iface.parent
if iface:
iface.setUserData('hasConcreteDescendant', True)
if self.isMaybeCrossOriginObject():
self.proxy = True
if self.proxy:
iface = self.interface
while iface.parent:
iface = iface.parent
iface.setUserData('hasProxyDescendant', True)
self.name = interface.identifier.name
# self.extendedAttributes is a dict of dicts, keyed on
# all/getterOnly/setterOnly and then on member name. Values are an
# array of extended attributes.
self.extendedAttributes = {'all': {}, 'getterOnly': {}, 'setterOnly': {}}
def addExtendedAttribute(attribute, config):
def add(key, members, attribute):
for member in members:
self.extendedAttributes[key].setdefault(member, []).append(attribute)
if isinstance(config, dict):
for key in ['all', 'getterOnly', 'setterOnly']:
add(key, config.get(key, []), attribute)
elif isinstance(config, list):
add('all', config, attribute)
else:
assert isinstance(config, str)
if config == '*':
iface = self.interface
while iface:
add('all', [m.name for m in iface.members], attribute)
iface = iface.parent
else:
add('all', [config], attribute)
self._binaryNames = desc.get('binaryNames', {})
self._binaryNames.setdefault('__legacycaller', 'LegacyCall')
self._binaryNames.setdefault('__stringifier', 'Stringifier')
self._internalNames = desc.get('internalNames', {})
for member in self.interface.members:
if not member.isAttr() and not member.isMethod():
continue
binaryName = member.getExtendedAttribute("BinaryName")
if binaryName:
assert isinstance(binaryName, list)
assert len(binaryName) == 1
self._binaryNames.setdefault(member.identifier.name,
binaryName[0])
self._internalNames.setdefault(member.identifier.name,
member.identifier.name.replace('-', '_'))
# Build the prototype chain.
self.prototypeChain = []
parent = interface
while parent:
self.prototypeChain.insert(0, parent.identifier.name)
parent = parent.parent
self.prototypeDepth = len(self.prototypeChain) - 1
config.maxProtoChainLength = max(config.maxProtoChainLength,
len(self.prototypeChain))
def maybeGetSuperModule(self):
"""
Returns name of super module if self is part of it
"""
filename = getIdlFileName(self.interface)
# if interface name is not same as webidl file
# webidl is super module for interface
if filename.lower() != self.interface.identifier.name.lower():
return filename
return None
def binaryNameFor(self, name):
return self._binaryNames.get(name, name)
def internalNameFor(self, name):
return self._internalNames.get(name, name)
def hasNamedPropertiesObject(self):
if self.interface.isExternal():
return False
return self.isGlobal() and self.supportsNamedProperties()
def supportsNamedProperties(self):
return self.operations['NamedGetter'] is not None
def getExtendedAttributes(self, member, getter=False, setter=False):
def maybeAppendInfallibleToAttrs(attrs, throws):
if throws is None:
attrs.append("infallible")
elif throws is True:
pass
else:
raise TypeError("Unknown value for 'Throws'")
name = member.identifier.name
if member.isMethod():
attrs = self.extendedAttributes['all'].get(name, [])
throws = member.getExtendedAttribute("Throws")
maybeAppendInfallibleToAttrs(attrs, throws)
return attrs
assert member.isAttr()
assert bool(getter) != bool(setter)
key = 'getterOnly' if getter else 'setterOnly'
attrs = self.extendedAttributes['all'].get(name, []) + self.extendedAttributes[key].get(name, [])
throws = member.getExtendedAttribute("Throws")
if throws is None:
throwsAttr = "GetterThrows" if getter else "SetterThrows"
throws = member.getExtendedAttribute(throwsAttr)
maybeAppendInfallibleToAttrs(attrs, throws)
return attrs
def getParentName(self):
parent = self.interface.parent
while parent:
if not parent.getExtendedAttribute("Inline"):
return parent.identifier.name
parent = parent.parent
return None
def supportsIndexedProperties(self):
return self.operations['IndexedGetter'] is not None
def isMaybeCrossOriginObject(self):
# If we're isGlobal and have cross-origin members, we're a Window, and
# that's not a cross-origin object. The WindowProxy is.
return self.concrete and self.interface.hasCrossOriginMembers and not self.isGlobal()
def hasDescendants(self):
return (self.interface.getUserData("hasConcreteDescendant", False)
or self.interface.getUserData("hasProxyDescendant", False))
def hasHTMLConstructor(self):
ctor = self.interface.ctor()
return ctor and ctor.isHTMLConstructor()
def shouldHaveGetConstructorObjectMethod(self):
assert self.interface.hasInterfaceObject()
if self.interface.getExtendedAttribute("Inline"):
return False
return (self.interface.isCallback() or self.interface.isNamespace()
or self.hasDescendants() or self.hasHTMLConstructor())
def shouldCacheConstructor(self):
return self.hasDescendants() or self.hasHTMLConstructor()
def isExposedConditionally(self):
return self.interface.isExposedConditionally()
def isGlobal(self):
"""
Returns true if this is the primary interface for a global object
of some sort.
"""
return bool(self.interface.getExtendedAttribute("Global")
or self.interface.getExtendedAttribute("PrimaryGlobal"))
# Some utility methods
def MakeNativeName(name):
return name[0].upper() + name[1:]
def getIdlFileName(object):
return os.path.basename(object.location.filename).split('.webidl')[0]
def getModuleFromObject(object):
return ('crate::dom::bindings::codegen::Bindings::' + getIdlFileName(object) + 'Binding')
def getTypesFromDescriptor(descriptor):
"""
Get all argument and return types for all members of the descriptor
"""
members = [m for m in descriptor.interface.members]
if descriptor.interface.ctor():
members.append(descriptor.interface.ctor())
members.extend(descriptor.interface.legacyFactoryFunctions)
signatures = [s for m in members if m.isMethod() for s in m.signatures()]
types = []
for s in signatures:
assert len(s) == 2
(returnType, arguments) = s
types.append(returnType)
types.extend(a.type for a in arguments)
types.extend(a.type for a in members if a.isAttr())
return types
def getTypesFromDictionary(dictionary):
"""
Get all member types for this dictionary
"""
if isinstance(dictionary, IDLWrapperType):
dictionary = dictionary.inner
types = []
curDict = dictionary
while curDict:
types.extend([getUnwrappedType(m.type) for m in curDict.members])
curDict = curDict.parent
return types
def getTypesFromCallback(callback):
"""
Get the types this callback depends on: its return type and the
types of its arguments.
"""
sig = callback.signatures()[0]
types = [sig[0]] # Return type
types.extend(arg.type for arg in sig[1]) # Arguments
return types
def getUnwrappedType(type):
while isinstance(type, IDLSequenceType):
type = type.inner
return type
def iteratorNativeType(descriptor, infer=False):
iterableDecl = descriptor.interface.maplikeOrSetlikeOrIterable
assert (iterableDecl.isIterable() and iterableDecl.isPairIterator()) \
or iterableDecl.isSetlike() or iterableDecl.isMaplike()
res = "IterableIterator%s" % ("" if infer else '<%s>' % descriptor.interface.identifier.name)
# todo: this hack is telling us that something is still wrong in codegen
if iterableDecl.isSetlike() or iterableDecl.isMaplike():
res = f"crate::dom::bindings::iterable::{res}"
return res

View file

@ -1,6 +0,0 @@
<table id="${interface}">
<tr>
<th>${interface}</th>
</tr>
${properties}
</table>

View file

@ -1,35 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `servo` crate.">
<meta name="keywords" content="rust, rustlang, rust-lang, servo">
<title>Supported DOM APIs - servo - Rust</title>
<link rel="stylesheet" type="text/css" href="../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../main.css">
</head>
<body class="rustdoc">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class='sidebar'>
<div class='block crate'>
<h3>Interfaces</h3>
<ul>
${interfaces}
</ul>
</div>
</nav>
<section id='main' class="content mod">
<h1 class='fqn'><span class='in-band'>DOM APIs currently supported in <a class='mod' href=''>Servo</a></span></h1>
<div id='properties' class='docblock'>
${apis}
</div>
</section>
</body>
</html>

View file

@ -1 +0,0 @@
<li><a href="#${interface}">${interface}</a></li>

View file

@ -1,3 +0,0 @@
<tr>
<td>${name}</td>
</tr>

View file

@ -1,159 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
import os
import sys
import json
import re
SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__))
SERVO_ROOT = os.path.abspath(os.path.join(SCRIPT_PATH, "..", "..", "..", "..", ".."))
FILTER_PATTERN = re.compile("// skip-unless ([A-Z_]+)\n")
def main():
os.chdir(os.path.join(os.path.dirname(__file__)))
sys.path.insert(0, os.path.join(SERVO_ROOT, "third_party", "WebIDL"))
sys.path.insert(0, os.path.join(SERVO_ROOT, "third_party", "ply"))
css_properties_json, out_dir = sys.argv[1:]
# Four dotdots: /path/to/target(4)/debug(3)/build(2)/style-*(1)/out
# Do not ascend above the target dir, because it may not be called target
# or even have a parent (see CARGO_TARGET_DIR).
doc_servo = os.path.join(out_dir, "..", "..", "..", "..", "doc")
webidls_dir = os.path.join(SCRIPT_PATH, "..", "..", "webidls")
config_file = "Bindings.conf"
import WebIDL
from Configuration import Configuration
from CodegenRust import CGBindingRoot
parser = WebIDL.Parser(make_dir(os.path.join(out_dir, "cache")))
webidls = [name for name in os.listdir(webidls_dir) if name.endswith(".webidl")]
for webidl in webidls:
filename = os.path.join(webidls_dir, webidl)
with open(filename, "r", encoding="utf-8") as f:
contents = f.read()
filter_match = FILTER_PATTERN.search(contents)
if filter_match:
env_var = filter_match.group(1)
if not os.environ.get(env_var):
continue
parser.parse(contents, filename)
add_css_properties_attributes(css_properties_json, parser)
parser_results = parser.finish()
config = Configuration(config_file, parser_results)
make_dir(os.path.join(out_dir, "Bindings"))
for name, filename in [
("PrototypeList", "PrototypeList.rs"),
("RegisterBindings", "RegisterBindings.rs"),
("InterfaceObjectMap", "InterfaceObjectMap.rs"),
("InterfaceObjectMapData", "InterfaceObjectMapData.json"),
("InterfaceTypes", "InterfaceTypes.rs"),
("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)
generate(config, "SupportedDomApis", os.path.join(doc_servo, "apis.html"))
for webidl in webidls:
filename = os.path.join(webidls_dir, webidl)
prefix = "Bindings/%sBinding" % webidl[:-len(".webidl")]
module = CGBindingRoot(config, prefix, filename).define()
if module:
with open(os.path.join(out_dir, prefix + ".rs"), "wb") as f:
f.write(module.encode("utf-8"))
def make_dir(path):
if not os.path.exists(path):
os.makedirs(path)
return path
def generate(config, name, filename):
from CodegenRust import GlobalGenRoots
root = getattr(GlobalGenRoots, name)(config)
code = root.define()
with open(filename, "wb") as f:
f.write(code.encode("utf-8"))
def add_css_properties_attributes(css_properties_json, parser):
def map_preference_name(preference_name: str):
"""Map between Stylo preference names and Servo preference names as the
`css-properties.json` file is generated by Stylo. This should be kept in sync with the
preference mapping done in `components/servo_config/prefs.rs`, which handles the runtime version of
these preferences."""
MAPPING = [
["layout.unimplemented", "layout_unimplemented"],
["layout.threads", "layout_threads"],
["layout.legacy_layout", "layout_legacy_layout"],
["layout.flexbox.enabled", "layout_flexbox_enabled"],
["layout.columns.enabled", "layout_columns_enabled"],
["layout.grid.enabled", "layout_grid_enabled"],
["layout.css.transition-behavior.enabled", "layout_css_transition_behavior_enabled"],
["layout.writing-mode.enabled", "layout_writing_mode_enabled"],
["layout.container-queries.enabled", "layout_container_queries_enabled"],
]
for mapping in MAPPING:
if mapping[0] == preference_name:
return mapping[1]
return preference_name
css_properties = json.load(open(css_properties_json, "rb"))
idl = "partial interface CSSStyleDeclaration {\n%s\n};\n" % "\n".join(
" [%sCEReactions, SetterThrows] attribute [LegacyNullToEmptyString] DOMString %s;" % (
(f'Pref="{map_preference_name(data["pref"])}", ' if data["pref"] else ""),
attribute_name
)
for (kind, properties_list) in sorted(css_properties.items())
for (property_name, data) in sorted(properties_list.items())
for attribute_name in attribute_names(property_name)
)
parser.parse(idl, "CSSStyleDeclaration_generated.webidl")
def attribute_names(property_name):
# https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-dashed-attribute
if property_name != "float":
yield property_name
else:
yield "_float"
# https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-camel-cased-attribute
if "-" in property_name:
yield "".join(camel_case(property_name))
# https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-webkit-cased-attribute
if property_name.startswith("-webkit-"):
yield "".join(camel_case(property_name), True)
# https://drafts.csswg.org/cssom/#css-property-to-idl-attribute
def camel_case(chars, webkit_prefixed=False):
if webkit_prefixed:
chars = chars[1:]
next_is_uppercase = False
for c in chars:
if c == '-':
next_is_uppercase = True
elif next_is_uppercase:
next_is_uppercase = False
# Should be ASCII-uppercase, but all non-custom CSS property names are within ASCII
yield c.upper()
else:
yield c
if __name__ == "__main__":
main()

View file

@ -174,28 +174,28 @@ pub(crate) mod xmlname;
#[allow(missing_docs, non_snake_case)]
pub(crate) mod codegen {
pub(crate) mod DomTypeHolder {
include!(concat!(env!("OUT_DIR"), "/DomTypeHolder.rs"));
include!(concat!(env!("BINDINGS_OUT_DIR"), "/DomTypeHolder.rs"));
}
pub(crate) mod DomTypes {
include!(concat!(env!("OUT_DIR"), "/DomTypes.rs"));
include!(concat!(env!("BINDINGS_OUT_DIR"), "/DomTypes.rs"));
}
#[allow(dead_code)]
pub(crate) mod Bindings {
include!(concat!(env!("OUT_DIR"), "/Bindings/mod.rs"));
include!(concat!(env!("BINDINGS_OUT_DIR"), "/Bindings/mod.rs"));
}
pub(crate) mod InterfaceObjectMap {
include!(concat!(env!("OUT_DIR"), "/InterfaceObjectMap.rs"));
include!(concat!(env!("BINDINGS_OUT_DIR"), "/InterfaceObjectMap.rs"));
}
#[allow(dead_code, unused_imports, clippy::enum_variant_names)]
pub(crate) mod InheritTypes {
include!(concat!(env!("OUT_DIR"), "/InheritTypes.rs"));
include!(concat!(env!("BINDINGS_OUT_DIR"), "/InheritTypes.rs"));
}
#[allow(clippy::upper_case_acronyms)]
pub(crate) mod PrototypeList {
include!(concat!(env!("OUT_DIR"), "/PrototypeList.rs"));
include!(concat!(env!("BINDINGS_OUT_DIR"), "/PrototypeList.rs"));
}
pub(crate) mod RegisterBindings {
include!(concat!(env!("OUT_DIR"), "/RegisterBindings.rs"));
include!(concat!(env!("BINDINGS_OUT_DIR"), "/RegisterBindings.rs"));
}
#[allow(
non_camel_case_types,
@ -206,6 +206,6 @@ pub(crate) mod codegen {
clippy::enum_variant_names
)]
pub(crate) mod UnionTypes {
include!(concat!(env!("OUT_DIR"), "/UnionTypes.rs"));
include!(concat!(env!("BINDINGS_OUT_DIR"), "/UnionTypes.rs"));
}
}

View file

@ -206,7 +206,7 @@
pub(crate) mod macros;
pub(crate) mod types {
include!(concat!(env!("OUT_DIR"), "/InterfaceTypes.rs"));
include!(concat!(env!("BINDINGS_OUT_DIR"), "/InterfaceTypes.rs"));
}
pub(crate) mod abortcontroller;

View file

@ -1,15 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* WebGL IDL definitions from the Khronos specification:
* https://www.khronos.org/registry/webgl/extensions/ANGLE_instanced_arrays/
*/
[LegacyNoInterfaceObject, Exposed=Window]
interface ANGLEInstancedArrays {
const GLenum VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE = 0x88FE;
undefined drawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount);
undefined drawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei primcount);
undefined vertexAttribDivisorANGLE(GLuint index, GLuint divisor);
};

View file

@ -1,57 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://w3c.github.io/aria/#dom-ariamixin
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
interface mixin ARIAMixin {
[CEReactions] attribute DOMString? role;
[CEReactions] attribute DOMString? ariaAtomic;
[CEReactions] attribute DOMString? ariaAutoComplete;
[CEReactions] attribute DOMString? ariaBrailleLabel;
[CEReactions] attribute DOMString? ariaBrailleRoleDescription;
[CEReactions] attribute DOMString? ariaBusy;
[CEReactions] attribute DOMString? ariaChecked;
[CEReactions] attribute DOMString? ariaColCount;
[CEReactions] attribute DOMString? ariaColIndex;
[CEReactions] attribute DOMString? ariaColIndexText;
[CEReactions] attribute DOMString? ariaColSpan;
[CEReactions] attribute DOMString? ariaCurrent;
[CEReactions] attribute DOMString? ariaDescription;
[CEReactions] attribute DOMString? ariaDisabled;
[CEReactions] attribute DOMString? ariaExpanded;
[CEReactions] attribute DOMString? ariaHasPopup;
[CEReactions] attribute DOMString? ariaHidden;
[CEReactions] attribute DOMString? ariaInvalid;
[CEReactions] attribute DOMString? ariaKeyShortcuts;
[CEReactions] attribute DOMString? ariaLabel;
[CEReactions] attribute DOMString? ariaLevel;
[CEReactions] attribute DOMString? ariaLive;
[CEReactions] attribute DOMString? ariaModal;
[CEReactions] attribute DOMString? ariaMultiLine;
[CEReactions] attribute DOMString? ariaMultiSelectable;
[CEReactions] attribute DOMString? ariaOrientation;
[CEReactions] attribute DOMString? ariaPlaceholder;
[CEReactions] attribute DOMString? ariaPosInSet;
[CEReactions] attribute DOMString? ariaPressed;
[CEReactions] attribute DOMString? ariaReadOnly;
[CEReactions] attribute DOMString? ariaRelevant;
[CEReactions] attribute DOMString? ariaRequired;
[CEReactions] attribute DOMString? ariaRoleDescription;
[CEReactions] attribute DOMString? ariaRowCount;
[CEReactions] attribute DOMString? ariaRowIndex;
[CEReactions] attribute DOMString? ariaRowIndexText;
[CEReactions] attribute DOMString? ariaRowSpan;
[CEReactions] attribute DOMString? ariaSelected;
[CEReactions] attribute DOMString? ariaSetSize;
[CEReactions] attribute DOMString? ariaSort;
[CEReactions] attribute DOMString? ariaValueMax;
[CEReactions] attribute DOMString? ariaValueMin;
[CEReactions] attribute DOMString? ariaValueNow;
[CEReactions] attribute DOMString? ariaValueText;
};

View file

@ -1,13 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://dom.spec.whatwg.org/#interface-abortcontroller
[Exposed=*, Pref="dom_abort_controller_enabled"]
interface AbortController {
constructor();
//[SameObject] readonly attribute AbortSignal signal;
undefined abort(optional any reason);
};

View file

@ -1,21 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://dom.spec.whatwg.org/#interface-abstractrange
*/
[Exposed=Window]
interface AbstractRange {
[Pure]
readonly attribute Node startContainer;
[Pure]
readonly attribute unsigned long startOffset;
[Pure]
readonly attribute Node endContainer;
[Pure]
readonly attribute unsigned long endOffset;
[Pure]
readonly attribute boolean collapsed;
};

View file

@ -1,15 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// Interface for testing element activation
// This interface is entirely internal to Servo, and should not be accessible to
// web pages.
[Exposed=(Window,Worker)]
interface mixin ActivatableElement {
[Throws, Pref="dom_testing_element_activation_enabled"]
undefined enterFormalActivationState();
[Throws, Pref="dom_testing_element_activation_enabled"]
undefined exitFormalActivationState();
};

View file

@ -1,28 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://webaudio.github.io/web-audio-api/#analysernode
*/
dictionary AnalyserOptions : AudioNodeOptions {
unsigned long fftSize = 2048;
double maxDecibels = -30;
double minDecibels = -100;
double smoothingTimeConstant = 0.8;
};
[Exposed=Window]
interface AnalyserNode : AudioNode {
[Throws] constructor(BaseAudioContext context, optional AnalyserOptions options = {});
undefined getFloatFrequencyData (Float32Array array);
undefined getByteFrequencyData (Uint8Array array);
undefined getFloatTimeDomainData (Float32Array array);
undefined getByteTimeDomainData (Uint8Array array);
[SetterThrows] attribute unsigned long fftSize;
readonly attribute unsigned long frequencyBinCount;
[SetterThrows] attribute double minDecibels;
[SetterThrows] attribute double maxDecibels;
[SetterThrows] attribute double smoothingTimeConstant;
};

View file

@ -1,26 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://www.w3.org/TR/css3-animations/#animation-events-
* http://dev.w3.org/csswg/css3-animations/#animation-events-
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
[Exposed=Window]
interface AnimationEvent : Event {
constructor(DOMString type, optional AnimationEventInit eventInitDict = {});
readonly attribute DOMString animationName;
readonly attribute float elapsedTime;
readonly attribute DOMString pseudoElement;
};
dictionary AnimationEventInit : EventInit {
DOMString animationName = "";
float elapsedTime = 0;
DOMString pseudoElement = "";
};

View file

@ -1,28 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://dom.spec.whatwg.org/#interface-attr
*
*/
[Exposed=Window]
interface Attr : Node {
[Constant]
readonly attribute DOMString? namespaceURI;
[Constant]
readonly attribute DOMString? prefix;
[Constant]
readonly attribute DOMString localName;
[Constant]
readonly attribute DOMString name;
[CEReactions, Pure]
attribute DOMString value;
[Pure]
readonly attribute Element? ownerElement;
[Constant]
readonly attribute boolean specified; // useless; always returns true
};

View file

@ -1,29 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://webaudio.github.io/web-audio-api/#audiobuffer
*/
dictionary AudioBufferOptions {
unsigned long numberOfChannels = 1;
required unsigned long length;
required float sampleRate;
};
[Exposed=Window]
interface AudioBuffer {
[Throws] constructor(AudioBufferOptions options);
readonly attribute float sampleRate;
readonly attribute unsigned long length;
readonly attribute double duration;
readonly attribute unsigned long numberOfChannels;
[Throws] Float32Array getChannelData(unsigned long channel);
[Throws] undefined copyFromChannel(Float32Array destination,
unsigned long channelNumber,
optional unsigned long startInChannel = 0);
[Throws] undefined copyToChannel(Float32Array source,
unsigned long channelNumber,
optional unsigned long startInChannel = 0);
};

View file

@ -1,30 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://webaudio.github.io/web-audio-api/#AudioBufferSourceNode
*/
dictionary AudioBufferSourceOptions {
AudioBuffer? buffer;
float detune = 0;
boolean loop = false;
double loopEnd = 0;
double loopStart = 0;
float playbackRate = 1;
};
[Exposed=Window]
interface AudioBufferSourceNode : AudioScheduledSourceNode {
[Throws] constructor(BaseAudioContext context, optional AudioBufferSourceOptions options = {});
[Throws] attribute AudioBuffer? buffer;
readonly attribute AudioParam playbackRate;
readonly attribute AudioParam detune;
attribute boolean loop;
attribute double loopStart;
attribute double loopEnd;
[Throws] undefined start(optional double when = 0,
optional double offset,
optional double duration);
};

View file

@ -1,40 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://webaudio.github.io/web-audio-api/#dom-audiocontext
*/
enum AudioContextLatencyCategory {
"balanced",
"interactive",
"playback"
};
dictionary AudioContextOptions {
(AudioContextLatencyCategory or double) latencyHint = "interactive";
float sampleRate;
};
dictionary AudioTimestamp {
double contextTime;
DOMHighResTimeStamp performanceTime;
};
[Exposed=Window]
interface AudioContext : BaseAudioContext {
[Throws] constructor(optional AudioContextOptions contextOptions = {});
readonly attribute double baseLatency;
readonly attribute double outputLatency;
AudioTimestamp getOutputTimestamp();
Promise<undefined> suspend();
Promise<undefined> close();
[Throws] MediaElementAudioSourceNode createMediaElementSource(HTMLMediaElement mediaElement);
[Throws] MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream);
[Throws] MediaStreamTrackAudioSourceNode createMediaStreamTrackSource(MediaStreamTrack mediaStreamTrack);
[Throws] MediaStreamAudioDestinationNode createMediaStreamDestination();
};

View file

@ -1,12 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://webaudio.github.io/web-audio-api/#dom-audiodestinationnode
*/
[Exposed=Window]
interface AudioDestinationNode : AudioNode {
readonly attribute unsigned long maxChannelCount;
};

View file

@ -1,22 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://webaudio.github.io/web-audio-api/#audiolistener
*/
[Exposed=Window]
interface AudioListener {
readonly attribute AudioParam positionX;
readonly attribute AudioParam positionY;
readonly attribute AudioParam positionZ;
readonly attribute AudioParam forwardX;
readonly attribute AudioParam forwardY;
readonly attribute AudioParam forwardZ;
readonly attribute AudioParam upX;
readonly attribute AudioParam upY;
readonly attribute AudioParam upZ;
[Throws] AudioListener setPosition (float x, float y, float z);
[Throws] AudioListener setOrientation (float x, float y, float z, float xUp, float yUp, float zUp);
};

View file

@ -1,62 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://webaudio.github.io/web-audio-api/#dom-audionode
*/
enum ChannelCountMode {
"max",
"clamped-max",
"explicit"
};
enum ChannelInterpretation {
"speakers",
"discrete"
};
dictionary AudioNodeOptions {
unsigned long channelCount;
ChannelCountMode channelCountMode;
ChannelInterpretation channelInterpretation;
};
[Exposed=Window]
interface AudioNode : EventTarget {
[Throws]
AudioNode connect(AudioNode destinationNode,
optional unsigned long output = 0,
optional unsigned long input = 0);
[Throws]
undefined connect(AudioParam destinationParam,
optional unsigned long output = 0);
[Throws]
undefined disconnect();
[Throws]
undefined disconnect(unsigned long output);
[Throws]
undefined disconnect(AudioNode destination);
[Throws]
undefined disconnect(AudioNode destination, unsigned long output);
[Throws]
undefined disconnect(AudioNode destination,
unsigned long output,
unsigned long input);
[Throws]
undefined disconnect(AudioParam destination);
[Throws]
undefined disconnect(AudioParam destination, unsigned long output);
readonly attribute BaseAudioContext context;
readonly attribute unsigned long numberOfInputs;
readonly attribute unsigned long numberOfOutputs;
[SetterThrows]
attribute unsigned long channelCount;
[SetterThrows]
attribute ChannelCountMode channelCountMode;
[SetterThrows]
attribute ChannelInterpretation channelInterpretation;
};

View file

@ -1,32 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://webaudio.github.io/web-audio-api/#dom-audioparam
*/
enum AutomationRate {
"a-rate",
"k-rate"
};
[Exposed=Window]
interface AudioParam {
attribute float value;
[SetterThrows] attribute AutomationRate automationRate;
readonly attribute float defaultValue;
readonly attribute float minValue;
readonly attribute float maxValue;
[Throws] AudioParam setValueAtTime(float value, double startTime);
[Throws] AudioParam linearRampToValueAtTime(float value, double endTime);
[Throws] AudioParam exponentialRampToValueAtTime(float value, double endTime);
[Throws] AudioParam setTargetAtTime(float target,
double startTime,
float timeConstant);
[Throws] AudioParam setValueCurveAtTime(sequence<float> values,
double startTime,
double duration);
[Throws] AudioParam cancelScheduledValues(double cancelTime);
[Throws] AudioParam cancelAndHoldAtTime(double cancelTime);
};

View file

@ -1,14 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://webaudio.github.io/web-audio-api/#AudioScheduledSourceNode
*/
[Exposed=Window]
interface AudioScheduledSourceNode : AudioNode {
attribute EventHandler onended;
[Throws] undefined start(optional double when = 0);
[Throws] undefined stop(optional double when = 0);
};

View file

@ -1,14 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#audiotrack
[Exposed=Window]
interface AudioTrack {
readonly attribute DOMString id;
readonly attribute DOMString kind;
readonly attribute DOMString label;
readonly attribute DOMString language;
attribute boolean enabled;
};

View file

@ -1,16 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#audiotracklist
[Exposed=Window]
interface AudioTrackList : EventTarget {
readonly attribute unsigned long length;
getter AudioTrack (unsigned long index);
AudioTrack? getTrackById(DOMString id);
attribute EventHandler onchange;
attribute EventHandler onaddtrack;
attribute EventHandler onremovetrack;
};

View file

@ -1,55 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://webaudio.github.io/web-audio-api/#BaseAudioContext
*/
enum AudioContextState {
"suspended",
"running",
"closed"
};
callback DecodeErrorCallback = undefined (DOMException error);
callback DecodeSuccessCallback = undefined (AudioBuffer decodedData);
[Exposed=Window]
interface BaseAudioContext : EventTarget {
readonly attribute AudioDestinationNode destination;
readonly attribute float sampleRate;
readonly attribute double currentTime;
readonly attribute AudioListener listener;
readonly attribute AudioContextState state;
Promise<undefined> resume();
attribute EventHandler onstatechange;
[Throws] AudioBuffer createBuffer(unsigned long numberOfChannels,
unsigned long length,
float sampleRate);
Promise<AudioBuffer> decodeAudioData(ArrayBuffer audioData,
optional DecodeSuccessCallback successCallback,
optional DecodeErrorCallback errorCallback);
[Throws] AudioBufferSourceNode createBufferSource();
[Throws] ConstantSourceNode createConstantSource();
// ScriptProcessorNode createScriptProcessor(optional unsigned long bufferSize = 0,
// optional unsigned long numberOfInputChannels = 2,
// optional unsigned long numberOfOutputChannels = 2);
[Throws] AnalyserNode createAnalyser();
[Throws] GainNode createGain();
// DelayNode createDelay(optional double maxDelayTime = 1);
[Throws] BiquadFilterNode createBiquadFilter();
[Throws] IIRFilterNode createIIRFilter(sequence<double> feedforward,
sequence<double> feedback);
// WaveShaperNode createWaveShaper();
[Throws] PannerNode createPanner();
[Throws] StereoPannerNode createStereoPanner();
// ConvolverNode createConvolver();
[Throws] ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6);
[Throws] ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6);
// DynamicsCompressorNode createDynamicsCompressor();
[Throws] OscillatorNode createOscillator();
// PeriodicWave createPeriodicWave(sequence<float> real,
// sequence<float> imag,
// optional PeriodicWaveConstraints constraints);
};

View file

@ -1,12 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* For more information on this interface please see
* https://html.spec.whatwg.org/multipage/#beforeunloadevent
*/
[Exposed=Window]
interface BeforeUnloadEvent : Event {
attribute DOMString returnValue;
};

View file

@ -1,39 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://webaudio.github.io/web-audio-api/#biquadfilternode
*/
enum BiquadFilterType {
"lowpass",
"highpass",
"bandpass",
"lowshelf",
"highshelf",
"peaking",
"notch",
"allpass"
};
dictionary BiquadFilterOptions : AudioNodeOptions {
BiquadFilterType type = "lowpass";
float Q = 1;
float detune = 0;
float frequency = 350;
float gain = 0;
};
[Exposed=Window]
interface BiquadFilterNode : AudioNode {
[Throws] constructor(BaseAudioContext context, optional BiquadFilterOptions options = {});
attribute BiquadFilterType type;
readonly attribute AudioParam frequency;
readonly attribute AudioParam detune;
readonly attribute AudioParam Q;
readonly attribute AudioParam gain;
// the AudioParam model of https://github.com/servo/servo/issues/21659 needs to
// be implemented before we implement this
// void getFrequencyResponse (Float32Array frequencyHz, Float32Array magResponse, Float32Array phaseResponse);
};

View file

@ -1,29 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://w3c.github.io/FileAPI/#blob
[Exposed=(Window,Worker)]
interface Blob {
[Throws] constructor(optional sequence<BlobPart> blobParts,
optional BlobPropertyBag options = {});
readonly attribute unsigned long long size;
readonly attribute DOMString type;
// slice Blob into byte-ranged chunks
Blob slice(optional [Clamp] long long start,
optional [Clamp] long long end,
optional DOMString contentType);
[NewObject, Throws] ReadableStream stream();
[NewObject] Promise<DOMString> text();
[NewObject] Promise<ArrayBuffer> arrayBuffer();
};
dictionary BlobPropertyBag {
DOMString type = "";
};
typedef (ArrayBuffer or ArrayBufferView or Blob or DOMString) BlobPart;

View file

@ -1,42 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://webbluetoothcg.github.io/web-bluetooth/#bluetooth
dictionary BluetoothDataFilterInit {
BufferSource dataPrefix;
BufferSource mask;
};
dictionary BluetoothLEScanFilterInit {
sequence<BluetoothServiceUUID> services;
DOMString name;
DOMString namePrefix;
// Maps unsigned shorts to BluetoothDataFilters.
record<DOMString, BluetoothDataFilterInit> manufacturerData;
// Maps BluetoothServiceUUIDs to BluetoothDataFilters.
record<DOMString, BluetoothDataFilterInit> serviceData;
};
dictionary RequestDeviceOptions {
sequence<BluetoothLEScanFilterInit> filters;
sequence<BluetoothServiceUUID> optionalServices = [];
boolean acceptAllDevices = false;
};
[Exposed=Window, Pref="dom_bluetooth_enabled"]
interface Bluetooth : EventTarget {
[SecureContext]
Promise<boolean> getAvailability();
[SecureContext]
attribute EventHandler onavailabilitychanged;
// [SecureContext, SameObject]
// readonly attribute BluetoothDevice? referringDevice;
[SecureContext]
Promise<BluetoothDevice> requestDevice(optional RequestDeviceOptions options = {});
};
// Bluetooth includes BluetoothDeviceEventHandlers;
// Bluetooth includes CharacteristicEventHandlers;
// Bluetooth includes ServiceEventHandlers;

View file

@ -1,37 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://webbluetoothcg.github.io/web-bluetooth/#advertising-events
/*interface BluetoothManufacturerDataMap {
readonly maplike<unsigned short, DataView>;
};
interface BluetoothServiceDataMap {
readonly maplike<UUID, DataView>;
};*/
[Exposed=Window, Pref="dom_bluetooth_enabled"]
interface BluetoothAdvertisingEvent : Event {
[Throws] constructor(DOMString type, BluetoothAdvertisingEventInit init);
[SameObject]
readonly attribute BluetoothDevice device;
// readonly attribute FrozenArray<UUID> uuids;
readonly attribute DOMString? name;
readonly attribute unsigned short? appearance;
readonly attribute byte? txPower;
readonly attribute byte? rssi;
// [SameObject]
// readonly attribute BluetoothManufacturerDataMap manufacturerData;
// [SameObject]
// readonly attribute BluetoothServiceDataMap serviceData;
};
dictionary BluetoothAdvertisingEventInit : EventInit {
required BluetoothDevice device;
// sequence<(DOMString or unsigned long)> uuids;
DOMString name;
unsigned short appearance;
byte txPower;
byte rssi;
// Map manufacturerData;
// Map serviceData;
};

View file

@ -1,18 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://webbluetoothcg.github.io/web-bluetooth/#characteristicproperties
[Exposed=Window, Pref="dom_bluetooth_enabled"]
interface BluetoothCharacteristicProperties {
readonly attribute boolean broadcast;
readonly attribute boolean read;
readonly attribute boolean writeWithoutResponse;
readonly attribute boolean write;
readonly attribute boolean notify;
readonly attribute boolean indicate;
readonly attribute boolean authenticatedSignedWrites;
readonly attribute boolean reliableWrite;
readonly attribute boolean writableAuxiliaries;
};

View file

@ -1,25 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothdevice
[Exposed=Window, Pref="dom_bluetooth_enabled"]
interface BluetoothDevice : EventTarget {
readonly attribute DOMString id;
readonly attribute DOMString? name;
readonly attribute BluetoothRemoteGATTServer? gatt;
Promise<undefined> watchAdvertisements();
undefined unwatchAdvertisements();
readonly attribute boolean watchingAdvertisements;
};
interface mixin BluetoothDeviceEventHandlers {
attribute EventHandler ongattserverdisconnected;
};
// BluetoothDevice includes EventTarget;
BluetoothDevice includes BluetoothDeviceEventHandlers;
// BluetoothDevice includes CharacteristicEventHandlers;
// BluetoothDevice includes ServiceEventHandlers;

View file

@ -1,20 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothpermissionresult
dictionary BluetoothPermissionDescriptor : PermissionDescriptor {
DOMString deviceId;
// These match RequestDeviceOptions.
sequence<BluetoothLEScanFilterInit> filters;
sequence<BluetoothServiceUUID> optionalServices = [];
boolean acceptAllDevices = false;
};
[Exposed=Window, Pref="dom_bluetooth_enabled"]
interface BluetoothPermissionResult : PermissionStatus {
// attribute FrozenArray<BluetoothDevice> devices;
// Workaround until FrozenArray get implemented.
sequence<BluetoothDevice> devices();
};

View file

@ -1,29 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothremotegattcharacteristic
[Exposed=Window, Pref="dom_bluetooth_enabled"]
interface BluetoothRemoteGATTCharacteristic : EventTarget {
[SameObject]
readonly attribute BluetoothRemoteGATTService service;
readonly attribute DOMString uuid;
readonly attribute BluetoothCharacteristicProperties properties;
readonly attribute ByteString? value;
Promise<BluetoothRemoteGATTDescriptor> getDescriptor(BluetoothDescriptorUUID descriptor);
Promise<sequence<BluetoothRemoteGATTDescriptor>>
getDescriptors(optional BluetoothDescriptorUUID descriptor);
Promise<ByteString> readValue();
//Promise<DataView> readValue();
Promise<undefined> writeValue(BufferSource value);
Promise<BluetoothRemoteGATTCharacteristic> startNotifications();
Promise<BluetoothRemoteGATTCharacteristic> stopNotifications();
};
interface mixin CharacteristicEventHandlers {
attribute EventHandler oncharacteristicvaluechanged;
};
// BluetoothRemoteGATTCharacteristic includes EventTarget;
BluetoothRemoteGATTCharacteristic includes CharacteristicEventHandlers;

View file

@ -1,16 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// http://webbluetoothcg.github.io/web-bluetooth/#bluetoothremotegattdescriptor
[Exposed=Window, Pref="dom_bluetooth_enabled"]
interface BluetoothRemoteGATTDescriptor {
[SameObject]
readonly attribute BluetoothRemoteGATTCharacteristic characteristic;
readonly attribute DOMString uuid;
readonly attribute ByteString? value;
Promise<ByteString> readValue();
//Promise<DataView> readValue();
Promise<undefined> writeValue(BufferSource value);
};

View file

@ -1,17 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//https://webbluetoothcg.github.io/web-bluetooth/#bluetoothremotegattserver
[Exposed=Window, Pref="dom_bluetooth_enabled"]
interface BluetoothRemoteGATTServer {
[SameObject]
readonly attribute BluetoothDevice device;
readonly attribute boolean connected;
Promise<BluetoothRemoteGATTServer> connect();
[Throws]
undefined disconnect();
Promise<BluetoothRemoteGATTService> getPrimaryService(BluetoothServiceUUID service);
Promise<sequence<BluetoothRemoteGATTService>> getPrimaryServices(optional BluetoothServiceUUID service);
};

View file

@ -1,28 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothremotegattservice
[Exposed=Window, Pref="dom_bluetooth_enabled"]
interface BluetoothRemoteGATTService : EventTarget {
[SameObject]
readonly attribute BluetoothDevice device;
readonly attribute DOMString uuid;
readonly attribute boolean isPrimary;
Promise<BluetoothRemoteGATTCharacteristic> getCharacteristic(BluetoothCharacteristicUUID characteristic);
Promise<sequence<BluetoothRemoteGATTCharacteristic>>
getCharacteristics(optional BluetoothCharacteristicUUID characteristic);
Promise<BluetoothRemoteGATTService> getIncludedService(BluetoothServiceUUID service);
Promise<sequence<BluetoothRemoteGATTService>> getIncludedServices(optional BluetoothServiceUUID service);
};
interface mixin ServiceEventHandlers {
attribute EventHandler onserviceadded;
attribute EventHandler onservicechanged;
attribute EventHandler onserviceremoved;
};
// BluetoothRemoteGATTService includes EventTarget;
// BluetoothRemoteGATTService includes CharacteristicEventHandlers;
BluetoothRemoteGATTService includes ServiceEventHandlers;

View file

@ -1,21 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothuuid
[Exposed=Window, Pref="dom_bluetooth_enabled"]
interface BluetoothUUID {
[Throws]
static UUID getService(BluetoothServiceUUID name);
[Throws]
static UUID getCharacteristic(BluetoothCharacteristicUUID name);
[Throws]
static UUID getDescriptor(BluetoothDescriptorUUID name);
static UUID canonicalUUID([EnforceRange] unsigned long alias);
};
typedef DOMString UUID;
typedef (DOMString or unsigned long) BluetoothServiceUUID;
typedef (DOMString or unsigned long) BluetoothCharacteristicUUID;
typedef (DOMString or unsigned long) BluetoothDescriptorUUID;

View file

@ -1,17 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://fetch.spec.whatwg.org/#body
[Exposed=(Window,Worker)]
interface mixin Body {
readonly attribute boolean bodyUsed;
readonly attribute ReadableStream? body;
[NewObject] Promise<ArrayBuffer> arrayBuffer();
[NewObject] Promise<Blob> blob();
[NewObject] Promise<FormData> formData();
[NewObject] Promise<any> json();
[NewObject] Promise<USVString> text();
};

View file

@ -1,18 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is:
* https://html.spec.whatwg.org/multipage/#broadcastchannel
*/
[Exposed=(Window,Worker)]
interface BroadcastChannel : EventTarget {
constructor(DOMString name);
readonly attribute DOMString name;
[Throws] undefined postMessage(any message);
undefined close();
attribute EventHandler onmessage;
attribute EventHandler onmessageerror;
};

View file

@ -1,11 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://dom.spec.whatwg.org/#interface-cdatasection
*/
[Exposed=Window]
interface CDATASection : Text {
};

View file

@ -1,24 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* http://dev.w3.org/csswg/cssom/#the-css-interface
*/
[Abstract, Exposed=Window]
interface CSS {
[Throws]
static DOMString escape(DOMString ident);
};
// https://drafts.csswg.org/css-conditional-3/#the-css-interface
partial interface CSS {
static boolean supports(DOMString property, DOMString value);
static boolean supports(DOMString conditionText);
};
// https://drafts.css-houdini.org/css-paint-api-1/#paint-worklet
partial interface CSS {
[SameObject, Pref="dom_worklet_enabled"] static readonly attribute Worklet paintWorklet;
};

View file

@ -1,9 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.csswg.org/css-conditional/#cssconditionrule
[Abstract, Exposed=Window]
interface CSSConditionRule : CSSGroupingRule {
readonly attribute DOMString conditionText;
};

View file

@ -1,14 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.csswg.org/css-fonts/#cssfontfacerule is unfortunately not web-compatible:
// https://github.com/w3c/csswg-drafts/issues/825
// https://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/css.html#CSS-CSSFontFaceRule ,
// plus extended attributes matching CSSStyleRule
[Exposed=Window]
interface CSSFontFaceRule : CSSRule {
// [SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
};

View file

@ -1,12 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.csswg.org/cssom/#the-cssgroupingrule-interface
[Abstract, Exposed=Window]
interface CSSGroupingRule : CSSRule {
[SameObject] readonly attribute CSSRuleList cssRules;
[Throws] unsigned long insertRule(DOMString rule, unsigned long index);
[Throws] undefined deleteRule(unsigned long index);
};

View file

@ -1,12 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.csswg.org/cssom/#cssimportrule
[Exposed=Window]
interface CSSImportRule : CSSRule {
// readonly attribute DOMString href;
// [SameObject, PutForwards=mediaText] readonly attribute MediaList media;
// [SameObject] readonly attribute CSSStyleSheet styleSheet;
readonly attribute DOMString? layerName;
};

View file

@ -1,10 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.csswg.org/css-animations/#interface-csskeyframerule
[Exposed=Window]
interface CSSKeyframeRule : CSSRule {
// attribute DOMString keyText;
readonly attribute CSSStyleDeclaration style;
};

View file

@ -1,15 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.csswg.org/css-animations/#interface-csskeyframesrule
[Exposed=Window]
interface CSSKeyframesRule : CSSRule {
[SetterThrows]
attribute DOMString name;
readonly attribute CSSRuleList cssRules;
undefined appendRule(DOMString rule);
undefined deleteRule(DOMString select);
CSSKeyframeRule? findRule(DOMString select);
};

View file

@ -1,9 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.csswg.org/css-cascade-5/#the-csslayerblockrule-interface
[Exposed=Window]
interface CSSLayerBlockRule : CSSGroupingRule {
readonly attribute DOMString name;
};

View file

@ -1,9 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.csswg.org/css-cascade-5/#the-csslayerstatementrule-interface
[Exposed=Window]
interface CSSLayerStatementRule : CSSRule {
readonly attribute /*FrozenArray<ResizeObserverSize>*/any nameList;
};

View file

@ -1,10 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.csswg.org/cssom/#the-cssmediarule-interface
// https://drafts.csswg.org/css-conditional/#cssmediarule
[Exposed=Window]
interface CSSMediaRule : CSSConditionRule {
[SameObject, PutForwards=mediaText] readonly attribute MediaList media;
};

View file

@ -1,10 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.csswg.org/cssom/#the-cssnamespacerule-interface
[Exposed=Window]
interface CSSNamespaceRule : CSSRule {
readonly attribute DOMString namespaceURI;
readonly attribute DOMString prefix;
};

View file

@ -1,32 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.csswg.org/cssom/#the-cssrule-interface
[Abstract, Exposed=Window]
interface CSSRule {
const unsigned short STYLE_RULE = 1;
const unsigned short CHARSET_RULE = 2; // historical
const unsigned short IMPORT_RULE = 3;
const unsigned short MEDIA_RULE = 4;
const unsigned short FONT_FACE_RULE = 5;
const unsigned short PAGE_RULE = 6;
const unsigned short MARGIN_RULE = 9;
const unsigned short NAMESPACE_RULE = 10;
readonly attribute unsigned short type;
attribute DOMString cssText;
// readonly attribute CSSRule? parentRule;
readonly attribute CSSStyleSheet? parentStyleSheet;
};
// https://drafts.csswg.org/css-animations/#interface-cssrule-idl
partial interface CSSRule {
const unsigned short KEYFRAMES_RULE = 7;
const unsigned short KEYFRAME_RULE = 8;
};
// https://drafts.csswg.org/css-conditional-3/#extentions-to-cssrule-interface
partial interface CSSRule {
const unsigned short SUPPORTS_RULE = 12;
};

View file

@ -1,11 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.csswg.org/cssom/#cssrulelist
// [LegacyArrayClass]
[Exposed=Window]
interface CSSRuleList {
getter CSSRule? item(unsigned long index);
readonly attribute unsigned long length;
};

View file

@ -1,29 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface
*
* Copyright © 2013 W3C® (MIT, ERCIM, Keio, Beihang), All Rights Reserved.
*/
[Exposed=Window]
interface CSSStyleDeclaration {
[CEReactions, SetterThrows]
attribute DOMString cssText;
readonly attribute unsigned long length;
getter DOMString item(unsigned long index);
DOMString getPropertyValue(DOMString property);
DOMString getPropertyPriority(DOMString property);
[CEReactions, Throws]
undefined setProperty(DOMString property, [LegacyNullToEmptyString] DOMString value,
optional [LegacyNullToEmptyString] DOMString priority = "");
[CEReactions, Throws]
DOMString removeProperty(DOMString property);
// readonly attribute CSSRule? parentRule;
[CEReactions, SetterThrows]
attribute DOMString cssFloat;
};
// Auto-generated in GlobalGen.py: accessors for each CSS property

View file

@ -1,10 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.csswg.org/cssom/#the-cssstylerule-interface
[Exposed=Window]
interface CSSStyleRule : CSSRule {
attribute DOMString selectorText;
[SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
};

View file

@ -1,12 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.csswg.org/cssom/#the-cssstylesheet-interface
[Exposed=Window]
interface CSSStyleSheet : StyleSheet {
// readonly attribute CSSRule? ownerRule;
[Throws, SameObject] readonly attribute CSSRuleList cssRules;
[Throws] unsigned long insertRule(DOMString rule, optional unsigned long index = 0);
[Throws] undefined deleteRule(unsigned long index);
};

View file

@ -1,10 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.css-houdini.org/css-typed-om-1/#cssstylevalue
// NOTE: should this be exposed to Window?
[Pref="dom_worklet_enabled", Exposed=(Worklet)]
interface CSSStyleValue {
stringifier;
};

View file

@ -1,8 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.csswg.org/css-conditional/#csssupportsrule
[Exposed=Window]
interface CSSSupportsRule : CSSConditionRule {
};

View file

@ -1,264 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#2dcontext
// typedef (HTMLImageElement or
// SVGImageElement) HTMLOrSVGImageElement;
typedef HTMLImageElement HTMLOrSVGImageElement;
typedef (HTMLOrSVGImageElement or
/*HTMLVideoElement or*/
HTMLCanvasElement or
/*ImageBitmap or*/
OffscreenCanvas or
/*VideoFrame or*/
/*CSSImageValue*/ CSSStyleValue) CanvasImageSource;
enum CanvasFillRule { "nonzero", "evenodd" };
[Exposed=Window]
interface CanvasRenderingContext2D {
// back-reference to the canvas
readonly attribute HTMLCanvasElement canvas;
};
CanvasRenderingContext2D includes CanvasState;
CanvasRenderingContext2D includes CanvasTransform;
CanvasRenderingContext2D includes CanvasCompositing;
CanvasRenderingContext2D includes CanvasImageSmoothing;
CanvasRenderingContext2D includes CanvasFillStrokeStyles;
CanvasRenderingContext2D includes CanvasShadowStyles;
CanvasRenderingContext2D includes CanvasFilters;
CanvasRenderingContext2D includes CanvasRect;
CanvasRenderingContext2D includes CanvasDrawPath;
CanvasRenderingContext2D includes CanvasUserInterface;
CanvasRenderingContext2D includes CanvasText;
CanvasRenderingContext2D includes CanvasDrawImage;
CanvasRenderingContext2D includes CanvasImageData;
CanvasRenderingContext2D includes CanvasPathDrawingStyles;
CanvasRenderingContext2D includes CanvasTextDrawingStyles;
CanvasRenderingContext2D includes CanvasPath;
interface mixin CanvasState {
// state
undefined save(); // push state on state stack
undefined restore(); // pop state stack and restore state
undefined reset();
};
interface mixin CanvasTransform {
// transformations (default transform is the identity matrix)
undefined scale(unrestricted double x, unrestricted double y);
undefined rotate(unrestricted double angle);
undefined translate(unrestricted double x, unrestricted double y);
undefined transform(unrestricted double a,
unrestricted double b,
unrestricted double c,
unrestricted double d,
unrestricted double e,
unrestricted double f);
[NewObject] DOMMatrix getTransform();
undefined setTransform(unrestricted double a,
unrestricted double b,
unrestricted double c,
unrestricted double d,
unrestricted double e,
unrestricted double f);
// void setTransform(optional DOMMatrixInit matrix);
undefined resetTransform();
};
interface mixin CanvasCompositing {
// compositing
attribute unrestricted double globalAlpha; // (default 1.0)
attribute DOMString globalCompositeOperation; // (default source-over)
};
interface mixin CanvasImageSmoothing {
// image smoothing
attribute boolean imageSmoothingEnabled; // (default true)
// attribute ImageSmoothingQuality imageSmoothingQuality; // (default low)
};
interface mixin CanvasFillStrokeStyles {
// colours and styles (see also the CanvasDrawingStyles interface)
attribute (DOMString or CanvasGradient or CanvasPattern) strokeStyle; // (default black)
attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle; // (default black)
CanvasGradient createLinearGradient(double x0, double y0, double x1, double y1);
[Throws]
CanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1);
[Throws]
CanvasPattern? createPattern(CanvasImageSource image, [LegacyNullToEmptyString] DOMString repetition);
};
interface mixin CanvasShadowStyles {
// shadows
attribute unrestricted double shadowOffsetX; // (default 0)
attribute unrestricted double shadowOffsetY; // (default 0)
attribute unrestricted double shadowBlur; // (default 0)
attribute DOMString shadowColor; // (default transparent black)
};
interface mixin CanvasFilters {
// filters
//attribute DOMString filter; // (default "none")
};
interface mixin CanvasRect {
// rects
undefined clearRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
undefined fillRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
undefined strokeRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
};
interface mixin CanvasDrawPath {
// path API (see also CanvasPath)
undefined beginPath();
undefined fill(optional CanvasFillRule fillRule = "nonzero");
//void fill(Path2D path, optional CanvasFillRule fillRule = "nonzero");
undefined stroke();
//void stroke(Path2D path);
undefined clip(optional CanvasFillRule fillRule = "nonzero");
//void clip(Path2D path, optional CanvasFillRule fillRule = "nonzero");
boolean isPointInPath(unrestricted double x, unrestricted double y,
optional CanvasFillRule fillRule = "nonzero");
//boolean isPointInPath(Path2D path, unrestricted double x, unrestricted double y,
// optional CanvasFillRule fillRule = "nonzero");
//boolean isPointInStroke(unrestricted double x, unrestricted double y);
//boolean isPointInStroke(Path2D path, unrestricted double x, unrestricted double y);
};
interface mixin CanvasUserInterface {
//void drawFocusIfNeeded(Element element);
//void drawFocusIfNeeded(Path2D path, Element element);
//void scrollPathIntoView();
//void scrollPathIntoView(Path2D path);
};
interface mixin CanvasText {
// text (see also the CanvasPathDrawingStyles and CanvasTextDrawingStyles interfaces)
[Pref="dom_canvas_text_enabled"]
undefined fillText(DOMString text, unrestricted double x, unrestricted double y,
optional unrestricted double maxWidth);
//void strokeText(DOMString text, unrestricted double x, unrestricted double y,
// optional unrestricted double maxWidth);
[Pref="dom_canvas_text_enabled"]
TextMetrics measureText(DOMString text);
};
interface mixin CanvasDrawImage {
// drawing images
[Throws]
undefined drawImage(CanvasImageSource image, unrestricted double dx, unrestricted double dy);
[Throws]
undefined drawImage(CanvasImageSource image, unrestricted double dx, unrestricted double dy,
unrestricted double dw, unrestricted double dh);
[Throws]
undefined drawImage(CanvasImageSource image, unrestricted double sx, unrestricted double sy,
unrestricted double sw, unrestricted double sh,
unrestricted double dx, unrestricted double dy,
unrestricted double dw, unrestricted double dh);
};
interface mixin CanvasImageData {
// pixel manipulation
[Throws]
ImageData createImageData(long sw, long sh);
[Throws]
ImageData createImageData(ImageData imagedata);
[Throws]
ImageData getImageData(long sx, long sy, long sw, long sh);
undefined putImageData(ImageData imagedata, long dx, long dy);
undefined putImageData(ImageData imagedata,
long dx, long dy,
long dirtyX, long dirtyY,
long dirtyWidth, long dirtyHeight);
};
enum CanvasLineCap { "butt", "round", "square" };
enum CanvasLineJoin { "round", "bevel", "miter"};
enum CanvasTextAlign { "start", "end", "left", "right", "center" };
enum CanvasTextBaseline { "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" };
enum CanvasDirection { "ltr", "rtl", "inherit" };
interface mixin CanvasPathDrawingStyles {
// line caps/joins
attribute unrestricted double lineWidth; // (default 1)
attribute CanvasLineCap lineCap; // (default "butt")
attribute CanvasLineJoin lineJoin; // (default "miter")
attribute unrestricted double miterLimit; // (default 10)
// dashed lines
//void setLineDash(sequence<unrestricted double> segments); // default empty
//sequence<unrestricted double> getLineDash();
//attribute unrestricted double lineDashOffset;
};
interface mixin CanvasTextDrawingStyles {
// text
attribute DOMString font; // (default 10px sans-serif)
attribute CanvasTextAlign textAlign; // "start", "end", "left", "right", "center" (default: "start")
attribute CanvasTextBaseline textBaseline; // "top", "hanging", "middle", "alphabetic",
// "ideographic", "bottom" (default: "alphabetic")
attribute CanvasDirection direction; // "ltr", "rtl", "inherit" (default: "inherit")
};
interface mixin CanvasPath {
// shared path API methods
undefined closePath();
undefined moveTo(unrestricted double x, unrestricted double y);
undefined lineTo(unrestricted double x, unrestricted double y);
undefined quadraticCurveTo(unrestricted double cpx, unrestricted double cpy,
unrestricted double x, unrestricted double y);
undefined bezierCurveTo(unrestricted double cp1x,
unrestricted double cp1y,
unrestricted double cp2x,
unrestricted double cp2y,
unrestricted double x,
unrestricted double y);
[Throws]
undefined arcTo(unrestricted double x1, unrestricted double y1,
unrestricted double x2, unrestricted double y2,
unrestricted double radius);
undefined rect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
[Throws]
undefined arc(unrestricted double x, unrestricted double y, unrestricted double radius,
unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise = false);
[Throws]
undefined ellipse(unrestricted double x, unrestricted double y, unrestricted double radius_x,
unrestricted double radius_y, unrestricted double rotation, unrestricted double startAngle,
unrestricted double endAngle, optional boolean anticlockwise = false);
};
[Exposed=(Window, PaintWorklet, Worker)]
interface CanvasGradient {
// opaque object
[Throws]
undefined addColorStop(double offset, DOMString color);
};
[Exposed=(Window, PaintWorklet, Worker)]
interface CanvasPattern {
// opaque object
//undefined setTransform(optional DOMMatrix2DInit transform = {});
};
[Exposed=(Window,Worker),
Serializable]
interface ImageData {
[Throws] constructor(unsigned long sw, unsigned long sh/*, optional ImageDataSettings settings = {}*/);
[Throws] constructor(/* Uint8ClampedArray */ object data, unsigned long sw, optional unsigned long sh
/*, optional ImageDataSettings settings = {}*/);
readonly attribute unsigned long width;
readonly attribute unsigned long height;
[Throws] readonly attribute Uint8ClampedArray data;
//readonly attribute PredefinedColorSpace colorSpace;
};

View file

@ -1,16 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://webaudio.github.io/web-audio-api/#channelmergernode
*/
dictionary ChannelMergerOptions : AudioNodeOptions {
unsigned long numberOfInputs = 6;
};
[Exposed=Window]
interface ChannelMergerNode : AudioNode {
[Throws] constructor(BaseAudioContext context, optional ChannelMergerOptions options = {});
};

View file

@ -1,16 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://webaudio.github.io/web-audio-api/#channelsplitternode
*/
dictionary ChannelSplitterOptions : AudioNodeOptions {
unsigned long numberOfOutputs = 6;
};
[Exposed=Window]
interface ChannelSplitterNode : AudioNode {
[Throws] constructor(BaseAudioContext context, optional ChannelSplitterOptions options = {});
};

View file

@ -1,28 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://dom.spec.whatwg.org/#characterdata
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
[Exposed=Window, Abstract]
interface CharacterData : Node {
[Pure] attribute [LegacyNullToEmptyString] DOMString data;
[Pure] readonly attribute unsigned long length;
[Pure, Throws]
DOMString substringData(unsigned long offset, unsigned long count);
undefined appendData(DOMString data);
[Throws]
undefined insertData(unsigned long offset, DOMString data);
[Throws]
undefined deleteData(unsigned long offset, unsigned long count);
[Throws]
undefined replaceData(unsigned long offset, unsigned long count, DOMString data);
};
CharacterData includes ChildNode;
CharacterData includes NonDocumentTypeChildNode;

View file

@ -1,25 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is:
* https://dom.spec.whatwg.org/#interface-childnode
*/
interface mixin ChildNode {
[Throws, CEReactions, Unscopable]
undefined before((Node or DOMString)... nodes);
[Throws, CEReactions, Unscopable]
undefined after((Node or DOMString)... nodes);
[Throws, CEReactions, Unscopable]
undefined replaceWith((Node or DOMString)... nodes);
[CEReactions, Unscopable]
undefined remove();
};
interface mixin NonDocumentTypeChildNode {
[Pure]
readonly attribute Element? previousElementSibling;
[Pure]
readonly attribute Element? nextElementSibling;
};

View file

@ -1,20 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://w3c.github.io/ServiceWorker/#client
[Pref="dom_serviceworker_enabled", Exposed=ServiceWorker]
interface Client {
readonly attribute USVString url;
readonly attribute FrameType frameType;
readonly attribute DOMString id;
//void postMessage(any message, optional sequence<Transferable> transfer);
};
enum FrameType {
"auxiliary",
"top-level",
"nested",
"none"
};

View file

@ -1,15 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// https://w3c.github.io/clipboard-apis/
[Exposed=Window, Pref="dom_clipboardevent_enabled"]
interface ClipboardEvent : Event {
constructor (DOMString type, optional ClipboardEventInit eventInitDict = {});
readonly attribute DataTransfer? clipboardData;
};
dictionary ClipboardEventInit : EventInit {
DataTransfer? clipboardData = null;
};

View file

@ -1,18 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
//https://html.spec.whatwg.org/multipage/#the-closeevent-interfaces
[Exposed=(Window,Worker)]
interface CloseEvent : Event {
[Throws] constructor(DOMString type, optional CloseEventInit eventInitDict = {});
readonly attribute boolean wasClean;
readonly attribute unsigned short code;
readonly attribute DOMString reason;
};
dictionary CloseEventInit : EventInit {
boolean wasClean = false;
unsigned short code = 0;
DOMString reason = "";
};

View file

@ -1,15 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://dom.spec.whatwg.org/#comment
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
[Exposed=Window]
interface Comment : CharacterData {
[Throws] constructor(optional DOMString data = "");
};

View file

@ -1,21 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://w3c.github.io/uievents/#idl-compositionevent
*
*/
// https://w3c.github.io/uievents/#idl-compositionevent
[Exposed=Window, Pref="dom_composition_event_enabled"]
interface CompositionEvent : UIEvent {
[Throws] constructor(DOMString type, optional CompositionEventInit eventInitDict = {});
readonly attribute DOMString data;
};
// https://w3c.github.io/uievents/#idl-compositioneventinit
dictionary CompositionEventInit : UIEventInit {
DOMString data = "";
};

View file

@ -1,36 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://console.spec.whatwg.org/
[ClassString="Console",
Exposed=*]
namespace console {
// Logging
undefined assert(optional boolean condition = false, any... data);
undefined clear();
undefined debug(any... messages);
undefined error(any... messages);
undefined info(any... messages);
undefined log(any... messages);
// undefined table(optional any tabularData, optional sequence<DOMString> properties);
undefined trace(any... data);
undefined warn(any... messages);
// undefined dir(optional any item, optional object? options);
// undefined dirxml(any... data);
// Counting
undefined count(optional DOMString label = "default");
undefined countReset(optional DOMString label = "default");
// Grouping
undefined group(any... data);
undefined groupCollapsed(any... data);
undefined groupEnd();
// Timing
undefined time(optional DOMString label = "default");
undefined timeLog(optional DOMString label = "default", any... data);
undefined timeEnd(optional DOMString label = "default");
};

View file

@ -1,17 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://webaudio.github.io/web-audio-api/#ConstantSourceNode
*/
dictionary ConstantSourceOptions: AudioNodeOptions {
float offset = 1;
};
[Exposed=Window]
interface ConstantSourceNode : AudioScheduledSourceNode {
[Throws] constructor(BaseAudioContext context, optional ConstantSourceOptions options = {});
readonly attribute AudioParam offset;
};

View file

@ -1,19 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://w3c.github.io/webcrypto/#crypto-interface
*
*/
partial interface mixin WindowOrWorkerGlobalScope {
[SameObject] readonly attribute Crypto crypto;
};
[Exposed=(Window,Worker)]
interface Crypto {
[SecureContext, Pref="dom_crypto_subtle_enabled"] readonly attribute SubtleCrypto subtle;
[Throws] ArrayBufferView getRandomValues(ArrayBufferView array);
[SecureContext] DOMString randomUUID();
};

View file

@ -1,17 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://w3c.github.io/webcrypto/#cryptokey-interface
enum KeyType { "public", "private", "secret" };
enum KeyUsage { "encrypt", "decrypt", "sign", "verify", "deriveKey", "deriveBits", "wrapKey", "unwrapKey" };
[SecureContext, Exposed=(Window,Worker), Serializable, Pref="dom_crypto_subtle_enabled"]
interface CryptoKey {
readonly attribute KeyType type;
readonly attribute boolean extractable;
readonly attribute object algorithm;
readonly attribute object usages;
};

View file

@ -1,28 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#customelementregistry
[Exposed=Window, Pref="dom_customelements_enabled"]
interface CustomElementRegistry {
[Throws, CEReactions]
undefined define(
DOMString name,
CustomElementConstructor constructor_,
optional ElementDefinitionOptions options = {}
);
any get(DOMString name);
DOMString? getName(CustomElementConstructor constructor);
Promise<CustomElementConstructor> whenDefined(DOMString name);
[CEReactions] undefined upgrade(Node root);
};
callback CustomElementConstructor = HTMLElement();
dictionary ElementDefinitionOptions {
DOMString extends;
};

View file

@ -1,33 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* For more information on this interface please see
* https://dom.spec.whatwg.org/#interface-customevent
*
* To the extent possible under law, the editors have waived
* all copyright and related or neighboring rights to this work.
* In addition, as of 1 May 2014, the editors have made this specification
* available under the Open Web Foundation Agreement Version 1.0,
* which is available at
* http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0.
*/
// https://dom.spec.whatwg.org/#dom-customevent-initcustomevent
[Exposed=*]
interface CustomEvent : Event {
constructor(DOMString type, optional CustomEventInit eventInitDict = {});
readonly attribute any detail;
undefined initCustomEvent(
DOMString type,
optional boolean bubbles = false,
optional boolean cancelable = false,
optional any detail = null
); // legacy
};
dictionary CustomEventInit : EventInit {
any detail = null;
};

View file

@ -1,50 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
/* https://heycam.github.io/webidl/#es-DOMException
* https://heycam.github.io/webidl/#es-DOMException-constructor-object
*/
[
ExceptionClass,
Exposed=(Window,Worker,Worklet,DissimilarOriginWindow)
]
interface DOMException {
[Throws] constructor(optional DOMString message="", optional DOMString name="Error");
const unsigned short INDEX_SIZE_ERR = 1;
const unsigned short DOMSTRING_SIZE_ERR = 2; // historical
const unsigned short HIERARCHY_REQUEST_ERR = 3;
const unsigned short WRONG_DOCUMENT_ERR = 4;
const unsigned short INVALID_CHARACTER_ERR = 5;
const unsigned short NO_DATA_ALLOWED_ERR = 6; // historical
const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
const unsigned short NOT_FOUND_ERR = 8;
const unsigned short NOT_SUPPORTED_ERR = 9;
const unsigned short INUSE_ATTRIBUTE_ERR = 10; // historical
const unsigned short INVALID_STATE_ERR = 11;
const unsigned short SYNTAX_ERR = 12;
const unsigned short INVALID_MODIFICATION_ERR = 13;
const unsigned short NAMESPACE_ERR = 14;
const unsigned short INVALID_ACCESS_ERR = 15;
const unsigned short VALIDATION_ERR = 16; // historical
const unsigned short TYPE_MISMATCH_ERR = 17; // historical; use JavaScript's TypeError instead
const unsigned short SECURITY_ERR = 18;
const unsigned short NETWORK_ERR = 19;
const unsigned short ABORT_ERR = 20;
const unsigned short URL_MISMATCH_ERR = 21;
const unsigned short QUOTA_EXCEEDED_ERR = 22;
const unsigned short TIMEOUT_ERR = 23;
const unsigned short INVALID_NODE_TYPE_ERR = 24;
const unsigned short DATA_CLONE_ERR = 25;
// Error code as u16
readonly attribute unsigned short code;
// The name of the error code (ie, a string repr of |code|)
readonly attribute DOMString name;
// A custom message set by the thrower.
readonly attribute DOMString message;
};

View file

@ -1,27 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://dom.spec.whatwg.org/#interface-domimplementation
*
* Copyright:
* To the extent possible under law, the editors have waived all copyright and
* related or neighboring rights to this work.
*/
[Exposed=Window]
interface DOMImplementation {
[NewObject, Throws]
DocumentType createDocumentType(DOMString qualifiedName, DOMString publicId,
DOMString systemId);
[NewObject, Throws]
XMLDocument createDocument(DOMString? namespace,
[LegacyNullToEmptyString] DOMString qualifiedName,
optional DocumentType? doctype = null);
[NewObject]
Document createHTMLDocument(optional DOMString title);
[Pure]
boolean hasFeature(); // useless, always return true
};

View file

@ -1,100 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.fxtf.org/geometry/#dommatrix
[Exposed=(Window,Worker,PaintWorklet),
LegacyWindowAlias=WebKitCSSMatrix]
interface DOMMatrix : DOMMatrixReadOnly {
[Throws] constructor(optional (DOMString or sequence<unrestricted double>) init);
[NewObject, Throws] static DOMMatrix fromMatrix(optional DOMMatrixInit other = {});
[NewObject, Throws] static DOMMatrix fromFloat32Array(Float32Array array32);
[NewObject, Throws] static DOMMatrix fromFloat64Array(Float64Array array64);
// These attributes are simple aliases for certain elements of the 4x4 matrix
inherit attribute unrestricted double a;
inherit attribute unrestricted double b;
inherit attribute unrestricted double c;
inherit attribute unrestricted double d;
inherit attribute unrestricted double e;
inherit attribute unrestricted double f;
inherit attribute unrestricted double m11;
inherit attribute unrestricted double m12;
inherit attribute unrestricted double m13;
inherit attribute unrestricted double m14;
inherit attribute unrestricted double m21;
inherit attribute unrestricted double m22;
inherit attribute unrestricted double m23;
inherit attribute unrestricted double m24;
inherit attribute unrestricted double m31;
inherit attribute unrestricted double m32;
inherit attribute unrestricted double m33;
inherit attribute unrestricted double m34;
inherit attribute unrestricted double m41;
inherit attribute unrestricted double m42;
inherit attribute unrestricted double m43;
inherit attribute unrestricted double m44;
// Mutable transform methods
[Throws] DOMMatrix multiplySelf(optional DOMMatrixInit other = {});
[Throws] DOMMatrix preMultiplySelf(optional DOMMatrixInit other = {});
DOMMatrix translateSelf(optional unrestricted double tx = 0,
optional unrestricted double ty = 0,
optional unrestricted double tz = 0);
DOMMatrix scaleSelf(optional unrestricted double scaleX = 1,
optional unrestricted double scaleY,
optional unrestricted double scaleZ = 1,
optional unrestricted double originX = 0,
optional unrestricted double originY = 0,
optional unrestricted double originZ = 0);
DOMMatrix scale3dSelf(optional unrestricted double scale = 1,
optional unrestricted double originX = 0,
optional unrestricted double originY = 0,
optional unrestricted double originZ = 0);
DOMMatrix rotateSelf(optional unrestricted double rotX = 0,
optional unrestricted double rotY,
optional unrestricted double rotZ);
DOMMatrix rotateFromVectorSelf(optional unrestricted double x = 0,
optional unrestricted double y = 0);
DOMMatrix rotateAxisAngleSelf(optional unrestricted double x = 0,
optional unrestricted double y = 0,
optional unrestricted double z = 0,
optional unrestricted double angle = 0);
DOMMatrix skewXSelf(optional unrestricted double sx = 0);
DOMMatrix skewYSelf(optional unrestricted double sy = 0);
DOMMatrix invertSelf();
// DOMMatrix setMatrixValue(DOMString transformList);
};
dictionary DOMMatrix2DInit {
unrestricted double a;
unrestricted double b;
unrestricted double c;
unrestricted double d;
unrestricted double e;
unrestricted double f;
unrestricted double m11;
unrestricted double m12;
unrestricted double m21;
unrestricted double m22;
unrestricted double m41;
unrestricted double m42;
};
dictionary DOMMatrixInit : DOMMatrix2DInit {
unrestricted double m13 = 0;
unrestricted double m14 = 0;
unrestricted double m23 = 0;
unrestricted double m24 = 0;
unrestricted double m31 = 0;
unrestricted double m32 = 0;
unrestricted double m33 = 1;
unrestricted double m34 = 0;
unrestricted double m43 = 0;
unrestricted double m44 = 1;
boolean is2D;
};

View file

@ -1,86 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://drafts.fxtf.org/geometry-1/#DOMMatrix
*
* Copyright:
* To the extent possible under law, the editors have waived all copyright and
* related or neighboring rights to this work.
*/
[Exposed=(Window,Worker,PaintWorklet)]
interface DOMMatrixReadOnly {
[Throws] constructor(optional (DOMString or sequence<unrestricted double>) init);
[NewObject, Throws] static DOMMatrixReadOnly fromMatrix(optional DOMMatrixInit other = {});
[NewObject, Throws] static DOMMatrixReadOnly fromFloat32Array(Float32Array array32);
[NewObject, Throws] static DOMMatrixReadOnly fromFloat64Array(Float64Array array64);
// These attributes are simple aliases for certain elements of the 4x4 matrix
readonly attribute unrestricted double a;
readonly attribute unrestricted double b;
readonly attribute unrestricted double c;
readonly attribute unrestricted double d;
readonly attribute unrestricted double e;
readonly attribute unrestricted double f;
readonly attribute unrestricted double m11;
readonly attribute unrestricted double m12;
readonly attribute unrestricted double m13;
readonly attribute unrestricted double m14;
readonly attribute unrestricted double m21;
readonly attribute unrestricted double m22;
readonly attribute unrestricted double m23;
readonly attribute unrestricted double m24;
readonly attribute unrestricted double m31;
readonly attribute unrestricted double m32;
readonly attribute unrestricted double m33;
readonly attribute unrestricted double m34;
readonly attribute unrestricted double m41;
readonly attribute unrestricted double m42;
readonly attribute unrestricted double m43;
readonly attribute unrestricted double m44;
readonly attribute boolean is2D;
readonly attribute boolean isIdentity;
// Immutable transform methods
DOMMatrix translate(optional unrestricted double tx = 0,
optional unrestricted double ty = 0,
optional unrestricted double tz = 0);
DOMMatrix scale(optional unrestricted double scaleX = 1,
optional unrestricted double scaleY,
optional unrestricted double scaleZ = 1,
optional unrestricted double originX = 0,
optional unrestricted double originY = 0,
optional unrestricted double originZ = 0);
[NewObject] DOMMatrix scaleNonUniform(optional unrestricted double scaleX = 1,
optional unrestricted double scaleY = 1);
DOMMatrix scale3d(optional unrestricted double scale = 1,
optional unrestricted double originX = 0,
optional unrestricted double originY = 0,
optional unrestricted double originZ = 0);
DOMMatrix rotate(optional unrestricted double rotX = 0,
optional unrestricted double rotY,
optional unrestricted double rotZ);
DOMMatrix rotateFromVector(optional unrestricted double x = 0,
optional unrestricted double y = 0);
DOMMatrix rotateAxisAngle(optional unrestricted double x = 0,
optional unrestricted double y = 0,
optional unrestricted double z = 0,
optional unrestricted double angle = 0);
DOMMatrix skewX(optional unrestricted double sx = 0);
DOMMatrix skewY(optional unrestricted double sy = 0);
[Throws] DOMMatrix multiply(optional DOMMatrixInit other = {});
DOMMatrix flipX();
DOMMatrix flipY();
DOMMatrix inverse();
DOMPoint transformPoint(optional DOMPointInit point = {});
Float32Array toFloat32Array();
Float64Array toFloat64Array();
[Exposed=Window, Throws] stringifier;
[Default] object toJSON();
};

View file

@ -1,22 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://w3c.github.io/DOM-Parsing/#the-domparser-interface
*/
enum SupportedType {
"text/html",
"text/xml",
"application/xml",
"application/xhtml+xml",
"image/svg+xml"
};
[Exposed=Window]
interface DOMParser {
[Throws] constructor();
[Throws]
Document parseFromString(DOMString str, SupportedType type);
};

View file

@ -1,30 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* http://dev.w3.org/fxtf/geometry/
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
// http://dev.w3.org/fxtf/geometry/Overview.html#dompoint
[Exposed=(Window,Worker,PaintWorklet)]
interface DOMPoint : DOMPointReadOnly {
[Throws] constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
optional unrestricted double z = 0, optional unrestricted double w = 1);
[NewObject] static DOMPoint fromPoint(optional DOMPointInit other = {});
inherit attribute unrestricted double x;
inherit attribute unrestricted double y;
inherit attribute unrestricted double z;
inherit attribute unrestricted double w;
};
dictionary DOMPointInit {
unrestricted double x = 0;
unrestricted double y = 0;
unrestricted double z = 0;
unrestricted double w = 1;
};

View file

@ -1,25 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* http://dev.w3.org/fxtf/geometry/
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
// http://dev.w3.org/fxtf/geometry/Overview.html#dompointreadonly
[Exposed=(Window,Worker,PaintWorklet)]
interface DOMPointReadOnly {
[Throws] constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
optional unrestricted double z = 0, optional unrestricted double w = 1);
[NewObject] static DOMPointReadOnly fromPoint(optional DOMPointInit other = {});
readonly attribute unrestricted double x;
readonly attribute unrestricted double y;
readonly attribute unrestricted double z;
readonly attribute unrestricted double w;
[Default] object toJSON();
};

View file

@ -1,34 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://drafts.fxtf.org/geometry/#DOMQuad
*
* Copyright:
* To the extent possible under law, the editors have waived all copyright and
* related or neighboring rights to this work.
*/
[Exposed=(Window,Worker)]
interface DOMQuad {
[Throws] constructor(optional DOMPointInit p1 = {}, optional DOMPointInit p2 = {},
optional DOMPointInit p3 = {}, optional DOMPointInit p4 = {});
[NewObject] static DOMQuad fromRect(optional DOMRectInit other = {});
[NewObject] static DOMQuad fromQuad(optional DOMQuadInit other = {});
[SameObject] readonly attribute DOMPoint p1;
[SameObject] readonly attribute DOMPoint p2;
[SameObject] readonly attribute DOMPoint p3;
[SameObject] readonly attribute DOMPoint p4;
[NewObject] DOMRect getBounds();
[Default] object toJSON();
};
dictionary DOMQuadInit {
DOMPointInit p1 = {};
DOMPointInit p2 = {};
DOMPointInit p3 = {};
DOMPointInit p4 = {};
};

View file

@ -1,20 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.fxtf.org/geometry/#domrect
[Exposed=(Window,Worker),
Serializable,
LegacyWindowAlias=SVGRect]
interface DOMRect : DOMRectReadOnly {
[Throws] constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
optional unrestricted double width = 0, optional unrestricted double height = 0);
[NewObject] static DOMRect fromRect(optional DOMRectInit other = {});
inherit attribute unrestricted double x;
inherit attribute unrestricted double y;
inherit attribute unrestricted double width;
inherit attribute unrestricted double height;
};

View file

@ -1,11 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.fxtf.org/geometry-1/#domrectlist
[Exposed=Window]
interface DOMRectList {
readonly attribute unsigned long length;
getter DOMRect? item(unsigned long index);
};

View file

@ -1,33 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://drafts.fxtf.org/geometry/#domrect
[Exposed=(Window,Worker),
Serializable]
interface DOMRectReadOnly {
[Throws] constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
optional unrestricted double width = 0, optional unrestricted double height = 0);
[NewObject] static DOMRectReadOnly fromRect(optional DOMRectInit other = {});
readonly attribute unrestricted double x;
readonly attribute unrestricted double y;
readonly attribute unrestricted double width;
readonly attribute unrestricted double height;
readonly attribute unrestricted double top;
readonly attribute unrestricted double right;
readonly attribute unrestricted double bottom;
readonly attribute unrestricted double left;
[Default] object toJSON();
};
// https://drafts.fxtf.org/geometry/#dictdef-domrectinit
dictionary DOMRectInit {
unrestricted double x = 0;
unrestricted double y = 0;
unrestricted double width = 0;
unrestricted double height = 0;
};

View file

@ -1,18 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is
* https://html.spec.whatwg.org/multipage/#domstringlist
*
* Copyright:
* To the extent possible under law, the editors have waived all copyright and
* related or neighboring rights to this work.
*/
[Exposed=(Window,Worker)]
interface DOMStringList {
readonly attribute unsigned long length;
getter DOMString? item(unsigned long index);
boolean contains(DOMString string);
};

View file

@ -1,13 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#the-domstringmap-interface
[Exposed=Window, LegacyOverrideBuiltIns]
interface DOMStringMap {
getter DOMString (DOMString name);
[CEReactions, Throws]
setter undefined (DOMString name, DOMString value);
[CEReactions]
deleter undefined (DOMString name);
};

View file

@ -1,30 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://dom.spec.whatwg.org/#domtokenlist
[Exposed=Window]
interface DOMTokenList {
[Pure]
readonly attribute unsigned long length;
[Pure]
getter DOMString? item(unsigned long index);
[Pure]
boolean contains(DOMString token);
[CEReactions, Throws]
undefined add(DOMString... tokens);
[CEReactions, Throws]
undefined remove(DOMString... tokens);
[CEReactions, Throws]
boolean toggle(DOMString token, optional boolean force);
[CEReactions, Throws]
boolean replace(DOMString token, DOMString newToken);
[Pure, Throws]
boolean supports(DOMString token);
[CEReactions, Pure]
stringifier attribute DOMString value;
iterable<DOMString?>;
};

View file

@ -1,24 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#datatransfer
[Exposed=Window]
interface DataTransfer {
constructor();
attribute DOMString dropEffect;
attribute DOMString effectAllowed;
[SameObject] readonly attribute DataTransferItemList items;
undefined setDragImage(Element image, long x, long y);
/* old interface */
readonly attribute /* FrozenArray<DOMString> */ any types;
DOMString getData(DOMString format);
undefined setData(DOMString format, DOMString data);
undefined clearData(optional DOMString format);
[SameObject] readonly attribute FileList files;
};

View file

@ -1,15 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#datatransferitem
[Exposed=Window]
interface DataTransferItem {
readonly attribute DOMString kind;
readonly attribute DOMString type;
undefined getAsString(FunctionStringCallback? _callback);
File? getAsFile();
};
callback FunctionStringCallback = undefined (DOMString data);

View file

@ -1,15 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#datatransferitemlist
[Exposed=Window]
interface DataTransferItemList {
readonly attribute unsigned long length;
getter DataTransferItem (unsigned long index);
[Throws] DataTransferItem? add(DOMString data, DOMString type);
[Throws] DataTransferItem? add(File data);
[Throws] undefined remove(unsigned long index);
undefined clear();
};

View file

@ -1,13 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#dedicatedworkerglobalscope
[Global=(Worker,DedicatedWorker), Exposed=DedicatedWorker]
/*sealed*/ interface DedicatedWorkerGlobalScope : WorkerGlobalScope {
[Throws] undefined postMessage(any message, sequence<object> transfer);
[Throws] undefined postMessage(any message, optional StructuredSerializeOptions options = {});
attribute EventHandler onmessage;
undefined close();
};

View file

@ -1,26 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
// This is a Servo-specific interface, used to represent locations
// that are not similar-origin, so live in another script thread.
// It is based on the interface for Window, but only contains the
// accessors that do not throw security exceptions when called
// cross-origin.
//
// Note that similar-origin locations are kept in the same script
// thread, so this mechanism cannot be relied upon as the only
// way to enforce security policy.
// https://html.spec.whatwg.org/multipage/#location
[Exposed=(Window,DissimilarOriginWindow), LegacyUnforgeable, LegacyNoInterfaceObject]
interface DissimilarOriginLocation {
[Throws] attribute USVString href;
[Throws] undefined assign(USVString url);
[Throws] undefined replace(USVString url);
[Throws] undefined reload();
[Throws] stringifier;
// TODO: finish this interface
};

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