Bug 1330111 - Convert the getFocusedInput method on nsIFormFillController to an attribute. r=felipe a=jcristau
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Tue, 31 Jan 2017 23:57:49 -0800
changeset 376006 e22cc104ea978ac6c889c6820e20b15d31068870
parent 376005 83a5402b5472f547f133de773592120994806ff1
child 376007 8898738f895e8800c0f181c3b2784ac766d22a1e
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfelipe, jcristau
bugs1330111
milestone53.0a2
Bug 1330111 - Convert the getFocusedInput method on nsIFormFillController to an attribute. r=felipe a=jcristau The convention is to use an attribute. This also fixes reference counting. MozReview-Commit-ID: B38ZVNt4Ugi
toolkit/components/satchel/nsFormFillController.cpp
toolkit/components/satchel/nsIFormFillController.idl
--- a/toolkit/components/satchel/nsFormFillController.cpp
+++ b/toolkit/components/satchel/nsFormFillController.cpp
@@ -310,16 +310,22 @@ nsFormFillController::MarkAsAutofillFiel
   nsCOMPtr<nsINode> node = do_QueryInterface(aInput);
   NS_ENSURE_STATE(node);
   mAutofillInputs.Put(node, true);
   node->AddMutationObserverUnlessExists(this);
 
   return NS_OK;
 }
 
+NS_IMETHODIMP
+nsFormFillController::GetFocusedInput(nsIDOMHTMLInputElement **aInput) {
+  *aInput = mFocusedInput;
+  NS_IF_ADDREF(*aInput);
+  return NS_OK;
+}
 
 ////////////////////////////////////////////////////////////////////////
 //// nsIAutoCompleteInput
 
 NS_IMETHODIMP
 nsFormFillController::GetPopup(nsIAutoCompletePopup **aPopup)
 {
   *aPopup = mFocusedPopup;
--- a/toolkit/components/satchel/nsIFormFillController.idl
+++ b/toolkit/components/satchel/nsIFormFillController.idl
@@ -16,16 +16,21 @@ interface nsIDOMHTMLInputElement;
  * is focused.  When this happens, the input will be bound to the
  * global nsIAutoCompleteController service.
  */
 
 [scriptable, uuid(07f0a0dc-f6e9-4cdd-a55f-56d770523a4c)]
 interface nsIFormFillController : nsISupports
 {
   /*
+   * The input element the form fill controller is currently bound to.
+   */
+  readonly attribute nsIDOMHTMLInputElement focusedInput;
+
+  /*
    * Start controlling form fill behavior for the given browser
    *
    * @param docShell - The docShell to attach to
    * @param popup - The popup to show when autocomplete results are available
    */
   void attachToBrowser(in nsIDocShell docShell, in nsIAutoCompletePopup popup);
 
   /*