From 16d9438074236a57e8d76bcf07fa0e050d43fd66 Mon Sep 17 00:00:00 2001 From: "bryner%brianryner.com" Date: Wed, 5 Oct 2005 00:36:30 +0000 Subject: [PATCH] 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 --- .../html/content/src/nsHTMLObjectElement.cpp | 12 ++++++------ .../html/content/src/nsHTMLSharedElement.cpp | 17 +++++++++++++++-- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/mozilla/content/html/content/src/nsHTMLObjectElement.cpp b/mozilla/content/html/content/src/nsHTMLObjectElement.cpp index df388f2e3d4..82859e73fd6 100644 --- a/mozilla/content/html/content/src/nsHTMLObjectElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLObjectElement.cpp @@ -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); } diff --git a/mozilla/content/html/content/src/nsHTMLSharedElement.cpp b/mozilla/content/html/content/src/nsHTMLSharedElement.cpp index 304c380d51a..c455cc685ef 100644 --- a/mozilla/content/html/content/src/nsHTMLSharedElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLSharedElement.cpp @@ -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); +}