Bug 756973 - make RootAccessible::NativeState faster, r=tbsaunde, enn

This commit is contained in:
Alexander Surkov 2012-05-23 08:48:35 +09:00
Родитель 653f6e51e8
Коммит 3ca9bb540a
2 изменённых файлов: 14 добавлений и 14 удалений

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

@ -137,33 +137,28 @@ RootAccessible::GetChromeFlags()
PRUint64
RootAccessible::NativeState()
{
PRUint64 states = nsDocAccessibleWrap::NativeState();
PRUint64 state = nsDocAccessibleWrap::NativeState();
if (state & states::DEFUNCT)
return state;
#ifdef MOZ_XUL
PRUint32 chromeFlags = GetChromeFlags();
if (chromeFlags & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE)
states |= states::SIZEABLE;
state |= states::SIZEABLE;
// If it has a titlebar it's movable
// XXX unless it's minimized or maximized, but not sure
// how to detect that
if (chromeFlags & nsIWebBrowserChrome::CHROME_TITLEBAR)
states |= states::MOVEABLE;
state |= states::MOVEABLE;
if (chromeFlags & nsIWebBrowserChrome::CHROME_MODAL)
states |= states::MODAL;
state |= states::MODAL;
#endif
nsFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm) {
nsCOMPtr<nsIDOMWindow> rootWindow;
GetWindow(getter_AddRefs(rootWindow));
if (fm && fm->GetActiveWindow() == mDocument->GetWindow())
state |= states::ACTIVE;
nsCOMPtr<nsIDOMWindow> activeWindow;
fm->GetActiveWindow(getter_AddRefs(activeWindow));
if (activeWindow == rootWindow)
states |= states::ACTIVE;
}
return states;
return state;
}
const char* const docEvents[] = {

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

@ -67,6 +67,11 @@ public:
*/
nsPIDOMWindow* GetFocusedWindow() const { return mFocusedWindow; }
/**
* Return an active window. Version of nsIFocusManager::GetActiveWindow.
*/
nsPIDOMWindow* GetActiveWindow() const { return mActiveWindow; }
/**
* Called when content has been removed.
*/