Bug 513185. Calculate an opaque backstop color for a dropdown combobox (select) before possible scroll (which leads to painting). r=roc

--HG--
extra : rebase_source : 0ad5b14f24291dd16779328b1901a7f1a0091840
This commit is contained in:
Timothy Nikkel 2009-09-02 14:46:47 +12:00
Родитель 56f0d1ff1d
Коммит 25b7e778fe
1 изменённых файлов: 12 добавлений и 8 удалений

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

@ -234,6 +234,8 @@ nsListControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
DO_GLOBAL_REFLOW_COUNT_DSP("nsListControlFrame"); DO_GLOBAL_REFLOW_COUNT_DSP("nsListControlFrame");
if (IsInDropDownMode()) { if (IsInDropDownMode()) {
NS_ASSERTION(NS_GET_A(mLastDropdownBackstopColor) == 255,
"need an opaque backstop color");
// XXX Because we have an opaque widget and we get called to paint with // XXX Because we have an opaque widget and we get called to paint with
// this frame as the root of a stacking context we need make sure to draw // this frame as the root of a stacking context we need make sure to draw
// some opaque color over the whole widget. (Bug 511323) // some opaque color over the whole widget. (Bug 511323)
@ -1175,6 +1177,8 @@ nsListControlFrame::Init(nsIContent* aContent,
mStartSelectionIndex = kNothingSelected; mStartSelectionIndex = kNothingSelected;
mEndSelectionIndex = kNothingSelected; mEndSelectionIndex = kNothingSelected;
mLastDropdownBackstopColor = PresContext()->DefaultBackgroundColor();
return result; return result;
} }
@ -1744,14 +1748,6 @@ nsListControlFrame::AboutToDropDown()
NS_ASSERTION(IsInDropDownMode(), NS_ASSERTION(IsInDropDownMode(),
"AboutToDropDown called without being in dropdown mode"); "AboutToDropDown called without being in dropdown mode");
if (mIsAllContentHere && mIsAllFramesHere && mHasBeenInitialized) {
ScrollToIndex(GetSelectedIndex());
#ifdef ACCESSIBILITY
FireMenuItemActiveEvent(); // Inform assistive tech what got focus
#endif
}
mItemSelectionStarted = PR_FALSE;
// Our widget doesn't get invalidated on changes to the rest of the document, // Our widget doesn't get invalidated on changes to the rest of the document,
// so compute and store this color at the start of a dropdown so we don't // so compute and store this color at the start of a dropdown so we don't
// get weird painting behaviour. // get weird painting behaviour.
@ -1773,6 +1769,14 @@ nsListControlFrame::AboutToDropDown()
mLastDropdownBackstopColor = mLastDropdownBackstopColor =
NS_ComposeColors(PresContext()->DefaultBackgroundColor(), NS_ComposeColors(PresContext()->DefaultBackgroundColor(),
mLastDropdownBackstopColor); mLastDropdownBackstopColor);
if (mIsAllContentHere && mIsAllFramesHere && mHasBeenInitialized) {
ScrollToIndex(GetSelectedIndex());
#ifdef ACCESSIBILITY
FireMenuItemActiveEvent(); // Inform assistive tech what got focus
#endif
}
mItemSelectionStarted = PR_FALSE;
} }
// We are about to be rolledup from the outside (ComboboxFrame) // We are about to be rolledup from the outside (ComboboxFrame)