Bug 816180. Convert DocumentFragment to WebIDL. r=peterv

This commit is contained in:
Boris Zbarsky 2012-12-24 19:35:19 -08:00
parent a0fdb58284
commit 2a16338145
8 changed files with 35 additions and 26 deletions

View File

@ -16,6 +16,7 @@
#include "nsGkAtoms.h"
#include "nsDOMString.h"
#include "nsContentUtils.h"
#include "mozilla/dom/DocumentFragmentBinding.h"
nsresult
NS_NewDocumentFragment(nsIDOMDocumentFragment** aInstancePtrResult,
@ -50,6 +51,14 @@ DocumentFragment::DocumentFragment(already_AddRefed<nsINodeInfo> aNodeInfo)
mNodeInfo->Equals(nsGkAtoms::documentFragmentNodeName,
kNameSpaceID_None),
"Bad NodeType in aNodeInfo");
SetIsDOMBinding();
}
JSObject*
DocumentFragment::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
{
return DocumentFragmentBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
bool

View File

@ -41,6 +41,9 @@ public:
{
}
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
bool *aTriedToWrap);
// nsIContent
virtual already_AddRefed<nsINodeInfo>
GetExistingAttrNameFromQName(const nsAString& aStr) const

View File

@ -194,6 +194,10 @@ DOMInterfaces = {
'nativeType': 'nsDOMParser',
},
'DocumentFragment': {
'resultNotAddRefed': [ 'querySelector' ]
},
'DOMSettableTokenList': {
'nativeType': 'nsDOMSettableTokenList',
'binaryNames': {
@ -227,7 +231,7 @@ DOMInterfaces = {
'resultNotAddRefed': [
'classList', 'attributes', 'children', 'firstElementChild',
'lastElementChild', 'previousElementSibling', 'nextElementSibling',
'getAttributeNode', 'getAttributeNodeNS'
'getAttributeNode', 'getAttributeNodeNS', 'querySelector'
]
},
@ -988,7 +992,6 @@ addExternalIface('ClientRect')
addExternalIface('Comment', nativeType='mozilla::dom::Comment')
addExternalIface("Counter")
addExternalIface('CSSRule')
addExternalIface('DocumentFragment', nativeType='mozilla::dom::DocumentFragment')
addExternalIface('DocumentType', headerFile="nsDOMDocumentType.h")
addExternalIface('DOMRequest')
addExternalIface('DOMStringList')

View File

@ -75,13 +75,6 @@
"EventTarget interface: calling addEventListener(DOMString,EventListener,boolean) on xmlDoc with too few arguments must throw TypeError": true,
"EventTarget interface: calling removeEventListener(DOMString,EventListener,boolean) on xmlDoc with too few arguments must throw TypeError": true,
"EventTarget interface: calling dispatchEvent(Event) on xmlDoc with too few arguments must throw TypeError": true,
"DocumentFragment interface: existence and properties of interface object": true,
"DocumentFragment interface: existence and properties of interface prototype object": true,
"DocumentFragment interface: existence and properties of interface prototype object's \"constructor\" property": true,
"Stringification of document.createDocumentFragment()": "debug",
"EventTarget interface: calling addEventListener(DOMString,EventListener,boolean) on document.createDocumentFragment() with too few arguments must throw TypeError": true,
"EventTarget interface: calling removeEventListener(DOMString,EventListener,boolean) on document.createDocumentFragment() with too few arguments must throw TypeError": true,
"EventTarget interface: calling dispatchEvent(Event) on document.createDocumentFragment() with too few arguments must throw TypeError": true,
"DocumentType interface: existence and properties of interface object": true,
"DocumentType interface: existence and properties of interface prototype object": true,
"DocumentType interface: existence and properties of interface prototype object's \"constructor\" property": true,

View File

@ -17,7 +17,6 @@
interface Attr;
interface CDATASection;
interface DocumentFragment;
interface Comment;
interface NodeIterator;
interface ProcessingInstruction;

View File

@ -4,7 +4,8 @@
* 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/
* http://www.w3.org/TR/2012/WD-dom-20120405/#interface-documentfragment
* http://www.w3.org/TR/2012/WD-selectors-api-20120628/#interface-definitions
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
@ -12,6 +13,21 @@
interface DocumentFragment : Node {
// NEW
/*
FIXME: not implemented yet
void prepend((Node or DOMString)... nodes);
void append((Node or DOMString)... nodes);
*/
/*
};
http://www.w3.org/TR/2012/WD-selectors-api-20120628/#interface-definitions
partial interface DocumentFragment {
*/
[Throws]
Element? querySelector(DOMString selectors);
[Throws]
NodeList querySelectorAll(DOMString selectors);
};

View File

@ -27,6 +27,7 @@ webidl_files = \
CSSValueList.webidl \
DelayNode.webidl \
Document.webidl \
DocumentFragment.webidl \
DOMImplementation.webidl \
DOMParser.webidl \
DOMSettableTokenList.webidl \

View File

@ -67,8 +67,6 @@ members = [
'nsIDOMCharacterData.length',
'nsIDOMNamedNodeMap.item',
'nsIDOMNamedNodeMap.length',
'nsIDOMNodeSelector.querySelector',
'nsIDOMNodeSelector.querySelectorAll',
'nsIDOMText.splitText',
'nsIDOMDOMStringList.*',
'nsIDOMXULDocument.getBoxObjectFor',
@ -449,19 +447,6 @@ customMethodCalls = {
'nsIDOMStorage_Clear': {
'code': nsIDOMStorage_Clear_customMethodCallCode
},
'nsIDOMNodeSelector_QuerySelector': {
'thisType': 'nsINode',
'code': ' mozilla::ErrorResult error;\n'
' nsIContent* result = '
'self->QuerySelector(arg0, error);\n'
' rv = error.ErrorCode();'
},
'nsIDOMNodeSelector_QuerySelectorAll': {
'thisType': 'nsINode',
'code': ' mozilla::ErrorResult error;\n'
' nsCOMPtr<nsINodeList> result = self->QuerySelectorAll(arg0, error);\n'
' rv = error.ErrorCode();'
},
'nsIDOMElementCSSInlineStyle_GetStyle': {
'thisType': 'nsStyledElement',
'code': ' /* XXXbz MathML elements inherit from nsStyledElement but\n'