375196, r+sr=roc

This commit is contained in:
Olli.Pettay@helsinki.fi 2007-03-25 22:38:22 -07:00
parent d8627a0a9d
commit cf1ccace7f
12 changed files with 29 additions and 32 deletions

View File

@ -2440,7 +2440,7 @@ nsGenericElement::DispatchEvent(nsPresContext* aPresContext,
return NS_OK;
}
nsIPresShell *shell = aPresContext->GetPresShell();
nsCOMPtr<nsIPresShell> shell = aPresContext->GetPresShell();
if (!shell) {
return NS_OK;
}
@ -3882,7 +3882,7 @@ nsGenericElement::PostHandleEventForLinks(nsEventChainPostVisitor& aVisitor)
}
// The default action is simply to dispatch DOMActivate
nsIPresShell *shell = aVisitor.mPresContext->GetPresShell();
nsCOMPtr<nsIPresShell> shell = aVisitor.mPresContext->GetPresShell();
if (shell) {
// single-click
nsEventStatus status = nsEventStatus_eIgnore;

View File

@ -379,7 +379,8 @@ nsHTMLButtonElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
case NS_MOUSE_CLICK:
{
if (NS_IS_MOUSE_LEFT_CLICK(aVisitor.mEvent)) {
nsIPresShell *presShell = aVisitor.mPresContext->GetPresShell();
nsCOMPtr<nsIPresShell> presShell =
aVisitor.mPresContext->GetPresShell();
if (presShell) {
// single-click
nsUIEvent event(NS_IS_TRUSTED_EVENT(aVisitor.mEvent),
@ -403,7 +404,8 @@ nsHTMLButtonElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
event.originator = this;
nsEventStatus status = nsEventStatus_eIgnore;
nsIPresShell *presShell = aVisitor.mPresContext->GetPresShell();
nsCOMPtr<nsIPresShell> presShell =
aVisitor.mPresContext->GetPresShell();
// If |nsIPresShell::Destroy| has been called due to
// handling the event, the pres context will return
// a null pres shell. See bug 125624.

View File

@ -1045,7 +1045,7 @@ nsHTMLInputElement::MaybeSubmitForm(nsPresContext* aPresContext)
return NS_OK;
}
nsIPresShell* shell = aPresContext->GetPresShell();
nsCOMPtr<nsIPresShell> shell = aPresContext->GetPresShell();
if (!shell) {
return NS_OK;
}
@ -1502,7 +1502,7 @@ nsHTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
NS_IS_MOUSE_LEFT_CLICK(aVisitor.mEvent)) {
nsUIEvent actEvent(NS_IS_TRUSTED_EVENT(aVisitor.mEvent), NS_UI_ACTIVATE, 1);
nsIPresShell *shell = aVisitor.mPresContext->GetPresShell();
nsCOMPtr<nsIPresShell> shell = aVisitor.mPresContext->GetPresShell();
if (shell) {
nsEventStatus status = nsEventStatus_eIgnore;
SET_BOOLBIT(mBitField, BF_IN_INTERNAL_ACTIVATE, PR_TRUE);
@ -1770,7 +1770,8 @@ nsHTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
event.originator = this;
nsEventStatus status = nsEventStatus_eIgnore;
nsIPresShell *presShell = aVisitor.mPresContext->GetPresShell();
nsCOMPtr<nsIPresShell> presShell =
aVisitor.mPresContext->GetPresShell();
// If |nsIPresShell::Destroy| has been called due to
// handling the event the pres context will return a null

View File

@ -1011,7 +1011,7 @@ nsSVGSVGElement::SetCurrentScaleTranslate(float s, float x, float y)
// now dispatch an SVGZoom event if we are the root element
nsIDocument* doc = GetCurrentDoc();
if (doc) {
nsIPresShell* presShell = doc->GetShellAt(0);
nsCOMPtr<nsIPresShell> presShell = doc->GetShellAt(0);
NS_ASSERTION(presShell, "no presShell");
if (presShell &&
doc->GetRootContent() == NS_STATIC_CAST(nsIContent*, this)) {
@ -1036,7 +1036,7 @@ nsSVGSVGElement::SetCurrentTranslate(float x, float y)
// now dispatch an SVGScroll event if we are the root element
nsIDocument* doc = GetCurrentDoc();
if (doc) {
nsIPresShell* presShell = doc->GetShellAt(0);
nsCOMPtr<nsIPresShell> presShell = doc->GetShellAt(0);
NS_ASSERTION(presShell, "no presShell");
if (presShell &&
doc->GetRootContent() == NS_STATIC_CAST(nsIContent*, this)) {

View File

@ -1114,7 +1114,7 @@ nsXMLContentSink::HandleEndElement(const PRUnichar *aName)
nsEventStatus status = nsEventStatus_eIgnore;
nsEvent event(PR_TRUE, NS_SVG_LOAD);
event.eventStructType = NS_SVG_EVENT;
nsIPresShell *presShell = mDocument->GetShellAt(0);
nsCOMPtr<nsIPresShell> presShell = mDocument->GetShellAt(0);
if (presShell) {
FlushTags();
presShell->HandleDOMEventWithTarget(content, &event, &status);

View File

@ -514,6 +514,7 @@ public:
/**
* Interface to dispatch events via the presshell
* @note The caller must have a strong reference to the PresShell.
*/
NS_IMETHOD HandleEventWithTarget(nsEvent* aEvent,
nsIFrame* aFrame,
@ -522,6 +523,7 @@ public:
/**
* Dispatch event to content only (NOT full processing)
* @note The caller must have a strong reference to the PresShell.
*/
NS_IMETHOD HandleDOMEventWithTarget(nsIContent* aTargetContent,
nsEvent* aEvent,

View File

@ -394,7 +394,7 @@ nsComboboxControlFrame::ShowPopup(PRBool aShowPopup)
NS_XUL_POPUP_SHOWING : NS_XUL_POPUP_HIDING, nsnull,
nsMouseEvent::eReal);
nsIPresShell *shell = GetPresContext()->GetPresShell();
nsCOMPtr<nsIPresShell> shell = GetPresContext()->GetPresShell();
if (shell)
shell->HandleDOMEventWithTarget(mContent, &event, &status);
}

View File

@ -1658,7 +1658,7 @@ nsListControlFrame::FireOnChange()
nsEventStatus status = nsEventStatus_eIgnore;
nsEvent event(PR_TRUE, NS_FORM_CHANGE);
nsIPresShell *presShell = GetPresContext()->GetPresShell();
nsCOMPtr<nsIPresShell> presShell = GetPresContext()->GetPresShell();
if (presShell) {
presShell->HandleEventWithTarget(&event, this, nsnull, &status);
}

View File

@ -305,7 +305,7 @@ nsTextInputListener::NotifySelectionChanged(nsIDOMDocument* aDoc, nsISelection*
nsCOMPtr<nsIDocument> doc = content->GetDocument();
if (doc)
{
nsIPresShell *presShell = doc->GetShellAt(0);
nsCOMPtr<nsIPresShell> presShell = doc->GetShellAt(0);
if (presShell)
{
nsEventStatus status = nsEventStatus_eIgnore;
@ -2467,8 +2467,8 @@ nsTextControlFrame::FireOnInput()
// Have the content handle the event, propagating it according to normal
// DOM rules.
GetPresContext()->PresShell()->HandleEventWithTarget(&event, nsnull, mContent,
&status);
nsCOMPtr<nsIPresShell> shell = GetPresContext()->PresShell();
shell->HandleEventWithTarget(&event, nsnull, mContent, &status);
}
nsresult
@ -2488,9 +2488,8 @@ nsTextControlFrame::CheckFireOnChange()
// Dispatch the change event
nsEventStatus status = nsEventStatus_eIgnore;
nsInputEvent event(PR_TRUE, NS_FORM_CHANGE, nsnull);
GetPresContext()->PresShell()->HandleEventWithTarget(&event, nsnull,
mContent, &status);
nsCOMPtr<nsIPresShell> shell = GetPresContext()->PresShell();
shell->HandleEventWithTarget(&event, nsnull, mContent, &status);
}
return NS_OK;
}

View File

@ -155,9 +155,8 @@ nsButtonBoxFrame::DoMouseClick(nsGUIEvent* aEvent, PRBool aTrustEvent)
}
// Have the content handle the event, propagating it according to normal DOM rules.
nsIPresShell *shell = GetPresContext()->GetPresShell();
nsCOMPtr<nsIPresShell> shell = GetPresContext()->GetPresShell();
if (shell) {
shell->HandleDOMEventWithTarget(mContent, &event, &status);
// shell may no longer be alive, don't use it here unless you keep a ref
}
}

View File

@ -1726,7 +1726,7 @@ nsMenuFrame::OnCreate()
nsresult rv = NS_OK;
nsIPresShell *shell = GetPresContext()->GetPresShell();
nsCOMPtr<nsIPresShell> shell = GetPresContext()->GetPresShell();
if (shell) {
if (child) {
rv = shell->HandleDOMEventWithTarget(child, &event, &status);
@ -1734,7 +1734,6 @@ nsMenuFrame::OnCreate()
else {
rv = shell->HandleDOMEventWithTarget(mContent, &event, &status);
}
// shell may no longer be alive, don't use it here unless you keep a ref
}
if ( NS_FAILED(rv) || status == nsEventStatus_eConsumeNoDefault )
@ -1800,7 +1799,7 @@ nsMenuFrame::OnCreated()
GetMenuChildrenElement(getter_AddRefs(child));
nsresult rv = NS_OK;
nsIPresShell *shell = GetPresContext()->GetPresShell();
nsCOMPtr<nsIPresShell> shell = GetPresContext()->GetPresShell();
if (shell) {
if (child) {
rv = shell->HandleDOMEventWithTarget(child, &event, &status);
@ -1808,7 +1807,6 @@ nsMenuFrame::OnCreated()
else {
rv = shell->HandleDOMEventWithTarget(mContent, &event, &status);
}
// shell may no longer be alive, don't use it here unless you keep a ref
}
if ( NS_FAILED(rv) || status == nsEventStatus_eConsumeNoDefault )
@ -1827,7 +1825,7 @@ nsMenuFrame::OnDestroy()
GetMenuChildrenElement(getter_AddRefs(child));
nsresult rv = NS_OK;
nsIPresShell *shell = GetPresContext()->GetPresShell();
nsCOMPtr<nsIPresShell> shell = GetPresContext()->GetPresShell();
if (shell) {
if (child) {
rv = shell->HandleDOMEventWithTarget(child, &event, &status);
@ -1835,7 +1833,6 @@ nsMenuFrame::OnDestroy()
else {
rv = shell->HandleDOMEventWithTarget(mContent, &event, &status);
}
// shell may no longer be alive, don't use it here unless you keep a ref
}
if ( NS_FAILED(rv) || status == nsEventStatus_eConsumeNoDefault )
@ -1854,7 +1851,7 @@ nsMenuFrame::OnDestroyed()
GetMenuChildrenElement(getter_AddRefs(child));
nsresult rv = NS_OK;
nsIPresShell *shell = GetPresContext()->GetPresShell();
nsCOMPtr<nsIPresShell> shell = GetPresContext()->GetPresShell();
if (shell) {
if (child) {
rv = shell->HandleDOMEventWithTarget(child, &event, &status);
@ -1862,7 +1859,6 @@ nsMenuFrame::OnDestroyed()
else {
rv = shell->HandleDOMEventWithTarget(mContent, &event, &status);
}
// shell may no longer be alive, don't use it here unless you keep a ref
}
if ( NS_FAILED(rv) || status == nsEventStatus_eConsumeNoDefault )

View File

@ -645,11 +645,10 @@ nsPopupSetFrame::OnCreate(PRInt32 aX, PRInt32 aY, nsIContent* aPopupContent)
if (aPopupContent) {
nsCOMPtr<nsIContent> kungFuDeathGrip(aPopupContent);
nsIPresShell *shell = GetPresContext()->GetPresShell();
nsCOMPtr<nsIPresShell> shell = GetPresContext()->GetPresShell();
if (shell) {
nsresult rv = shell->HandleDOMEventWithTarget(aPopupContent, &event,
&status);
// shell may no longer be alive, don't use it here unless you keep a ref
if ( NS_FAILED(rv) || status == nsEventStatus_eConsumeNoDefault )
return PR_FALSE;
}
@ -714,11 +713,10 @@ nsPopupSetFrame::OnCreated(PRInt32 aX, PRInt32 aY, nsIContent* aPopupContent)
//event.point.y = aY;
if (aPopupContent) {
nsIPresShell *shell = GetPresContext()->GetPresShell();
nsCOMPtr<nsIPresShell> shell = GetPresContext()->GetPresShell();
if (shell) {
nsresult rv = shell->HandleDOMEventWithTarget(aPopupContent, &event,
&status);
// shell may no longer be alive, don't use it here unless you keep a ref
if ( NS_FAILED(rv) || status == nsEventStatus_eConsumeNoDefault )
return PR_FALSE;
}