зеркало из https://github.com/mozilla/pjs.git
Don't scroll to the selected element if the reflow was interrupted, we'll do it later. b=512410 r=bzbarsky
This commit is contained in:
Родитель
376cc4660e
Коммит
2365bba515
|
@ -169,6 +169,7 @@ nsListControlFrame::nsListControlFrame(
|
|||
nsIPresShell* aShell, nsIDocument* aDocument, nsStyleContext* aContext)
|
||||
: nsHTMLScrollFrame(aShell, aContext, PR_FALSE),
|
||||
mMightNeedSecondPass(PR_FALSE),
|
||||
mHasPendingInterruptAtStartOfReflow(PR_FALSE),
|
||||
mLastDropdownComputedHeight(NS_UNCONSTRAINEDSIZE)
|
||||
{
|
||||
mComboboxFrame = nsnull;
|
||||
|
@ -554,6 +555,8 @@ nsListControlFrame::Reflow(nsPresContext* aPresContext,
|
|||
NS_PRECONDITION(aReflowState.ComputedWidth() != NS_UNCONSTRAINEDSIZE,
|
||||
"Must have a computed width");
|
||||
|
||||
mHasPendingInterruptAtStartOfReflow = aPresContext->HasPendingInterrupt();
|
||||
|
||||
// If all the content and frames are here
|
||||
// then initialize it before reflow
|
||||
if (mIsAllContentHere && !mHasBeenInitialized) {
|
||||
|
@ -1803,7 +1806,9 @@ nsListControlFrame::DidReflow(nsPresContext* aPresContext,
|
|||
nsDidReflowStatus aStatus)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
PRBool wasInterrupted = !mHasPendingInterruptAtStartOfReflow &&
|
||||
aPresContext->HasPendingInterrupt();
|
||||
|
||||
if (IsInDropDownMode())
|
||||
{
|
||||
//SyncViewWithFrame();
|
||||
|
@ -1813,7 +1818,7 @@ nsListControlFrame::DidReflow(nsPresContext* aPresContext,
|
|||
rv = nsHTMLScrollFrame::DidReflow(aPresContext, aReflowState, aStatus);
|
||||
}
|
||||
|
||||
if (mNeedToReset) {
|
||||
if (mNeedToReset && !wasInterrupted) {
|
||||
mNeedToReset = PR_FALSE;
|
||||
// Suppress scrolling to the selected element if we restored
|
||||
// scroll history state AND the list contents have not changed
|
||||
|
@ -1827,6 +1832,7 @@ nsListControlFrame::DidReflow(nsPresContext* aPresContext,
|
|||
ResetList(!DidHistoryRestore() || mPostChildrenLoadedReset);
|
||||
}
|
||||
|
||||
mHasPendingInterruptAtStartOfReflow = PR_FALSE;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -438,6 +438,12 @@ protected:
|
|||
// pass. This only happens for auto heights.
|
||||
PRPackedBool mMightNeedSecondPass:1;
|
||||
|
||||
/**
|
||||
* Set to aPresContext->HasPendingInterrupt() at the start of Reflow.
|
||||
* Set to PR_FALSE at the end of DidReflow.
|
||||
*/
|
||||
PRPackedBool mHasPendingInterruptAtStartOfReflow:1;
|
||||
|
||||
// The last computed height we reflowed at if we're a combobox dropdown.
|
||||
// XXXbz should we be using a subclass here? Or just not worry
|
||||
// about the extra member on listboxes?
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<html><head>
|
||||
<title>Bug 506481 - selected item not showing in listbox box</title>
|
||||
</head><body>
|
||||
<select multiple="multiple">
|
||||
<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>option 12</option><option>option 13</option><option>option 14</option><option>option 15</option><option>option 16</option><option>option 17</option><option>option 18</option><option>option 19</option><option>option 20</option><option>option 21</option><option>option 22</option><option>option 23</option><option>option 24</option><option>option 25</option><option>option 26</option><option>option 27</option><option>option 28</option><option>option 29</option><option>option 30</option><option>option 31</option><option>option 32</option><option>option 33</option><option>option 34</option><option>option 35</option><option>option 36</option><option>option 37</option><option>option 38</option><option>option 39</option><option>option 40</option><option>option 41</option><option>option 42</option><option>option 43</option><option>option 44</option><option>option 45</option><option>option 46</option><option>option 47</option><option>option 48</option><option>option 49</option><option>option 50</option>
|
||||
</select>
|
||||
<select multiple="multiple">
|
||||
<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>option 12</option><option>option 13</option><option>option 14</option><option>option 15</option><option>option 16</option><option>option 17</option><option>option 18</option><option>option 19</option><option>option 20</option><option>option 21</option><option>option 22</option><option>option 23</option><option>option 24</option><option>option 25</option><option>option 26</option><option>option 27</option><option>option 28</option><option>option 29</option><option>option 30</option><option>option 31</option><option>option 32</option><option>option 33</option><option>option 34</option><option>option 35</option><option>option 36</option><option>option 37</option><option>option 38</option><option>option 39</option><option>option 40</option><option>option 41</option><option>option 42</option><option>option 43</option><option>option 44</option><option>option 45</option><option>option 46</option><option>option 47</option><option>option 48</option><option>option 49</option><option>option 50</option>
|
||||
</select>
|
||||
|
||||
<script>
|
||||
var sel = document.getElementsByTagName('select')
|
||||
sel[0].selectedIndex=50
|
||||
sel[1].selectedIndex=50
|
||||
document.body.offsetHeight;
|
||||
</script>
|
||||
</body></html>
|
|
@ -0,0 +1,10 @@
|
|||
<html><head>
|
||||
<title>Bug 506481 - selected item not showing in listbox box</title>
|
||||
</head><body>
|
||||
<select multiple="multiple"><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>option 12</option><option>option 13</option><option>option 14</option><option>option 15</option><option>option 16</option><option>option 17</option><option>option 18</option><option>option 19</option><option>option 20</option><option>option 21</option><option>option 22</option><option>option 23</option><option>option 24</option><option>option 25</option><option>option 26</option><option>option 27</option><option>option 28</option><option>option 29</option><option>option 30</option><option>option 31</option><option>option 32</option><option>option 33</option><option>option 34</option><option>option 35</option><option>option 36</option><option>option 37</option><option>option 38</option><option>option 39</option><option>option 40</option><option>option 41</option><option>option 42</option><option>option 43</option><option>option 44</option><option>option 45</option><option>option 46</option><option>option 47</option><option>option 48</option><option>option 49</option><option selected>option 50</option>
|
||||
</select>
|
||||
<select multiple="multiple"><script></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>option 12</option><option>option 13</option><option>option 14</option><option>option 15</option><option>option 16</option><option>option 17</option><option>option 18</option><option>option 19</option><option>option 20</option><option>option 21</option><option>option 22</option><option>option 23</option><option>option 24</option><option>option 25</option><option>option 26</option><option>option 27</option><option>option 28</option><option>option 29</option><option>option 30</option><option>option 31</option><option>option 32</option><option>option 33</option><option>option 34</option><option>option 35</option><option>option 36</option><option>option 37</option><option>option 38</option><option>option 39</option><option>option 40</option><option>option 41</option><option>option 42</option><option>option 43</option><option>option 44</option><option>option 45</option><option>option 46</option><option>option 47</option><option>option 48</option><option>option 49</option><option selected>option 50</option>
|
||||
</select>
|
||||
</body></html>
|
|
@ -1311,3 +1311,4 @@ fails-if(MOZ_WIDGET_TOOLKIT!="cocoa") == 488692-1.html 488692-1-ref.html # needs
|
|||
== 507487-2.xhtml 507487-2-ref.xhtml
|
||||
== 508919-1.xhtml 508919-1-ref.xhtml
|
||||
== 509155-1.xhtml 509155-1-ref.xhtml
|
||||
== 512410.html 512410-ref.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче