2001-09-25 05:32:19 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2012-09-30 20:40:24 +04:00
|
|
|
|
2013-02-08 16:50:30 +04:00
|
|
|
#include "mozilla/dom/HTMLButtonElement.h"
|
|
|
|
|
2013-02-08 16:50:30 +04:00
|
|
|
#include "mozilla/dom/HTMLButtonElementBinding.h"
|
1998-10-14 01:31:26 +04:00
|
|
|
#include "nsIDOMHTMLFormElement.h"
|
2012-09-30 20:40:24 +04:00
|
|
|
#include "nsAttrValueInlines.h"
|
2006-12-26 20:47:52 +03:00
|
|
|
#include "nsGkAtoms.h"
|
2003-01-09 09:49:07 +03:00
|
|
|
#include "nsIPresShell.h"
|
1998-09-03 05:03:33 +04:00
|
|
|
#include "nsStyleConsts.h"
|
2004-08-01 03:15:21 +04:00
|
|
|
#include "nsPresContext.h"
|
1998-10-14 01:31:26 +04:00
|
|
|
#include "nsIFormControl.h"
|
|
|
|
#include "nsIForm.h"
|
2010-05-26 16:49:38 +04:00
|
|
|
#include "nsFormSubmission.h"
|
2010-08-20 21:47:30 +04:00
|
|
|
#include "nsFormSubmissionConstants.h"
|
1999-01-15 05:07:46 +03:00
|
|
|
#include "nsIURL.h"
|
2001-10-24 04:01:09 +04:00
|
|
|
#include "nsIFrame.h"
|
1999-08-21 04:19:34 +04:00
|
|
|
#include "nsIFormControlFrame.h"
|
2000-12-30 22:22:22 +03:00
|
|
|
#include "nsIDOMEvent.h"
|
2000-09-08 05:46:00 +04:00
|
|
|
#include "nsIDocument.h"
|
2013-09-25 15:21:20 +04:00
|
|
|
#include "mozilla/ContentEvents.h"
|
2014-03-18 08:48:21 +04:00
|
|
|
#include "mozilla/EventDispatcher.h"
|
2014-04-01 08:09:23 +04:00
|
|
|
#include "mozilla/EventStateManager.h"
|
2014-04-03 08:18:36 +04:00
|
|
|
#include "mozilla/EventStates.h"
|
2013-09-25 15:21:18 +04:00
|
|
|
#include "mozilla/MouseEvents.h"
|
2013-09-25 15:21:19 +04:00
|
|
|
#include "mozilla/TextEvents.h"
|
2001-12-16 14:58:03 +03:00
|
|
|
#include "nsUnicharUtils.h"
|
2005-12-13 02:53:06 +03:00
|
|
|
#include "nsLayoutUtils.h"
|
2006-11-28 06:17:03 +03:00
|
|
|
#include "nsPresState.h"
|
2012-07-27 18:03:27 +04:00
|
|
|
#include "nsError.h"
|
Bug 178324, refactor focus by moving all focus handling into one place and simplifying it, add many tests, fixes many other bugs too numerous to mention in this small checkin comment, r=josh,smichaud,ere,dbaron,marco,neil,gavin,smaug,sr=smaug (CLOSED TREE)
2009-06-10 22:00:39 +04:00
|
|
|
#include "nsFocusManager.h"
|
2013-06-19 18:24:37 +04:00
|
|
|
#include "mozilla/dom/HTMLFormElement.h"
|
2010-09-08 21:43:28 +04:00
|
|
|
#include "mozAutoDocUpdate.h"
|
2006-03-07 20:08:51 +03:00
|
|
|
|
2007-08-17 01:10:29 +04:00
|
|
|
#define NS_IN_SUBMIT_CLICK (1 << 0)
|
|
|
|
#define NS_OUTER_ACTIVATE_EVENT (1 << 1)
|
1998-09-03 05:03:33 +04:00
|
|
|
|
2013-02-08 16:50:30 +04:00
|
|
|
NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Button)
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2010-04-15 15:03:00 +04:00
|
|
|
static const nsAttrValue::EnumTable kButtonTypeTable[] = {
|
|
|
|
{ "button", NS_FORM_BUTTON_BUTTON },
|
|
|
|
{ "reset", NS_FORM_BUTTON_RESET },
|
|
|
|
{ "submit", NS_FORM_BUTTON_SUBMIT },
|
|
|
|
{ 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
// Default type is 'submit'.
|
|
|
|
static const nsAttrValue::EnumTable* kButtonDefaultType = &kButtonTypeTable[2];
|
|
|
|
|
1998-10-14 01:31:26 +04:00
|
|
|
|
|
|
|
// Construction, destruction
|
2014-06-20 06:01:40 +04:00
|
|
|
HTMLButtonElement::HTMLButtonElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
2013-02-08 16:50:30 +04:00
|
|
|
FromParser aFromParser)
|
2013-08-02 05:21:31 +04:00
|
|
|
: nsGenericHTMLFormElementWithState(aNodeInfo),
|
2010-04-15 15:03:00 +04:00
|
|
|
mType(kButtonDefaultType->value),
|
2011-10-17 18:59:28 +04:00
|
|
|
mDisabledChanged(false),
|
|
|
|
mInInternalActivate(false),
|
2011-06-01 01:57:16 +04:00
|
|
|
mInhibitStateRestoration(!!(aFromParser & FROM_PARSER_FRAGMENT))
|
1998-09-03 05:03:33 +04:00
|
|
|
{
|
2011-06-01 05:46:57 +04:00
|
|
|
// Set up our default state: enabled
|
|
|
|
AddStatesSilently(NS_EVENT_STATE_ENABLED);
|
1998-09-03 05:03:33 +04:00
|
|
|
}
|
|
|
|
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLButtonElement::~HTMLButtonElement()
|
1998-09-03 05:03:33 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
1998-10-14 01:31:26 +04:00
|
|
|
// nsISupports
|
1998-09-03 05:03:33 +04:00
|
|
|
|
2014-04-25 20:49:00 +04:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_INHERITED(HTMLButtonElement,
|
|
|
|
nsGenericHTMLFormElementWithState,
|
|
|
|
mValidity)
|
2013-01-16 22:01:01 +04:00
|
|
|
|
2013-02-08 16:50:30 +04:00
|
|
|
NS_IMPL_ADDREF_INHERITED(HTMLButtonElement, Element)
|
|
|
|
NS_IMPL_RELEASE_INHERITED(HTMLButtonElement, Element)
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2010-01-12 16:08:43 +03:00
|
|
|
|
2013-02-08 16:50:30 +04:00
|
|
|
// QueryInterface implementation for HTMLButtonElement
|
|
|
|
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLButtonElement)
|
2014-04-27 11:06:00 +04:00
|
|
|
NS_INTERFACE_TABLE_INHERITED(HTMLButtonElement,
|
|
|
|
nsIDOMHTMLButtonElement,
|
|
|
|
nsIConstraintValidation)
|
2013-08-08 00:23:08 +04:00
|
|
|
NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLFormElementWithState)
|
1998-09-03 05:03:33 +04:00
|
|
|
|
2010-08-21 22:52:49 +04:00
|
|
|
// nsIConstraintValidation
|
2014-04-29 20:58:00 +04:00
|
|
|
NS_IMPL_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(HTMLButtonElement)
|
2010-08-18 22:28:08 +04:00
|
|
|
|
2014-04-29 20:58:00 +04:00
|
|
|
NS_IMETHODIMP
|
|
|
|
HTMLButtonElement::SetCustomValidity(const nsAString& aError)
|
|
|
|
{
|
|
|
|
nsIConstraintValidation::SetCustomValidity(aError);
|
|
|
|
|
|
|
|
UpdateState(true);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
HTMLButtonElement::UpdateBarredFromConstraintValidation()
|
|
|
|
{
|
|
|
|
SetBarredFromConstraintValidation(mType == NS_FORM_BUTTON_BUTTON ||
|
|
|
|
mType == NS_FORM_BUTTON_RESET ||
|
|
|
|
IsDisabled());
|
|
|
|
}
|
1998-10-14 01:31:26 +04:00
|
|
|
|
2014-04-29 20:58:00 +04:00
|
|
|
void
|
|
|
|
HTMLButtonElement::FieldSetDisabledChanged(bool aNotify)
|
|
|
|
{
|
|
|
|
UpdateBarredFromConstraintValidation();
|
|
|
|
|
|
|
|
nsGenericHTMLFormElementWithState::FieldSetDisabledChanged(aNotify);
|
|
|
|
}
|
|
|
|
|
|
|
|
// nsIDOMHTMLButtonElement
|
1999-07-28 09:26:55 +04:00
|
|
|
|
2013-02-08 16:50:30 +04:00
|
|
|
NS_IMPL_ELEMENT_CLONE(HTMLButtonElement)
|
1999-07-28 09:26:55 +04:00
|
|
|
|
2000-12-23 13:56:31 +03:00
|
|
|
|
2002-08-07 03:50:08 +04:00
|
|
|
// nsIDOMHTMLButtonElement
|
2000-12-23 13:56:31 +03:00
|
|
|
|
1998-09-03 05:03:33 +04:00
|
|
|
NS_IMETHODIMP
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLButtonElement::GetForm(nsIDOMHTMLFormElement** aForm)
|
1998-09-03 05:03:33 +04:00
|
|
|
{
|
2013-08-02 05:21:31 +04:00
|
|
|
return nsGenericHTMLFormElementWithState::GetForm(aForm);
|
1998-09-03 05:03:33 +04:00
|
|
|
}
|
2000-12-23 13:56:31 +03:00
|
|
|
|
2013-02-08 16:50:30 +04:00
|
|
|
NS_IMPL_BOOL_ATTR(HTMLButtonElement, Autofocus, autofocus)
|
|
|
|
NS_IMPL_BOOL_ATTR(HTMLButtonElement, Disabled, disabled)
|
|
|
|
NS_IMPL_ACTION_ATTR(HTMLButtonElement, FormAction, formaction)
|
2013-02-13 19:35:35 +04:00
|
|
|
NS_IMPL_ENUM_ATTR_DEFAULT_MISSING_INVALID_VALUES(HTMLButtonElement, FormEnctype, formenctype,
|
|
|
|
"", kFormDefaultEnctype->tag)
|
|
|
|
NS_IMPL_ENUM_ATTR_DEFAULT_MISSING_INVALID_VALUES(HTMLButtonElement, FormMethod, formmethod,
|
|
|
|
"", kFormDefaultMethod->tag)
|
2013-02-08 16:50:30 +04:00
|
|
|
NS_IMPL_BOOL_ATTR(HTMLButtonElement, FormNoValidate, formnovalidate)
|
|
|
|
NS_IMPL_STRING_ATTR(HTMLButtonElement, FormTarget, formtarget)
|
|
|
|
NS_IMPL_STRING_ATTR(HTMLButtonElement, Name, name)
|
|
|
|
NS_IMPL_STRING_ATTR(HTMLButtonElement, Value, value)
|
|
|
|
NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(HTMLButtonElement, Type, type,
|
2010-04-15 15:03:00 +04:00
|
|
|
kButtonDefaultType->tag)
|
1998-09-03 05:03:33 +04:00
|
|
|
|
2012-10-06 11:19:51 +04:00
|
|
|
int32_t
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLButtonElement::TabIndexDefault()
|
2012-10-06 11:19:51 +04:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLButtonElement::IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t *aTabIndex)
|
2004-07-25 01:12:43 +04:00
|
|
|
{
|
2013-08-02 05:21:31 +04:00
|
|
|
if (nsGenericHTMLFormElementWithState::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex)) {
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2004-07-25 01:12:43 +04:00
|
|
|
}
|
2010-06-21 16:37:34 +04:00
|
|
|
|
|
|
|
*aIsFocusable =
|
|
|
|
#ifdef XP_MACOSX
|
2010-08-09 20:15:47 +04:00
|
|
|
(!aWithMouse || nsFocusManager::sMouseFocusesFormControl) &&
|
2010-06-21 16:37:34 +04:00
|
|
|
#endif
|
2010-09-19 01:33:16 +04:00
|
|
|
!IsDisabled();
|
2008-04-15 22:40:38 +04:00
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2004-07-25 01:12:43 +04:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLButtonElement::ParseAttribute(int32_t aNamespaceID,
|
|
|
|
nsIAtom* aAttribute,
|
|
|
|
const nsAString& aValue,
|
|
|
|
nsAttrValue& aResult)
|
1998-09-03 05:03:33 +04:00
|
|
|
{
|
2010-08-20 21:47:30 +04:00
|
|
|
if (aNamespaceID == kNameSpaceID_None) {
|
|
|
|
if (aAttribute == nsGkAtoms::type) {
|
|
|
|
// XXX ARG!! This is major evilness. ParseAttribute
|
|
|
|
// shouldn't set members. Override SetAttr instead
|
2011-09-29 10:19:26 +04:00
|
|
|
bool success = aResult.ParseEnumValue(aValue, kButtonTypeTable, false);
|
2010-08-20 21:47:30 +04:00
|
|
|
if (success) {
|
|
|
|
mType = aResult.GetEnumValue();
|
|
|
|
} else {
|
|
|
|
mType = kButtonDefaultType->value;
|
|
|
|
}
|
|
|
|
|
|
|
|
return success;
|
1998-10-14 01:31:26 +04:00
|
|
|
}
|
2010-04-15 15:03:00 +04:00
|
|
|
|
2010-08-20 21:47:30 +04:00
|
|
|
if (aAttribute == nsGkAtoms::formmethod) {
|
2011-10-17 18:59:28 +04:00
|
|
|
return aResult.ParseEnumValue(aValue, kFormMethodTable, false);
|
2010-08-20 21:47:30 +04:00
|
|
|
}
|
|
|
|
if (aAttribute == nsGkAtoms::formenctype) {
|
2011-10-17 18:59:28 +04:00
|
|
|
return aResult.ParseEnumValue(aValue, kFormEnctypeTable, false);
|
2010-08-20 21:47:30 +04:00
|
|
|
}
|
1998-10-14 01:31:26 +04:00
|
|
|
}
|
2000-12-23 13:56:31 +03:00
|
|
|
|
2005-11-29 19:37:15 +03:00
|
|
|
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
|
|
|
|
aResult);
|
1998-09-03 05:03:33 +04:00
|
|
|
}
|
|
|
|
|
2013-01-03 19:17:36 +04:00
|
|
|
bool
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLButtonElement::IsDisabledForEvents(uint32_t aMessage)
|
1998-09-03 05:03:33 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
nsIFormControlFrame* formControlFrame = GetFormControlFrame(false);
|
2014-03-25 19:36:49 +04:00
|
|
|
nsIFrame* formFrame = do_QueryFrame(formControlFrame);
|
2013-01-03 19:17:36 +04:00
|
|
|
return IsElementDisabledForEvents(aMessage, formFrame);
|
|
|
|
}
|
2001-04-13 04:39:52 +04:00
|
|
|
|
2013-01-03 19:17:36 +04:00
|
|
|
nsresult
|
2014-03-18 08:48:19 +04:00
|
|
|
HTMLButtonElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
2013-01-03 19:17:36 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
aVisitor.mCanHandle = false;
|
2013-01-03 19:17:36 +04:00
|
|
|
if (IsDisabledForEvents(aVisitor.mEvent->message)) {
|
2011-07-19 03:16:44 +04:00
|
|
|
return NS_OK;
|
2001-04-13 04:39:52 +04:00
|
|
|
}
|
2002-11-30 03:01:21 +03:00
|
|
|
|
2007-08-17 01:10:29 +04:00
|
|
|
// Track whether we're in the outermost Dispatch invocation that will
|
|
|
|
// cause activation of the input. That is, if we're a click event, or a
|
|
|
|
// DOMActivate that was dispatched directly, this will be set, but if we're
|
|
|
|
// a DOMActivate dispatched from click handling, it will not be set.
|
2013-10-28 13:03:19 +04:00
|
|
|
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
2011-09-29 10:19:26 +04:00
|
|
|
bool outerActivateEvent =
|
2013-10-28 13:03:19 +04:00
|
|
|
((mouseEvent && mouseEvent->IsLeftClickEvent()) ||
|
2007-08-17 01:10:29 +04:00
|
|
|
(aVisitor.mEvent->message == NS_UI_ACTIVATE &&
|
|
|
|
!mInInternalActivate));
|
|
|
|
|
|
|
|
if (outerActivateEvent) {
|
|
|
|
aVisitor.mItemFlags |= NS_OUTER_ACTIVATE_EVENT;
|
|
|
|
if (mType == NS_FORM_BUTTON_SUBMIT && mForm) {
|
|
|
|
aVisitor.mItemFlags |= NS_IN_SUBMIT_CLICK;
|
|
|
|
// tell the form that we are about to enter a click handler.
|
|
|
|
// that means that if there are scripted submissions, the
|
|
|
|
// latest one will be deferred until after the exit point of the handler.
|
2010-08-20 03:23:59 +04:00
|
|
|
mForm->OnSubmitClickBegin(this);
|
2007-08-17 01:10:29 +04:00
|
|
|
}
|
2002-11-30 03:01:21 +03:00
|
|
|
}
|
|
|
|
|
2006-03-07 20:08:51 +03:00
|
|
|
return nsGenericHTMLElement::PreHandleEvent(aVisitor);
|
|
|
|
}
|
1998-09-03 05:03:33 +04:00
|
|
|
|
2006-03-07 20:08:51 +03:00
|
|
|
nsresult
|
2014-03-18 08:48:20 +04:00
|
|
|
HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
2006-03-07 20:08:51 +03:00
|
|
|
{
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
if (!aVisitor.mPresContext) {
|
|
|
|
return rv;
|
|
|
|
}
|
2007-08-17 01:10:29 +04:00
|
|
|
|
2013-10-28 13:03:19 +04:00
|
|
|
if (aVisitor.mEventStatus != nsEventStatus_eConsumeNoDefault) {
|
|
|
|
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
|
|
|
if (mouseEvent && mouseEvent->IsLeftClickEvent()) {
|
2014-02-15 05:06:06 +04:00
|
|
|
// XXX Activating actually occurs even if it's caused by untrusted event.
|
|
|
|
// Therefore, shouldn't this be always trusted event?
|
2013-10-28 13:03:19 +04:00
|
|
|
InternalUIEvent actEvent(aVisitor.mEvent->mFlags.mIsTrusted,
|
2014-02-15 05:06:06 +04:00
|
|
|
NS_UI_ACTIVATE);
|
|
|
|
actEvent.detail = 1;
|
2013-10-28 13:03:19 +04:00
|
|
|
|
|
|
|
nsCOMPtr<nsIPresShell> shell = aVisitor.mPresContext->GetPresShell();
|
|
|
|
if (shell) {
|
|
|
|
nsEventStatus status = nsEventStatus_eIgnore;
|
|
|
|
mInInternalActivate = true;
|
|
|
|
shell->HandleDOMEventWithTarget(this, &actEvent, &status);
|
|
|
|
mInInternalActivate = false;
|
|
|
|
|
|
|
|
// If activate is cancelled, we must do the same as when click is
|
|
|
|
// cancelled (revert the checkbox to its original value).
|
|
|
|
if (status == nsEventStatus_eConsumeNoDefault) {
|
|
|
|
aVisitor.mEventStatus = status;
|
|
|
|
}
|
|
|
|
}
|
2007-08-17 01:10:29 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-07-30 02:59:37 +04:00
|
|
|
// mForm is null if the event handler removed us from the document (bug 194582).
|
2006-03-07 20:08:51 +03:00
|
|
|
if ((aVisitor.mItemFlags & NS_IN_SUBMIT_CLICK) && mForm) {
|
2002-11-30 03:01:21 +03:00
|
|
|
// tell the form that we are about to exit a click handler
|
|
|
|
// so the form knows not to defer subsequent submissions
|
|
|
|
// the pending ones that were created during the handler
|
|
|
|
// will be flushed or forgoten.
|
|
|
|
mForm->OnSubmitClickEnd();
|
|
|
|
}
|
|
|
|
|
2006-03-07 20:08:51 +03:00
|
|
|
if (nsEventStatus_eIgnore == aVisitor.mEventStatus) {
|
|
|
|
switch (aVisitor.mEvent->message) {
|
2002-11-30 03:01:21 +03:00
|
|
|
case NS_KEY_PRESS:
|
|
|
|
case NS_KEY_UP:
|
|
|
|
{
|
|
|
|
// For backwards compat, trigger buttons with space or enter
|
|
|
|
// (bug 25300)
|
2013-10-18 10:10:24 +04:00
|
|
|
WidgetKeyboardEvent* keyEvent = aVisitor.mEvent->AsKeyboardEvent();
|
2006-03-07 20:08:51 +03:00
|
|
|
if ((keyEvent->keyCode == NS_VK_RETURN &&
|
|
|
|
NS_KEY_PRESS == aVisitor.mEvent->message) ||
|
2011-12-18 10:00:47 +04:00
|
|
|
(keyEvent->keyCode == NS_VK_SPACE &&
|
|
|
|
NS_KEY_UP == aVisitor.mEvent->message)) {
|
2002-11-30 03:01:21 +03:00
|
|
|
nsEventStatus status = nsEventStatus_eIgnore;
|
2005-04-29 03:48:28 +04:00
|
|
|
|
2013-10-02 10:38:27 +04:00
|
|
|
WidgetMouseEvent event(aVisitor.mEvent->mFlags.mIsTrusted,
|
|
|
|
NS_MOUSE_CLICK, nullptr,
|
|
|
|
WidgetMouseEvent::eReal);
|
2011-08-26 11:43:56 +04:00
|
|
|
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
|
2014-03-18 08:48:21 +04:00
|
|
|
EventDispatcher::Dispatch(static_cast<nsIContent*>(this),
|
|
|
|
aVisitor.mPresContext, &event, nullptr,
|
|
|
|
&status);
|
2010-12-27 23:42:10 +03:00
|
|
|
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
2002-03-10 04:09:14 +03:00
|
|
|
}
|
2000-06-21 04:40:11 +04:00
|
|
|
}
|
2002-11-30 03:01:21 +03:00
|
|
|
break;// NS_KEY_PRESS
|
|
|
|
|
2006-11-17 00:35:39 +03:00
|
|
|
case NS_MOUSE_BUTTON_DOWN:
|
2002-11-30 03:01:21 +03:00
|
|
|
{
|
2013-10-22 12:55:20 +04:00
|
|
|
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
|
|
|
if (mouseEvent->button == WidgetMouseEvent::eLeftButton) {
|
|
|
|
if (mouseEvent->mFlags.mIsTrusted) {
|
2014-04-01 08:09:23 +04:00
|
|
|
EventStateManager* esm =
|
2013-10-22 12:55:20 +04:00
|
|
|
aVisitor.mPresContext->EventStateManager();
|
2014-04-01 08:09:23 +04:00
|
|
|
EventStateManager::SetActiveManager(
|
|
|
|
static_cast<EventStateManager*>(esm), this);
|
2013-10-22 12:55:20 +04:00
|
|
|
}
|
|
|
|
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
|
|
|
if (fm)
|
|
|
|
fm->SetFocus(this, nsIFocusManager::FLAG_BYMOUSE |
|
|
|
|
nsIFocusManager::FLAG_NOSCROLL);
|
|
|
|
mouseEvent->mFlags.mMultipleActionsPrevented = true;
|
|
|
|
} else if (mouseEvent->button == WidgetMouseEvent::eMiddleButton ||
|
|
|
|
mouseEvent->button == WidgetMouseEvent::eRightButton) {
|
|
|
|
// cancel all of these events for buttons
|
|
|
|
//XXXsmaug What to do with these events? Why these should be cancelled?
|
|
|
|
if (aVisitor.mDOMEvent) {
|
|
|
|
aVisitor.mDOMEvent->StopPropagation();
|
2006-11-17 00:35:39 +03:00
|
|
|
}
|
|
|
|
}
|
2001-12-06 09:57:03 +03:00
|
|
|
}
|
2002-11-30 03:01:21 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
// cancel all of these events for buttons
|
2006-03-07 20:08:51 +03:00
|
|
|
//XXXsmaug What to do with these events? Why these should be cancelled?
|
2006-11-17 00:35:39 +03:00
|
|
|
case NS_MOUSE_BUTTON_UP:
|
|
|
|
case NS_MOUSE_DOUBLECLICK:
|
2002-11-30 03:01:21 +03:00
|
|
|
{
|
2013-10-22 12:55:20 +04:00
|
|
|
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
|
|
|
if (aVisitor.mDOMEvent &&
|
|
|
|
(mouseEvent->button == WidgetMouseEvent::eMiddleButton ||
|
|
|
|
mouseEvent->button == WidgetMouseEvent::eRightButton)) {
|
2006-03-26 01:03:49 +03:00
|
|
|
aVisitor.mDOMEvent->StopPropagation();
|
2002-11-30 03:01:21 +03:00
|
|
|
}
|
2001-12-06 09:57:03 +03:00
|
|
|
}
|
2002-11-30 03:01:21 +03:00
|
|
|
break;
|
1998-09-03 05:03:33 +04:00
|
|
|
|
2013-07-11 19:46:04 +04:00
|
|
|
case NS_MOUSE_ENTER_SYNTH:
|
|
|
|
{
|
|
|
|
aVisitor.mPresContext->EventStateManager()->
|
|
|
|
SetContentState(this, NS_EVENT_STATE_HOVER);
|
|
|
|
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
// XXX this doesn't seem to do anything yet
|
|
|
|
case NS_MOUSE_EXIT_SYNTH:
|
|
|
|
{
|
|
|
|
aVisitor.mPresContext->EventStateManager()->
|
|
|
|
SetContentState(nullptr, NS_EVENT_STATE_HOVER);
|
|
|
|
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2002-11-30 03:01:21 +03:00
|
|
|
default:
|
|
|
|
break;
|
2006-03-07 20:08:51 +03:00
|
|
|
}
|
2007-08-17 01:10:29 +04:00
|
|
|
if (aVisitor.mItemFlags & NS_OUTER_ACTIVATE_EVENT) {
|
|
|
|
if (mForm && (mType == NS_FORM_BUTTON_SUBMIT ||
|
|
|
|
mType == NS_FORM_BUTTON_RESET)) {
|
2013-09-27 10:20:55 +04:00
|
|
|
InternalFormEvent event(true,
|
|
|
|
(mType == NS_FORM_BUTTON_RESET) ? NS_FORM_RESET : NS_FORM_SUBMIT);
|
2007-08-17 01:10:29 +04:00
|
|
|
event.originator = this;
|
|
|
|
nsEventStatus status = nsEventStatus_eIgnore;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIPresShell> presShell =
|
|
|
|
aVisitor.mPresContext->GetPresShell();
|
|
|
|
// If |nsIPresShell::Destroy| has been called due to
|
|
|
|
// handling the event, the pres context will return
|
|
|
|
// a null pres shell. See bug 125624.
|
|
|
|
//
|
|
|
|
// Using presShell to dispatch the event. It makes sure that
|
|
|
|
// event is not handled if the window is being destroyed.
|
2010-09-11 08:07:41 +04:00
|
|
|
if (presShell && (event.message != NS_FORM_SUBMIT ||
|
2010-09-11 08:11:58 +04:00
|
|
|
mForm->HasAttr(kNameSpaceID_None, nsGkAtoms::novalidate) ||
|
2010-09-15 03:38:07 +04:00
|
|
|
// We know the element is a submit control, if this check is moved,
|
|
|
|
// make sure formnovalidate is used only if it's a submit control.
|
|
|
|
HasAttr(kNameSpaceID_None, nsGkAtoms::formnovalidate) ||
|
2010-09-11 08:07:41 +04:00
|
|
|
mForm->CheckValidFormSubmission())) {
|
|
|
|
// TODO: removing this code and have the submit event sent by the form
|
|
|
|
// see bug 592124.
|
2009-10-30 04:49:11 +03:00
|
|
|
// Hold a strong ref while dispatching
|
2013-06-19 18:24:37 +04:00
|
|
|
nsRefPtr<HTMLFormElement> form(mForm);
|
2009-10-30 04:49:11 +03:00
|
|
|
presShell->HandleDOMEventWithTarget(mForm, &event, &status);
|
2010-12-27 23:42:10 +03:00
|
|
|
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
2002-11-30 03:01:21 +03:00
|
|
|
}
|
2007-08-17 01:10:29 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if ((aVisitor.mItemFlags & NS_IN_SUBMIT_CLICK) && mForm) {
|
|
|
|
// Tell the form to flush a possible pending submission.
|
|
|
|
// the reason is that the script returned false (the event was
|
|
|
|
// not ignored) so if there is a stored submission, it needs to
|
|
|
|
// be submitted immediatelly.
|
|
|
|
// Note, NS_IN_SUBMIT_CLICK is set only when we're in outer activate event.
|
|
|
|
mForm->FlushPendingSubmission();
|
2002-11-30 03:01:21 +03:00
|
|
|
} //if
|
1998-09-03 05:03:33 +04:00
|
|
|
|
2006-03-07 20:08:51 +03:00
|
|
|
return rv;
|
1998-09-03 05:03:33 +04:00
|
|
|
}
|
1998-10-14 01:31:26 +04:00
|
|
|
|
2011-06-01 05:46:57 +04:00
|
|
|
nsresult
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLButtonElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
|
|
|
bool aCompileEventHandlers)
|
2011-06-01 05:46:57 +04:00
|
|
|
{
|
2013-08-02 05:21:31 +04:00
|
|
|
nsresult rv =
|
|
|
|
nsGenericHTMLFormElementWithState::BindToTree(aDocument, aParent, aBindingParent,
|
|
|
|
aCompileEventHandlers);
|
2011-06-01 05:46:57 +04:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
// Update our state; we may now be the default submit element
|
|
|
|
UpdateState(false);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLButtonElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
2011-06-01 05:46:57 +04:00
|
|
|
{
|
2013-08-02 05:21:31 +04:00
|
|
|
nsGenericHTMLFormElementWithState::UnbindFromTree(aDeep, aNullParent);
|
2011-06-01 05:46:57 +04:00
|
|
|
|
|
|
|
// Update our state; we may no longer be the default submit element
|
|
|
|
UpdateState(false);
|
|
|
|
}
|
|
|
|
|
2002-02-16 04:19:24 +03:00
|
|
|
NS_IMETHODIMP
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLButtonElement::Reset()
|
2001-11-02 10:40:01 +03:00
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2002-02-16 04:19:24 +03:00
|
|
|
NS_IMETHODIMP
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLButtonElement::SubmitNamesValues(nsFormSubmission* aFormSubmission)
|
2001-11-02 10:40:01 +03:00
|
|
|
{
|
2002-02-16 04:19:24 +03:00
|
|
|
//
|
|
|
|
// We only submit if we were the button pressed
|
|
|
|
//
|
2010-08-20 01:58:20 +04:00
|
|
|
if (aFormSubmission->GetOriginatingElement() != this) {
|
2001-11-02 10:40:01 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2002-02-16 04:19:24 +03:00
|
|
|
// Disabled elements don't submit
|
2010-09-19 01:33:16 +04:00
|
|
|
if (IsDisabled()) {
|
|
|
|
return NS_OK;
|
2001-11-02 10:40:01 +03:00
|
|
|
}
|
|
|
|
|
2002-02-16 04:19:24 +03:00
|
|
|
//
|
|
|
|
// Get the name (if no name, no submit)
|
|
|
|
//
|
2001-11-02 10:40:01 +03:00
|
|
|
nsAutoString name;
|
2010-02-25 08:57:54 +03:00
|
|
|
GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
|
|
|
|
if (name.IsEmpty()) {
|
2005-10-28 15:25:24 +04:00
|
|
|
return NS_OK;
|
2002-02-16 04:19:24 +03:00
|
|
|
}
|
2001-11-02 10:40:01 +03:00
|
|
|
|
2002-02-16 04:19:24 +03:00
|
|
|
//
|
|
|
|
// Get the value
|
|
|
|
//
|
2001-11-02 10:40:01 +03:00
|
|
|
nsAutoString value;
|
2011-11-16 11:50:19 +04:00
|
|
|
nsresult rv = GetValue(value);
|
2002-02-16 04:19:24 +03:00
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
return rv;
|
|
|
|
}
|
2001-11-02 10:40:01 +03:00
|
|
|
|
2002-02-16 04:19:24 +03:00
|
|
|
//
|
|
|
|
// Submit
|
|
|
|
//
|
2011-11-16 11:50:19 +04:00
|
|
|
return aFormSubmission->AddNameValuePair(name, value);
|
2001-11-02 10:40:01 +03:00
|
|
|
}
|
2006-11-28 06:17:03 +03:00
|
|
|
|
|
|
|
void
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLButtonElement::DoneCreatingElement()
|
2006-11-28 06:17:03 +03:00
|
|
|
{
|
2011-06-01 01:57:16 +04:00
|
|
|
if (!mInhibitStateRestoration) {
|
2013-08-02 05:21:31 +04:00
|
|
|
nsresult rv = GenerateStateKey();
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
RestoreFormControlState();
|
|
|
|
}
|
2011-06-01 01:57:16 +04:00
|
|
|
}
|
2006-11-28 06:17:03 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLButtonElement::BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|
|
|
const nsAttrValueOrString* aValue,
|
|
|
|
bool aNotify)
|
2006-11-28 06:17:03 +03:00
|
|
|
{
|
2006-12-26 20:47:52 +03:00
|
|
|
if (aNotify && aName == nsGkAtoms::disabled &&
|
2006-11-28 06:17:03 +03:00
|
|
|
aNameSpaceID == kNameSpaceID_None) {
|
2011-10-17 18:59:28 +04:00
|
|
|
mDisabledChanged = true;
|
2006-11-28 06:17:03 +03:00
|
|
|
}
|
|
|
|
|
2013-08-02 05:21:31 +04:00
|
|
|
return nsGenericHTMLFormElementWithState::BeforeSetAttr(aNameSpaceID, aName,
|
|
|
|
aValue, aNotify);
|
2006-11-28 06:17:03 +03:00
|
|
|
}
|
|
|
|
|
2010-04-15 15:03:00 +04:00
|
|
|
nsresult
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLButtonElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|
|
|
const nsAttrValue* aValue, bool aNotify)
|
2010-04-15 15:03:00 +04:00
|
|
|
{
|
2010-09-10 09:08:56 +04:00
|
|
|
if (aNameSpaceID == kNameSpaceID_None) {
|
|
|
|
if (aName == nsGkAtoms::type) {
|
|
|
|
if (!aValue) {
|
|
|
|
mType = kButtonDefaultType->value;
|
|
|
|
}
|
2014-04-29 20:58:00 +04:00
|
|
|
}
|
2010-09-10 09:08:56 +04:00
|
|
|
|
2014-04-29 20:58:00 +04:00
|
|
|
if (aName == nsGkAtoms::type || aName == nsGkAtoms::disabled) {
|
|
|
|
UpdateBarredFromConstraintValidation();
|
|
|
|
UpdateState(aNotify);
|
2010-08-21 21:52:57 +04:00
|
|
|
}
|
2010-04-15 15:03:00 +04:00
|
|
|
}
|
|
|
|
|
2013-08-02 05:21:31 +04:00
|
|
|
return nsGenericHTMLFormElementWithState::AfterSetAttr(aNameSpaceID, aName,
|
|
|
|
aValue, aNotify);
|
2010-04-15 15:03:00 +04:00
|
|
|
}
|
|
|
|
|
2006-11-28 06:17:03 +03:00
|
|
|
NS_IMETHODIMP
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLButtonElement::SaveState()
|
2006-11-28 06:17:03 +03:00
|
|
|
{
|
|
|
|
if (!mDisabledChanged) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2013-07-24 11:38:13 +04:00
|
|
|
nsPresState* state = GetPrimaryPresState();
|
2006-11-28 06:17:03 +03:00
|
|
|
if (state) {
|
2010-09-19 01:33:16 +04:00
|
|
|
// We do not want to save the real disabled state but the disabled
|
|
|
|
// attribute.
|
|
|
|
state->SetDisabled(HasAttr(kNameSpaceID_None, nsGkAtoms::disabled));
|
2006-11-28 06:17:03 +03:00
|
|
|
}
|
|
|
|
|
2013-07-24 11:38:13 +04:00
|
|
|
return NS_OK;
|
2006-11-28 06:17:03 +03:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLButtonElement::RestoreState(nsPresState* aState)
|
2006-11-28 06:17:03 +03:00
|
|
|
{
|
2009-03-13 23:29:57 +03:00
|
|
|
if (aState && aState->IsDisabledSet()) {
|
2008-12-12 22:25:22 +03:00
|
|
|
SetDisabled(aState->GetDisabled());
|
2007-10-10 07:39:16 +04:00
|
|
|
}
|
2006-11-28 06:17:03 +03:00
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2006-11-28 06:17:03 +03:00
|
|
|
}
|
2010-08-18 22:28:08 +04:00
|
|
|
|
2014-04-03 08:18:36 +04:00
|
|
|
EventStates
|
2013-02-08 16:50:30 +04:00
|
|
|
HTMLButtonElement::IntrinsicState() const
|
2010-08-19 04:03:20 +04:00
|
|
|
{
|
2014-04-03 08:18:36 +04:00
|
|
|
EventStates state = nsGenericHTMLFormElementWithState::IntrinsicState();
|
2014-04-29 20:58:00 +04:00
|
|
|
|
|
|
|
if (IsCandidateForConstraintValidation()) {
|
|
|
|
if (IsValid()) {
|
|
|
|
state |= NS_EVENT_STATE_VALID;
|
|
|
|
if (!mForm || !mForm->HasAttr(kNameSpaceID_None, nsGkAtoms::novalidate)) {
|
|
|
|
state |= NS_EVENT_STATE_MOZ_UI_VALID;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
state |= NS_EVENT_STATE_INVALID;
|
|
|
|
if (!mForm || !mForm->HasAttr(kNameSpaceID_None, nsGkAtoms::novalidate)) {
|
|
|
|
state |= NS_EVENT_STATE_MOZ_UI_INVALID;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-08-21 21:52:57 +04:00
|
|
|
|
2010-09-10 09:08:56 +04:00
|
|
|
if (mForm && !mForm->GetValidity() && IsSubmitControl()) {
|
|
|
|
state |= NS_EVENT_STATE_MOZ_SUBMITINVALID;
|
|
|
|
}
|
|
|
|
|
2010-10-08 01:09:31 +04:00
|
|
|
return state;
|
2010-08-19 04:03:20 +04:00
|
|
|
}
|
2013-02-08 16:50:30 +04:00
|
|
|
|
2013-02-08 16:50:30 +04:00
|
|
|
JSObject*
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 17:13:33 +03:00
|
|
|
HTMLButtonElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
2013-02-08 16:50:30 +04:00
|
|
|
{
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 17:13:33 +03:00
|
|
|
return HTMLButtonElementBinding::Wrap(aCx, this, aGivenProto);
|
2013-02-08 16:50:30 +04:00
|
|
|
}
|
|
|
|
|
2013-02-08 16:50:30 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|