Bug 231830, crash on style.display = 'none' for select element when event onchange occurs [@ nsStyleContext::GetRuleNode ][@ nsIFrame::Invalidate ], r+sr=bz

git-svn-id: svn://10.0.0.236/trunk@207128 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
Olli.Pettay%helsinki.fi
2006-08-11 12:09:30 +00:00
parent 669acc5bbe
commit f45fdfb0d8
3 changed files with 20 additions and 4 deletions

View File

@@ -375,6 +375,7 @@ NS_IMETHODIMP nsComboboxControlFrame::GetAccessible(nsIAccessible** aAccessible)
void
nsComboboxControlFrame::SetFocus(PRBool aOn, PRBool aRepaint)
{
nsWeakFrame weakFrame(this);
if (aOn) {
nsListControlFrame::ComboboxFocusSet();
mFocused = this;
@@ -383,9 +384,14 @@ nsComboboxControlFrame::SetFocus(PRBool aOn, PRBool aRepaint)
if (mDroppedDown) {
mListControlFrame->ComboboxFinish(mDisplayedIndex);
}
// May delete |this|.
mListControlFrame->FireOnChange();
}
if (!weakFrame.IsAlive()) {
return;
}
// This is needed on a temporary basis. It causes the focus
// rect to be drawn. This is much faster than ReResolvingStyle
// Bug 32920

View File

@@ -1933,7 +1933,7 @@ nsListControlFrame::ToggleOptionSelectedFromFrame(PRInt32 aIndex)
// Dispatch event and such
void
PRBool
nsListControlFrame::UpdateSelection()
{
if (mIsAllFramesHere) {
@@ -1943,9 +1943,12 @@ nsListControlFrame::UpdateSelection()
}
// if it's a listbox, fire on change
else if (mIsAllContentHere) {
nsWeakFrame weakFrame(this);
FireOnChange();
return weakFrame.IsAlive();
}
}
return PR_TRUE;
}
void
@@ -3054,7 +3057,10 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
nsCaseInsensitiveStringComparator())) {
PRBool wasChanged = PerformSelection(index, isShift, isControl);
if (wasChanged) {
UpdateSelection(); // dispatch event, update combobox, etc.
// dispatch event, update combobox, etc.
if (!UpdateSelection()) {
return NS_OK;
}
}
break;
}
@@ -3088,7 +3094,10 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
wasChanged = PerformSelection(newIndex, isShift, isControl);
}
if (wasChanged) {
UpdateSelection(); // dispatch event, update combobox, etc.
// dispatch event, update combobox, etc.
if (!UpdateSelection()) {
return NS_OK;
}
}
#ifdef ACCESSIBILITY
if (charcode != ' ') {

View File

@@ -153,7 +153,6 @@ public:
virtual void SyncViewWithFrame();
virtual void AboutToDropDown();
virtual void AboutToRollup();
virtual void UpdateSelection();
virtual void SetOverrideReflowOptimization(PRBool aValue) { mOverrideReflowOpt = aValue; }
virtual void FireOnChange();
virtual void ComboboxFinish(PRInt32 aIndex);
@@ -201,6 +200,8 @@ public:
#endif
protected:
// Returns PR_FALSE if calling it destroyed |this|.
PRBool UpdateSelection();
PRBool GetMultiple(nsIDOMHTMLSelectElement* aSelect = nsnull) const;
void DropDownToggleKey(nsIDOMEvent* aKeyEvent);
nsresult IsOptionDisabled(PRInt32 anIndex, PRBool &aIsDisabled);