зеркало из https://github.com/mozilla/pjs.git
Bug 724452 - use nsFocusManager::GetFocusManager() more, r=tbsaunde, hub, surkov
This commit is contained in:
Родитель
9de30fca2d
Коммит
4df520e019
|
@ -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));
|
||||
|
|
Загрузка…
Ссылка в новой задаче