Bug 1129526 - Make the RenderFrameParent put focus on the correct OOP child before delivering a click event to it. r=botond

This commit is contained in:
Kartikaya Gupta 2015-02-05 14:41:50 -05:00
parent e2616030bb
commit 2af5e47ca3
2 changed files with 24 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include "mozilla/layers/CompositorParent.h"
#include "mozilla/layers/LayerTransactionParent.h"
#include "nsContentUtils.h"
#include "nsFocusManager.h"
#include "nsFrameLoader.h"
#include "nsIObserver.h"
#include "nsSubDocumentFrame.h"
@ -148,6 +149,7 @@ public:
return;
}
if (mRenderFrame) {
mRenderFrame->TakeFocusForClick();
TabParent* browser = TabParent::GetFrom(mRenderFrame->Manager());
browser->HandleSingleTap(aPoint, aModifiers, aGuid);
}
@ -595,6 +597,25 @@ RenderFrameParent::GetTextureFactoryIdentifier(TextureFactoryIdentifier* aTextur
}
}
void
RenderFrameParent::TakeFocusForClick()
{
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
if (!fm) {
return;
}
nsCOMPtr<nsIContent> owner = mFrameLoader->GetOwnerContent();
if (!owner) {
return;
}
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(owner);
if (!element) {
return;
}
fm->SetFocus(element, nsIFocusManager::FLAG_BYMOUSE |
nsIFocusManager::FLAG_NOSCROLL);
}
} // namespace layout
} // namespace mozilla

View File

@ -116,6 +116,9 @@ public:
void GetTextureFactoryIdentifier(TextureFactoryIdentifier* aTextureFactoryIdentifier);
inline uint64_t GetLayersId() { return mLayersId; }
void TakeFocusForClick();
protected:
void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;