Commit 4f25d118 authored by Emilio Cobos Álvarez's avatar Emilio Cobos Álvarez
Browse files

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
parent 11816a64
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line
@@ -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();
+0 −8
Original line number Diff line number Diff line
@@ -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();
+0 −10
Original line number Diff line number Diff line
@@ -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
   */
+4 −6
Original line number Diff line number Diff line
@@ -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,
+0 −13
Original line number Diff line number Diff line
@@ -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?
Loading