Bug 1895229 - Remove nsIWebBrowserChromeFocus. r=hsivonen,dom-core

It's only implemented by BrowserChild, we can do this more directly.

Differential Revision: https://phabricator.services.mozilla.com/D209534
This commit is contained in:
Emilio Cobos Álvarez 2024-05-06 11:30:34 +00:00
Родитель 11816a64de
Коммит 4f25d1180d
9 изменённых файлов: 4 добавлений и 97 удалений

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

@ -167,7 +167,6 @@
#include "nsIURILoader.h"
#include "nsIViewSourceChannel.h"
#include "nsIWebBrowserChrome.h"
#include "nsIWebBrowserChromeFocus.h"
#include "nsIWebBrowserFind.h"
#include "nsIWebProgress.h"
#include "nsIWidget.h"
@ -2098,27 +2097,6 @@ nsDocShell::GetBusyFlags(BusyFlags* aBusyFlags) {
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::TabToTreeOwner(bool aForward, bool aForDocumentNavigation,
bool* aTookFocus) {
NS_ENSURE_ARG_POINTER(aTookFocus);
nsCOMPtr<nsIWebBrowserChromeFocus> chromeFocus = do_GetInterface(mTreeOwner);
if (chromeFocus) {
if (aForward) {
*aTookFocus =
NS_SUCCEEDED(chromeFocus->FocusNextElement(aForDocumentNavigation));
} else {
*aTookFocus =
NS_SUCCEEDED(chromeFocus->FocusPrevElement(aForDocumentNavigation));
}
} else {
*aTookFocus = false;
}
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetLoadURIDelegate(nsILoadURIDelegate** aLoadURIDelegate) {
nsCOMPtr<nsILoadURIDelegate> delegate = GetLoadURIDelegate();

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

@ -39,7 +39,6 @@
#include "nsIRemoteTab.h"
#include "nsIBrowserChild.h"
#include "nsRect.h"
#include "nsIWebBrowserChromeFocus.h"
#include "nsIContent.h"
#include "nsServiceManagerUtils.h"
#include "nsViewManager.h"
@ -196,13 +195,6 @@ nsDocShellTreeOwner::GetInterface(const nsIID& aIID, void** aSink) {
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIWebBrowserChromeFocus))) {
if (mWebBrowserChromeWeak != nullptr) {
return mWebBrowserChromeWeak->QueryReferent(aIID, aSink);
}
return mOwnerWin->QueryInterface(aIID, aSink);
}
if (aIID.Equals(NS_GET_IID(nsIPrompt))) {
nsCOMPtr<nsIPrompt> prompt;
EnsurePrompter();

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

@ -271,16 +271,6 @@ interface nsIDocShell : nsIDocShellTreeItem
*/
attribute float zoom;
/*
* Tells the docshell to offer focus to its tree owner.
* This is currently only necessary for embedding chrome.
* If forDocumentNavigation is true, then document navigation should be
* performed, where only the root of documents are selected. Otherwise, the
* next element in the parent should be returned. Returns true if focus was
* successfully taken by the tree owner.
*/
boolean tabToTreeOwner(in boolean forward, in boolean forDocumentNavigation);
/**
* Current busy state for DocShell
*/

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

@ -3662,12 +3662,10 @@ nsresult nsFocusManager::DetermineElementToMoveFocus(
}
} else {
if (aNavigateByKey) {
// There is no parent, so call the tree owner. This will tell the
// embedder or parent process that it should take the focus.
bool tookFocus;
docShell->TabToTreeOwner(forward, forDocumentNavigation, &tookFocus);
// If the tree owner took the focus, blur the current element.
if (tookFocus) {
// There is no parent, so move the focus to the parent process.
if (auto* child = BrowserChild::GetFrom(docShell)) {
child->SendMoveFocus(forward, forDocumentNavigation);
// Blur the current element.
RefPtr<BrowsingContext> focusedBC = GetFocusedBrowsingContext();
if (focusedBC && focusedBC->IsInProcess()) {
Blur(focusedBC, nullptr, true, true, false,

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

@ -502,7 +502,6 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(BrowserChild)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChromeFocus)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_ENTRY(nsIWindowProvider)
NS_INTERFACE_MAP_ENTRY(nsIBrowserChild)
@ -627,18 +626,6 @@ BrowserChild::GetDimensions(DimensionKind aDimensionKind, int32_t* aX,
NS_IMETHODIMP
BrowserChild::Blur() { return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHODIMP
BrowserChild::FocusNextElement(bool aForDocumentNavigation) {
SendMoveFocus(true, aForDocumentNavigation);
return NS_OK;
}
NS_IMETHODIMP
BrowserChild::FocusPrevElement(bool aForDocumentNavigation) {
SendMoveFocus(false, aForDocumentNavigation);
return NS_OK;
}
NS_IMETHODIMP
BrowserChild::GetInterface(const nsIID& aIID, void** aSink) {
// XXXbz should we restrict the set of interfaces we hand out here?

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

@ -12,7 +12,6 @@
#include "nsIWebNavigation.h"
#include "nsCOMPtr.h"
#include "nsIWebBrowserChrome.h"
#include "nsIWebBrowserChromeFocus.h"
#include "nsIInterfaceRequestor.h"
#include "nsIWindowProvider.h"
#include "nsIDocShell.h"
@ -128,7 +127,6 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
public ipc::MessageManagerCallback,
public PBrowserChild,
public nsIWebBrowserChrome,
public nsIWebBrowserChromeFocus,
public nsIInterfaceRequestor,
public nsIWindowProvider,
public nsSupportsWeakReference,
@ -185,7 +183,6 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSIWEBBROWSERCHROME
NS_DECL_NSIWEBBROWSERCHROMEFOCUS
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSIWINDOWPROVIDER
NS_DECL_NSIBROWSERCHILD

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

@ -12,7 +12,6 @@ DIRS += ["build"]
XPIDL_SOURCES += [
"nsIWebBrowser.idl",
"nsIWebBrowserChrome.idl",
"nsIWebBrowserChromeFocus.idl",
]
XPIDL_SOURCES += [

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

@ -38,7 +38,6 @@ interface nsIWebBrowser : nsISupports
* window via the browser's <CODE>nsIBaseWindow</CODE> interface.
*
* The chrome may optionally implement <CODE>nsIInterfaceRequestor</CODE>,
* <CODE>nsIWebBrowserChromeFocus</CODE>,
* <CODE>nsIContextMenuListener</CODE> and
* <CODE>nsITooltipListener</CODE> to receive additional notifications
* from the browser object.
@ -57,7 +56,6 @@ interface nsIWebBrowser : nsISupports
* @see nsIBaseWindow
* @see nsIWebBrowserChrome
* @see nsIInterfaceRequestor
* @see nsIWebBrowserChromeFocus
* @see nsIContextMenuListener
* @see nsITooltipListener
* @see nsIWeakReference

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

@ -1,32 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 0 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
/**
* The nsIWebBrowserChromeFocus is implemented by the same object as the
* nsIEmbeddingSiteWindow. It represents the focus up-calls from mozilla
* to the embedding chrome. See mozilla bug #70224 for gratuitous info.
*/
[scriptable, uuid(947B2EE6-51ED-4C2B-9F45-426C27CA84C6)]
interface nsIWebBrowserChromeFocus : nsISupports
{
/**
* Set the focus at the next focusable element in the chrome. If
* aForDocumentNavigation is true, this was a document navigation, so
* focus the parent window.
*/
void focusNextElement(in boolean aForDocumentNavigation);
/**
* Set the focus at the previous focusable element in the chrome.
*/
void focusPrevElement(in boolean aForDocumentNavigation);
};