Bug 838559 - Convert HTMLMenuElement to WebIDL. r=Ms2ger

This commit is contained in:
Andrea Marchesini 2013-02-06 14:19:20 -05:00
Родитель 56a3519e26
Коммит 21baecbda2
6 изменённых файлов: 70 добавлений и 2 удалений

Просмотреть файл

@ -4,6 +4,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 "HTMLMenuElement.h" #include "HTMLMenuElement.h"
#include "mozilla/dom/HTMLMenuElementBinding.h"
#include "nsXULContextMenuBuilder.h" #include "nsXULContextMenuBuilder.h"
#include "nsEventDispatcher.h" #include "nsEventDispatcher.h"
#include "nsHTMLMenuItemElement.h" #include "nsHTMLMenuItemElement.h"
@ -44,6 +45,7 @@ enum SeparatorType
HTMLMenuElement::HTMLMenuElement(already_AddRefed<nsINodeInfo> aNodeInfo) HTMLMenuElement::HTMLMenuElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericHTMLElement(aNodeInfo), mType(MENU_TYPE_LIST) : nsGenericHTMLElement(aNodeInfo), mType(MENU_TYPE_LIST)
{ {
SetIsDOMBinding();
} }
HTMLMenuElement::~HTMLMenuElement() HTMLMenuElement::~HTMLMenuElement()
@ -256,5 +258,12 @@ HTMLMenuElement::AddSeparator(nsIMenuBuilder* aBuilder, int8_t& aSeparator)
aSeparator = ST_TRUE; aSeparator = ST_TRUE;
} }
JSObject*
HTMLMenuElement::WrapNode(JSContext* aCx, JSObject* aScope,
bool* aTriedToWrap)
{
return HTMLMenuElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
} // namespace dom } // namespace dom
} // namespace mozilla } // namespace mozilla

Просмотреть файл

@ -54,6 +54,35 @@ public:
uint8_t GetType() const { return mType; } uint8_t GetType() const { return mType; }
// WebIDL
// The XPCOM GetType is OK for us
void SetType(const nsAString& aType, ErrorResult& aError)
{
SetHTMLAttr(nsGkAtoms::type, aType, aError);
}
// The XPCOM GetLabel is OK for us
void SetLabel(const nsAString& aLabel, ErrorResult& aError)
{
SetHTMLAttr(nsGkAtoms::label, aLabel, aError);
}
bool Compact() const
{
return GetBoolAttr(nsGkAtoms::compact);
}
void SetCompact(bool aCompact, ErrorResult& aError)
{
SetHTMLBoolAttr(nsGkAtoms::compact, aCompact, aError);
}
protected:
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
bool *aTriedToWrap) MOZ_OVERRIDE;
protected: protected:
static bool CanLoadIcon(nsIContent* aContent, const nsAString& aIcon); static bool CanLoadIcon(nsIContent* aContent, const nsAString& aIcon);

Просмотреть файл

@ -419,6 +419,10 @@ DOMInterfaces = {
'hasInstanceInterface': 'nsIDOMHTMLLIElement', 'hasInstanceInterface': 'nsIDOMHTMLLIElement',
}, },
'HTMLMenuElement': {
'hasInstanceInterface': 'nsIDOMHTMLMenuElement',
},
'HTMLOListElement': { 'HTMLOListElement': {
'headerFile' : 'mozilla/dom/HTMLSharedListElement.h', 'headerFile' : 'mozilla/dom/HTMLSharedListElement.h',
'hasInstanceInterface': 'nsIDOMHTMLOListElement' 'hasInstanceInterface': 'nsIDOMHTMLOListElement'
@ -1220,7 +1224,6 @@ def addExternalHTMLElement(element):
headerFile=nativeElement + '.h') headerFile=nativeElement + '.h')
addExternalHTMLElement('HTMLFormElement') addExternalHTMLElement('HTMLFormElement')
addExternalIface('HTMLMenuElement', nativeType='mozilla::dom::HTMLMenuElement', headerFile='HTMLMenuElement.h')
addExternalHTMLElement('HTMLOptionElement') addExternalHTMLElement('HTMLOptionElement')
addExternalHTMLElement('HTMLOptGroupElement') addExternalHTMLElement('HTMLOptGroupElement')
addExternalHTMLElement('HTMLVideoElement') addExternalHTMLElement('HTMLVideoElement')

Просмотреть файл

@ -13,7 +13,6 @@
*/ */
interface DOMStringMap; interface DOMStringMap;
interface HTMLMenuElement;
// Hack to make sure that we initialize the touch prefs properly // Hack to make sure that we initialize the touch prefs properly
[PrefControlled] [PrefControlled]

Просмотреть файл

@ -0,0 +1,27 @@
/* -*- 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-menu-element
* http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
*
* © 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-menu-element
interface HTMLMenuElement : HTMLElement {
[SetterThrows]
attribute DOMString type;
[SetterThrows]
attribute DOMString label;
};
// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
partial interface HTMLMenuElement {
[SetterThrows]
attribute boolean compact;
};

Просмотреть файл

@ -71,6 +71,7 @@ webidl_files = \
HTMLImageElement.webidl \ HTMLImageElement.webidl \
HTMLLabelElement.webidl \ HTMLLabelElement.webidl \
HTMLLIElement.webidl \ HTMLLIElement.webidl \
HTMLMenuElement.webidl \
HTMLOListElement.webidl \ HTMLOListElement.webidl \
HTMLOptionsCollection.webidl \ HTMLOptionsCollection.webidl \
HTMLParagraphElement.webidl \ HTMLParagraphElement.webidl \