Make sure plugin focus logic only apples for applet, object, and embed elements. Bug 311111, r+sr=bzbarsky, a=mscott.

git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@181635 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bryner%brianryner.com
2005-10-05 00:36:30 +00:00
parent f6ad964d52
commit 16d9438074
2 changed files with 21 additions and 8 deletions

View File

@@ -177,10 +177,6 @@ nsHTMLObjectElement::GetForm(nsIDOMHTMLFormElement** aForm)
PRBool
nsHTMLObjectElement::IsFocusable(PRInt32 *aTabIndex)
{
if (aTabIndex) {
GetTabIndex(aTabIndex);
}
nsIFrame* frame = GetPrimaryFrame(PR_FALSE);
if (frame) {
nsIObjectFrame *objFrame = nsnull;
@@ -191,12 +187,16 @@ nsHTMLObjectElement::IsFocusable(PRInt32 *aTabIndex)
if (pluginInstance) {
// Has a plugin: let the plugin decide what to do in terms of
// internal focus from mouse clicks
if (aTabIndex) {
GetTabIndex(aTabIndex);
}
return PR_TRUE;
}
}
}
return HasAttr(kNameSpaceID_None, nsHTMLAtoms::tabindex);
return nsGenericHTMLFormElement::IsFocusable(aTabIndex);
}

View File

@@ -136,8 +136,7 @@ public:
NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
// Let plugin decide whether it wants focus from mouse clicks
virtual PRBool IsFocusable(PRInt32 *aTabIndex = nsnull)
{ if (aTabIndex) GetTabIndex(aTabIndex); return PR_TRUE; }
virtual PRBool IsFocusable(PRInt32 *aTabIndex = nsnull);
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
const nsAString& aValue,
@@ -511,3 +510,17 @@ nsHTMLSharedElement::GetAttributeMappingFunction() const
return nsGenericHTMLElement::GetAttributeMappingFunction();
}
PRBool
nsHTMLSharedElement::IsFocusable(PRInt32 *aTabIndex)
{
if (mNodeInfo->Equals(nsHTMLAtoms::embed)) {
// Let plugin decide whether it wants focus from mouse clicks
if (aTabIndex) {
GetTabIndex(aTabIndex);
}
return PR_TRUE;
}
return nsGenericHTMLElement::IsFocusable(aTabIndex);
}