Bug 1456588 part 3. Change nsFocusManager::SetFocusInner to take Element. r=enndeakin
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 26 Apr 2018 10:37:47 -0400
changeset 415782 927fe6220136608b1f809435686fa6b2d21457c6
parent 415781 73369777ac65280d8b58b7885de1f98d9538118f
child 415783 e419e7f9947999ecd704e45ef5e4525191bbf48e
push id33910
push usershindli@mozilla.com
push dateThu, 26 Apr 2018 21:39:52 +0000
treeherdermozilla-central@63a0e2f626fe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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 1456588 part 3. Change nsFocusManager::SetFocusInner to take Element. r=enndeakin
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -587,17 +587,18 @@ nsFocusManager::MoveFocus(mozIDOMWindowP
   LOGCONTENTNAVIGATION("Element to be focused: %s", newFocus.get());
   if (newFocus && newFocus->IsElement()) {
     // for caret movement, pass false for the aFocusChanged argument,
     // otherwise the caret will end up moving to the focus position. This
     // would be a problem because the caret would move to the beginning of the
     // focused link making it impossible to navigate the caret over a link.
-    SetFocusInner(newFocus, aFlags, aType != MOVEFOCUS_CARET, true);
+    SetFocusInner(newFocus->AsElement(), aFlags, aType != MOVEFOCUS_CARET,
+                  true);
     *aElement = do_AddRef(newFocus->AsElement()).take();
   else if (aType == MOVEFOCUS_ROOT || aType == MOVEFOCUS_CARET) {
     // no content was found, so clear the focus for these two types.
   LOGFOCUS(("<<MoveFocus end>>"));
@@ -1219,17 +1220,17 @@ nsFocusManager::ActivateOrDeactivate(nsP
   // Look for any remote child frames, iterate over them and send the activation notification.
   nsContentUtils::CallOnAllRemoteChildren(aWindow, ActivateOrDeactivateChild,
                                           (void *)aActive);
-nsFocusManager::SetFocusInner(nsIContent* aNewContent, int32_t aFlags,
+nsFocusManager::SetFocusInner(Element* aNewContent, int32_t aFlags,
                               bool aFocusChanged, bool aAdjustWidget)
   // if the element is not focusable, just return and leave the focus as is
   nsCOMPtr<nsIContent> contentToFocus = CheckIfFocusable(aNewContent, aFlags);
   if (!contentToFocus)
   // check if the element to focus is a frame (iframe) containing a child
--- a/dom/base/nsFocusManager.h
+++ b/dom/base/nsFocusManager.h
@@ -22,16 +22,17 @@
 #define FOCUSMANAGER_CONTRACTID "@mozilla.org/focus-manager;1"
 class nsIContent;
 class nsIDocShellTreeItem;
 class nsPIDOMWindowOuter;
 namespace mozilla {
 namespace dom {
+class Element;
 class TabParent;
 struct nsDelayedBlurOrFocusEvent;
  * The focus manager keeps track of where the focus is, that is, the node
@@ -188,17 +189,17 @@ protected:
    * true, then the focus has actually shifted and the caret position will be
    * updated to the new focus, aNewContent will be scrolled into view (unless
    * a flag disables this) and the focus method for the window will be updated.
    * If aAdjustWidget is false, don't change the widget focus state.
    * All actual focus changes must use this method to do so. (as opposed
    * to those that update the focus in an inactive window for instance).
-  void SetFocusInner(nsIContent* aNewContent, int32_t aFlags,
+  void SetFocusInner(mozilla::dom::Element* aNewContent, int32_t aFlags,
                      bool aFocusChanged, bool aAdjustWidget);
    * Returns true if aPossibleAncestor is the same as aWindow or an
    * ancestor of aWindow.
   bool IsSameOrAncestor(nsPIDOMWindowOuter* aPossibleAncestor,
                         nsPIDOMWindowOuter* aWindow);