[PALEMOON] URL/Address/Location bar - suggestions in location bar cannot be hidden by clicking dropmarker again

https://github.com/MoonchildProductions/Pale-Moon/pull/1382
This commit is contained in:
janekptacijarabaci 2018-04-19 00:19:39 +02:00 committed by Roy Tam
commit 733c97be89

View file

@ -404,7 +404,10 @@
<method name="toggleHistoryPopup">
<body><![CDATA[
if (!this.popup.popupOpen)
// If this method is called on the same event tick as the popup gets
// hidden, do nothing to avoid re-opening the popup when the drop
// marker is clicked while the popup is still open.
if (!this.popup.isPopupHidingTick && !this.popup.popupOpen)
this.showHistoryPopup();
else
this.closePopup();
@ -871,6 +874,7 @@ extends="chrome://global/content/bindings/popup.xml#popup">
<implementation implements="nsIAutoCompletePopup">
<field name="mInput">null</field>
<field name="mPopupOpen">false</field>
<field name="mIsPopupHidingTick">false</field>
<!-- =================== nsIAutoCompletePopup =================== -->
@ -883,6 +887,9 @@ extends="chrome://global/content/bindings/popup.xml#popup">
<property name="popupOpen" readonly="true"
onget="return this.mPopupOpen;"/>
<property name="isPopupHidingTick" readonly="true"
onget="return this.mIsPopupHidingTick;"/>
<method name="closePopup">
<body>
<![CDATA[
@ -989,6 +996,14 @@ extends="chrome://global/content/bindings/popup.xml#popup">
this.removeAttribute("autocompleteinput");
this.mPopupOpen = false;
// Prevent opening popup from historydropmarker mousedown handler
// on the same event tick the popup is hidden by the same mousedown
// event.
this.mIsPopupHidingTick = true;
setTimeout(() => {
this.mIsPopupHidingTick = false;
}, 0);
// Reset the maxRows property to the cached "normal" value, and reset
// _normalMaxRows so that we can detect whether it was set by the input
// when the popupshowing handler runs.
@ -2103,18 +2118,9 @@ extends="chrome://global/content/bindings/popup.xml#popup">
</binding>
<binding id="private-history-dropmarker" extends="chrome://global/content/bindings/general.xml#dropmarker">
<implementation>
<method name="showPopup">
<body><![CDATA[
var textbox = document.getBindingParent(this);
textbox.showHistoryPopup();
]]></body>
</method>
</implementation>
<handlers>
<handler event="mousedown" button="0"><![CDATA[
this.showPopup();
document.getBindingParent(this).toggleHistoryPopup();
]]></handler>
</handlers>
</binding>