Bug 839179 - Part b: Move HTMLButtonElement to Paris bindings; r=bz

This commit is contained in:
Ms2ger 2013-02-08 13:50:30 +01:00
Родитель c8fd73f5f3
Коммит d0fe7fc7ff
6 изменённых файлов: 125 добавлений и 1 удалений

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

@ -1,4 +1,4 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* -*- Mode: C++; 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/. */

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

@ -5,6 +5,7 @@
#include "mozilla/dom/HTMLButtonElement.h"
#include "mozilla/dom/HTMLButtonElementBinding.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMEventTarget.h"
#include "nsAttrValueInlines.h"
@ -66,6 +67,8 @@ HTMLButtonElement::HTMLButtonElement(already_AddRefed<nsINodeInfo> aNodeInfo,
// Set up our default state: enabled
AddStatesSilently(NS_EVENT_STATE_ENABLED);
SetIsDOMBinding();
}
HTMLButtonElement::~HTMLButtonElement()
@ -545,5 +548,12 @@ HTMLButtonElement::IntrinsicState() const
return state;
}
JSObject*
HTMLButtonElement::WrapNode(JSContext* aCx, JSObject* aScope,
bool* aTriedToWrap)
{
return HTMLButtonElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
} // namespace dom
} // namespace mozilla

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

@ -60,6 +60,8 @@ public:
virtual nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const;
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
virtual JSObject*
WrapNode(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap) MOZ_OVERRIDE;
// nsIContent
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
@ -92,6 +94,76 @@ public:
bool* aIsFocusable,
int32_t* aTabIndex);
// WebIDL
bool Autofocus() const
{
return GetBoolAttr(nsGkAtoms::autofocus);
}
void SetAutofocus(bool aAutofocus, ErrorResult& aError)
{
SetHTMLBoolAttr(nsGkAtoms::autofocus, aAutofocus, aError);
}
bool Disabled() const
{
return GetBoolAttr(nsGkAtoms::disabled);
}
void SetDisabled(bool aDisabled, ErrorResult& aError)
{
SetHTMLBoolAttr(nsGkAtoms::disabled, aDisabled, aError);
}
// nsGenericHTMLFormElement::GetForm is fine.
using nsGenericHTMLFormElement::GetForm;
// XPCOM GetFormAction is fine.
void SetFormAction(const nsAString& aFormAction, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::formaction, aFormAction, aRv);
}
// XPCOM GetFormEnctype is fine.
void SetFormEnctype(const nsAString& aFormEnctype, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::formenctype, aFormEnctype, aRv);
}
// XPCOM GetFormMethod is fine.
void SetFormMethod(const nsAString& aFormMethod, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::formmethod, aFormMethod, aRv);
}
bool FormNoValidate() const
{
return GetBoolAttr(nsGkAtoms::formnovalidate);
}
void SetFormNoValidate(bool aFormNoValidate, ErrorResult& aError)
{
SetHTMLBoolAttr(nsGkAtoms::formnovalidate, aFormNoValidate, aError);
}
// XPCOM GetFormTarget is fine.
void SetFormTarget(const nsAString& aFormTarget, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::formtarget, aFormTarget, aRv);
}
// XPCOM GetName is fine.
void SetName(const nsAString& aName, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::name, aName, aRv);
}
// XPCOM GetType is fine.
void SetType(const nsAString& aType, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::type, aType, aRv);
}
// XPCOM GetValue is fine.
void SetValue(const nsAString& aValue, ErrorResult& aRv)
{
SetHTMLAttr(nsGkAtoms::value, aValue, aRv);
}
// nsIConstraintValidation::WillValidate is fine.
// nsIConstraintValidation::Validity() is fine.
// nsIConstraintValidation::GetValidationMessage() is fine.
// nsIConstraintValidation::CheckValidity() is fine.
using nsIConstraintValidation::CheckValidity;
// nsIConstraintValidation::SetCustomValidity() is fine.
protected:
uint8_t mType;
bool mDisabledChanged;

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

@ -361,6 +361,10 @@ DOMInterfaces = {
'hasInstanceInterface': 'nsIDOMHTMLBRElement',
},
'HTMLButtonElement': {
'hasInstanceInterface': 'nsIDOMHTMLButtonElement',
},
'HTMLCollection': {
'nativeType': 'nsIHTMLCollection',
'resultNotAddRefed': [ 'item' ]

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

@ -0,0 +1,37 @@
/* -*- 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-button-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-button-element
interface HTMLButtonElement : HTMLElement {
attribute boolean autofocus;
attribute boolean disabled;
readonly attribute HTMLFormElement? form;
attribute DOMString formAction;
attribute DOMString formEnctype;
attribute DOMString formMethod;
attribute boolean formNoValidate;
attribute DOMString formTarget;
attribute DOMString name;
attribute DOMString type;
attribute DOMString value;
// Not yet implemented:
// attribute HTMLMenuElement? menu;
readonly attribute boolean willValidate;
readonly attribute ValidityState validity;
readonly attribute DOMString validationMessage;
boolean checkValidity();
void setCustomValidity(DOMString error);
// Not yet implemented:
// readonly attribute NodeList labels;
};

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

@ -60,6 +60,7 @@ webidl_files = \
HTMLBaseElement.webidl \
HTMLBodyElement.webidl \
HTMLBRElement.webidl \
HTMLButtonElement.webidl \
HTMLCollection.webidl \
HTMLDataListElement.webidl \
HTMLDirectoryElement.webidl \