fix for bug 15189 along with an annoying assert that just started. r: rods

This commit is contained in:
joki%netscape.com 2000-05-16 21:58:37 +00:00
Родитель e67e10847a
Коммит c95cc22f27
3 изменённых файлов: 21 добавлений и 99 удалений

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

@ -2371,6 +2371,8 @@ nsListControlFrame::OptionDisabled(nsIContent * aContent)
nsresult
nsListControlFrame::SelectionChanged(nsIContent* aContent)
{
nsresult ret = NS_ERROR_FAILURE;
// Dispatch the NS_FORM_CHANGE event
nsEventStatus status = nsEventStatus_eIgnore;
nsGUIEvent event;
@ -2379,40 +2381,12 @@ nsListControlFrame::SelectionChanged(nsIContent* aContent)
event.message = NS_FORM_CHANGE;
event.flags = NS_EVENT_FLAG_NONE;
// Here we create our own DOM event and set the target to the Select
// We'll pass this DOM event in, in hopes that the target is used.
nsIDOMEvent* DOMEvent = nsnull;
nsAutoString empty;
nsresult res = NS_NewDOMUIEvent(&DOMEvent, mPresContext, empty, &event);
if (NS_SUCCEEDED(res) && DOMEvent && mContent) {
nsCOMPtr<nsIDOMEventTarget> target;
res = mContent->QueryInterface(kIDOMNodeIID, (void**)getter_AddRefs(target));
if (NS_SUCCEEDED(res) && target) {
nsCOMPtr<nsIPrivateDOMEvent> pDOMEvent;
res = DOMEvent->QueryInterface(kIPrivateDOMEventIID, (void**)getter_AddRefs(pDOMEvent));
if (NS_SUCCEEDED(res) && pDOMEvent) {
res = pDOMEvent->SetTarget(target);
if (NS_SUCCEEDED(res)) {
// Have the content handle the event.
res = mContent->HandleDOMEvent(mPresContext, &event, &DOMEvent, NS_EVENT_FLAG_BUBBLE, &status);
}
}
}
NS_RELEASE(DOMEvent);
nsCOMPtr<nsIPresShell> presShell;
mPresContext->GetShell(getter_AddRefs(presShell));
if (presShell) {
ret = presShell->HandleEventWithTarget(&event, this, nsnull, &status);
}
// Now have the frame handle the event
if (NS_SUCCEEDED(res)) {
if (this) {
nsIFrame* frame = nsnull;
res = this->QueryInterface(kIFrameIID, (void**)&frame);
if ((NS_SUCCEEDED(res)) && (nsnull != frame)) {
res = frame->HandleEvent(mPresContext, &event, &status);
// NS_RELEASE(frame);
}
}
}
return res;
return ret;
}
//---------------------------------------------------------

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

@ -2527,6 +2527,8 @@ nsGfxListControlFrame::GetOptionsContainer(nsIPresContext* aPresContext, nsIFram
nsresult
nsGfxListControlFrame::SelectionChanged(nsIContent* aContent)
{
nsresult ret = NS_ERROR_FAILURE;
// Dispatch the NS_FORM_CHANGE event
nsEventStatus status = nsEventStatus_eIgnore;
nsGUIEvent event;
@ -2535,40 +2537,12 @@ nsGfxListControlFrame::SelectionChanged(nsIContent* aContent)
event.message = NS_FORM_CHANGE;
event.flags = NS_EVENT_FLAG_NONE;
// Here we create our own DOM event and set the target to the Select
// We'll pass this DOM event in, in hopes that the target is used.
nsIDOMEvent* DOMEvent = nsnull;
nsAutoString empty;
nsresult res = NS_NewDOMUIEvent(&DOMEvent, mPresContext, empty, &event);
if (NS_SUCCEEDED(res) && DOMEvent && mContent) {
nsCOMPtr<nsIDOMEventTarget> target;
res = mContent->QueryInterface(kIDOMNodeIID, (void**)getter_AddRefs(target));
if (NS_SUCCEEDED(res) && target) {
nsCOMPtr<nsIPrivateDOMEvent> pDOMEvent;
res = DOMEvent->QueryInterface(kIPrivateDOMEventIID, (void**)getter_AddRefs(pDOMEvent));
if (NS_SUCCEEDED(res) && pDOMEvent) {
res = pDOMEvent->SetTarget(target);
if (NS_SUCCEEDED(res)) {
// Have the content handle the event.
res = mContent->HandleDOMEvent(mPresContext, &event, &DOMEvent, NS_EVENT_FLAG_BUBBLE, &status);
}
}
}
NS_RELEASE(DOMEvent);
nsCOMPtr<nsIPresShell> presShell;
mPresContext->GetShell(getter_AddRefs(presShell));
if (presShell) {
ret = presShell->HandleEventWithTarget(&event, this, nsnull, &status);
}
// Now have the frame handle the event
if (NS_SUCCEEDED(res)) {
if (this) {
nsIFrame* frame = nsnull;
res = this->QueryInterface(kIFrameIID, (void**)&frame);
if ((NS_SUCCEEDED(res)) && (nsnull != frame)) {
res = frame->HandleEvent(mPresContext, &event, &status);
// NS_RELEASE(frame);
}
}
}
return res;
return ret;
}
//---------------------------------------------------------

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

@ -2371,6 +2371,8 @@ nsListControlFrame::OptionDisabled(nsIContent * aContent)
nsresult
nsListControlFrame::SelectionChanged(nsIContent* aContent)
{
nsresult ret = NS_ERROR_FAILURE;
// Dispatch the NS_FORM_CHANGE event
nsEventStatus status = nsEventStatus_eIgnore;
nsGUIEvent event;
@ -2379,40 +2381,12 @@ nsListControlFrame::SelectionChanged(nsIContent* aContent)
event.message = NS_FORM_CHANGE;
event.flags = NS_EVENT_FLAG_NONE;
// Here we create our own DOM event and set the target to the Select
// We'll pass this DOM event in, in hopes that the target is used.
nsIDOMEvent* DOMEvent = nsnull;
nsAutoString empty;
nsresult res = NS_NewDOMUIEvent(&DOMEvent, mPresContext, empty, &event);
if (NS_SUCCEEDED(res) && DOMEvent && mContent) {
nsCOMPtr<nsIDOMEventTarget> target;
res = mContent->QueryInterface(kIDOMNodeIID, (void**)getter_AddRefs(target));
if (NS_SUCCEEDED(res) && target) {
nsCOMPtr<nsIPrivateDOMEvent> pDOMEvent;
res = DOMEvent->QueryInterface(kIPrivateDOMEventIID, (void**)getter_AddRefs(pDOMEvent));
if (NS_SUCCEEDED(res) && pDOMEvent) {
res = pDOMEvent->SetTarget(target);
if (NS_SUCCEEDED(res)) {
// Have the content handle the event.
res = mContent->HandleDOMEvent(mPresContext, &event, &DOMEvent, NS_EVENT_FLAG_BUBBLE, &status);
}
}
}
NS_RELEASE(DOMEvent);
nsCOMPtr<nsIPresShell> presShell;
mPresContext->GetShell(getter_AddRefs(presShell));
if (presShell) {
ret = presShell->HandleEventWithTarget(&event, this, nsnull, &status);
}
// Now have the frame handle the event
if (NS_SUCCEEDED(res)) {
if (this) {
nsIFrame* frame = nsnull;
res = this->QueryInterface(kIFrameIID, (void**)&frame);
if ((NS_SUCCEEDED(res)) && (nsnull != frame)) {
res = frame->HandleEvent(mPresContext, &event, &status);
// NS_RELEASE(frame);
}
}
}
return res;
return ret;
}
//---------------------------------------------------------