Bug 1357533 - Moused-over urlbar results should turn gray only after you move the mouse.
MozReview-Commit-ID: 9Uo4W22C0GZ
--- a/browser/themes/osx/browser.css
+++ b/browser/themes/osx/browser.css
@@ -844,18 +844,19 @@ toolbarpaletteitem[place="palette"] > #p
.autocomplete-richlistitem {
height: 30px;
min-height: 30px;
font: message-box;
border-radius: 2px;
border: 1px solid transparent;
}
-.autocomplete-richlistitem:hover,
-treechildren.searchbar-treebody::-moz-tree-row(hover) {
+/* .autocomplete-richlistitem:hover, */
+/* treechildren.searchbar-treebody::-moz-tree-row(hover) { */
+.autocomplete-richlistitem[mouseover] {
background-color: hsla(0, 0%, 0%, 0.06);
border-color: hsla(0, 0%, 0%, 0.1);
}
.autocomplete-richlistitem[selected],
treechildren.searchbar-treebody::-moz-tree-row(selected) {
background-color: Highlight;
color: HighlightText;
--- a/toolkit/content/widgets/autocomplete.xml
+++ b/toolkit/content/widgets/autocomplete.xml
@@ -818,16 +818,17 @@
]]>
</body>
</method>
<method name="openAutocompletePopup">
<parameter name="aInput"/>
<parameter name="aElement"/>
<body><![CDATA[
+ dump("****XXXadw openAutocompletePopup1\n");
// until we have "baseBinding", (see bug #373652) this allows
// us to override openAutocompletePopup(), but still call
// the method on the base class
this._openAutocompletePopup(aInput, aElement);
]]></body>
</method>
<method name="_openAutocompletePopup">
@@ -926,16 +927,17 @@ extends="chrome://global/content/binding
<property name="isPopupHidingTick" readonly="true"
onget="return this.mIsPopupHidingTick;"/>
<method name="closePopup">
<body>
<![CDATA[
if (this.mPopupOpen) {
+ dump("**********XXXadw closePopup\n");
this.hidePopup();
this.removeAttribute("width");
}
]]>
</body>
</method>
<!-- This is the default number of rows that we give the autocomplete
@@ -1113,49 +1115,62 @@ extends="chrome://global/content/binding
]]></body>
</method>
<method name="openAutocompletePopup">
<parameter name="aInput"/>
<parameter name="aElement"/>
<body>
<![CDATA[
+ dump("****XXXadw openAutocompletePopup2\n");
// until we have "baseBinding", (see bug #373652) this allows
// us to override openAutocompletePopup(), but still call
// the method on the base class
this._openAutocompletePopup(aInput, aElement);
]]>
</body>
</method>
<method name="_openAutocompletePopup">
<parameter name="aInput"/>
<parameter name="aElement"/>
<body>
<![CDATA[
+ dump("****XXXadw _openAutocompletePopup\n");
if (!this.mPopupOpen) {
// It's possible that the panel is hidden initially
// to avoid impacting startup / new window performance
aInput.popup.hidden = false;
this.mInput = aInput;
// clear any previous selection, see bugs 400671 and 488357
this.selectedIndex = -1;
+ this.mouseoverIndex = -1;
var width = aElement.getBoundingClientRect().width;
this.setAttribute("width", width > 100 ? width : 100);
// invalidate() depends on the width attribute
this._invalidate();
this.openPopup(aElement, "after_start", 0, 0, false, false);
}
]]>
</body>
</method>
+ <property name="mouseoverIndex">
+ <getter><![CDATA[
+ return this.richlistbox.mouseoverIndex;
+ ]]></getter>
+ <setter><![CDATA[
+ return this.richlistbox.mouseoverIndex = val;
+ ]]>
+ </setter>
+ </property>
+
<method name="invalidate">
<parameter name="reason"/>
<body>
<![CDATA[
// Don't bother doing work if we're not even showing
if (!this.mPopupOpen)
return;
@@ -1163,32 +1178,36 @@ extends="chrome://global/content/binding
]]>
</body>
</method>
<method name="_invalidate">
<parameter name="reason"/>
<body>
<![CDATA[
+ dump("****XXXadw _invalidate this.mPopupOpen=" + this.mPopupOpen + "\n");
+ //dump((new Error()).stack + "\n\n");
+
// collapsed if no matches
this.richlistbox.collapsed = (this._matchCount == 0);
// Update the richlistbox height.
if (this._adjustHeightTimeout) {
clearTimeout(this._adjustHeightTimeout);
}
if (this._shrinkTimeout) {
clearTimeout(this._shrinkTimeout);
}
if (this.mPopupOpen) {
delete this._adjustHeightOnPopupShown;
this._adjustHeightTimeout = setTimeout(() => this.adjustHeight(), 0);
} else {
this._adjustHeightOnPopupShown = true;
+ this.mouseoverIndex = -1;
}
this._currentIndex = 0;
if (this._appendResultTimeout) {
clearTimeout(this._appendResultTimeout);
}
this._appendCurrentResult(reason);
]]>
@@ -2544,18 +2563,46 @@ extends="chrome://global/content/binding
<xul:treerows class="autocomplete-treerows tree-rows" xbl:inherits="hidescrollbar" flex="1">
<children/>
</xul:treerows>
</content>
</binding>
<binding id="autocomplete-richlistbox" extends="chrome://global/content/bindings/richlistbox.xml#richlistbox">
<implementation>
- <field name="mLastMoveTime">Date.now()</field>
<field name="mousedOverIndex">-1</field>
+
+ <property name="mouseoverIndex">
+ <getter><![CDATA[
+ return this._mouseoverIndex;
+ ]]></getter>
+ <setter><![CDATA[
+ dump("****XXXadw set mouseoverIndex old=" + this._mouseoverIndex + " new=" + val + "\n");
+ if (this._mouseoverIndex != val) {
+ if (this._mouseoverIndex >= 0) {
+ let oldItem = this.getItemAtIndex(this._mouseoverIndex);
+ if (oldItem) {
+ oldItem.removeAttribute("mouseover");
+ }
+ }
+ this._mouseoverIndex = val;
+ if (val >= 0) {
+ let newItem = this.getItemAtIndex(val);
+ if (newItem) {
+ newItem.setAttribute("mouseover", "true");
+ }
+ }
+ }
+ return val;
+ ]]>
+ </setter>
+ </property>
+
+ <field name="_mouseoverIndex">-1</field>
+
</implementation>
<handlers>
<handler event="mouseup">
<![CDATA[
// don't call onPopupClick for the scrollbar buttons, thumb, slider, etc.
let item = event.originalTarget;
while (item && item.localName != "richlistitem") {
item = item.parentNode;
@@ -2565,33 +2612,44 @@ extends="chrome://global/content/binding
return;
this.parentNode.onPopupClick(event);
]]>
</handler>
<handler event="mousemove">
<![CDATA[
- if (Date.now() - this.mLastMoveTime <= 30) {
- return;
- }
let item = event.target;
while (item && item.localName != "richlistitem") {
item = item.parentNode;
}
-
if (!item) {
+ this.mouseoverIndex = -1;
return;
}
-
- this.mousedOverIndex = this.getIndexOfItem(item);
- this.mLastMoveTime = Date.now();
+ this.mouseoverIndex = this.getIndexOfItem(item);
]]>
</handler>
+
+ <handler event="mouseout">
+ <![CDATA[
+ let target = event.originalTarget;
+ dump("****XXXadw mouseout " + event.originalTarget.localName + " " + event.originalTarget.localName + "\n");
+ if (target.localName != "richlistitem") {
+ return;
+ }
+ //if (!this._XXXadw) {
+ // this._XXXadw = setTimeout(() => {
+ this.mouseoverIndex = -1;
+ // }, 1000);
+ //}
+ ]]>
+ </handler>
+
</handlers>
</binding>
<binding id="autocomplete-treebody">
<implementation>
<field name="mLastMoveTime">Date.now()</field>
</implementation>