mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 839022 - Convert HTMLSourceElement to WebIDL. r=Ms2ger
This commit is contained in:
parent
b6efdd3977
commit
28423d0a04
@ -5,6 +5,7 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "mozilla/dom/HTMLSourceElement.h"
|
#include "mozilla/dom/HTMLSourceElement.h"
|
||||||
|
#include "mozilla/dom/HTMLSourceElementBinding.h"
|
||||||
|
|
||||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Source)
|
NS_IMPL_NS_NEW_HTML_ELEMENT(Source)
|
||||||
DOMCI_NODE_DATA(HTMLSourceElement, mozilla::dom::HTMLSourceElement)
|
DOMCI_NODE_DATA(HTMLSourceElement, mozilla::dom::HTMLSourceElement)
|
||||||
@ -15,6 +16,7 @@ namespace dom {
|
|||||||
HTMLSourceElement::HTMLSourceElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
HTMLSourceElement::HTMLSourceElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||||
: nsGenericHTMLElement(aNodeInfo)
|
: nsGenericHTMLElement(aNodeInfo)
|
||||||
{
|
{
|
||||||
|
SetIsDOMBinding();
|
||||||
}
|
}
|
||||||
|
|
||||||
HTMLSourceElement::~HTMLSourceElement()
|
HTMLSourceElement::~HTMLSourceElement()
|
||||||
@ -75,5 +77,12 @@ HTMLSourceElement::BindToTree(nsIDocument *aDocument,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JSObject*
|
||||||
|
HTMLSourceElement::WrapNode(JSContext* aCx, JSObject* aScope,
|
||||||
|
bool* aTriedToWrap)
|
||||||
|
{
|
||||||
|
return HTMLSourceElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
@ -36,18 +36,50 @@ public:
|
|||||||
// nsIDOMHTMLSourceElement
|
// nsIDOMHTMLSourceElement
|
||||||
NS_DECL_NSIDOMHTMLSOURCEELEMENT
|
NS_DECL_NSIDOMHTMLSOURCEELEMENT
|
||||||
|
|
||||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
virtual nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const;
|
||||||
|
|
||||||
// Override BindToTree() so that we can trigger a load when we add a
|
// Override BindToTree() so that we can trigger a load when we add a
|
||||||
// child source element.
|
// child source element.
|
||||||
virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent,
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||||
nsIContent *aBindingParent,
|
nsIContent* aBindingParent,
|
||||||
bool aCompileEventHandlers);
|
bool aCompileEventHandlers);
|
||||||
|
|
||||||
virtual nsXPCClassInfo* GetClassInfo();
|
virtual nsXPCClassInfo* GetClassInfo();
|
||||||
|
|
||||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||||
|
|
||||||
|
// WebIDL
|
||||||
|
void GetSrc(nsString& aSrc)
|
||||||
|
{
|
||||||
|
GetURIAttr(nsGkAtoms::src, nullptr, aSrc);
|
||||||
|
}
|
||||||
|
void SetSrc(const nsAString& aSrc, mozilla::ErrorResult& rv)
|
||||||
|
{
|
||||||
|
SetHTMLAttr(nsGkAtoms::src, aSrc, rv);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetType(nsString& aType)
|
||||||
|
{
|
||||||
|
GetHTMLAttr(nsGkAtoms::type, aType);
|
||||||
|
}
|
||||||
|
void SetType(const nsAString& aType, ErrorResult& rv)
|
||||||
|
{
|
||||||
|
SetHTMLAttr(nsGkAtoms::type, aType, rv);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GetMedia(nsString& aMedia)
|
||||||
|
{
|
||||||
|
GetHTMLAttr(nsGkAtoms::media, aMedia);
|
||||||
|
}
|
||||||
|
void SetMedia(const nsAString& aMedia, mozilla::ErrorResult& rv)
|
||||||
|
{
|
||||||
|
SetHTMLAttr(nsGkAtoms::media, aMedia, rv);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual JSObject* WrapNode(JSContext* aCx, JSObject* aScope,
|
||||||
|
bool* aTriedToWrap) MOZ_OVERRIDE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void GetItemValueText(nsAString& text);
|
virtual void GetItemValueText(nsAString& text);
|
||||||
virtual void SetItemValueText(const nsAString& text);
|
virtual void SetItemValueText(const nsAString& text);
|
||||||
|
@ -60,7 +60,6 @@ function reflectString(aParameters)
|
|||||||
form: [ "acceptCharset", "name", "target" ],
|
form: [ "acceptCharset", "name", "target" ],
|
||||||
input: [ "accept", "alt", "formTarget", "max", "min", "name", "pattern", "placeholder", "step", "defaultValue" ],
|
input: [ "accept", "alt", "formTarget", "max", "min", "name", "pattern", "placeholder", "step", "defaultValue" ],
|
||||||
link: [ "crossOrigin" ],
|
link: [ "crossOrigin" ],
|
||||||
source: [ "media" ],
|
|
||||||
textarea: [ "name", "placeholder" ]
|
textarea: [ "name", "placeholder" ]
|
||||||
};
|
};
|
||||||
if (!(element.localName in todoAttrs) || todoAttrs[element.localName].indexOf(idlAttr) == -1) {
|
if (!(element.localName in todoAttrs) || todoAttrs[element.localName].indexOf(idlAttr) == -1) {
|
||||||
|
@ -470,6 +470,10 @@ DOMInterfaces = {
|
|||||||
'hasInstanceInterface': 'nsIDOMHTMLScriptElement',
|
'hasInstanceInterface': 'nsIDOMHTMLScriptElement',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'HTMLSourceElement': {
|
||||||
|
'hasInstanceInterface': 'nsIDOMHTMLSourceElement',
|
||||||
|
},
|
||||||
|
|
||||||
'HTMLTableCellElement': {
|
'HTMLTableCellElement': {
|
||||||
'hasInstanceInterface': 'nsIDOMHTMLTableCellElement'
|
'hasInstanceInterface': 'nsIDOMHTMLTableCellElement'
|
||||||
},
|
},
|
||||||
|
21
dom/webidl/HTMLSourceElement.webidl
Normal file
21
dom/webidl/HTMLSourceElement.webidl
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/* -*- 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/#the-source-element
|
||||||
|
*
|
||||||
|
* © 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 HTMLSourceElement : HTMLElement {
|
||||||
|
[SetterThrows]
|
||||||
|
attribute DOMString src;
|
||||||
|
[SetterThrows]
|
||||||
|
attribute DOMString type;
|
||||||
|
[SetterThrows]
|
||||||
|
attribute DOMString media;
|
||||||
|
};
|
@ -196,6 +196,12 @@ webidl_files = \
|
|||||||
XULElement.webidl \
|
XULElement.webidl \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
ifdef MOZ_MEDIA
|
||||||
|
webidl_files += \
|
||||||
|
HTMLSourceElement.webidl \
|
||||||
|
$(NULL)
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef MOZ_WEBGL
|
ifdef MOZ_WEBGL
|
||||||
webidl_files += \
|
webidl_files += \
|
||||||
WebGLRenderingContext.webidl \
|
WebGLRenderingContext.webidl \
|
||||||
|
Loading…
Reference in New Issue
Block a user