Bug 724452 - use nsFocusManager::GetFocusManager() more, r=tbsaunde, hub, surkov

This commit is contained in:
Jignesh Kakadiya 2012-02-12 11:34:00 +09:00
Родитель 9de30fca2d
Коммит 4df520e019
5 изменённых файлов: 3 добавлений и 43 удалений

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

@ -283,38 +283,6 @@ nsAccessNode::ScrollTo(PRUint32 aScrollType)
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
}
// nsAccessNode public
already_AddRefed<nsINode>
nsAccessNode::GetCurrentFocus()
{
// XXX: consider to use nsFocusManager directly, it allows us to avoid
// unnecessary query interface calls.
nsIDocument* doc = GetDocumentNode();
NS_ENSURE_TRUE(doc, nsnull);
nsIDOMWindow* win = doc->GetWindow();
nsCOMPtr<nsIDOMWindow> focusedWindow;
nsCOMPtr<nsIDOMElement> focusedElement;
nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
if (fm)
fm->GetFocusedElementForWindow(win, true, getter_AddRefs(focusedWindow),
getter_AddRefs(focusedElement));
nsINode *focusedNode = nsnull;
if (focusedElement) {
CallQueryInterface(focusedElement, &focusedNode);
}
else if (focusedWindow) {
nsCOMPtr<nsIDOMDocument> doc;
focusedWindow->GetDocument(getter_AddRefs(doc));
if (doc)
CallQueryInterface(doc, &focusedNode);
}
return focusedNode;
}
void
nsAccessNode::Language(nsAString& aLanguage)
{

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

@ -95,14 +95,6 @@ public:
*/
nsRootAccessible* RootAccessible() const;
/**
* Return focused node within accessible window.
*
* XXX: it shouldn't break us if we return focused node not depending on
* window so that we can turn this method into util method.
*/
already_AddRefed<nsINode> GetCurrentFocus();
/**
* Initialize the access node object, add it to the cache.
*/

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

@ -1147,7 +1147,7 @@ nsAccessible::TakeFocus()
}
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(focusContent));
nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
nsFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm)
fm->SetFocus(element, 0);

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

@ -378,7 +378,7 @@ NS_IMETHODIMP nsDocAccessible::TakeFocus()
return NS_ERROR_FAILURE;
// Focus the document.
nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
nsFocusManager* fm = nsFocusManager::GetFocusManager();
NS_ENSURE_STATE(fm);
nsCOMPtr<nsIDOMElement> newFocus;

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

@ -203,7 +203,7 @@ nsRootAccessible::NativeState()
states |= states::MODAL;
#endif
nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
nsFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm) {
nsCOMPtr<nsIDOMWindow> rootWindow;
GetWindow(getter_AddRefs(rootWindow));