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
parent b4c4d22417
commit a705793753
9 changed files with 4 additions and 97 deletions

View File

@@ -167,7 +167,6 @@
#include "nsIURILoader.h" #include "nsIURILoader.h"
#include "nsIViewSourceChannel.h" #include "nsIViewSourceChannel.h"
#include "nsIWebBrowserChrome.h" #include "nsIWebBrowserChrome.h"
#include "nsIWebBrowserChromeFocus.h"
#include "nsIWebBrowserFind.h" #include "nsIWebBrowserFind.h"
#include "nsIWebProgress.h" #include "nsIWebProgress.h"
#include "nsIWidget.h" #include "nsIWidget.h"
@@ -2098,27 +2097,6 @@ nsDocShell::GetBusyFlags(BusyFlags* aBusyFlags) {
return NS_OK; 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 NS_IMETHODIMP
nsDocShell::GetLoadURIDelegate(nsILoadURIDelegate** aLoadURIDelegate) { nsDocShell::GetLoadURIDelegate(nsILoadURIDelegate** aLoadURIDelegate) {
nsCOMPtr<nsILoadURIDelegate> delegate = GetLoadURIDelegate(); nsCOMPtr<nsILoadURIDelegate> delegate = GetLoadURIDelegate();

View File

@@ -39,7 +39,6 @@
#include "nsIRemoteTab.h" #include "nsIRemoteTab.h"
#include "nsIBrowserChild.h" #include "nsIBrowserChild.h"
#include "nsRect.h" #include "nsRect.h"
#include "nsIWebBrowserChromeFocus.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "nsViewManager.h" #include "nsViewManager.h"
@@ -196,13 +195,6 @@ nsDocShellTreeOwner::GetInterface(const nsIID& aIID, void** aSink) {
return NS_OK; 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))) { if (aIID.Equals(NS_GET_IID(nsIPrompt))) {
nsCOMPtr<nsIPrompt> prompt; nsCOMPtr<nsIPrompt> prompt;
EnsurePrompter(); EnsurePrompter();

View File

@@ -271,16 +271,6 @@ interface nsIDocShell : nsIDocShellTreeItem
*/ */
attribute float zoom; 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 * Current busy state for DocShell
*/ */

View File

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

View File

@@ -502,7 +502,6 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(BrowserChild) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(BrowserChild)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome) NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChromeFocus)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor) NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_ENTRY(nsIWindowProvider) NS_INTERFACE_MAP_ENTRY(nsIWindowProvider)
NS_INTERFACE_MAP_ENTRY(nsIBrowserChild) NS_INTERFACE_MAP_ENTRY(nsIBrowserChild)
@@ -627,18 +626,6 @@ BrowserChild::GetDimensions(DimensionKind aDimensionKind, int32_t* aX,
NS_IMETHODIMP NS_IMETHODIMP
BrowserChild::Blur() { return NS_ERROR_NOT_IMPLEMENTED; } 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 NS_IMETHODIMP
BrowserChild::GetInterface(const nsIID& aIID, void** aSink) { BrowserChild::GetInterface(const nsIID& aIID, void** aSink) {
// XXXbz should we restrict the set of interfaces we hand out here? // XXXbz should we restrict the set of interfaces we hand out here?

View File

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

View File

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

View File

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

View File

@@ -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);
};