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 524491 7196b821847c1cb4a0b53ec3f2768ea126305b07
parent 524490 f3448180f267c07b61351a2ba58992289c978fdc
child 524495 78bc178af5840669071e87af36fa20b4bc6065fa
child 524498 d08e73bddc51022e6465f10d45dd205d4d6ecd67
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [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",