2015-05-03 19:32:37 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 11:12:37 +00: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 16:40:24 +00:00
|
|
|
|
2013-02-08 12:50:30 +00:00
|
|
|
#include "mozilla/dom/HTMLButtonElement.h"
|
|
|
|
|
2013-02-08 12:50:30 +00:00
|
|
|
#include "mozilla/dom/HTMLButtonElementBinding.h"
|
1998-10-13 21:31:26 +00:00
|
|
|
#include "nsIDOMHTMLFormElement.h"
|
2012-09-30 16:40:24 +00:00
|
|
|
#include "nsAttrValueInlines.h"
|
2006-12-26 17:47:52 +00:00
|
|
|
#include "nsGkAtoms.h"
|
2003-01-09 06:49:07 +00:00
|
|
|
#include "nsIPresShell.h"
|
1998-09-03 01:03:33 +00:00
|
|
|
#include "nsStyleConsts.h"
|
2004-07-31 23:15:21 +00:00
|
|
|
#include "nsPresContext.h"
|
1998-10-13 21:31:26 +00:00
|
|
|
#include "nsIFormControl.h"
|
|
|
|
#include "nsIForm.h"
|
2010-05-26 12:49:38 +00:00
|
|
|
#include "nsFormSubmission.h"
|
2010-08-20 17:47:30 +00:00
|
|
|
#include "nsFormSubmissionConstants.h"
|
1999-01-15 02:07:46 +00:00
|
|
|
#include "nsIURL.h"
|
2001-10-24 00:01:09 +00:00
|
|
|
#include "nsIFrame.h"
|
1999-08-21 00:19:34 +00:00
|
|
|
#include "nsIFormControlFrame.h"
|
2000-12-30 19:22:22 +00:00
|
|
|
#include "nsIDOMEvent.h"
|
2000-09-08 01:46:00 +00:00
|
|
|
#include "nsIDocument.h"
|
2013-09-25 11:21:20 +00:00
|
|
|
#include "mozilla/ContentEvents.h"
|
2014-03-18 04:48:21 +00:00
|
|
|
#include "mozilla/EventDispatcher.h"
|
2014-04-01 04:09:23 +00:00
|
|
|
#include "mozilla/EventStateManager.h"
|
2014-04-03 04:18:36 +00:00
|
|
|
#include "mozilla/EventStates.h"
|
2013-09-25 11:21:18 +00:00
|
|
|
#include "mozilla/MouseEvents.h"
|
2013-09-25 11:21:19 +00:00
|
|
|
#include "mozilla/TextEvents.h"
|
2001-12-16 11:58:03 +00:00
|
|
|
#include "nsUnicharUtils.h"
|
2005-12-12 23:53:06 +00:00
|
|
|
#include "nsLayoutUtils.h"
|
2006-11-28 03:17:03 +00:00
|
|
|
#include "nsPresState.h"
|
2012-07-27 14:03:27 +00: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 18:00:39 +00:00
|
|
|
#include "nsFocusManager.h"
|
2013-06-19 14:24:37 +00:00
|
|
|
#include "mozilla/dom/HTMLFormElement.h"
|
2010-09-08 17:43:28 +00:00
|
|
|
#include "mozAutoDocUpdate.h"
|
2006-03-07 17:08:51 +00:00
|
|
|
|
2007-08-16 21:10:29 +00:00
|
|
|
#define NS_IN_SUBMIT_CLICK (1 << 0)
|
|
|
|
#define NS_OUTER_ACTIVATE_EVENT (1 << 1)
|
1998-09-03 01:03:33 +00:00
|
|
|
|
2013-02-08 12:50:30 +00:00
|
|
|
NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Button)
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2010-04-15 11:03:00 +00: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-13 21:31:26 +00:00
|
|
|
|
|
|
|
// Construction, destruction
|
2014-06-20 02:01:40 +00:00
|
|
|
HTMLButtonElement::HTMLButtonElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
2013-02-08 12:50:30 +00:00
|
|
|
FromParser aFromParser)
|
2013-08-02 01:21:31 +00:00
|
|
|
: nsGenericHTMLFormElementWithState(aNodeInfo),
|
2010-04-15 11:03:00 +00:00
|
|
|
mType(kButtonDefaultType->value),
|
2011-10-17 14:59:28 +00:00
|
|
|
mDisabledChanged(false),
|
|
|
|
mInInternalActivate(false),
|
2011-05-31 21:57:16 +00:00
|
|
|
mInhibitStateRestoration(!!(aFromParser & FROM_PARSER_FRAGMENT))
|
1998-09-03 01:03:33 +00:00
|
|
|
{
|
2011-06-01 01:46:57 +00:00
|
|
|
// Set up our default state: enabled
|
|
|
|
AddStatesSilently(NS_EVENT_STATE_ENABLED);
|
1998-09-03 01:03:33 +00:00
|
|
|
}
|
|
|
|
|
2013-02-08 12:50:30 +00:00
|
|
|
HTMLButtonElement::~HTMLButtonElement()
|
1998-09-03 01:03:33 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
1998-10-13 21:31:26 +00:00
|
|
|
// nsISupports
|
1998-09-03 01:03:33 +00:00
|
|
|
|
2014-04-25 16:49:00 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_INHERITED(HTMLButtonElement,
|
|
|
|
nsGenericHTMLFormElementWithState,
|
|
|
|
mValidity)
|
2013-01-16 18:01:01 +00:00
|
|
|
|
2013-02-08 12:50:30 +00: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 16:46:42 +00:00
|
|
|
|
2010-01-12 13:08:43 +00:00
|
|
|
|
2013-02-08 12:50:30 +00:00
|
|
|
// QueryInterface implementation for HTMLButtonElement
|
|
|
|
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLButtonElement)
|
2014-04-27 07:06:00 +00:00
|
|
|
NS_INTERFACE_TABLE_INHERITED(HTMLButtonElement,
|
|
|
|
nsIDOMHTMLButtonElement,
|
|
|
|
nsIConstraintValidation)
|
2013-08-07 20:23:08 +00:00
|
|
|
NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLFormElementWithState)
|
1998-09-03 01:03:33 +00:00
|
|
|
|
2010-08-21 18:52:49 +00:00
|
|
|
// nsIConstraintValidation
|
2014-04-29 16:58:00 +00:00
|
|
|
NS_IMPL_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(HTMLButtonElement)
|
2010-08-18 18:28:08 +00:00
|
|
|
|
2014-04-29 16:58:00 +00: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-13 21:31:26 +00:00
|
|
|
|
2014-04-29 16:58:00 +00:00
|
|
|
void
|
|
|
|
HTMLButtonElement::FieldSetDisabledChanged(bool aNotify)
|
|
|
|
{
|
|
|
|
UpdateBarredFromConstraintValidation();
|
|
|
|
|
|
|
|
nsGenericHTMLFormElementWithState::FieldSetDisabledChanged(aNotify);
|
|
|
|
}
|
|
|
|
|
|
|
|
// nsIDOMHTMLButtonElement
|
1999-07-28 05:26:55 +00:00
|
|
|
|
2013-02-08 12:50:30 +00:00
|
|
|
NS_IMPL_ELEMENT_CLONE(HTMLButtonElement)
|
1999-07-28 05:26:55 +00:00
|
|
|
|
2000-12-23 10:56:31 +00:00
|
|
|
|
2002-08-06 23:50:08 +00:00
|
|
|
// nsIDOMHTMLButtonElement
|
2000-12-23 10:56:31 +00:00
|
|
|
|
1998-09-03 01:03:33 +00:00
|
|
|
NS_IMETHODIMP
|
2013-02-08 12:50:30 +00:00
|
|
|
HTMLButtonElement::GetForm(nsIDOMHTMLFormElement** aForm)
|
1998-09-03 01:03:33 +00:00
|
|
|
{
|
2013-08-02 01:21:31 +00:00
|
|
|
return nsGenericHTMLFormElementWithState::GetForm(aForm);
|
1998-09-03 01:03:33 +00:00
|
|
|
}
|
2000-12-23 10:56:31 +00:00
|
|
|
|
2013-02-08 12:50:30 +00: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 15:35:35 +00: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 12:50:30 +00: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 11:03:00 +00:00
|
|
|
kButtonDefaultType->tag)
|
1998-09-03 01:03:33 +00:00
|
|
|
|
2012-10-06 07:19:51 +00:00
|
|
|
int32_t
|
2013-02-08 12:50:30 +00:00
|
|
|
HTMLButtonElement::TabIndexDefault()
|
2012-10-06 07:19:51 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
2013-02-08 12:50:30 +00:00
|
|
|
HTMLButtonElement::IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t *aTabIndex)
|
2004-07-24 21:12:43 +00:00
|
|
|
{
|
2013-08-02 01:21:31 +00:00
|
|
|
if (nsGenericHTMLFormElementWithState::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex)) {
|
2011-10-17 14:59:28 +00:00
|
|
|
return true;
|
2004-07-24 21:12:43 +00:00
|
|
|
}
|
2010-06-21 12:37:34 +00:00
|
|
|
|
|
|
|
*aIsFocusable =
|
|
|
|
#ifdef XP_MACOSX
|
2010-08-09 16:15:47 +00:00
|
|
|
(!aWithMouse || nsFocusManager::sMouseFocusesFormControl) &&
|
2010-06-21 12:37:34 +00:00
|
|
|
#endif
|
2010-09-18 21:33:16 +00:00
|
|
|
!IsDisabled();
|
2008-04-15 18:40:38 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
return false;
|
2004-07-24 21:12:43 +00:00
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
2013-02-08 12:50:30 +00:00
|
|
|
HTMLButtonElement::ParseAttribute(int32_t aNamespaceID,
|
|
|
|
nsIAtom* aAttribute,
|
|
|
|
const nsAString& aValue,
|
|
|
|
nsAttrValue& aResult)
|
1998-09-03 01:03:33 +00:00
|
|
|
{
|
2010-08-20 17:47:30 +00: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 06:19:26 +00:00
|
|
|
bool success = aResult.ParseEnumValue(aValue, kButtonTypeTable, false);
|
2010-08-20 17:47:30 +00:00
|
|
|
if (success) {
|
|
|
|
mType = aResult.GetEnumValue();
|
|
|
|
} else {
|
|
|
|
mType = kButtonDefaultType->value;
|
|
|
|
}
|
|
|
|
|
|
|
|
return success;
|
1998-10-13 21:31:26 +00:00
|
|
|
}
|
2010-04-15 11:03:00 +00:00
|
|
|
|
2010-08-20 17:47:30 +00:00
|
|
|
if (aAttribute == nsGkAtoms::formmethod) {
|
2011-10-17 14:59:28 +00:00
|
|
|
return aResult.ParseEnumValue(aValue, kFormMethodTable, false);
|
2010-08-20 17:47:30 +00:00
|
|
|
}
|
|
|
|
if (aAttribute == nsGkAtoms::formenctype) {
|
2011-10-17 14:59:28 +00:00
|
|
|
return aResult.ParseEnumValue(aValue, kFormEnctypeTable, false);
|
2010-08-20 17:47:30 +00:00
|
|
|
}
|
1998-10-13 21:31:26 +00:00
|
|
|
}
|
2000-12-23 10:56:31 +00:00
|
|
|
|
2005-11-29 16:37:15 +00:00
|
|
|
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
|
|
|
|
aResult);
|
1998-09-03 01:03:33 +00:00
|
|
|
}
|
|
|
|
|
2013-01-03 15:17:36 +00:00
|
|
|
bool
|
2015-08-26 12:56:59 +00:00
|
|
|
HTMLButtonElement::IsDisabledForEvents(EventMessage aMessage)
|
1998-09-03 01:03:33 +00:00
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
nsIFormControlFrame* formControlFrame = GetFormControlFrame(false);
|
2014-03-25 15:36:49 +00:00
|
|
|
nsIFrame* formFrame = do_QueryFrame(formControlFrame);
|
2013-01-03 15:17:36 +00:00
|
|
|
return IsElementDisabledForEvents(aMessage, formFrame);
|
|
|
|
}
|
2001-04-13 00:39:52 +00:00
|
|
|
|
2013-01-03 15:17:36 +00:00
|
|
|
nsresult
|
2014-03-18 04:48:19 +00:00
|
|
|
HTMLButtonElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
2013-01-03 15:17:36 +00:00
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
aVisitor.mCanHandle = false;
|
2015-08-22 01:34:51 +00:00
|
|
|
if (IsDisabledForEvents(aVisitor.mEvent->mMessage)) {
|
2011-07-18 23:16:44 +00:00
|
|
|
return NS_OK;
|
2001-04-13 00:39:52 +00:00
|
|
|
}
|
2002-11-30 00:01:21 +00:00
|
|
|
|
2007-08-16 21:10:29 +00: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 09:03:19 +00:00
|
|
|
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
2011-09-29 06:19:26 +00:00
|
|
|
bool outerActivateEvent =
|
2013-10-28 09:03:19 +00:00
|
|
|
((mouseEvent && mouseEvent->IsLeftClickEvent()) ||
|
2015-09-02 06:08:01 +00:00
|
|
|
(aVisitor.mEvent->mMessage == eLegacyDOMActivate &&
|
2007-08-16 21:10:29 +00:00
|
|
|
!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-19 23:23:59 +00:00
|
|
|
mForm->OnSubmitClickBegin(this);
|
2007-08-16 21:10:29 +00:00
|
|
|
}
|
2002-11-30 00:01:21 +00:00
|
|
|
}
|
|
|
|
|
2006-03-07 17:08:51 +00:00
|
|
|
return nsGenericHTMLElement::PreHandleEvent(aVisitor);
|
|
|
|
}
|
1998-09-03 01:03:33 +00:00
|
|
|
|
2006-03-07 17:08:51 +00:00
|
|
|
nsresult
|
2014-03-18 04:48:20 +00:00
|
|
|
HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
|
2006-03-07 17:08:51 +00:00
|
|
|
{
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
if (!aVisitor.mPresContext) {
|
|
|
|
return rv;
|
|
|
|
}
|
2007-08-16 21:10:29 +00:00
|
|
|
|
2013-10-28 09:03:19 +00:00
|
|
|
if (aVisitor.mEventStatus != nsEventStatus_eConsumeNoDefault) {
|
|
|
|
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
|
|
|
if (mouseEvent && mouseEvent->IsLeftClickEvent()) {
|
2015-08-22 04:02:39 +00:00
|
|
|
// DOMActive event should be trusted since the activation is actually
|
|
|
|
// occurred even if the cause is an untrusted click event.
|
2015-09-02 06:08:01 +00:00
|
|
|
InternalUIEvent actEvent(true, eLegacyDOMActivate, mouseEvent);
|
2014-02-15 01:06:06 +00:00
|
|
|
actEvent.detail = 1;
|
2013-10-28 09:03:19 +00: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-16 21:10:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-07-29 22:59:37 +00:00
|
|
|
// mForm is null if the event handler removed us from the document (bug 194582).
|
2006-03-07 17:08:51 +00:00
|
|
|
if ((aVisitor.mItemFlags & NS_IN_SUBMIT_CLICK) && mForm) {
|
2002-11-30 00:01:21 +00: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 17:08:51 +00:00
|
|
|
if (nsEventStatus_eIgnore == aVisitor.mEventStatus) {
|
2015-08-22 01:34:51 +00:00
|
|
|
switch (aVisitor.mEvent->mMessage) {
|
2015-08-28 23:58:27 +00:00
|
|
|
case eKeyPress:
|
2015-08-28 23:58:27 +00:00
|
|
|
case eKeyUp:
|
2002-11-30 00:01:21 +00:00
|
|
|
{
|
|
|
|
// For backwards compat, trigger buttons with space or enter
|
|
|
|
// (bug 25300)
|
2013-10-18 06:10:24 +00:00
|
|
|
WidgetKeyboardEvent* keyEvent = aVisitor.mEvent->AsKeyboardEvent();
|
2006-03-07 17:08:51 +00:00
|
|
|
if ((keyEvent->keyCode == NS_VK_RETURN &&
|
2015-08-28 23:58:27 +00:00
|
|
|
eKeyPress == aVisitor.mEvent->mMessage) ||
|
2011-12-18 06:00:47 +00:00
|
|
|
(keyEvent->keyCode == NS_VK_SPACE &&
|
2015-08-28 23:58:27 +00:00
|
|
|
eKeyUp == aVisitor.mEvent->mMessage)) {
|
2002-11-30 00:01:21 +00:00
|
|
|
nsEventStatus status = nsEventStatus_eIgnore;
|
2005-04-28 23:48:28 +00:00
|
|
|
|
2013-10-02 06:38:27 +00:00
|
|
|
WidgetMouseEvent event(aVisitor.mEvent->mFlags.mIsTrusted,
|
2015-08-28 23:58:32 +00:00
|
|
|
eMouseClick, nullptr,
|
2013-10-02 06:38:27 +00:00
|
|
|
WidgetMouseEvent::eReal);
|
2011-08-26 07:43:56 +00:00
|
|
|
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
|
2014-03-18 04:48:21 +00:00
|
|
|
EventDispatcher::Dispatch(static_cast<nsIContent*>(this),
|
|
|
|
aVisitor.mPresContext, &event, nullptr,
|
|
|
|
&status);
|
2010-12-27 20:42:10 +00:00
|
|
|
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
2002-03-10 01:09:14 +00:00
|
|
|
}
|
2000-06-21 00:40:11 +00:00
|
|
|
}
|
2015-08-28 23:58:27 +00:00
|
|
|
break;
|
2002-11-30 00:01:21 +00:00
|
|
|
|
2015-08-28 23:58:30 +00:00
|
|
|
case eMouseDown:
|
2002-11-30 00:01:21 +00:00
|
|
|
{
|
2013-10-22 08:55:20 +00:00
|
|
|
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
|
|
|
if (mouseEvent->button == WidgetMouseEvent::eLeftButton) {
|
|
|
|
if (mouseEvent->mFlags.mIsTrusted) {
|
2014-04-01 04:09:23 +00:00
|
|
|
EventStateManager* esm =
|
2013-10-22 08:55:20 +00:00
|
|
|
aVisitor.mPresContext->EventStateManager();
|
2014-04-01 04:09:23 +00:00
|
|
|
EventStateManager::SetActiveManager(
|
|
|
|
static_cast<EventStateManager*>(esm), this);
|
2013-10-22 08:55:20 +00:00
|
|
|
}
|
|
|
|
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
2015-11-12 16:35:20 +00:00
|
|
|
if (fm) {
|
|
|
|
uint32_t flags = nsIFocusManager::FLAG_BYMOUSE |
|
|
|
|
nsIFocusManager::FLAG_NOSCROLL;
|
|
|
|
// If this was a touch-generated event, pass that information:
|
|
|
|
if (mouseEvent->inputSource == nsIDOMMouseEvent::MOZ_SOURCE_TOUCH) {
|
|
|
|
flags |= nsIFocusManager::FLAG_BYTOUCH;
|
|
|
|
}
|
|
|
|
fm->SetFocus(this, flags);
|
|
|
|
}
|
2013-10-22 08:55:20 +00:00
|
|
|
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-16 21:35:39 +00:00
|
|
|
}
|
|
|
|
}
|
2001-12-06 06:57:03 +00:00
|
|
|
}
|
2002-11-30 00:01:21 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
// cancel all of these events for buttons
|
2006-03-07 17:08:51 +00:00
|
|
|
//XXXsmaug What to do with these events? Why these should be cancelled?
|
2015-08-28 23:58:30 +00:00
|
|
|
case eMouseUp:
|
2015-08-28 23:58:31 +00:00
|
|
|
case eMouseDoubleClick:
|
2002-11-30 00:01:21 +00:00
|
|
|
{
|
2013-10-22 08:55:20 +00:00
|
|
|
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
|
|
|
if (aVisitor.mDOMEvent &&
|
|
|
|
(mouseEvent->button == WidgetMouseEvent::eMiddleButton ||
|
|
|
|
mouseEvent->button == WidgetMouseEvent::eRightButton)) {
|
2006-03-25 22:03:49 +00:00
|
|
|
aVisitor.mDOMEvent->StopPropagation();
|
2002-11-30 00:01:21 +00:00
|
|
|
}
|
2001-12-06 06:57:03 +00:00
|
|
|
}
|
2002-11-30 00:01:21 +00:00
|
|
|
break;
|
1998-09-03 01:03:33 +00:00
|
|
|
|
2015-08-28 23:58:32 +00:00
|
|
|
case eMouseOver:
|
2013-07-11 15:46:04 +00:00
|
|
|
{
|
|
|
|
aVisitor.mPresContext->EventStateManager()->
|
|
|
|
SetContentState(this, NS_EVENT_STATE_HOVER);
|
|
|
|
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
// XXX this doesn't seem to do anything yet
|
2015-08-28 23:58:32 +00:00
|
|
|
case eMouseOut:
|
2013-07-11 15:46:04 +00:00
|
|
|
{
|
|
|
|
aVisitor.mPresContext->EventStateManager()->
|
|
|
|
SetContentState(nullptr, NS_EVENT_STATE_HOVER);
|
|
|
|
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2002-11-30 00:01:21 +00:00
|
|
|
default:
|
|
|
|
break;
|
2006-03-07 17:08:51 +00:00
|
|
|
}
|
2007-08-16 21:10:29 +00:00
|
|
|
if (aVisitor.mItemFlags & NS_OUTER_ACTIVATE_EVENT) {
|
|
|
|
if (mForm && (mType == NS_FORM_BUTTON_SUBMIT ||
|
|
|
|
mType == NS_FORM_BUTTON_RESET)) {
|
2013-09-27 06:20:55 +00:00
|
|
|
InternalFormEvent event(true,
|
2015-09-02 06:08:00 +00:00
|
|
|
(mType == NS_FORM_BUTTON_RESET) ? eFormReset : eFormSubmit);
|
2007-08-16 21:10:29 +00: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.
|
2015-09-02 06:08:00 +00:00
|
|
|
if (presShell && (event.mMessage != eFormSubmit ||
|
2010-09-11 04:11:58 +00:00
|
|
|
mForm->HasAttr(kNameSpaceID_None, nsGkAtoms::novalidate) ||
|
2010-09-14 23:38:07 +00: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 04:07:41 +00:00
|
|
|
mForm->CheckValidFormSubmission())) {
|
|
|
|
// TODO: removing this code and have the submit event sent by the form
|
|
|
|
// see bug 592124.
|
2009-10-30 01:49:11 +00:00
|
|
|
// Hold a strong ref while dispatching
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<HTMLFormElement> form(mForm);
|
2009-10-30 01:49:11 +00:00
|
|
|
presShell->HandleDOMEventWithTarget(mForm, &event, &status);
|
2010-12-27 20:42:10 +00:00
|
|
|
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
2002-11-30 00:01:21 +00:00
|
|
|
}
|
2007-08-16 21:10:29 +00: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 00:01:21 +00:00
|
|
|
} //if
|
1998-09-03 01:03:33 +00:00
|
|
|
|
2006-03-07 17:08:51 +00:00
|
|
|
return rv;
|
1998-09-03 01:03:33 +00:00
|
|
|
}
|
1998-10-13 21:31:26 +00:00
|
|
|
|
2011-06-01 01:46:57 +00:00
|
|
|
nsresult
|
2013-02-08 12:50:30 +00:00
|
|
|
HTMLButtonElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
|
|
|
bool aCompileEventHandlers)
|
2011-06-01 01:46:57 +00:00
|
|
|
{
|
2013-08-02 01:21:31 +00:00
|
|
|
nsresult rv =
|
|
|
|
nsGenericHTMLFormElementWithState::BindToTree(aDocument, aParent, aBindingParent,
|
|
|
|
aCompileEventHandlers);
|
2011-06-01 01:46:57 +00: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 12:50:30 +00:00
|
|
|
HTMLButtonElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
2011-06-01 01:46:57 +00:00
|
|
|
{
|
2013-08-02 01:21:31 +00:00
|
|
|
nsGenericHTMLFormElementWithState::UnbindFromTree(aDeep, aNullParent);
|
2011-06-01 01:46:57 +00:00
|
|
|
|
|
|
|
// Update our state; we may no longer be the default submit element
|
|
|
|
UpdateState(false);
|
|
|
|
}
|
|
|
|
|
2002-02-16 01:19:24 +00:00
|
|
|
NS_IMETHODIMP
|
2013-02-08 12:50:30 +00:00
|
|
|
HTMLButtonElement::Reset()
|
2001-11-02 07:40:01 +00:00
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2002-02-16 01:19:24 +00:00
|
|
|
NS_IMETHODIMP
|
2013-02-08 12:50:30 +00:00
|
|
|
HTMLButtonElement::SubmitNamesValues(nsFormSubmission* aFormSubmission)
|
2001-11-02 07:40:01 +00:00
|
|
|
{
|
2002-02-16 01:19:24 +00:00
|
|
|
//
|
|
|
|
// We only submit if we were the button pressed
|
|
|
|
//
|
2010-08-19 21:58:20 +00:00
|
|
|
if (aFormSubmission->GetOriginatingElement() != this) {
|
2001-11-02 07:40:01 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2002-02-16 01:19:24 +00:00
|
|
|
// Disabled elements don't submit
|
2010-09-18 21:33:16 +00:00
|
|
|
if (IsDisabled()) {
|
|
|
|
return NS_OK;
|
2001-11-02 07:40:01 +00:00
|
|
|
}
|
|
|
|
|
2002-02-16 01:19:24 +00:00
|
|
|
//
|
|
|
|
// Get the name (if no name, no submit)
|
|
|
|
//
|
2001-11-02 07:40:01 +00:00
|
|
|
nsAutoString name;
|
2010-02-25 05:57:54 +00:00
|
|
|
GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
|
|
|
|
if (name.IsEmpty()) {
|
2005-10-28 11:25:24 +00:00
|
|
|
return NS_OK;
|
2002-02-16 01:19:24 +00:00
|
|
|
}
|
2001-11-02 07:40:01 +00:00
|
|
|
|
2002-02-16 01:19:24 +00:00
|
|
|
//
|
|
|
|
// Get the value
|
|
|
|
//
|
2001-11-02 07:40:01 +00:00
|
|
|
nsAutoString value;
|
2011-11-16 07:50:19 +00:00
|
|
|
nsresult rv = GetValue(value);
|
2002-02-16 01:19:24 +00:00
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
return rv;
|
|
|
|
}
|
2001-11-02 07:40:01 +00:00
|
|
|
|
2002-02-16 01:19:24 +00:00
|
|
|
//
|
|
|
|
// Submit
|
|
|
|
//
|
2011-11-16 07:50:19 +00:00
|
|
|
return aFormSubmission->AddNameValuePair(name, value);
|
2001-11-02 07:40:01 +00:00
|
|
|
}
|
2006-11-28 03:17:03 +00:00
|
|
|
|
|
|
|
void
|
2013-02-08 12:50:30 +00:00
|
|
|
HTMLButtonElement::DoneCreatingElement()
|
2006-11-28 03:17:03 +00:00
|
|
|
{
|
2011-05-31 21:57:16 +00:00
|
|
|
if (!mInhibitStateRestoration) {
|
2013-08-02 01:21:31 +00:00
|
|
|
nsresult rv = GenerateStateKey();
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
RestoreFormControlState();
|
|
|
|
}
|
2011-05-31 21:57:16 +00:00
|
|
|
}
|
2006-11-28 03:17:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2013-02-08 12:50:30 +00:00
|
|
|
HTMLButtonElement::BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
2015-08-01 05:14:06 +00:00
|
|
|
nsAttrValueOrString* aValue,
|
2013-02-08 12:50:30 +00:00
|
|
|
bool aNotify)
|
2006-11-28 03:17:03 +00:00
|
|
|
{
|
2006-12-26 17:47:52 +00:00
|
|
|
if (aNotify && aName == nsGkAtoms::disabled &&
|
2006-11-28 03:17:03 +00:00
|
|
|
aNameSpaceID == kNameSpaceID_None) {
|
2011-10-17 14:59:28 +00:00
|
|
|
mDisabledChanged = true;
|
2006-11-28 03:17:03 +00:00
|
|
|
}
|
|
|
|
|
2013-08-02 01:21:31 +00:00
|
|
|
return nsGenericHTMLFormElementWithState::BeforeSetAttr(aNameSpaceID, aName,
|
|
|
|
aValue, aNotify);
|
2006-11-28 03:17:03 +00:00
|
|
|
}
|
|
|
|
|
2010-04-15 11:03:00 +00:00
|
|
|
nsresult
|
2013-02-08 12:50:30 +00:00
|
|
|
HTMLButtonElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|
|
|
const nsAttrValue* aValue, bool aNotify)
|
2010-04-15 11:03:00 +00:00
|
|
|
{
|
2010-09-10 05:08:56 +00:00
|
|
|
if (aNameSpaceID == kNameSpaceID_None) {
|
|
|
|
if (aName == nsGkAtoms::type) {
|
|
|
|
if (!aValue) {
|
|
|
|
mType = kButtonDefaultType->value;
|
|
|
|
}
|
2014-04-29 16:58:00 +00:00
|
|
|
}
|
2010-09-10 05:08:56 +00:00
|
|
|
|
2014-04-29 16:58:00 +00:00
|
|
|
if (aName == nsGkAtoms::type || aName == nsGkAtoms::disabled) {
|
|
|
|
UpdateBarredFromConstraintValidation();
|
|
|
|
UpdateState(aNotify);
|
2010-08-21 17:52:57 +00:00
|
|
|
}
|
2010-04-15 11:03:00 +00:00
|
|
|
}
|
|
|
|
|
2013-08-02 01:21:31 +00:00
|
|
|
return nsGenericHTMLFormElementWithState::AfterSetAttr(aNameSpaceID, aName,
|
|
|
|
aValue, aNotify);
|
2010-04-15 11:03:00 +00:00
|
|
|
}
|
|
|
|
|
2006-11-28 03:17:03 +00:00
|
|
|
NS_IMETHODIMP
|
2013-02-08 12:50:30 +00:00
|
|
|
HTMLButtonElement::SaveState()
|
2006-11-28 03:17:03 +00:00
|
|
|
{
|
|
|
|
if (!mDisabledChanged) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2013-07-24 07:38:13 +00:00
|
|
|
nsPresState* state = GetPrimaryPresState();
|
2006-11-28 03:17:03 +00:00
|
|
|
if (state) {
|
2010-09-18 21:33:16 +00: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 03:17:03 +00:00
|
|
|
}
|
|
|
|
|
2013-07-24 07:38:13 +00:00
|
|
|
return NS_OK;
|
2006-11-28 03:17:03 +00:00
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
2013-02-08 12:50:30 +00:00
|
|
|
HTMLButtonElement::RestoreState(nsPresState* aState)
|
2006-11-28 03:17:03 +00:00
|
|
|
{
|
2009-03-13 20:29:57 +00:00
|
|
|
if (aState && aState->IsDisabledSet()) {
|
2008-12-12 19:25:22 +00:00
|
|
|
SetDisabled(aState->GetDisabled());
|
2007-10-10 03:39:16 +00:00
|
|
|
}
|
2006-11-28 03:17:03 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
return false;
|
2006-11-28 03:17:03 +00:00
|
|
|
}
|
2010-08-18 18:28:08 +00:00
|
|
|
|
2014-04-03 04:18:36 +00:00
|
|
|
EventStates
|
2013-02-08 12:50:30 +00:00
|
|
|
HTMLButtonElement::IntrinsicState() const
|
2010-08-19 00:03:20 +00:00
|
|
|
{
|
2014-04-03 04:18:36 +00:00
|
|
|
EventStates state = nsGenericHTMLFormElementWithState::IntrinsicState();
|
2014-04-29 16:58:00 +00: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 17:52:57 +00:00
|
|
|
|
2010-09-10 05:08:56 +00:00
|
|
|
if (mForm && !mForm->GetValidity() && IsSubmitControl()) {
|
|
|
|
state |= NS_EVENT_STATE_MOZ_SUBMITINVALID;
|
|
|
|
}
|
|
|
|
|
2010-10-07 21:09:31 +00:00
|
|
|
return state;
|
2010-08-19 00:03:20 +00:00
|
|
|
}
|
2013-02-08 12:50:30 +00:00
|
|
|
|
2013-02-08 12:50:30 +00: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 14:13:33 +00:00
|
|
|
HTMLButtonElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
2013-02-08 12:50:30 +00: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 14:13:33 +00:00
|
|
|
return HTMLButtonElementBinding::Wrap(aCx, this, aGivenProto);
|
2013-02-08 12:50:30 +00:00
|
|
|
}
|
|
|
|
|
2013-02-08 12:50:30 +00:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|