Fix non-functioning form autocomplete (bug 212220). Instead of using an attribute on the nsIAutoCompleteInput (since it's not always a content node), add an attribute to the IDL interface. Also, make use of JS's (a || b) semantics to avoid some temporary variables. r=hewitt.

This commit is contained in:
bryner%netscape.com 2003-07-13 02:27:25 +00:00
Родитель 06dbe6f09a
Коммит a928bf88c3
4 изменённых файлов: 29 добавлений и 5 удалений

Просмотреть файл

@ -81,6 +81,11 @@ interface nsIAutoCompleteInput : nsISupports
*/
attribute unsigned long minResultsForPopup;
/*
* The maximum number of rows to show in the autocomplete popup.
*/
attribute unsigned long maxRows;
/*
* Option to show a second column in the popup which contains
* the comment for each autocomplete result

Просмотреть файл

@ -78,6 +78,7 @@ NS_IMPL_RELEASE(nsFormFillController);
nsFormFillController::nsFormFillController() :
mTimeout(50),
mMinResultsForPopup(1),
mMaxRows(0),
mDisableAutoComplete(PR_FALSE),
mCompleteDefaultIndex(PR_FALSE),
mForceComplete(PR_FALSE)
@ -290,6 +291,20 @@ NS_IMETHODIMP nsFormFillController::SetMinResultsForPopup(PRUint32 aMinResultsFo
return NS_OK;
}
NS_IMETHODIMP
nsFormFillController::GetMaxRows(PRUint32 *aMaxRows)
{
*aMaxRows = mMaxRows;
return NS_OK;
}
NS_IMETHODIMP
nsFormFillController::SetMaxRows(PRUint32 aMaxRows)
{
mMaxRows = aMaxRows;
return NS_OK;
}
NS_IMETHODIMP
nsFormFillController::GetShowCommentColumn(PRUint32 *aShowCommentColumn)
{

Просмотреть файл

@ -106,6 +106,7 @@ protected:
PRUint32 mTimeout;
PRUint32 mMinResultsForPopup;
PRUint32 mMaxRows;
PRPackedBool mDisableAutoComplete;
PRPackedBool mCompleteDefaultIndex;
PRPackedBool mForceComplete;

Просмотреть файл

@ -102,7 +102,7 @@
<property name="minResultsForPopup"
onset="this.setAttribute('minresultsforpopup', val); return val;"
onget="var t = parseInt(this.getAttribute('minresultsforpopup')); return t ? t : 0;"/>
onget="return parseInt(this.getAttribute('minresultsforpopup')) || 0;"/>
<property name="showCommentColumn"
onset="this.setAttribute('showcommentcolumn', val); return val;"
@ -110,7 +110,7 @@
<property name="timeout"
onset="this.setAttribute('timeout', val); return val;"
onget="var t = parseInt(this.getAttribute('timeout')); return t ? t : 50;"/>
onget="return parseInt(this.getAttribute('timeout')) || 50;"/>
<property name="searchParam"
onget="return this.getAttribute('autocompletesearchparam');"
@ -208,7 +208,7 @@
<!-- maximum number of rows to display at a time -->
<property name="maxRows"
onset="this.setAttribute('maxrows', val); return val;"
onget="var t = parseInt(this.getAttribute('maxrows')); return t ? t : 0;"/>
onget="return parseInt(this.getAttribute('maxrows')) || 0;"/>
<!-- option to allow scrolling through the list via the tab key, rather than
tab moving focus out of the textbox -->
@ -504,8 +504,11 @@
]]></setter>
</property>
<property name="maxRows" readonly="true"
onget="var t = parseInt(this.mInput.getAttribute('maxrows')); return t ? t : 6;"/>
<property name="maxRows" readonly="true">
<getter><![CDATA[
return (this.mInput && this.mInput.maxRows) || 6;
]]></getter>
</property>
<property name="showCommentColumn"
onget="return this.mShowCommentColumn;">