Bug 756381 - make FocusManager::FocusedDOMNode faster, r=tbsaunde, smaug

This commit is contained in:
Alexander Surkov 2012-05-22 18:25:44 +09:00
Родитель b3cd06bf34
Коммит 4378030fb4
4 изменённых файлов: 14 добавлений и 12 удалений

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

@ -345,15 +345,8 @@ FocusManager::FocusedDOMNode() const
}
// Otherwise the focus can be on DOM document.
nsCOMPtr<nsIDOMWindow> focusedWnd;
DOMFocusManager->GetFocusedWindow(getter_AddRefs(focusedWnd));
if (focusedWnd) {
nsCOMPtr<nsIDOMDocument> DOMDoc;
focusedWnd->GetDocument(getter_AddRefs(DOMDoc));
nsCOMPtr<nsIDocument> DOMDocNode(do_QueryInterface(DOMDoc));
return DOMDocNode;
}
return nsnull;
nsPIDOMWindow* focusedWnd = DOMFocusManager->GetFocusedWindow();
return focusedWnd ? focusedWnd->GetExtantDoc() : nsnull;
}
nsIDocument*

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

@ -62,6 +62,11 @@ public:
*/
nsIContent* GetFocusedContent() { return mFocusedContent; }
/**
* Return a focused window. Version of nsIFocusManager::GetFocusedWindow.
*/
nsPIDOMWindow* GetFocusedWindow() const { return mFocusedWindow; }
/**
* Called when content has been removed.
*/

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

@ -913,7 +913,6 @@ protected:
// These member variables are used on both inner and the outer windows.
nsCOMPtr<nsIPrincipal> mDocumentPrincipal;
nsCOMPtr<nsIDocument> mDoc; // For fast access to principals
JSObject* mJSObject;
typedef nsCOMArray<nsIDOMStorageEvent> nsDOMStorageEventArray;

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

@ -48,8 +48,8 @@ class nsIArray;
class nsPIWindowRoot;
#define NS_PIDOMWINDOW_IID \
{ 0x7a6238d4, 0x7cbc, 0x43b2, \
{ 0x86, 0x68, 0x92, 0xeb, 0x9e, 0xb0, 0x49, 0xaf } }
{ 0xf0bafbe6, 0xe45c, 0x490e, \
{ 0xa2, 0x1c, 0xfe, 0x14, 0x2f, 0xb6, 0x34, 0xba } }
class nsPIDOMWindow : public nsIDOMWindowInternal
{
@ -164,6 +164,10 @@ public:
{
return mDocument;
}
nsIDocument* GetExtantDoc() const
{
return mDoc;
}
// Internal getter/setter for the frame element, this version of the
// getter crosses chrome boundaries whereas the public scriptable
@ -596,6 +600,7 @@ protected:
// sure you keep them in sync!
nsCOMPtr<nsIDOMEventTarget> mChromeEventHandler; // strong
nsCOMPtr<nsIDOMDocument> mDocument; // strong
nsCOMPtr<nsIDocument> mDoc; // strong, for fast access
nsCOMPtr<nsIDOMEventTarget> mParentTarget; // strong