Bug 839022 - Convert HTMLSourceElement to WebIDL. r=Ms2ger

This commit is contained in:
Andrea Marchesini 2013-02-07 10:39:10 -05:00
parent af40b2d946
commit 06e54c8580
6 changed files with 75 additions and 4 deletions

View File

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/HTMLSourceElement.h"
#include "mozilla/dom/HTMLSourceElementBinding.h"
NS_IMPL_NS_NEW_HTML_ELEMENT(Source)
DOMCI_NODE_DATA(HTMLSourceElement, mozilla::dom::HTMLSourceElement)
@ -15,6 +16,7 @@ namespace dom {
HTMLSourceElement::HTMLSourceElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)
{
SetIsDOMBinding();
}
HTMLSourceElement::~HTMLSourceElement()
@ -75,5 +77,12 @@ HTMLSourceElement::BindToTree(nsIDocument *aDocument,
return NS_OK;
}
JSObject*
HTMLSourceElement::WrapNode(JSContext* aCx, JSObject* aScope,
bool* aTriedToWrap)
{
return HTMLSourceElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
} // namespace dom
} // namespace mozilla

View File

@ -36,18 +36,50 @@ public:
// 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
// child source element.
virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent,
nsIContent *aBindingParent,
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
bool aCompileEventHandlers);
virtual nsXPCClassInfo* GetClassInfo();
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:
virtual void GetItemValueText(nsAString& text);
virtual void SetItemValueText(const nsAString& text);

View File

@ -60,7 +60,6 @@ function reflectString(aParameters)
form: [ "acceptCharset", "name", "target" ],
input: [ "accept", "alt", "formTarget", "max", "min", "name", "pattern", "placeholder", "step", "defaultValue" ],
link: [ "crossOrigin" ],
source: [ "media" ],
textarea: [ "name", "placeholder" ]
};
if (!(element.localName in todoAttrs) || todoAttrs[element.localName].indexOf(idlAttr) == -1) {

View File

@ -470,6 +470,10 @@ DOMInterfaces = {
'hasInstanceInterface': 'nsIDOMHTMLScriptElement',
},
'HTMLSourceElement': {
'hasInstanceInterface': 'nsIDOMHTMLSourceElement',
},
'HTMLTableCellElement': {
'hasInstanceInterface': 'nsIDOMHTMLTableCellElement'
},

View 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;
};

View File

@ -196,6 +196,12 @@ webidl_files = \
XULElement.webidl \
$(NULL)
ifdef MOZ_MEDIA
webidl_files += \
HTMLSourceElement.webidl \
$(NULL)
endif
ifdef MOZ_WEBGL
webidl_files += \
WebGLRenderingContext.webidl \