зеркало из https://github.com/mozilla/gecko-dev.git
Bug 695623 - xul:browser is subject of focus event when tabbing from chrome to content process, r=davidb, olli.pettay
This commit is contained in:
Родитель
0c46b073ba
Коммит
5c182f0204
|
@ -41,6 +41,7 @@
|
|||
#include "nsAccUtils.h"
|
||||
#include "nsRootAccessible.h"
|
||||
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsFocusManager.h"
|
||||
|
||||
namespace dom = mozilla::dom;
|
||||
|
@ -352,18 +353,22 @@ FocusManager::ProcessFocusEvent(AccEvent* aEvent)
|
|||
}
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
FocusManager::FocusedDOMElm() const
|
||||
nsINode*
|
||||
FocusManager::FocusedDOMNode() const
|
||||
{
|
||||
nsFocusManager* DOMFocusManager = nsFocusManager::GetFocusManager();
|
||||
return DOMFocusManager->GetFocusedContent();
|
||||
}
|
||||
nsIContent* focusedElm = DOMFocusManager->GetFocusedContent();
|
||||
|
||||
nsIDocument*
|
||||
FocusManager::FocusedDOMDocument() const
|
||||
{
|
||||
nsFocusManager* DOMFocusManager = nsFocusManager::GetFocusManager();
|
||||
// No focus on remote target elements like xul:browser having DOM focus and
|
||||
// residing in chrome process because it means an element in content process
|
||||
// keeps the focus.
|
||||
if (focusedElm) {
|
||||
if (nsEventStateManager::IsRemoteTarget(focusedElm))
|
||||
return nsnull;
|
||||
return focusedElm;
|
||||
}
|
||||
|
||||
// Otherwise the focus can be on DOM document.
|
||||
nsCOMPtr<nsIDOMWindow> focusedWnd;
|
||||
DOMFocusManager->GetFocusedWindow(getter_AddRefs(focusedWnd));
|
||||
if (focusedWnd) {
|
||||
|
@ -374,3 +379,10 @@ FocusManager::FocusedDOMDocument() const
|
|||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsIDocument*
|
||||
FocusManager::FocusedDOMDocument() const
|
||||
{
|
||||
nsINode* focusedNode = FocusedDOMNode();
|
||||
return focusedNode ? focusedNode->OwnerDoc() : nsnull;
|
||||
}
|
||||
|
|
|
@ -146,18 +146,7 @@ private:
|
|||
/**
|
||||
* Return DOM node having DOM focus.
|
||||
*/
|
||||
inline nsINode* FocusedDOMNode() const
|
||||
{
|
||||
nsINode* focusedNode = FocusedDOMElm();
|
||||
if (focusedNode)
|
||||
return focusedNode;
|
||||
return FocusedDOMDocument();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return DOM element having DOM focus.
|
||||
*/
|
||||
nsIContent* FocusedDOMElm() const;
|
||||
nsINode* FocusedDOMNode() const;
|
||||
|
||||
/**
|
||||
* Return DOM document having DOM focus.
|
||||
|
|
|
@ -228,6 +228,8 @@ public:
|
|||
// Sets the full-screen event state on aElement to aIsFullScreen.
|
||||
static void SetFullScreenState(mozilla::dom::Element* aElement, bool aIsFullScreen);
|
||||
|
||||
static bool IsRemoteTarget(nsIContent* aTarget);
|
||||
|
||||
protected:
|
||||
friend class MouseEnterLeaveDispatcher;
|
||||
|
||||
|
@ -465,7 +467,6 @@ protected:
|
|||
bool IsTargetCrossProcess(nsGUIEvent *aEvent);
|
||||
|
||||
void DispatchCrossProcessEvent(nsEvent* aEvent, nsIFrameLoader* remote);
|
||||
bool IsRemoteTarget(nsIContent* target);
|
||||
bool HandleCrossProcessEvent(nsEvent *aEvent,
|
||||
nsIFrame* aTargetFrame,
|
||||
nsEventStatus *aStatus);
|
||||
|
|
Загрузка…
Ссылка в новой задаче