mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1236364 - Don't reuse existing richlistitem in urlbar when handling a delete. r=mak
This commit is contained in:
parent
a025d03ce8
commit
e144996b68
@ -678,7 +678,7 @@ nsAutoCompleteController::HandleDelete(bool *_retval)
|
||||
}
|
||||
|
||||
// Invalidate the popup.
|
||||
popup->Invalidate();
|
||||
popup->Invalidate(nsIAutoCompletePopup::INVALIDATE_REASON_DELETE);
|
||||
} else {
|
||||
// Nothing left in the popup, clear any pending search timers and
|
||||
// close the popup.
|
||||
@ -1618,7 +1618,7 @@ nsAutoCompleteController::ProcessResult(int32_t aSearchIndex, nsIAutoCompleteRes
|
||||
nsCOMPtr<nsIAutoCompletePopup> popup;
|
||||
input->GetPopup(getter_AddRefs(popup));
|
||||
NS_ENSURE_TRUE(popup != nullptr, NS_ERROR_FAILURE);
|
||||
popup->Invalidate();
|
||||
popup->Invalidate(nsIAutoCompletePopup::INVALIDATE_REASON_NEW_RESULT);
|
||||
|
||||
uint32_t minResults;
|
||||
input->GetMinResultsForPopup(&minResults);
|
||||
|
@ -7,7 +7,7 @@
|
||||
interface nsIDOMElement;
|
||||
interface nsIAutoCompleteInput;
|
||||
|
||||
[scriptable, uuid(1b9d7d8a-6dd0-11dc-8314-0800200c9a66)]
|
||||
[scriptable, uuid(bd3c2662-a988-41ab-8c94-c15ed0e6ac7d)]
|
||||
interface nsIAutoCompletePopup : nsISupports
|
||||
{
|
||||
/*
|
||||
@ -47,9 +47,18 @@ interface nsIAutoCompletePopup : nsISupports
|
||||
/*
|
||||
* Instruct the result view to repaint itself to reflect the most current
|
||||
* underlying data
|
||||
*
|
||||
* @param reason - The reason the popup needs to be invalidated, one of the
|
||||
* INVALIDATE_REASON consts.
|
||||
*/
|
||||
void invalidate();
|
||||
|
||||
void invalidate(in unsigned short reason);
|
||||
|
||||
/*
|
||||
* Possible values of invalidate()'s 'reason' argument.
|
||||
*/
|
||||
const unsigned short INVALIDATE_REASON_NEW_RESULT = 0;
|
||||
const unsigned short INVALIDATE_REASON_DELETE = 1;
|
||||
|
||||
/*
|
||||
* Change the selection relative to the current selection and make sure
|
||||
* the newly selected row is visible
|
||||
|
@ -1087,18 +1087,20 @@ extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
</method>
|
||||
|
||||
<method name="invalidate">
|
||||
<parameter name="reason"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
// Don't bother doing work if we're not even showing
|
||||
if (!this.mPopupOpen)
|
||||
return;
|
||||
|
||||
this._invalidate();
|
||||
this._invalidate(reason);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="_invalidate">
|
||||
<parameter name="reason"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
// collapsed if no matches
|
||||
@ -1117,7 +1119,7 @@ extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
if (this._appendResultTimeout) {
|
||||
clearTimeout(this._appendResultTimeout);
|
||||
}
|
||||
this._appendCurrentResult();
|
||||
this._appendCurrentResult(reason);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
@ -1209,6 +1211,7 @@ extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
</method>
|
||||
|
||||
<method name="_appendCurrentResult">
|
||||
<parameter name="invalidateReason"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var controller = this.mInput.controller;
|
||||
@ -1234,13 +1237,15 @@ extends="chrome://global/content/bindings/popup.xml#popup">
|
||||
// re-use the existing item
|
||||
item = this.richlistbox.childNodes[this._currentIndex];
|
||||
|
||||
// Completely re-use the existing richlistitem if it's the same.
|
||||
// Also re-use it if we are about to replace the currently mouse
|
||||
// selected item, to avoid surprising the user.
|
||||
// Completely reuse the existing richlistitem for invalidation
|
||||
// due to new results, but only when: the item is the same, *OR*
|
||||
// we are about to replace the currently mouse-selected item, to
|
||||
// avoid surprising the user.
|
||||
let iface = Components.interfaces.nsIAutoCompletePopup;
|
||||
if (item.getAttribute("text") == trimmedSearchString &&
|
||||
(item.getAttribute("url") == url ||
|
||||
this.richlistbox.mouseSelectedIndex === this._currentIndex)
|
||||
) {
|
||||
invalidateReason == iface.INVALIDATE_REASON_NEW_RESULT &&
|
||||
(item.getAttribute("url") == url ||
|
||||
this.richlistbox.mouseSelectedIndex === this._currentIndex)) {
|
||||
item.collapsed = false;
|
||||
this._currentIndex++;
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user