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

This commit is contained in:
bryner%brianryner.com 2005-10-04 23:43:54 +00:00
Родитель fc7a7ea64d
Коммит 4a968165ad
2 изменённых файлов: 21 добавлений и 9 удалений

Просмотреть файл

@ -241,17 +241,17 @@ nsHTMLObjectElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
PRBool nsHTMLObjectElement::IsFocusable(PRInt32 *aTabIndex)
{
if (aTabIndex) {
GetTabIndex(aTabIndex);
}
if (Type() == eType_Plugin) {
// Has plugin content: 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);
}

Просмотреть файл

@ -130,9 +130,7 @@ public:
// Have to override tabindex for <embed> to act right
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,
@ -594,3 +592,17 @@ nsHTMLSharedElement::IntrinsicState() const
}
return state;
}
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);
}