Bug 795610 - Part d: Prepare HTMLElement.click() for WebIDL bindings; r=mounir

This commit is contained in:
Ms2ger 2012-10-06 09:19:52 +02:00
parent ade404accf
commit f5b72a0de2
11 changed files with 19 additions and 25 deletions

View File

@ -3808,10 +3808,11 @@ nsGenericHTMLElement::Focus()
return fm ? fm->SetFocus(elem, 0) : NS_OK;
}
nsresult nsGenericHTMLElement::Click()
void
nsGenericHTMLElement::Click()
{
if (HasFlag(NODE_HANDLING_CLICK))
return NS_OK;
return;
// Strong in case the event kills it
nsCOMPtr<nsIDocument> doc = GetCurrentDoc();
@ -3837,7 +3838,6 @@ nsresult nsGenericHTMLElement::Click()
nsEventDispatcher::Dispatch(this, context, &event);
UnsetFlags(NODE_HANDLING_CLICK);
return NS_OK;
}
bool

View File

@ -81,6 +81,7 @@ public:
const nsAString& aValue);
// WebIDL HTMLElement
virtual void Click();
virtual int32_t TabIndexDefault()
{
return -1;
@ -119,6 +120,11 @@ public:
nsresult GetClassName(nsAString& aClassName);
nsresult SetClassName(const nsAString& aClassName);
nsresult DOMClick()
{
Click();
return NS_OK;
}
nsresult GetTabIndex(int32_t* aTabIndex)
{
*aTabIndex = TabIndex();
@ -159,7 +165,6 @@ public:
// methods properly override them.
NS_IMETHOD Focus();
NS_IMETHOD Blur();
NS_IMETHOD Click();
NS_IMETHOD GetHidden(bool* aHidden);
NS_IMETHOD SetHidden(bool aHidden);
NS_IMETHOD GetSpellcheck(bool* aSpellcheck);
@ -1396,7 +1401,6 @@ protected:
/* Use this macro to declare functions that forward the behavior of this
* interface to another object.
* This macro doesn't forward
* - Click
* - Focus
* - GetInnerHTML
* - SetInnerHTML
@ -1442,6 +1446,9 @@ protected:
NS_IMETHOD SetHidden(bool aHidden) { \
return _to SetHidden(aHidden); \
} \
NS_IMETHOD DOMClick() { \
return _to DOMClick(); \
} \
NS_IMETHOD GetTabIndex(int32_t* aTabIndex) { \
return _to GetTabIndex(aTabIndex); \
} \

View File

@ -28,9 +28,6 @@ public:
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLElement::)
NS_IMETHOD Click() {
return nsGenericHTMLElement::Click();
}
NS_IMETHOD Focus() {
return nsGenericHTMLElement::Focus();
}

View File

@ -1972,13 +1972,14 @@ nsHTMLInputElement::SelectAll(nsPresContext* aPresContext)
}
}
NS_IMETHODIMP
void
nsHTMLInputElement::Click()
{
if (mType == NS_FORM_INPUT_FILE)
if (mType == NS_FORM_INPUT_FILE) {
FireAsyncClickHandler();
}
return nsGenericHTMLElement::Click();
nsGenericHTMLElement::Click();
}
NS_IMETHODIMP

View File

@ -76,7 +76,6 @@ public:
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLFormElement::)
NS_IMETHOD Click();
NS_IMETHOD Focus();
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
return nsGenericHTMLFormElement::GetInnerHTML(aInnerHTML);
@ -84,6 +83,7 @@ public:
NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) {
return nsGenericHTMLFormElement::SetInnerHTML(aInnerHTML);
}
virtual void Click() MOZ_OVERRIDE;
virtual int32_t TabIndexDefault() MOZ_OVERRIDE;
// nsIDOMHTMLInputElement

View File

@ -42,9 +42,6 @@ public:
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLFormElement::)
NS_IMETHOD Click() {
return nsGenericHTMLFormElement::Click();
}
NS_IMETHOD Focus();
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
return nsGenericHTMLFormElement::GetInnerHTML(aInnerHTML);

View File

@ -37,9 +37,6 @@ public:
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLElement::)
NS_IMETHOD Click() {
return nsGenericHTMLElement::Click();
}
NS_IMETHOD Focus();
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) {
return nsGenericHTMLElement::GetInnerHTML(aInnerHTML);

View File

@ -50,9 +50,6 @@ public:
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLElement::)
NS_IMETHOD Click() {
return nsGenericHTMLElement::Click();
}
NS_IMETHOD Focus() {
return nsGenericHTMLElement::Focus();
}

View File

@ -38,9 +38,6 @@ public:
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_BASIC(nsGenericHTMLElement::)
NS_IMETHOD Click() {
return nsGenericHTMLElement::Click();
}
NS_IMETHOD Focus() {
return nsGenericHTMLElement::Focus();
}

View File

@ -201,7 +201,7 @@ nsXULContextMenuBuilder::Click(const nsAString& aGeneratedItemId)
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIDOMHTMLElement> element = mElements.SafeObjectAt(idx);
if (element) {
element->Click();
element->DOMClick();
}
}

View File

@ -49,6 +49,7 @@ interface nsIDOMHTMLElement : nsIDOMElement
* See <http://www.whatwg.org/html5/#the-hidden-attribute>.
*/
attribute boolean hidden;
[binaryname(DOMClick)]
void click();
attribute long tabIndex;
void focus();