Bug 1312244 - Autocomplete popup does not close when anchor clicked a second time. r?Enn draft
authorMike Conley <mconley@mozilla.com>
Mon, 24 Oct 2016 11:32:10 -0400
changeset 428949 adea6235f3d8b49cb6b405d692471f35eeb9ba58
parent 428743 6f334e502eec9f25fb1dde6b5db98e9c0b826dba
child 534854 21ea658d7c5b6163f7365566c67f9b6559732637
push id33437
push usermconley@mozilla.com
push dateMon, 24 Oct 2016 20:12:18 +0000
reviewersEnn
bugs1312244, 1183037
milestone52.0a1
Bug 1312244 - Autocomplete popup does not close when anchor clicked a second time. r?Enn The popuphiding / popuphidden events are fired synchronously when the popup manager decides we're doing a "rollup" (closing the popups due to "outside" events). In the case of this bug, the "outside" event is a click on the input element in content. Here's the kicker though: we handle that popuphidden event and queue a message to content _before_ the mouse event that caused the roll-up is dispatched to content. This means that browser-content.js hears that the popup closed due to popuphidden first, sets its internal state of popupClosed to true, and then the MouseDown on the input field is processed. The nsFormFillController then queries browser-content's AutoCompletePopup, sees its closed, and tells the parent to open it again. This patch adds the norolluponanchor attribute to the panel, which causes us to ignore the rollup event if it happens to be targeted within the anchor rect. This means that we need to trust content to tell us to close the autocomplete popup if the input is clicked when the popup is open (and this is what bug 1183037, which this bug depends on, does). MozReview-Commit-ID: 4A9qVfTYIUz
browser/base/content/browser.xul
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -136,17 +136,22 @@
     <menupopup id="backForwardMenu"
                onpopupshowing="return FillHistoryMenu(event.target);"
                oncommand="gotoHistoryIndex(event); event.stopPropagation();"
                onclick="checkForMiddleClick(this, event);"/>
     <tooltip id="aHTMLTooltip" page="true"/>
     <tooltip id="remoteBrowserTooltip"/>
 
     <!-- for search and content formfill/pw manager -->
-    <panel type="autocomplete-richlistbox" id="PopupAutoComplete" noautofocus="true" hidden="true"/>
+
+    <panel type="autocomplete-richlistbox"
+           id="PopupAutoComplete"
+           noautofocus="true"
+           hidden="true"
+           norolluponanchor="true" />
 
     <!-- for search with one-off buttons -->
     <panel type="autocomplete" id="PopupSearchAutoComplete" noautofocus="true" hidden="true"/>
 
     <!-- for url bar autocomplete -->
     <panel type="autocomplete-richlistbox"
            id="PopupAutoCompleteRichResult"
            noautofocus="true"