mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 13:21:28 +00:00
Bug 495983 - Remove nsPageTransitionEvent, r+sr=jst
This commit is contained in:
parent
8bd913e653
commit
e58d9d852a
@ -168,7 +168,7 @@ static NS_DEFINE_CID(kDOMEventGroupCID, NS_DOMEVENTGROUP_CID);
|
||||
#include "nsIXULDocument.h"
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsIPropertyBag2.h"
|
||||
|
||||
#include "nsIDOMPageTransitionEvent.h"
|
||||
#include "nsFrameLoader.h"
|
||||
|
||||
#include "mozAutoDocUpdate.h"
|
||||
@ -7055,14 +7055,24 @@ nsDocument::CheckAncestryAndGetFrame(nsIDocument* aDocument) const
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::DispatchEventToWindow(nsEvent *aEvent)
|
||||
nsDocument::DispatchPageTransition(nsPIDOMEventTarget* aDispatchTarget,
|
||||
const nsAString& aType,
|
||||
PRBool aPersisted)
|
||||
{
|
||||
nsPIDOMWindow *window = GetWindow();
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
aEvent->target = static_cast<nsIDocument*>(this);
|
||||
nsEventDispatcher::Dispatch(window, nsnull, aEvent);
|
||||
if (aDispatchTarget) {
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
CreateEvent(NS_LITERAL_STRING("pagetransition"), getter_AddRefs(event));
|
||||
nsCOMPtr<nsIDOMPageTransitionEvent> ptEvent = do_QueryInterface(event);
|
||||
nsCOMPtr<nsIPrivateDOMEvent> pEvent = do_QueryInterface(ptEvent);
|
||||
if (pEvent && NS_SUCCEEDED(ptEvent->InitPageTransitionEvent(aType, PR_TRUE,
|
||||
PR_TRUE,
|
||||
aPersisted))) {
|
||||
pEvent->SetTrusted(PR_TRUE);
|
||||
pEvent->SetTarget(this);
|
||||
nsEventDispatcher::DispatchDOMEvent(aDispatchTarget, nsnull, event,
|
||||
nsnull, nsnull);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -7101,14 +7111,10 @@ nsDocument::OnPageShow(PRBool aPersisted, nsIDOMEventTarget* aDispatchStartTarge
|
||||
mAnimationController->OnPageShow();
|
||||
}
|
||||
#endif
|
||||
|
||||
nsPageTransitionEvent event(PR_TRUE, NS_PAGE_SHOW, aPersisted);
|
||||
if (aDispatchStartTarget) {
|
||||
event.target = static_cast<nsIDocument*>(this);
|
||||
nsEventDispatcher::Dispatch(aDispatchStartTarget, nsnull, &event);
|
||||
} else {
|
||||
DispatchEventToWindow(&event);
|
||||
}
|
||||
nsCOMPtr<nsPIDOMEventTarget> target =
|
||||
aDispatchStartTarget ? do_QueryInterface(aDispatchStartTarget) :
|
||||
do_QueryInterface(GetWindow());
|
||||
DispatchPageTransition(target, NS_LITERAL_STRING("pageshow"), aPersisted);
|
||||
}
|
||||
|
||||
void
|
||||
@ -7147,13 +7153,10 @@ nsDocument::OnPageHide(PRBool aPersisted, nsIDOMEventTarget* aDispatchStartTarge
|
||||
#endif
|
||||
|
||||
// Now send out a PageHide event.
|
||||
nsPageTransitionEvent event(PR_TRUE, NS_PAGE_HIDE, aPersisted);
|
||||
if (aDispatchStartTarget) {
|
||||
event.target = static_cast<nsIDocument*>(this);
|
||||
nsEventDispatcher::Dispatch(aDispatchStartTarget, nsnull, &event);
|
||||
} else {
|
||||
DispatchEventToWindow(&event);
|
||||
}
|
||||
nsCOMPtr<nsPIDOMEventTarget> target =
|
||||
aDispatchStartTarget ? do_QueryInterface(aDispatchStartTarget) :
|
||||
do_QueryInterface(GetWindow());
|
||||
DispatchPageTransition(target, NS_LITERAL_STRING("pagehide"), aPersisted);
|
||||
|
||||
mVisible = PR_FALSE;
|
||||
}
|
||||
|
@ -1078,8 +1078,9 @@ protected:
|
||||
return kNameSpaceID_None;
|
||||
}
|
||||
|
||||
// Dispatch an event to the ScriptGlobalObject for this document
|
||||
void DispatchEventToWindow(nsEvent *aEvent);
|
||||
void DispatchPageTransition(nsPIDOMEventTarget* aDispatchTarget,
|
||||
const nsAString& aType,
|
||||
PRBool aPersisted);
|
||||
|
||||
// nsContentList match functions for GetElementsByClassName
|
||||
static PRBool MatchClassNames(nsIContent* aContent, PRInt32 aNamespaceID,
|
||||
|
@ -92,7 +92,7 @@ NS_NewDOMTextEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, class nsT
|
||||
nsresult
|
||||
NS_NewDOMBeforeUnloadEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, nsEvent* aEvent);
|
||||
nsresult
|
||||
NS_NewDOMPageTransitionEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, class nsPageTransitionEvent* aEvent);
|
||||
NS_NewDOMPageTransitionEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, nsEvent* aEvent);
|
||||
#ifdef MOZ_SVG
|
||||
nsresult
|
||||
NS_NewDOMSVGEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, class nsEvent* aEvent);
|
||||
|
@ -560,6 +560,10 @@ nsDOMEvent::SetEventType(const nsAString& aEventTypeArg)
|
||||
mEvent->message = NS_CUT;
|
||||
else if (atom == nsGkAtoms::onpaste)
|
||||
mEvent->message = NS_PASTE;
|
||||
else if (atom == nsGkAtoms::onpageshow)
|
||||
mEvent->message = NS_PAGE_SHOW;
|
||||
else if (atom == nsGkAtoms::onpagehide)
|
||||
mEvent->message = NS_PAGE_HIDE;
|
||||
} else if (mEvent->eventStructType == NS_MUTATION_EVENT) {
|
||||
if (atom == nsGkAtoms::onDOMAttrModified)
|
||||
mEvent->message = NS_MUTATION_ATTRMODIFIED;
|
||||
@ -584,11 +588,6 @@ nsDOMEvent::SetEventType(const nsAString& aEventTypeArg)
|
||||
mEvent->message = NS_UI_FOCUSOUT;
|
||||
else if (atom == nsGkAtoms::oninput)
|
||||
mEvent->message = NS_FORM_INPUT;
|
||||
} else if (mEvent->eventStructType == NS_PAGETRANSITION_EVENT) {
|
||||
if (atom == nsGkAtoms::onpageshow)
|
||||
mEvent->message = NS_PAGE_SHOW;
|
||||
else if (atom == nsGkAtoms::onpagehide)
|
||||
mEvent->message = NS_PAGE_HIDE;
|
||||
} else if (mEvent->eventStructType == NS_XUL_COMMAND_EVENT) {
|
||||
if (atom == nsGkAtoms::oncommand)
|
||||
mEvent->message = NS_XUL_COMMAND;
|
||||
@ -943,13 +942,6 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
|
||||
static_cast<nsUIEvent*>(mEvent)->detail);
|
||||
break;
|
||||
}
|
||||
case NS_PAGETRANSITION_EVENT:
|
||||
{
|
||||
newEvent =
|
||||
new nsPageTransitionEvent(PR_FALSE, msg,
|
||||
((nsPageTransitionEvent*) mEvent)->persisted);
|
||||
break;
|
||||
}
|
||||
#ifdef MOZ_SVG
|
||||
case NS_SVG_EVENT:
|
||||
{
|
||||
|
@ -39,21 +39,6 @@
|
||||
#include "nsDOMPageTransitionEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
nsDOMPageTransitionEvent::nsDOMPageTransitionEvent(nsPresContext* aPresContext,
|
||||
nsPageTransitionEvent* aEvent)
|
||||
: nsDOMEvent(aPresContext, aEvent ? aEvent :
|
||||
new nsPageTransitionEvent(PR_FALSE, 0, PR_FALSE))
|
||||
{
|
||||
if ( aEvent ) {
|
||||
mEventIsInternal = PR_FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
mEventIsInternal = PR_TRUE;
|
||||
mEvent->time = PR_Now();
|
||||
}
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMPageTransitionEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMPageTransitionEvent)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(PageTransitionEvent)
|
||||
@ -65,7 +50,7 @@ NS_IMPL_RELEASE_INHERITED(nsDOMPageTransitionEvent, nsDOMEvent)
|
||||
NS_IMETHODIMP
|
||||
nsDOMPageTransitionEvent::GetPersisted(PRBool* aPersisted)
|
||||
{
|
||||
*aPersisted = static_cast<nsPageTransitionEvent*>(mEvent)->persisted;
|
||||
*aPersisted = mPersisted;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -78,13 +63,13 @@ nsDOMPageTransitionEvent::InitPageTransitionEvent(const nsAString &aTypeArg,
|
||||
nsresult rv = nsDOMEvent::InitEvent(aTypeArg, aCanBubbleArg, aCancelableArg);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
static_cast<nsPageTransitionEvent*>(mEvent)->persisted = aPersisted;
|
||||
mPersisted = aPersisted;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult NS_NewDOMPageTransitionEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsPresContext* aPresContext,
|
||||
nsPageTransitionEvent *aEvent)
|
||||
nsEvent *aEvent)
|
||||
{
|
||||
nsDOMPageTransitionEvent* it =
|
||||
new nsDOMPageTransitionEvent(aPresContext, aEvent);
|
||||
|
@ -46,15 +46,17 @@ class nsDOMPageTransitionEvent : public nsIDOMPageTransitionEvent,
|
||||
public nsDOMEvent
|
||||
{
|
||||
public:
|
||||
nsDOMPageTransitionEvent(nsPresContext* aPresContext,
|
||||
nsPageTransitionEvent* aEvent);
|
||||
|
||||
nsDOMPageTransitionEvent(nsPresContext* aPresContext, nsEvent* aEvent) :
|
||||
nsDOMEvent(aPresContext, aEvent), mPersisted(PR_FALSE) {}
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
NS_DECL_NSIDOMPAGETRANSITIONEVENT
|
||||
|
||||
// Forward to base class
|
||||
NS_FORWARD_TO_NSDOMEVENT
|
||||
protected:
|
||||
PRBool mPersisted;
|
||||
};
|
||||
|
||||
#endif // nsDOMPageTransitionEvent_h__
|
||||
|
@ -620,10 +620,6 @@ nsEventDispatcher::CreateEvent(nsPresContext* aPresContext,
|
||||
case NS_MUTATION_EVENT:
|
||||
return NS_NewDOMMutationEvent(aDOMEvent, aPresContext,
|
||||
static_cast<nsMutationEvent*>(aEvent));
|
||||
case NS_PAGETRANSITION_EVENT:
|
||||
return NS_NewDOMPageTransitionEvent(aDOMEvent, aPresContext,
|
||||
static_cast<nsPageTransitionEvent*>
|
||||
(aEvent));
|
||||
case NS_GUI_EVENT:
|
||||
case NS_COMPOSITION_EVENT:
|
||||
case NS_SCROLLPORT_EVENT:
|
||||
@ -726,6 +722,8 @@ nsEventDispatcher::CreateEvent(nsPresContext* aPresContext,
|
||||
return NS_NewDOMSimpleGestureEvent(aDOMEvent, aPresContext, nsnull);
|
||||
if (aEventType.LowerCaseEqualsLiteral("beforeunloadevent"))
|
||||
return NS_NewDOMBeforeUnloadEvent(aDOMEvent, aPresContext, nsnull);
|
||||
if (aEventType.LowerCaseEqualsLiteral("pagetransition"))
|
||||
return NS_NewDOMPageTransitionEvent(aDOMEvent, aPresContext, nsnull);
|
||||
|
||||
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
||||
}
|
||||
|
@ -92,7 +92,6 @@ class nsHashKey;
|
||||
|
||||
|
||||
#define NS_UI_EVENT 27
|
||||
#define NS_PAGETRANSITION_EVENT 29
|
||||
#ifdef MOZ_SVG
|
||||
#define NS_SVG_EVENT 30
|
||||
#define NS_SVGZOOM_EVENT 31
|
||||
@ -1209,21 +1208,6 @@ public:
|
||||
PRInt32 detail;
|
||||
};
|
||||
|
||||
/**
|
||||
* PageTransition event
|
||||
*/
|
||||
class nsPageTransitionEvent : public nsEvent
|
||||
{
|
||||
public:
|
||||
nsPageTransitionEvent(PRBool isTrusted, PRUint32 msg, PRBool p)
|
||||
: nsEvent(isTrusted, msg, NS_PAGETRANSITION_EVENT),
|
||||
persisted(p)
|
||||
{
|
||||
}
|
||||
|
||||
PRBool persisted;
|
||||
};
|
||||
|
||||
/**
|
||||
* XUL command event
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user