Bug 506481. Make sure that we'll scroll to the selected option even if it's added after our initial reflow but before we finish adding initial option kids. r=mats

This commit is contained in:
Boris Zbarsky 2009-08-24 14:17:56 -04:00
Родитель 82e9a8aa88
Коммит c51488146f
4 изменённых файлов: 16 добавлений и 2 удалений

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

@ -1479,12 +1479,13 @@ nsListControlFrame::AddOption(PRInt32 aIndex)
} }
} }
// Make sure we scroll to the selected option as needed
mNeedToReset = PR_TRUE;
if (!mHasBeenInitialized) { if (!mHasBeenInitialized) {
return NS_OK; return NS_OK;
} }
// Make sure we scroll to the selected option as needed
mNeedToReset = PR_TRUE;
mPostChildrenLoadedReset = mIsAllContentHere; mPostChildrenLoadedReset = mIsAllContentHere;
return NS_OK; return NS_OK;
} }

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

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html><body>
<select multiple="multiple" size="10">
<option>option 0</option><option>option 1</option><option>option 2</option><option>option 3</option><option>option 4</option><option>option 5</option><option>option 6</option><option>option 7</option><option>option 8</option><option>option 9</option><option>option 10</option><option>option 11</option><option selected>option 12</option>
</select>
</body></html>

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

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html><body>
<select multiple="multiple" size="10"><script>document.body.offsetHeight;</script>
<option>option 0</option><option>option 1</option><option>option 2</option><option>option 3</option><option>option 4</option><option>option 5</option><option>option 6</option><option>option 7</option><option>option 8</option><option>option 9</option><option>option 10</option><option>option 11</option><option selected>option 12</option>
</select>
</body></html>

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

@ -1304,6 +1304,7 @@ fails-if(MOZ_WIDGET_TOOLKIT!="cocoa") == 488692-1.html 488692-1-ref.html # needs
== 503364-1b.html 503364-1-ref.html == 503364-1b.html 503364-1-ref.html
== 504032-1.html 504032-1-ref.html == 504032-1.html 504032-1-ref.html
== 505743-1.html about:blank == 505743-1.html about:blank
== 506481-1.html 506481-1-ref.html
== 507187-1.html 507187-1-ref.html == 507187-1.html 507187-1-ref.html
== 507487-1.html 507487-1-ref.html == 507487-1.html 507487-1-ref.html
== 507487-2.xhtml 507487-2-ref.xhtml == 507487-2.xhtml 507487-2-ref.xhtml