Bug 843627 part 2. Implement the WebIDL API for <embed> and <applet>. r=peterv

This commit is contained in:
Boris Zbarsky 2013-03-17 10:42:03 -04:00
parent 3b2581e468
commit e89e9effb4
5 changed files with 205 additions and 1 deletions

View File

@ -104,6 +104,114 @@ public:
{
return static_cast<nsIDOMHTMLAppletElement*>(this);
}
// WebIDL API for <applet>
void GetAlign(DOMString& aValue)
{
GetHTMLAttr(nsGkAtoms::align, aValue);
}
void SetAlign(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::align, aValue, aRv);
}
void GetAlt(DOMString& aValue)
{
GetHTMLAttr(nsGkAtoms::alt, aValue);
}
void SetAlt(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::alt, aValue, aRv);
}
void GetArchive(DOMString& aValue)
{
GetHTMLAttr(nsGkAtoms::archive, aValue);
}
void SetArchive(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::archive, aValue, aRv);
}
void GetCode(DOMString& aValue)
{
GetHTMLAttr(nsGkAtoms::code, aValue);
}
void SetCode(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::code, aValue, aRv);
}
// XPCOM GetCodebase is ok; note that it's a URI attribute
void SetCodeBase(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::codebase, aValue, aRv);
}
void GetHeight(DOMString& aValue)
{
GetHTMLAttr(nsGkAtoms::height, aValue);
}
void SetHeight(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::height, aValue, aRv);
}
uint32_t Hspace()
{
return GetHTMLUnsignedIntAttr(nsGkAtoms::hspace, 0);
}
void SetHspace(uint32_t aValue, ErrorResult& aRv)
{
SetHTMLUnsignedIntAttr(nsGkAtoms::hspace, aValue, aRv);
}
void GetName(DOMString& aValue)
{
GetHTMLAttr(nsGkAtoms::name, aValue);
}
void SetName(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::name, aValue, aRv);
}
// XPCOM GetObject is ok; note that it's a URI attribute with a weird base URI
void SetObject(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::object, aValue, aRv);
}
uint32_t Vspace()
{
return GetHTMLUnsignedIntAttr(nsGkAtoms::vspace, 0);
}
void SetVspace(uint32_t aValue, ErrorResult& aRv)
{
SetHTMLUnsignedIntAttr(nsGkAtoms::vspace, aValue, aRv);
}
void GetWidth(DOMString& aValue)
{
GetHTMLAttr(nsGkAtoms::width, aValue);
}
void SetWidth(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::width, aValue, aRv);
}
// WebIDL <embed> api
// XPCOM GetSrc is ok; note that it's a URI attribute
void SetSrc(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::src, aValue, aRv);
}
void GetType(DOMString& aValue)
{
GetHTMLAttr(nsGkAtoms::type, aValue);
}
void SetType(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::type, aValue, aRv);
}
// width covered by <applet>
// height covered by <applet>
// align covered by <applet>
// name covered by <applet>
nsIDocument* GetSVGDocument()
{
return GetContentDocument();
}
private:
/**
* Calls LoadObject with the correct arguments to start the plugin load.

View File

@ -345,6 +345,10 @@ DOMInterfaces = {
'wrapperCache': False
},
'HTMLAppletElement': {
'nativeType': 'mozilla::dom::HTMLSharedObjectElement'
},
'HTMLBaseElement': {
'nativeType': 'mozilla::dom::HTMLSharedElement'
},
@ -386,6 +390,10 @@ DOMInterfaces = {
]
},
'HTMLEmbedElement': {
'nativeType': 'mozilla::dom::HTMLSharedObjectElement'
},
'HTMLHeadElement': {
'nativeType': 'mozilla::dom::HTMLSharedElement'
},

View File

@ -319,7 +319,7 @@ class IDLUnresolvedIdentifier(IDLObject):
[location])
if name[0] == '_' and not allowDoubleUnderscore:
name = name[1:]
if name in ["constructor", "toString"] and not allowForbidden:
if name in ["constructor", "iterator", "toString", "toJSON"] and not allowForbidden:
raise WebIDLError("Cannot use reserved identifier '%s'" % (name),
[location])

View File

@ -0,0 +1,43 @@
/* -*- 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-applet-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.
*/
// http://www.whatwg.org/specs/web-apps/current-work/#the-applet-element
[NeedNewResolve]
interface HTMLAppletElement : HTMLElement {
[Pure, SetterThrows]
attribute DOMString align;
[Pure, SetterThrows]
attribute DOMString alt;
[Pure, SetterThrows]
attribute DOMString archive;
[Pure, SetterThrows]
attribute DOMString code;
[Pure, SetterThrows]
attribute DOMString codeBase;
[Pure, SetterThrows]
attribute DOMString height;
[Pure, SetterThrows]
attribute unsigned long hspace;
[Pure, SetterThrows]
attribute DOMString name;
[Pure, SetterThrows]
attribute DOMString _object;
[Pure, SetterThrows]
attribute unsigned long vspace;
[Pure, SetterThrows]
attribute DOMString width;
};
HTMLAppletElement implements MozImageLoadingContent;
HTMLAppletElement implements MozFrameLoaderOwner;
HTMLAppletElement implements MozObjectLoadingContent;

View File

@ -0,0 +1,45 @@
/* -*- 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-embed-element
* http://www.whatwg.org/specs/web-apps/current-work/#HTMLEmbedElement-partial
*
* © 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.
*/
// http://www.whatwg.org/specs/web-apps/current-work/#the-embed-element
[NeedNewResolve]
interface HTMLEmbedElement : HTMLElement {
[Pure, SetterThrows]
attribute DOMString src;
[Pure, SetterThrows]
attribute DOMString type;
[Pure, SetterThrows]
attribute DOMString width;
[Pure, SetterThrows]
attribute DOMString height;
[Throws]
legacycaller any (any... arguments);
};
// http://www.whatwg.org/specs/web-apps/current-work/#HTMLEmbedElement-partial
partial interface HTMLEmbedElement {
[Pure, SetterThrows]
attribute DOMString align;
[Pure, SetterThrows]
attribute DOMString name;
};
partial interface HTMLEmbedElement {
// nsIDOMGetSVGDocument
Document? getSVGDocument();
};
HTMLEmbedElement implements MozImageLoadingContent;
HTMLEmbedElement implements MozFrameLoaderOwner;
HTMLEmbedElement implements MozObjectLoadingContent;