mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Generate bindings for Node, CharacterData, Text, Element, and HTMLElement. Hook up text nodes to use the new bindings.
This commit is contained in:
parent
c9bc2046f6
commit
fd4efad70c
20 changed files with 1069 additions and 62 deletions
|
@ -114,6 +114,12 @@ DOMInterfaces = {
|
|||
}
|
||||
}],
|
||||
|
||||
'CharacterData': {
|
||||
'nativeType': 'AbstractNode<ScriptView>',
|
||||
'concreteType': 'CharacterData',
|
||||
'pointerType': ''
|
||||
},
|
||||
|
||||
'ClientRect': [
|
||||
{
|
||||
'nativeType': 'ClientRect',
|
||||
|
@ -161,6 +167,11 @@ DOMInterfaces = {
|
|||
}
|
||||
}],
|
||||
|
||||
'Element': {
|
||||
'nativeType': 'AbstractNode<ScriptView>',
|
||||
'pointerType': ''
|
||||
},
|
||||
|
||||
'Event': {
|
||||
},
|
||||
|
||||
|
@ -218,6 +229,11 @@ DOMInterfaces = {
|
|||
'pointerType': '',
|
||||
},
|
||||
|
||||
'HTMLElement': {
|
||||
'nativeType': 'AbstractNode<ScriptView>',
|
||||
'pointerType': ''
|
||||
},
|
||||
|
||||
'HTMLOptionsCollection': [
|
||||
{
|
||||
'nativeType': 'nsHTMLOptionCollection',
|
||||
|
@ -266,6 +282,12 @@ DOMInterfaces = {
|
|||
'MouseEvent': {
|
||||
},
|
||||
|
||||
'Node': {
|
||||
'nativeType': 'AbstractNode<ScriptView>',
|
||||
'concreteType': 'Node<ScriptView>',
|
||||
'pointerType': ''
|
||||
},
|
||||
|
||||
'NodeList': [
|
||||
{
|
||||
'nativeType': 'nsINodeList',
|
||||
|
@ -343,6 +365,12 @@ DOMInterfaces = {
|
|||
'resultNotAddRefed': [ 'getItem' ]
|
||||
}],
|
||||
|
||||
'Text': {
|
||||
'nativeType': 'AbstractNode<ScriptView>',
|
||||
'concreteType': 'Text',
|
||||
'pointerType': ''
|
||||
},
|
||||
|
||||
'UIEvent': {
|
||||
},
|
||||
|
||||
|
@ -533,13 +561,13 @@ addExternalIface('CSSRule')
|
|||
addExternalIface('CSSValue')
|
||||
addExternalIface('DOMStringList', nativeType='nsDOMStringList',
|
||||
headerFile='nsDOMLists.h')
|
||||
addExternalIface('Element', nativeType='AbstractNode<ScriptView>', pointerType='')
|
||||
#addExternalIface('Element', nativeType='AbstractNode<ScriptView>', pointerType='')
|
||||
addExternalIface('File')
|
||||
addExternalIface('HitRegionOptions', nativeType='nsISupports')
|
||||
addExternalIface('HTMLElement', nativeType='AbstractNode<ScriptView>', pointerType='')
|
||||
#addExternalIface('HTMLElement', nativeType='AbstractNode<ScriptView>', pointerType='')
|
||||
addExternalIface('HTMLHeadElement', nativeType='AbstractNode<ScriptView>', pointerType='')
|
||||
addExternalIface('ImageData', nativeType='mozilla::dom::ImageData')
|
||||
addExternalIface('Node', nativeType='AbstractNode<ScriptView>', pointerType='')
|
||||
#addExternalIface('Node', nativeType='AbstractNode<ScriptView>', pointerType='')
|
||||
addExternalIface('PaintRequest')
|
||||
addExternalIface('SVGLength')
|
||||
addExternalIface('SVGMatrix')
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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://dom.spec.whatwg.org/#characterdata
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
interface CharacterData : Node {
|
||||
[TreatNullAs=EmptyString,SetterThrows] attribute DOMString data;
|
||||
readonly attribute unsigned long length;
|
||||
[Throws]
|
||||
DOMString substringData(unsigned long offset, unsigned long count);
|
||||
[Throws]
|
||||
void appendData(DOMString data);
|
||||
[Throws]
|
||||
void insertData(unsigned long offset, DOMString data);
|
||||
[Throws]
|
||||
void deleteData(unsigned long offset, unsigned long count);
|
||||
[Throws]
|
||||
void replaceData(unsigned long offset, unsigned long count, DOMString data);
|
||||
};
|
||||
|
||||
//CharacterData implements ChildNode;
|
|
@ -1453,7 +1453,7 @@ def getWrapTemplateForType(type, descriptorProvider, result, successCode,
|
|||
if not haveSuccessCode:
|
||||
return wrapCall + ";\n" + "return if (*vp).v != 0 { 1 } else { 0 };"
|
||||
failureCode = "return 0;"
|
||||
str = ("if !%s {\n" +
|
||||
str = ("if !(%s as bool) {\n" +
|
||||
CGIndenter(CGGeneric(failureCode)).define() + "\n" +
|
||||
"}\n" +
|
||||
successCode) % (wrapCall)
|
||||
|
@ -1522,12 +1522,10 @@ for (uint32_t i = 0; i < length; ++i) {
|
|||
if not isCreator:
|
||||
raise MethodNotCreatorError(descriptor.interface.identifier.name)
|
||||
wrapMethod = "WrapNewBindingNonWrapperCachedObject"
|
||||
properResult = result
|
||||
if descriptor.pointerType == '':
|
||||
properResult = result + ".as_cacheable_wrapper()"
|
||||
wrap = "%s.wrap(cx, ${obj}, ${jsvalPtr} as *mut JSVal)" % result
|
||||
else:
|
||||
properResult += " as @mut CacheableWrapper"
|
||||
wrap = "%s(cx, ${obj}, %s, ${jsvalPtr} as *mut JSVal)" % (wrapMethod, properResult)
|
||||
wrap = "%s(cx, ${obj}, %s as @mut CacheableWrapper, ${jsvalPtr} as *mut JSVal)" % (wrapMethod, result)
|
||||
# We don't support prefable stuff in workers.
|
||||
assert(not descriptor.prefable or not descriptor.workers)
|
||||
if not descriptor.prefable:
|
||||
|
@ -2476,7 +2474,7 @@ class CGWrapWithCacheMethod(CGAbstractMethod):
|
|||
def __init__(self, descriptor):
|
||||
assert descriptor.interface.hasInterfacePrototypeObject()
|
||||
args = [Argument('*JSContext', 'aCx'), Argument('*JSObject', 'aScope'),
|
||||
Argument('@mut ' + descriptor.name, 'aObject'),
|
||||
Argument('@mut ' + descriptor.concreteType, 'aObject'),
|
||||
Argument('*mut bool', 'aTriedToWrap')]
|
||||
CGAbstractMethod.__init__(self, descriptor, 'Wrap_', '*JSObject', args)
|
||||
|
||||
|
@ -2513,7 +2511,8 @@ class CGWrapMethod(CGAbstractMethod):
|
|||
# XXX can we wrap if we don't have an interface prototype object?
|
||||
assert descriptor.interface.hasInterfacePrototypeObject()
|
||||
args = [Argument('*JSContext', 'aCx'), Argument('*JSObject', 'aScope'),
|
||||
Argument('@mut ' + descriptor.name, 'aObject'), Argument('*mut bool', 'aTriedToWrap')]
|
||||
Argument('@mut ' + descriptor.concreteType, 'aObject'),
|
||||
Argument('*mut bool', 'aTriedToWrap')]
|
||||
CGAbstractMethod.__init__(self, descriptor, 'Wrap', '*JSObject', args, inline=True, pub=True)
|
||||
|
||||
def definition_body(self):
|
||||
|
@ -3161,7 +3160,7 @@ class CGAbstractBindingMethod(CGAbstractExternMethod):
|
|||
" return false as JSBool;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"let this: *rust_box<%s>;" % self.descriptor.name))
|
||||
"let this: *rust_box<%s>;" % self.descriptor.concreteType))
|
||||
|
||||
def generate_code(self):
|
||||
assert(False) # Override me
|
||||
|
@ -3201,7 +3200,7 @@ class CGSpecializedMethod(CGAbstractExternMethod):
|
|||
self.method = method
|
||||
name = method.identifier.name
|
||||
args = [Argument('*JSContext', 'cx'), Argument('JSHandleObject', 'obj'),
|
||||
Argument('*mut %s' % descriptor.name, 'this'),
|
||||
Argument('*mut %s' % descriptor.concreteType, 'this'),
|
||||
Argument('libc::c_uint', 'argc'), Argument('*mut JSVal', 'vp')]
|
||||
CGAbstractExternMethod.__init__(self, descriptor, name, 'JSBool', args)
|
||||
|
||||
|
@ -3246,7 +3245,7 @@ class CGSpecializedGetter(CGAbstractExternMethod):
|
|||
name = 'get_' + attr.identifier.name
|
||||
args = [ Argument('*JSContext', 'cx'),
|
||||
Argument('JSHandleObject', 'obj'),
|
||||
Argument('*%s' % descriptor.name, 'this'),
|
||||
Argument('*%s' % descriptor.concreteType, 'this'),
|
||||
Argument('*mut JSVal', 'vp') ]
|
||||
CGAbstractExternMethod.__init__(self, descriptor, name, "JSBool", args)
|
||||
|
||||
|
@ -3305,7 +3304,7 @@ class CGSpecializedSetter(CGAbstractExternMethod):
|
|||
name = 'set_' + attr.identifier.name
|
||||
args = [ Argument('*JSContext', 'cx'),
|
||||
Argument('JSHandleObject', 'obj'),
|
||||
Argument('*mut %s' % descriptor.name, 'this'),
|
||||
Argument('*mut %s' % descriptor.concreteType, 'this'),
|
||||
Argument('*mut JSVal', 'argv')]
|
||||
CGAbstractExternMethod.__init__(self, descriptor, name, "JSBool", args)
|
||||
|
||||
|
@ -3968,7 +3967,7 @@ def finalizeHook(descriptor, hookName, context):
|
|||
assert descriptor.nativeIsISupports
|
||||
release = """let val = JS_GetReservedSlot(obj, 0);
|
||||
let _: @mut %s = cast::transmute(RUST_JSVAL_TO_PRIVATE(val));
|
||||
""" % descriptor.name
|
||||
""" % descriptor.concreteType
|
||||
#return clearWrapper + release
|
||||
return release
|
||||
|
||||
|
@ -4603,8 +4602,11 @@ class CGBindingRoot(CGThing):
|
|||
'js::jsapi::*',
|
||||
'js::jsfriendapi::bindgen::*',
|
||||
'js::glue::*',
|
||||
'dom::node::AbstractNode', #XXXjdm
|
||||
'dom::characterdata::CharacterData', #XXXjdm
|
||||
'dom::node::{AbstractNode, Node, Text}', #XXXjdm
|
||||
'dom::document::{Document, AbstractDocument}', #XXXjdm
|
||||
'dom::element::Element', #XXXjdm
|
||||
'dom::htmlelement::HTMLElement', #XXXjdm
|
||||
'dom::htmldocument::HTMLDocument', #XXXjdm
|
||||
'dom::bindings::utils::*',
|
||||
'dom::bindings::conversions::*',
|
||||
|
|
189
src/components/script/dom/bindings/codegen/Element.webidl
Normal file
189
src/components/script/dom/bindings/codegen/Element.webidl
Normal file
|
@ -0,0 +1,189 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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://dom.spec.whatwg.org/#element and
|
||||
* http://domparsing.spec.whatwg.org/ and
|
||||
* http://dev.w3.org/csswg/cssom-view/ and
|
||||
* http://www.w3.org/TR/selectors-api/
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
interface Element : Node {
|
||||
/*
|
||||
We haven't moved these from Node to Element like the spec wants.
|
||||
|
||||
[Throws]
|
||||
readonly attribute DOMString? namespaceURI;
|
||||
readonly attribute DOMString? prefix;
|
||||
readonly attribute DOMString localName;
|
||||
*/
|
||||
// Not [Constant] because it depends on which document we're in
|
||||
[Pure]
|
||||
readonly attribute DOMString tagName;
|
||||
|
||||
[Pure]
|
||||
attribute DOMString id;
|
||||
/*
|
||||
FIXME Bug 810677 Move className from HTMLElement to Element
|
||||
attribute DOMString className;
|
||||
*/
|
||||
/*[Constant]
|
||||
readonly attribute DOMTokenList? classList;*/
|
||||
|
||||
/*[Constant]
|
||||
readonly attribute MozNamedAttrMap attributes;*/
|
||||
DOMString? getAttribute(DOMString name);
|
||||
DOMString? getAttributeNS(DOMString? namespace, DOMString localName);
|
||||
[Throws]
|
||||
void setAttribute(DOMString name, DOMString value);
|
||||
[Throws]
|
||||
void setAttributeNS(DOMString? namespace, DOMString name, DOMString value);
|
||||
[Throws]
|
||||
void removeAttribute(DOMString name);
|
||||
[Throws]
|
||||
void removeAttributeNS(DOMString? namespace, DOMString localName);
|
||||
boolean hasAttribute(DOMString name);
|
||||
boolean hasAttributeNS(DOMString? namespace, DOMString localName);
|
||||
|
||||
HTMLCollection getElementsByTagName(DOMString localName);
|
||||
[Throws]
|
||||
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
|
||||
HTMLCollection getElementsByClassName(DOMString classNames);
|
||||
|
||||
/**
|
||||
* The ratio of font-size-inflated text font size to computed font
|
||||
* size for this element. This will query the element for its primary frame,
|
||||
* and then use this to get font size inflation information about the frame.
|
||||
* This will be 1.0 if font size inflation is not enabled, and -1.0 if an
|
||||
* error occurred during the retrieval of the font size inflation.
|
||||
*
|
||||
* @note The font size inflation ratio that is returned is actually the
|
||||
* font size inflation data for the element's _primary frame_, not the
|
||||
* element itself, but for most purposes, this should be sufficient.
|
||||
*/
|
||||
/*[ChromeOnly]
|
||||
readonly attribute float fontSizeInflation;*/
|
||||
|
||||
// Mozilla specific stuff
|
||||
|
||||
/*[SetterThrows,LenientThis]
|
||||
attribute EventHandler onmouseenter;
|
||||
[SetterThrows,LenientThis]
|
||||
attribute EventHandler onmouseleave;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onwheel;*/
|
||||
|
||||
// Selectors API
|
||||
/**
|
||||
* Returns whether this element would be selected by the given selector
|
||||
* string.
|
||||
*
|
||||
* See <http://dev.w3.org/2006/webapi/selectors-api2/#matchesselector>
|
||||
*/
|
||||
[Throws]
|
||||
boolean mozMatchesSelector(DOMString selector);
|
||||
|
||||
// Proprietary extensions
|
||||
/**
|
||||
* Set this during a mousedown event to grab and retarget all mouse events
|
||||
* to this element until the mouse button is released or releaseCapture is
|
||||
* called. If retargetToElement is true, then all events are targetted at
|
||||
* this element. If false, events can also fire at descendants of this
|
||||
* element.
|
||||
*
|
||||
*/
|
||||
void setCapture(optional boolean retargetToElement = false);
|
||||
|
||||
/**
|
||||
* If this element has captured the mouse, release the capture. If another
|
||||
* element has captured the mouse, this method has no effect.
|
||||
*/
|
||||
void releaseCapture();
|
||||
|
||||
// Mozilla extensions
|
||||
/**
|
||||
* Requests that this element be made the full-screen element, as per the DOM
|
||||
* full-screen api.
|
||||
*
|
||||
* @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI>
|
||||
*/
|
||||
void mozRequestFullScreen();
|
||||
|
||||
/**
|
||||
* Requests that this element be made the pointer-locked element, as per the DOM
|
||||
* pointer lock api.
|
||||
*
|
||||
* @see <http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html>
|
||||
*/
|
||||
void mozRequestPointerLock();
|
||||
|
||||
// Obsolete methods.
|
||||
/*Attr? getAttributeNode(DOMString name);
|
||||
[Throws]
|
||||
Attr? setAttributeNode(Attr newAttr);
|
||||
[Throws]
|
||||
Attr? removeAttributeNode(Attr oldAttr);
|
||||
Attr? getAttributeNodeNS(DOMString? namespaceURI, DOMString localName);
|
||||
[Throws]
|
||||
Attr? setAttributeNodeNS(Attr newAttr);*/
|
||||
};
|
||||
|
||||
// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-element-interface
|
||||
partial interface Element {
|
||||
ClientRectList getClientRects();
|
||||
ClientRect getBoundingClientRect();
|
||||
|
||||
// scrolling
|
||||
void scrollIntoView(optional boolean top = true);
|
||||
// None of the CSSOM attributes are [Pure], because they flush
|
||||
attribute long scrollTop; // scroll on setting
|
||||
attribute long scrollLeft; // scroll on setting
|
||||
readonly attribute long scrollWidth;
|
||||
readonly attribute long scrollHeight;
|
||||
|
||||
readonly attribute long clientTop;
|
||||
readonly attribute long clientLeft;
|
||||
readonly attribute long clientWidth;
|
||||
readonly attribute long clientHeight;
|
||||
|
||||
// Mozilla specific stuff
|
||||
/* The maximum offset that the element can be scrolled to
|
||||
(i.e., the value that scrollLeft/scrollTop would be clamped to if they were
|
||||
set to arbitrarily large values. */
|
||||
/*readonly attribute long scrollTopMax;
|
||||
readonly attribute long scrollLeftMax;*/
|
||||
};
|
||||
|
||||
// http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html
|
||||
/*partial interface Element {
|
||||
[Pref="dom.undo_manager.enabled"]
|
||||
readonly attribute UndoManager? undoManager;
|
||||
[SetterThrows,Pref="dom.undo_manager.enabled"]
|
||||
attribute boolean undoScope;
|
||||
};*/
|
||||
|
||||
// http://domparsing.spec.whatwg.org/#extensions-to-the-element-interface
|
||||
partial interface Element {
|
||||
[Throws,TreatNullAs=EmptyString]
|
||||
attribute DOMString innerHTML;
|
||||
[Throws,TreatNullAs=EmptyString]
|
||||
attribute DOMString outerHTML;
|
||||
[Throws]
|
||||
void insertAdjacentHTML(DOMString position, DOMString text);
|
||||
};
|
||||
|
||||
// http://www.w3.org/TR/selectors-api/#interface-definitions
|
||||
partial interface Element {
|
||||
[Throws]
|
||||
Element? querySelector(DOMString selectors);
|
||||
/*[Throws]
|
||||
NodeList querySelectorAll(DOMString selectors);*/
|
||||
};
|
||||
|
||||
/*Element implements ChildNode;
|
||||
Element implements ParentNode;*/
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
|
||||
interface Selection;
|
||||
interface HTMLElement;
|
||||
interface HTMLHeadElement;
|
||||
|
||||
[OverrideBuiltins]
|
||||
|
|
118
src/components/script/dom/bindings/codegen/HTMLElement.webidl
Normal file
118
src/components/script/dom/bindings/codegen/HTMLElement.webidl
Normal file
|
@ -0,0 +1,118 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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.whatwg.org/specs/web-apps/current-work/ and
|
||||
* http://dev.w3.org/csswg/cssom-view/
|
||||
*
|
||||
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
|
||||
* Opera Software ASA. You are granted a license to use, reproduce
|
||||
* and create derivative works of this document.
|
||||
*/
|
||||
|
||||
interface HTMLElement : Element {
|
||||
// metadata attributes
|
||||
attribute DOMString title;
|
||||
attribute DOMString lang;
|
||||
// attribute boolean translate;
|
||||
[SetterThrows, Pure]
|
||||
attribute DOMString dir;
|
||||
/*[Constant]
|
||||
readonly attribute DOMStringMap dataset;*/
|
||||
|
||||
// microdata
|
||||
/*[SetterThrows, Pure]
|
||||
attribute boolean itemScope;
|
||||
[PutForwards=value,Constant] readonly attribute DOMSettableTokenList itemType;
|
||||
[SetterThrows, Pure]
|
||||
attribute DOMString itemId;
|
||||
[PutForwards=value,Constant] readonly attribute DOMSettableTokenList itemRef;
|
||||
[PutForwards=value,Constant] readonly attribute DOMSettableTokenList itemProp;*/
|
||||
/*[Constant]
|
||||
readonly attribute HTMLPropertiesCollection properties;*/
|
||||
[Throws]
|
||||
attribute any itemValue;
|
||||
|
||||
// user interaction
|
||||
[SetterThrows, Pure]
|
||||
attribute boolean hidden;
|
||||
void click();
|
||||
[SetterThrows, Pure]
|
||||
attribute long tabIndex;
|
||||
[Throws]
|
||||
void focus();
|
||||
[Throws]
|
||||
void blur();
|
||||
[SetterThrows, Pure]
|
||||
attribute DOMString accessKey;
|
||||
[Pure]
|
||||
readonly attribute DOMString accessKeyLabel;
|
||||
[SetterThrows, Pure]
|
||||
attribute boolean draggable;
|
||||
//[PutForwards=value] readonly attribute DOMSettableTokenList dropzone;
|
||||
[SetterThrows, Pure]
|
||||
attribute DOMString contentEditable;
|
||||
[Pure]
|
||||
readonly attribute boolean isContentEditable;
|
||||
/*[Pure]
|
||||
readonly attribute HTMLMenuElement? contextMenu;*/
|
||||
//[SetterThrows]
|
||||
// attribute HTMLMenuElement? contextMenu;
|
||||
[SetterThrows, Pure]
|
||||
attribute boolean spellcheck;
|
||||
|
||||
// command API
|
||||
//readonly attribute DOMString? commandType;
|
||||
//readonly attribute DOMString? commandLabel;
|
||||
//readonly attribute DOMString? commandIcon;
|
||||
//readonly attribute boolean? commandHidden;
|
||||
//readonly attribute boolean? commandDisabled;
|
||||
//readonly attribute boolean? commandChecked;
|
||||
|
||||
// styling
|
||||
/*[PutForwards=cssText, Constant]
|
||||
readonly attribute CSSStyleDeclaration style;*/
|
||||
|
||||
// Mozilla specific stuff
|
||||
// FIXME Bug 810677 Move className from HTMLElement to Element
|
||||
attribute DOMString className;
|
||||
|
||||
/*[SetterThrows]
|
||||
attribute EventHandler oncopy;
|
||||
[SetterThrows]
|
||||
attribute EventHandler oncut;
|
||||
[SetterThrows]
|
||||
attribute EventHandler onpaste;*/
|
||||
};
|
||||
|
||||
// http://dev.w3.org/csswg/cssom-view/#extensions-to-the-htmlelement-interface
|
||||
partial interface HTMLElement {
|
||||
// CSSOM things are not [Pure] because they can flush
|
||||
readonly attribute Element? offsetParent;
|
||||
readonly attribute long offsetTop;
|
||||
readonly attribute long offsetLeft;
|
||||
readonly attribute long offsetWidth;
|
||||
readonly attribute long offsetHeight;
|
||||
};
|
||||
|
||||
/*[NoInterfaceObject]
|
||||
interface TouchEventHandlers {
|
||||
[SetterThrows,Func="nsGenericHTMLElement::TouchEventsEnabled"]
|
||||
attribute EventHandler ontouchstart;
|
||||
[SetterThrows,Func="nsGenericHTMLElement::TouchEventsEnabled"]
|
||||
attribute EventHandler ontouchend;
|
||||
[SetterThrows,Func="nsGenericHTMLElement::TouchEventsEnabled"]
|
||||
attribute EventHandler ontouchmove;
|
||||
[SetterThrows,Func="nsGenericHTMLElement::TouchEventsEnabled"]
|
||||
attribute EventHandler ontouchenter;
|
||||
[SetterThrows,Func="nsGenericHTMLElement::TouchEventsEnabled"]
|
||||
attribute EventHandler ontouchleave;
|
||||
[SetterThrows,Func="nsGenericHTMLElement::TouchEventsEnabled"]
|
||||
attribute EventHandler ontouchcancel;
|
||||
};*/
|
||||
|
||||
/*HTMLElement implements GlobalEventHandlers;
|
||||
HTMLElement implements NodeEventHandlers;
|
||||
HTMLElement implements TouchEventHandlers;*/
|
107
src/components/script/dom/bindings/codegen/Node.webidl
Normal file
107
src/components/script/dom/bindings/codegen/Node.webidl
Normal file
|
@ -0,0 +1,107 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/2012/WD-dom-20120105/
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
/*interface Principal;
|
||||
interface URI;
|
||||
interface UserDataHandler;*/
|
||||
|
||||
interface Node /*: EventTarget*/ {
|
||||
const unsigned short ELEMENT_NODE = 1;
|
||||
const unsigned short ATTRIBUTE_NODE = 2; // historical
|
||||
const unsigned short TEXT_NODE = 3;
|
||||
const unsigned short CDATA_SECTION_NODE = 4; // historical
|
||||
const unsigned short ENTITY_REFERENCE_NODE = 5; // historical
|
||||
const unsigned short ENTITY_NODE = 6; // historical
|
||||
const unsigned short PROCESSING_INSTRUCTION_NODE = 7;
|
||||
const unsigned short COMMENT_NODE = 8;
|
||||
const unsigned short DOCUMENT_NODE = 9;
|
||||
const unsigned short DOCUMENT_TYPE_NODE = 10;
|
||||
const unsigned short DOCUMENT_FRAGMENT_NODE = 11;
|
||||
const unsigned short NOTATION_NODE = 12; // historical
|
||||
[Constant]
|
||||
readonly attribute unsigned short nodeType;
|
||||
[Pure]
|
||||
readonly attribute DOMString nodeName;
|
||||
|
||||
[Pure]
|
||||
readonly attribute DOMString? baseURI;
|
||||
|
||||
[Pure]
|
||||
readonly attribute Document? ownerDocument;
|
||||
[Pure]
|
||||
readonly attribute Node? parentNode;
|
||||
[Pure]
|
||||
readonly attribute Element? parentElement;
|
||||
boolean hasChildNodes();
|
||||
/*[Constant]
|
||||
readonly attribute NodeList childNodes;*/
|
||||
[Pure]
|
||||
readonly attribute Node? firstChild;
|
||||
[Pure]
|
||||
readonly attribute Node? lastChild;
|
||||
[Pure]
|
||||
readonly attribute Node? previousSibling;
|
||||
[Pure]
|
||||
readonly attribute Node? nextSibling;
|
||||
|
||||
[SetterThrows, Pure]
|
||||
attribute DOMString? nodeValue;
|
||||
[SetterThrows, Pure]
|
||||
attribute DOMString? textContent;
|
||||
/*[Throws]
|
||||
Node insertBefore(Node node, Node? child);*/ //XXXjdm we don't deal well with Node? parameters
|
||||
[Throws]
|
||||
Node appendChild(Node node);
|
||||
[Throws]
|
||||
Node replaceChild(Node node, Node child);
|
||||
[Throws]
|
||||
Node removeChild(Node child);
|
||||
void normalize();
|
||||
|
||||
[Throws]
|
||||
Node cloneNode(optional boolean deep = true);
|
||||
// boolean isEqualNode(Node? node); //XXXjdm we don't deal well with Node? parameters
|
||||
|
||||
const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01;
|
||||
const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02;
|
||||
const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04;
|
||||
const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08;
|
||||
const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10;
|
||||
const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; // historical
|
||||
unsigned short compareDocumentPosition(Node other);
|
||||
//boolean contains(Node? other); //XXXjdm we don't deal well with Node? parameters
|
||||
|
||||
DOMString? lookupPrefix(DOMString? namespace);
|
||||
DOMString? lookupNamespaceURI(DOMString? prefix);
|
||||
boolean isDefaultNamespace(DOMString? namespace);
|
||||
|
||||
// Mozilla-specific stuff
|
||||
// These have been moved to Element in the spec.
|
||||
// If we move namespaceURI, prefix and localName to Element they should return
|
||||
// a non-nullable type.
|
||||
[Constant]
|
||||
readonly attribute DOMString? namespaceURI;
|
||||
[Constant]
|
||||
readonly attribute DOMString? prefix;
|
||||
[Constant]
|
||||
readonly attribute DOMString? localName;
|
||||
|
||||
boolean hasAttributes();
|
||||
/*[Throws, Func="nsINode::IsChromeOrXBL"]
|
||||
any setUserData(DOMString key, any data, UserDataHandler? handler);
|
||||
[Throws, Func="nsINode::IsChromeOrXBL"]
|
||||
any getUserData(DOMString key);*/
|
||||
/*[ChromeOnly]
|
||||
readonly attribute Principal nodePrincipal;
|
||||
[ChromeOnly]
|
||||
readonly attribute URI? baseURIObject;*/
|
||||
};
|
19
src/components/script/dom/bindings/codegen/Text.webidl
Normal file
19
src/components/script/dom/bindings/codegen/Text.webidl
Normal file
|
@ -0,0 +1,19 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/2012/WD-dom-20120105/
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
[Constructor(optional DOMString data = "")]
|
||||
interface Text : CharacterData {
|
||||
[Throws]
|
||||
Text splitText(unsigned long offset);
|
||||
[Throws]
|
||||
readonly attribute DOMString wholeText;
|
||||
};
|
|
@ -10,8 +10,6 @@
|
|||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
interface Node;
|
||||
|
||||
[Constructor(DOMString type, optional UIEventInit eventInitDict)]
|
||||
interface UIEvent : Event
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue