Fix for focus-stealing via blur(). Bug 299677, patch by martijn.martijn@gmail.com, r=me, sr=jst.

git-svn-id: svn://10.0.0.236/trunk@178774 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bryner%brianryner.com
2005-08-24 06:10:44 +00:00
parent 55e06935bf
commit 811a3afa66
5 changed files with 18 additions and 6 deletions

View File

@@ -3577,7 +3577,9 @@ nsGenericHTMLElement::SetElementFocus(PRBool aDoFocus)
nsresult
nsGenericHTMLElement::Blur()
{
SetElementFocus(PR_FALSE);
if (ShouldFocus(this)) {
SetElementFocus(PR_FALSE);
}
return NS_OK;
}
@@ -3588,7 +3590,9 @@ nsGenericHTMLElement::Focus()
// Generic HTML elements are focusable only if tabindex explicitly set.
// SetFocus() will check to see if we're focusable and then
// call into esm to do the work of focusing.
SetElementFocus(PR_TRUE);
if (ShouldFocus(this)) {
SetElementFocus(PR_TRUE);
}
return NS_OK;
}

View File

@@ -207,7 +207,9 @@ nsHTMLAnchorElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
NS_IMETHODIMP
nsHTMLAnchorElement::Blur()
{
SetElementFocus(PR_FALSE);
if (ShouldFocus(this)) {
SetElementFocus(PR_FALSE);
}
return NS_OK;
}

View File

@@ -1041,7 +1041,9 @@ nsHTMLInputElement::FireOnChange()
NS_IMETHODIMP
nsHTMLInputElement::Blur()
{
SetElementFocus(PR_FALSE);
if (ShouldFocus(this)) {
SetElementFocus(PR_FALSE);
}
return NS_OK;
}

View File

@@ -1545,7 +1545,9 @@ NS_IMPL_INT_ATTR_DEFAULT_VALUE(nsHTMLSelectElement, TabIndex, tabindex, 0)
NS_IMETHODIMP
nsHTMLSelectElement::Blur()
{
SetElementFocus(PR_FALSE);
if (ShouldFocus(this)) {
SetElementFocus(PR_FALSE);
}
return NS_OK;
}

View File

@@ -213,7 +213,9 @@ nsHTMLTextAreaElement::GetForm(nsIDOMHTMLFormElement** aForm)
NS_IMETHODIMP
nsHTMLTextAreaElement::Blur()
{
SetElementFocus(PR_FALSE);
if (ShouldFocus(this)) {
SetElementFocus(PR_FALSE);
}
return NS_OK;
}