Bug 1534255 - Enable out-of-process iframes to take APZ focus. r=rhunt
authorHenri Sivonen <hsivonen@hsivonen.fi>
Mon, 11 Mar 2019 18:49:12 +0000
changeset 521493 7196b821847c
parent 521492 f3448180f267
child 521497 78bc178af584
child 521500 d08e73bddc51
push id10866
push usernerli@mozilla.com
push dateTue, 12 Mar 2019 18:59:09 +0000
treeherdermozilla-beta@445c24a51727 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrhunt
bugs1534255
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1534255 - Enable out-of-process iframes to take APZ focus. r=rhunt Differential Revision: https://phabricator.services.mozilla.com/D22968
gfx/layers/apz/src/FocusTarget.cpp
--- a/gfx/layers/apz/src/FocusTarget.cpp
+++ b/gfx/layers/apz/src/FocusTarget.cpp
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "mozilla/layers/FocusTarget.h"
 
+#include "mozilla/dom/BrowserBridgeChild.h"  // for BrowserBridgeChild
 #include "mozilla/dom/EventTarget.h"     // for EventTarget
 #include "mozilla/dom/TabParent.h"       // for TabParent
 #include "mozilla/EventDispatcher.h"     // for EventDispatcher
 #include "mozilla/layout/RenderFrame.h"  // For RenderFrame
 #include "nsIContentInlines.h"           // for nsINode::IsEditable()
 #include "nsIPresShell.h"                // for nsIPresShell
 #include "nsLayoutUtils.h"               // for nsLayoutUtils
 
@@ -174,16 +175,27 @@ FocusTarget::FocusTarget(nsIPresShell* a
 
     FT_LOG("Creating nil target with seq=%" PRIu64
            ", kl=%d (remote browser missing layers id)\n",
            aFocusSequenceNumber, mFocusHasKeyEventListeners);
 
     return;
   }
 
+  // Check if the key event target is a remote browser
+  if (BrowserBridgeChild* bbc = BrowserBridgeChild::GetFrom(keyEventTarget)) {
+    FT_LOG("Creating oopif reflayer target with seq=%" PRIu64
+           ", kl=%d, lt=%" PRIu64 "\n",
+           aFocusSequenceNumber, mFocusHasKeyEventListeners,
+           bbc->GetLayersId());
+
+    mData = AsVariant<LayersId>(bbc->GetLayersId());
+    return;
+  }
+
   // The content to scroll is either the focused element or the focus node of
   // the selection. It's difficult to determine if an element is an interactive
   // element requiring async keyboard scrolling to be disabled. So we only
   // allow async key scrolling based on the selection, which doesn't have
   // this problem and is more common.
   if (focusedContent) {
     FT_LOG("Creating nil target with seq=%" PRIu64
            ", kl=%d (disabling for focusing an element)\n",