Bug 1524239 - Attach the LayersId of the process-top-level layer that has focus to keyboard events. r=botond
authorHenri Sivonen <hsivonen@hsivonen.fi>
Wed, 27 Feb 2019 21:09:51 +0000
changeset 519581 67540efd30a3c3f0a082447274be21be6743fdab
parent 519580 fb0ffd7766a227b208ba3b2ac616a452eb4d1c4c
child 519582 4024f3814d1831602d7df302498b6ec0196f4a75
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1524239
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 1524239 - Attach the LayersId of the process-top-level layer that has focus to keyboard events. r=botond Differential Revision: https://phabricator.services.mozilla.com/D20308
gfx/layers/apz/src/APZCTreeManager.cpp
gfx/layers/apz/src/APZInputBridge.cpp
gfx/layers/apz/src/FocusState.cpp
gfx/layers/apz/src/FocusState.h
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -1463,16 +1463,17 @@ nsEventStatus APZCTreeManager::ReceiveIn
 
         // Update the out-parameters so they are what the caller expects.
         apzc->GetGuid(aOutTargetGuid);
         tapInput.mPoint = *untransformedPoint;
       }
       break;
     }
     case KEYBOARD_INPUT: {
+      aEvent.mLayersId = mFocusState.GetFocusLayersId();
       // Disable async keyboard scrolling when accessibility.browsewithcaret is
       // enabled
       if (!gfxPrefs::APZKeyboardEnabled() ||
           gfxPrefs::AccessibilityBrowseWithCaret()) {
         APZ_KEY_LOG("Skipping key input from invalid prefs\n");
         return result;
       }
 
--- a/gfx/layers/apz/src/APZInputBridge.cpp
+++ b/gfx/layers/apz/src/APZInputBridge.cpp
@@ -179,16 +179,17 @@ nsEventStatus APZInputBridge::ReceiveInp
 
       KeyboardInput input(keyboardEvent);
 
       nsEventStatus status =
           ReceiveInputEvent(input, aOutTargetGuid, aOutInputBlockId);
 
       keyboardEvent.mFlags.mHandledByAPZ = input.mHandledByAPZ;
       keyboardEvent.mFocusSequenceNumber = input.mFocusSequenceNumber;
+      aEvent.mLayersId = input.mLayersId;
       return status;
     }
     default: {
       UpdateWheelTransaction(aEvent.mRefPoint, aEvent.mMessage);
       ProcessUnhandledEvent(&aEvent.mRefPoint, aOutTargetGuid,
                             &aEvent.mFocusSequenceNumber, &aEvent.mLayersId);
       return nsEventStatus_eIgnore;
     }
--- a/gfx/layers/apz/src/FocusState.cpp
+++ b/gfx/layers/apz/src/FocusState.cpp
@@ -215,10 +215,16 @@ Maybe<ScrollableLayerGuid> FocusState::G
 
 bool FocusState::CanIgnoreKeyboardShortcutMisses() const {
   APZThreadUtils::AssertOnControllerThread();
   MutexAutoLock lock(mMutex);
 
   return IsCurrent(lock) && !mFocusHasKeyEventListeners;
 }
 
+LayersId FocusState::GetFocusLayersId() const {
+  MutexAutoLock lock(mMutex);
+
+  return mFocusLayersId;
+}
+
 }  // namespace layers
 }  // namespace mozilla
--- a/gfx/layers/apz/src/FocusState.h
+++ b/gfx/layers/apz/src/FocusState.h
@@ -120,16 +120,18 @@ class FocusState final {
   Maybe<ScrollableLayerGuid> GetVerticalTarget() const;
 
   /**
    * Gets whether it is safe to not increment the focus sequence number for an
    * unmatched keyboard event.
    */
   bool CanIgnoreKeyboardShortcutMisses() const;
 
+  LayersId GetFocusLayersId() const;
+
  private:
   /**
    * Whether the current focus state is known to be current or else if an event
    * has been processed that could change the focus but we have not received an
    * update with a new confirmed target.
    * This can only be called by methods that have already acquired mMutex; they
    * have to pass their lock as compile-time proof.
    */