mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1667081 - Part 2: Remove windowRaised in nsIFocusManager; r=hsivonen
And make nsFocusManager::WindowRaised just returning void given all caller doesn't actaully check the return value. Differential Revision: https://phabricator.services.mozilla.com/D91288
This commit is contained in:
parent
3af8ce6d7a
commit
6bf9a2e159
@ -647,9 +647,11 @@ nsFocusManager::MoveCaretToFocus(mozIDOMWindowProxy* aWindow) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFocusManager::WindowRaised(mozIDOMWindowProxy* aWindow) {
|
||||
NS_ENSURE_TRUE(aWindow, NS_ERROR_INVALID_ARG);
|
||||
void nsFocusManager::WindowRaised(mozIDOMWindowProxy* aWindow) {
|
||||
if (!aWindow) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindowOuter> window = nsPIDOMWindowOuter::From(aWindow);
|
||||
|
||||
if (MOZ_LOG_TEST(gFocusLog, LogLevel::Debug)) {
|
||||
@ -679,7 +681,7 @@ nsFocusManager::WindowRaised(mozIDOMWindowProxy* aWindow) {
|
||||
// what the focus manager thinks should be the current widget is actually
|
||||
// focused.
|
||||
EnsureCurrentWidgetFocused(CallerType::System);
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
// lower the existing window, if any. This shouldn't happen usually.
|
||||
@ -693,7 +695,7 @@ nsFocusManager::WindowRaised(mozIDOMWindowProxy* aWindow) {
|
||||
if (active == bc && !mActiveBrowsingContextInContentSetFromOtherProcess) {
|
||||
// EnsureCurrentWidgetFocused() should not be necessary with
|
||||
// PuppetWidget.
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
if (active && active != bc) {
|
||||
@ -711,7 +713,9 @@ nsFocusManager::WindowRaised(mozIDOMWindowProxy* aWindow) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem = window->GetDocShell();
|
||||
// If there's no docShellAsItem, this window must have been closed,
|
||||
// in that case there is no tree owner.
|
||||
NS_ENSURE_TRUE(docShellAsItem, NS_OK);
|
||||
if (!docShellAsItem) {
|
||||
return;
|
||||
}
|
||||
|
||||
// set this as the active window
|
||||
if (XRE_IsParentProcess()) {
|
||||
@ -730,7 +734,7 @@ nsFocusManager::WindowRaised(mozIDOMWindowProxy* aWindow) {
|
||||
if (baseWindow) {
|
||||
bool isEnabled = true;
|
||||
if (NS_SUCCEEDED(baseWindow->GetEnabled(&isEnabled)) && !isEnabled) {
|
||||
return NS_ERROR_FAILURE;
|
||||
return;
|
||||
}
|
||||
|
||||
baseWindow->SetVisibility(true);
|
||||
@ -767,14 +771,12 @@ nsFocusManager::WindowRaised(mozIDOMWindowProxy* aWindow) {
|
||||
|
||||
NS_ASSERTION(currentWindow, "window raised with no window current");
|
||||
if (!currentWindow) {
|
||||
return NS_OK;
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAppWindow> appWin(do_GetInterface(baseWindow));
|
||||
Focus(currentWindow, currentFocus, 0, true, false, appWin != nullptr, true,
|
||||
focusInOtherContentProcess);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -220,6 +220,11 @@ class nsFocusManager final : public nsIFocusManager,
|
||||
void RaiseWindow(nsPIDOMWindowOuter* aWindow,
|
||||
mozilla::dom::CallerType aCallerType);
|
||||
|
||||
/**
|
||||
* Called when a window has been raised.
|
||||
*/
|
||||
void WindowRaised(mozIDOMWindowProxy* aWindow);
|
||||
|
||||
static uint32_t FocusOptionsToFocusManagerFlags(
|
||||
const mozilla::dom::FocusOptions& aOptions);
|
||||
|
||||
|
@ -258,11 +258,6 @@ interface nsIFocusManager : nsISupports
|
||||
/** move focus to the last focusable document */
|
||||
const unsigned long MOVEFOCUS_LASTDOC = 10;
|
||||
|
||||
/**
|
||||
* Called when a window has been raised.
|
||||
*/
|
||||
[noscript] void windowRaised(in mozIDOMWindowProxy aWindow);
|
||||
|
||||
/**
|
||||
* Called when a window has been lowered.
|
||||
*/
|
||||
|
@ -2846,7 +2846,9 @@ void AppWindow::WindowActivated() {
|
||||
nsCOMPtr<nsPIDOMWindowOuter> window =
|
||||
mDocShell ? mDocShell->GetWindow() : nullptr;
|
||||
nsFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
if (fm && window) fm->WindowRaised(window);
|
||||
if (fm && window) {
|
||||
fm->WindowRaised(window);
|
||||
}
|
||||
|
||||
if (mChromeLoaded) {
|
||||
PersistentAttributesDirty(PAD_POSITION | PAD_SIZE | PAD_MISC);
|
||||
|
Loading…
Reference in New Issue
Block a user