mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 857884 - Use dom::EventTarget more in content/ and dom/ Part 2 r=Ms2ger
This commit is contained in:
parent
59707ec484
commit
3febe3b914
@ -120,6 +120,7 @@ class Selection;
|
||||
namespace dom {
|
||||
class DocumentFragment;
|
||||
class Element;
|
||||
class EventTarget;
|
||||
} // namespace dom
|
||||
|
||||
namespace layers {
|
||||
@ -2258,10 +2259,10 @@ public:
|
||||
~nsCxPusher(); // Calls Pop();
|
||||
|
||||
// Returns false if something erroneous happened.
|
||||
bool Push(nsIDOMEventTarget *aCurrentTarget);
|
||||
bool Push(mozilla::dom::EventTarget *aCurrentTarget);
|
||||
// If nothing has been pushed to stack, this works like Push.
|
||||
// Otherwise if context will change, Pop and Push will be called.
|
||||
bool RePush(nsIDOMEventTarget *aCurrentTarget);
|
||||
bool RePush(mozilla::dom::EventTarget *aCurrentTarget);
|
||||
// If a null JSContext is passed to Push(), that will cause no
|
||||
// push to happen and false to be returned.
|
||||
void Push(JSContext *cx);
|
||||
|
@ -3061,7 +3061,7 @@ IsContextOnStack(nsIJSContextStack *aStack, JSContext *aContext)
|
||||
}
|
||||
|
||||
bool
|
||||
nsCxPusher::Push(nsIDOMEventTarget *aCurrentTarget)
|
||||
nsCxPusher::Push(EventTarget *aCurrentTarget)
|
||||
{
|
||||
if (mPushedSomething) {
|
||||
NS_ERROR("Whaaa! No double pushing with nsCxPusher::Push()!");
|
||||
@ -3098,7 +3098,7 @@ nsCxPusher::Push(nsIDOMEventTarget *aCurrentTarget)
|
||||
}
|
||||
|
||||
bool
|
||||
nsCxPusher::RePush(nsIDOMEventTarget *aCurrentTarget)
|
||||
nsCxPusher::RePush(EventTarget *aCurrentTarget)
|
||||
{
|
||||
if (!mPushedSomething) {
|
||||
return Push(aCurrentTarget);
|
||||
@ -3554,10 +3554,10 @@ nsresult GetEventAndTarget(nsIDocument* aDoc, nsISupports* aTarget,
|
||||
const nsAString& aEventName,
|
||||
bool aCanBubble, bool aCancelable,
|
||||
bool aTrusted, nsIDOMEvent** aEvent,
|
||||
nsIDOMEventTarget** aTargetOut)
|
||||
EventTarget** aTargetOut)
|
||||
{
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(aDoc);
|
||||
nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(aTarget));
|
||||
nsCOMPtr<EventTarget> target(do_QueryInterface(aTarget));
|
||||
NS_ENSURE_TRUE(domDoc && target, NS_ERROR_INVALID_ARG);
|
||||
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
@ -3608,7 +3608,7 @@ nsContentUtils::DispatchEvent(nsIDocument* aDoc, nsISupports* aTarget,
|
||||
bool aTrusted, bool *aDefaultAction)
|
||||
{
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
nsCOMPtr<EventTarget> target;
|
||||
nsresult rv = GetEventAndTarget(aDoc, aTarget, aEventName, aCanBubble,
|
||||
aCancelable, aTrusted, getter_AddRefs(event),
|
||||
getter_AddRefs(target));
|
||||
@ -3627,7 +3627,7 @@ nsContentUtils::DispatchChromeEvent(nsIDocument *aDoc,
|
||||
{
|
||||
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
nsCOMPtr<EventTarget> target;
|
||||
nsresult rv = GetEventAndTarget(aDoc, aTarget, aEventName, aCanBubble,
|
||||
aCancelable, true, getter_AddRefs(event),
|
||||
getter_AddRefs(target));
|
||||
@ -3637,7 +3637,7 @@ nsContentUtils::DispatchChromeEvent(nsIDocument *aDoc,
|
||||
if (!aDoc->GetWindow())
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
nsIDOMEventTarget* piTarget = aDoc->GetWindow()->GetParentTarget();
|
||||
EventTarget* piTarget = aDoc->GetWindow()->GetParentTarget();
|
||||
if (!piTarget)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
@ -3879,7 +3879,7 @@ nsContentUtils::HasMutationListeners(nsINode* aNode,
|
||||
|
||||
// If we have a window, we can check it for mutation listeners now.
|
||||
if (aNode->IsInDoc()) {
|
||||
nsCOMPtr<nsIDOMEventTarget> piTarget(do_QueryInterface(window));
|
||||
nsCOMPtr<EventTarget> piTarget(do_QueryInterface(window));
|
||||
if (piTarget) {
|
||||
nsEventListenerManager* manager = piTarget->GetListenerManager(false);
|
||||
if (manager && manager->HasMutationListeners()) {
|
||||
@ -5926,7 +5926,7 @@ nsContentUtils::DispatchXULCommand(nsIContent* aTarget,
|
||||
return aShell->HandleDOMEventWithTarget(aTarget, event, &status);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(aTarget);
|
||||
nsCOMPtr<EventTarget> target = do_QueryInterface(aTarget);
|
||||
NS_ENSURE_STATE(target);
|
||||
bool dummy;
|
||||
return target->DispatchEvent(event, &dummy);
|
||||
|
@ -4461,11 +4461,10 @@ nsDocument::DispatchContentLoadedEvents()
|
||||
// target_frame is the [i]frame element that will be used as the
|
||||
// target for the event. It's the [i]frame whose content is done
|
||||
// loading.
|
||||
nsCOMPtr<nsIDOMEventTarget> target_frame;
|
||||
nsCOMPtr<EventTarget> target_frame;
|
||||
|
||||
if (mParentDocument) {
|
||||
target_frame =
|
||||
do_QueryInterface(mParentDocument->FindContentForSubDocument(this));
|
||||
target_frame = mParentDocument->FindContentForSubDocument(this);
|
||||
}
|
||||
|
||||
if (target_frame) {
|
||||
@ -6942,7 +6941,7 @@ nsDocument::GetListenerManager(bool aCreateIfNotFound)
|
||||
{
|
||||
if (!mListenerManager && aCreateIfNotFound) {
|
||||
mListenerManager =
|
||||
new nsEventListenerManager(static_cast<nsIDOMEventTarget*>(this));
|
||||
new nsEventListenerManager(static_cast<EventTarget*>(this));
|
||||
SetFlags(NODE_HAS_LISTENERMANAGER);
|
||||
}
|
||||
|
||||
@ -9272,7 +9271,7 @@ nsIDocument::CreateTouch(nsIDOMWindow* aView,
|
||||
float aRotationAngle,
|
||||
float aForce)
|
||||
{
|
||||
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(aTarget);
|
||||
nsCOMPtr<EventTarget> target = do_QueryInterface(aTarget);
|
||||
nsCOMPtr<nsIDOMTouch> touch = new Touch(target,
|
||||
aIdentifier,
|
||||
aPageX, aPageY,
|
||||
|
@ -2389,7 +2389,7 @@ nsFrameLoader::EnsureMessageManager()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIDOMEventTarget*
|
||||
EventTarget*
|
||||
nsFrameLoader::GetTabChildGlobalAsEventTarget()
|
||||
{
|
||||
return static_cast<nsInProcessTabChildGlobal*>(mChildMessageManager.get());
|
||||
|
@ -179,7 +179,7 @@ public:
|
||||
nsresult ReallyStartLoading();
|
||||
void Finalize();
|
||||
nsIDocShell* GetExistingDocShell() { return mDocShell; }
|
||||
nsIDOMEventTarget* GetTabChildGlobalAsEventTarget();
|
||||
mozilla::dom::EventTarget* GetTabChildGlobalAsEventTarget();
|
||||
nsresult CreateStaticClone(nsIFrameLoader* aDest);
|
||||
|
||||
/**
|
||||
|
@ -326,7 +326,7 @@ void
|
||||
nsXMLHttpRequest::RootJSResultObjects()
|
||||
{
|
||||
nsContentUtils::PreserveWrapper(
|
||||
static_cast<nsIDOMEventTarget*>(
|
||||
static_cast<EventTarget*>(
|
||||
static_cast<nsDOMEventTargetHelper*>(this)), this);
|
||||
}
|
||||
|
||||
@ -2149,7 +2149,7 @@ nsXMLHttpRequest::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult
|
||||
if (mIsHtml) {
|
||||
NS_ASSERTION(!(mState & XML_HTTP_REQUEST_SYNCLOOPING),
|
||||
"We weren't supposed to support HTML parsing with XHR!");
|
||||
nsCOMPtr<nsIDOMEventTarget> eventTarget = do_QueryInterface(mResponseXML);
|
||||
nsCOMPtr<EventTarget> eventTarget = do_QueryInterface(mResponseXML);
|
||||
nsEventListenerManager* manager = eventTarget->GetListenerManager(true);
|
||||
manager->AddEventListenerByType(new nsXHRParseEndListener(this),
|
||||
NS_LITERAL_STRING("DOMContentLoaded"),
|
||||
|
@ -230,7 +230,7 @@ public:
|
||||
nsIDOMEvent* aDOMEvent = nullptr,
|
||||
nsEventStatus* aEventStatus = nullptr,
|
||||
nsDispatchingCallback* aCallback = nullptr,
|
||||
nsCOMArray<nsIDOMEventTarget>* aTargets = nullptr);
|
||||
nsCOMArray<mozilla::dom::EventTarget>* aTargets = nullptr);
|
||||
|
||||
/**
|
||||
* Dispatches an event.
|
||||
|
@ -19,7 +19,7 @@ namespace dom {
|
||||
class Touch MOZ_FINAL : public nsIDOMTouch
|
||||
{
|
||||
public:
|
||||
Touch(nsIDOMEventTarget* aTarget,
|
||||
Touch(mozilla::dom::EventTarget* aTarget,
|
||||
int32_t aIdentifier,
|
||||
int32_t aPageX,
|
||||
int32_t aPageY,
|
||||
@ -87,7 +87,7 @@ public:
|
||||
mScreenPoint = nsDOMEvent::GetScreenCoords(aPresContext, aEvent, mRefPoint);
|
||||
mPointsInitialized = true;
|
||||
}
|
||||
void SetTarget(nsIDOMEventTarget *aTarget)
|
||||
void SetTarget(mozilla::dom::EventTarget *aTarget)
|
||||
{
|
||||
mTarget = aTarget;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ NS_IMETHODIMP nsAsyncDOMEvent::Run()
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target = window->GetParentTarget();
|
||||
nsCOMPtr<EventTarget> target = window->GetParentTarget();
|
||||
if (!target) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
@ -45,15 +45,15 @@ public:
|
||||
|
||||
static nsDOMEventTargetHelper* FromSupports(nsISupports* aSupports)
|
||||
{
|
||||
nsIDOMEventTarget* target =
|
||||
static_cast<nsIDOMEventTarget*>(aSupports);
|
||||
mozilla::dom::EventTarget* target =
|
||||
static_cast<mozilla::dom::EventTarget*>(aSupports);
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<nsIDOMEventTarget> target_qi =
|
||||
nsCOMPtr<mozilla::dom::EventTarget> target_qi =
|
||||
do_QueryInterface(aSupports);
|
||||
|
||||
// If this assertion fires the QI implementation for the object in
|
||||
// question doesn't use the nsIDOMEventTarget pointer as the
|
||||
// question doesn't use the EventTarget pointer as the
|
||||
// nsISupports pointer. That must be fixed, or we'll crash...
|
||||
NS_ASSERTION(target_qi == target, "Uh, fix QI!");
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ nsEventTargetChainItem::HandleEventTargetChain(
|
||||
{
|
||||
uint32_t createdELMs = nsEventListenerManager::sCreatedCount;
|
||||
// Save the target so that it can be restored later.
|
||||
nsCOMPtr<nsIDOMEventTarget> firstTarget = aVisitor.mEvent->target;
|
||||
nsCOMPtr<EventTarget> firstTarget = aVisitor.mEvent->target;
|
||||
|
||||
// Capture
|
||||
nsEventTargetChainItem* item = this;
|
||||
@ -306,7 +306,7 @@ nsEventTargetChainItem::HandleEventTargetChain(
|
||||
// item is at anonymous boundary. Need to retarget for the child items.
|
||||
nsEventTargetChainItem* nextTarget = item->mChild;
|
||||
while (nextTarget) {
|
||||
nsIDOMEventTarget* newTarget = nextTarget->GetNewTarget();
|
||||
EventTarget* newTarget = nextTarget->GetNewTarget();
|
||||
if (newTarget) {
|
||||
aVisitor.mEvent->target = newTarget;
|
||||
break;
|
||||
@ -336,7 +336,7 @@ nsEventTargetChainItem::HandleEventTargetChain(
|
||||
aVisitor.mEvent->mFlags.mInCapturePhase = false;
|
||||
item = item->mParent;
|
||||
while (item) {
|
||||
nsIDOMEventTarget* newTarget = item->GetNewTarget();
|
||||
EventTarget* newTarget = item->GetNewTarget();
|
||||
if (newTarget) {
|
||||
// Item is at anonymous boundary. Need to retarget for the current item
|
||||
// and for parent items.
|
||||
@ -428,7 +428,7 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget,
|
||||
nsIDOMEvent* aDOMEvent,
|
||||
nsEventStatus* aEventStatus,
|
||||
nsDispatchingCallback* aCallback,
|
||||
nsCOMArray<nsIDOMEventTarget>* aTargets)
|
||||
nsCOMArray<EventTarget>* aTargets)
|
||||
{
|
||||
PROFILER_LABEL("nsEventDispatcher", "Dispatch");
|
||||
NS_ASSERTION(aEvent, "Trying to dispatch without nsEvent!");
|
||||
|
@ -218,7 +218,7 @@ nsEventListenerService::GetEventTargetChainFor(nsIDOMEventTarget* aEventTarget,
|
||||
*aOutArray = nullptr;
|
||||
NS_ENSURE_ARG(aEventTarget);
|
||||
nsEvent event(true, NS_EVENT_TYPE_NULL);
|
||||
nsCOMArray<nsIDOMEventTarget> targets;
|
||||
nsCOMArray<EventTarget> targets;
|
||||
nsresult rv = nsEventDispatcher::Dispatch(aEventTarget, nullptr, &event,
|
||||
nullptr, nullptr, nullptr, &targets);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -1666,8 +1666,7 @@ nsEventStateManager::HandleCrossProcessEvent(nsEvent *aEvent,
|
||||
if (!touch || !touch->mChanged) {
|
||||
continue;
|
||||
}
|
||||
nsCOMPtr<nsIDOMEventTarget> targetPtr;
|
||||
touch->GetTarget(getter_AddRefs(targetPtr));
|
||||
nsCOMPtr<EventTarget> targetPtr = touch->GetTarget();
|
||||
if (!targetPtr) {
|
||||
continue;
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ nsSMILTimeValueSpec::GetEventListenerManager(Element* aTarget)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(aTarget, "null target; can't get EventListenerManager");
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
nsCOMPtr<EventTarget> target;
|
||||
|
||||
if (mParams.mType == nsSMILTimeValueSpecParams::ACCESSKEY) {
|
||||
nsIDocument* doc = aTarget->GetCurrentDoc();
|
||||
|
@ -4,14 +4,17 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsXBLPrototypeHandler.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "mozilla/dom/EventTarget.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
nsXBLEventHandler::nsXBLEventHandler(nsXBLPrototypeHandler* aHandler)
|
||||
: mProtoHandler(aHandler)
|
||||
@ -41,10 +44,8 @@ nsXBLEventHandler::HandleEvent(nsIDOMEvent* aEvent)
|
||||
if (!EventMatched(aEvent))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
aEvent->GetCurrentTarget(getter_AddRefs(target));
|
||||
|
||||
mProtoHandler->ExecuteHandler(target, aEvent);
|
||||
mProtoHandler->ExecuteHandler(aEvent->InternalDOMEvent()->GetCurrentTarget(),
|
||||
aEvent);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -88,8 +89,7 @@ nsXBLKeyEventHandler::ExecuteMatchedHandlers(nsIDOMKeyEvent* aKeyEvent,
|
||||
bool trustedEvent = false;
|
||||
aKeyEvent->GetIsTrusted(&trustedEvent);
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
aKeyEvent->GetCurrentTarget(getter_AddRefs(target));
|
||||
nsCOMPtr<EventTarget> target = aKeyEvent->InternalDOMEvent()->GetCurrentTarget();
|
||||
|
||||
bool executed = false;
|
||||
for (uint32_t i = 0; i < mProtoHandlers.Length(); ++i) {
|
||||
|
@ -187,7 +187,7 @@ nsXBLPrototypeHandler::InitAccessKeys()
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXBLPrototypeHandler::ExecuteHandler(nsIDOMEventTarget* aTarget,
|
||||
nsXBLPrototypeHandler::ExecuteHandler(EventTarget* aTarget,
|
||||
nsIDOMEvent* aEvent)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
@ -418,7 +418,7 @@ nsXBLPrototypeHandler::EnsureEventHandler(nsIScriptGlobalObject* aGlobal,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXBLPrototypeHandler::DispatchXBLCommand(nsIDOMEventTarget* aTarget, nsIDOMEvent* aEvent)
|
||||
nsXBLPrototypeHandler::DispatchXBLCommand(EventTarget* aTarget, nsIDOMEvent* aEvent)
|
||||
{
|
||||
// This is a special-case optimization to make command handling fast.
|
||||
// It isn't really a part of XBL, but it helps speed things up.
|
||||
@ -585,9 +585,9 @@ nsXBLPrototypeHandler::GetEventName()
|
||||
}
|
||||
|
||||
already_AddRefed<nsIController>
|
||||
nsXBLPrototypeHandler::GetController(nsIDOMEventTarget* aTarget)
|
||||
nsXBLPrototypeHandler::GetController(EventTarget* aTarget)
|
||||
{
|
||||
// XXX Fix this so there's a generic interface that describes controllers,
|
||||
// XXX Fix this so there's a generic interface that describes controllers,
|
||||
// This code should have no special knowledge of what objects might have controllers.
|
||||
nsCOMPtr<nsIControllers> controllers;
|
||||
|
||||
|
@ -24,11 +24,16 @@ class nsIContent;
|
||||
class nsIDOMUIEvent;
|
||||
class nsIDOMKeyEvent;
|
||||
class nsIDOMMouseEvent;
|
||||
class nsIDOMEventTarget;
|
||||
class nsIObjectInputStream;
|
||||
class nsIObjectOutputStream;
|
||||
class nsXBLPrototypeBinding;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class EventTarget;
|
||||
}
|
||||
}
|
||||
|
||||
#define NS_HANDLER_TYPE_XBL_JS (1 << 0)
|
||||
#define NS_HANDLER_TYPE_XBL_COMMAND (1 << 1)
|
||||
#define NS_HANDLER_TYPE_XUL (1 << 2)
|
||||
@ -99,7 +104,7 @@ public:
|
||||
nsXBLPrototypeHandler* GetNextHandler() { return mNextHandler; }
|
||||
void SetNextHandler(nsXBLPrototypeHandler* aHandler) { mNextHandler = aHandler; }
|
||||
|
||||
nsresult ExecuteHandler(nsIDOMEventTarget* aTarget, nsIDOMEvent* aEvent);
|
||||
nsresult ExecuteHandler(mozilla::dom::EventTarget* aTarget, nsIDOMEvent* aEvent);
|
||||
|
||||
already_AddRefed<nsIAtom> GetEventName();
|
||||
void SetEventName(nsIAtom* aName) { mEventName = aName; }
|
||||
@ -136,7 +141,7 @@ public:
|
||||
|
||||
public:
|
||||
static uint32_t gRefCnt;
|
||||
|
||||
|
||||
protected:
|
||||
void Init() {
|
||||
++gRefCnt;
|
||||
@ -145,10 +150,10 @@ protected:
|
||||
InitAccessKeys();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIController> GetController(nsIDOMEventTarget* aTarget);
|
||||
|
||||
already_AddRefed<nsIController> GetController(mozilla::dom::EventTarget* aTarget);
|
||||
|
||||
inline int32_t GetMatchingKeyCode(const nsAString& aKeyName);
|
||||
void ConstructPrototype(nsIContent* aKeyElement,
|
||||
void ConstructPrototype(nsIContent* aKeyElement,
|
||||
const PRUnichar* aEvent=nullptr, const PRUnichar* aPhase=nullptr,
|
||||
const PRUnichar* aAction=nullptr, const PRUnichar* aCommand=nullptr,
|
||||
const PRUnichar* aKeyCode=nullptr, const PRUnichar* aCharCode=nullptr,
|
||||
@ -161,7 +166,7 @@ protected:
|
||||
void GetEventType(nsAString& type);
|
||||
bool ModifiersMatchMask(nsIDOMUIEvent* aEvent,
|
||||
bool aIgnoreShiftKey = false);
|
||||
nsresult DispatchXBLCommand(nsIDOMEventTarget* aTarget, nsIDOMEvent* aEvent);
|
||||
nsresult DispatchXBLCommand(mozilla::dom::EventTarget* aTarget, nsIDOMEvent* aEvent);
|
||||
nsresult DispatchXULKeyCommand(nsIDOMEvent* aEvent);
|
||||
nsresult EnsureEventHandler(nsIScriptGlobalObject* aGlobal,
|
||||
nsIScriptContext *aBoundContext, nsIAtom *aName,
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsXBLSerialize.h"
|
||||
#include "nsDOMEvent.h"
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
#include "nsXULPrototypeCache.h"
|
||||
@ -286,8 +287,8 @@ nsXBLStreamListener::HandleEvent(nsIDOMEvent* aEvent)
|
||||
|
||||
// Get the binding document; note that we don't hold onto it in this object
|
||||
// to avoid creating a cycle
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
aEvent->GetCurrentTarget(getter_AddRefs(target));
|
||||
nsDOMEvent* event = aEvent->InternalDOMEvent();
|
||||
EventTarget* target = event->GetCurrentTarget();
|
||||
nsCOMPtr<nsIDocument> bindingDocument = do_QueryInterface(target);
|
||||
NS_ASSERTION(bindingDocument, "Event not targeted at document?!");
|
||||
|
||||
@ -558,11 +559,11 @@ nsXBLService::FlushStyleBindings(nsIContent* aContent)
|
||||
// then extra work needs to be done to hook it up to the document (XXX WHY??)
|
||||
//
|
||||
nsresult
|
||||
nsXBLService::AttachGlobalKeyHandler(nsIDOMEventTarget* aTarget)
|
||||
nsXBLService::AttachGlobalKeyHandler(EventTarget* aTarget)
|
||||
{
|
||||
// check if the receiver is a content node (not a document), and hook
|
||||
// it to the document if that is the case.
|
||||
nsCOMPtr<nsIDOMEventTarget> piTarget = aTarget;
|
||||
nsCOMPtr<EventTarget> piTarget = aTarget;
|
||||
nsCOMPtr<nsIContent> contentNode(do_QueryInterface(aTarget));
|
||||
if (contentNode) {
|
||||
// Only attach if we're really in a document
|
||||
@ -572,7 +573,7 @@ nsXBLService::AttachGlobalKeyHandler(nsIDOMEventTarget* aTarget)
|
||||
}
|
||||
|
||||
nsEventListenerManager* manager = piTarget->GetListenerManager(true);
|
||||
|
||||
|
||||
if (!piTarget || !manager)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -612,9 +613,9 @@ nsXBLService::AttachGlobalKeyHandler(nsIDOMEventTarget* aTarget)
|
||||
// Removes a key handler added by DeatchGlobalKeyHandler.
|
||||
//
|
||||
nsresult
|
||||
nsXBLService::DetachGlobalKeyHandler(nsIDOMEventTarget* aTarget)
|
||||
nsXBLService::DetachGlobalKeyHandler(EventTarget* aTarget)
|
||||
{
|
||||
nsCOMPtr<nsIDOMEventTarget> piTarget = aTarget;
|
||||
nsCOMPtr<EventTarget> piTarget = aTarget;
|
||||
nsCOMPtr<nsIContent> contentNode(do_QueryInterface(aTarget));
|
||||
if (!contentNode) // detaching is only supported for content nodes
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -625,7 +626,7 @@ nsXBLService::DetachGlobalKeyHandler(nsIDOMEventTarget* aTarget)
|
||||
piTarget = do_QueryInterface(doc);
|
||||
|
||||
nsEventListenerManager* manager = piTarget->GetListenerManager(true);
|
||||
|
||||
|
||||
if (!piTarget || !manager)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -24,7 +24,12 @@ class nsIURI;
|
||||
class nsIPrincipal;
|
||||
class nsSupportsHashtable;
|
||||
class nsHashtable;
|
||||
class nsIDOMEventTarget;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class EventTarget;
|
||||
}
|
||||
}
|
||||
|
||||
class nsXBLService : public nsIObserver,
|
||||
public nsSupportsWeakReference
|
||||
@ -63,8 +68,8 @@ class nsXBLService : public nsIObserver,
|
||||
nsXBLDocumentInfo** aResult);
|
||||
|
||||
// Used by XUL key bindings and for window XBL.
|
||||
static nsresult AttachGlobalKeyHandler(nsIDOMEventTarget* aTarget);
|
||||
static nsresult DetachGlobalKeyHandler(nsIDOMEventTarget* aTarget);
|
||||
static nsresult AttachGlobalKeyHandler(mozilla::dom::EventTarget* aTarget);
|
||||
static nsresult DetachGlobalKeyHandler(mozilla::dom::EventTarget* aTarget);
|
||||
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "nsEventStateManager.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
static nsINativeKeyBindings *sNativeEditorBindings = nullptr;
|
||||
|
||||
@ -540,12 +541,12 @@ nsXBLWindowKeyHandler::WalkHandlersAndExecute(nsIDOMKeyEvent* aKeyEvent,
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> piTarget;
|
||||
nsCOMPtr<EventTarget> piTarget;
|
||||
nsCOMPtr<nsIDOMElement> element = GetElement();
|
||||
if (element) {
|
||||
piTarget = do_QueryInterface(commandElt);
|
||||
} else {
|
||||
piTarget = mTarget;
|
||||
piTarget = do_QueryInterface(mTarget);
|
||||
}
|
||||
|
||||
rv = currHandler->ExecuteHandler(piTarget, aKeyEvent);
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
@ -33,6 +32,7 @@
|
||||
#include "nsHTMLReflowState.h"
|
||||
#include "nsIObjectLoadingContent.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/EventTarget.h"
|
||||
#include "mozilla/dom/FragmentOrElement.h"
|
||||
|
||||
// for event firing in context menus
|
||||
@ -43,8 +43,10 @@
|
||||
#include "nsViewManager.h"
|
||||
#include "nsError.h"
|
||||
#include "nsMenuFrame.h"
|
||||
#include "nsDOMEvent.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
// on win32 and os/2, context menus come up on mouse up. On other platforms,
|
||||
// they appear on mouse down. Certain bits of code care about this difference.
|
||||
@ -113,8 +115,7 @@ nsXULPopupListener::HandleEvent(nsIDOMEvent* aEvent)
|
||||
}
|
||||
|
||||
// Get the node that was clicked on.
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
mouseEvent->GetTarget(getter_AddRefs(target));
|
||||
EventTarget* target = mouseEvent->InternalDOMEvent()->GetTarget();
|
||||
nsCOMPtr<nsIDOMNode> targetNode = do_QueryInterface(target);
|
||||
|
||||
if (!targetNode && mIsContext) {
|
||||
|
@ -750,7 +750,7 @@ protected:
|
||||
// For that reasons don't use nsCOMPtr.
|
||||
|
||||
nsIDocShellTreeOwner * mTreeOwner; // Weak Reference
|
||||
nsIDOMEventTarget * mChromeEventHandler; //Weak Reference
|
||||
nsIDOMEventTarget * mChromeEventHandler; //Weak Reference
|
||||
|
||||
eCharsetReloadState mCharsetReloadState;
|
||||
|
||||
|
@ -2724,9 +2724,8 @@ TryGetTabChildGlobalAsEventTarget(nsISupports *aFrom)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
nsCOMPtr<EventTarget> eventTarget =
|
||||
do_QueryInterface(frameLoader->GetTabChildGlobalAsEventTarget());
|
||||
return eventTarget.forget();
|
||||
nsCOMPtr<EventTarget> target = frameLoader->GetTabChildGlobalAsEventTarget();
|
||||
return target.forget();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -29,9 +29,9 @@ interface nsIDOMTouch : nsISupports {
|
||||
readonly attribute float rotationAngle;
|
||||
readonly attribute float force;
|
||||
%{C++
|
||||
nsCOMPtr<nsIDOMEventTarget> mTarget;
|
||||
nsIDOMEventTarget *GetTarget() { return mTarget; }
|
||||
void SetTarget(nsIDOMEventTarget *target) { mTarget = target; }
|
||||
nsCOMPtr<mozilla::dom::EventTarget> mTarget;
|
||||
mozilla::dom::EventTarget *GetTarget() { return mTarget; }
|
||||
void SetTarget(mozilla::dom::EventTarget *target) { mTarget = target; }
|
||||
nsIntPoint mRefPoint;
|
||||
bool mChanged;
|
||||
uint32_t mMessage;
|
||||
|
@ -1768,7 +1768,7 @@ nsPresContext::MediaFeatureValuesChanged(StyleRebuildType aShouldRebuild,
|
||||
|
||||
if (!notifyList.IsEmpty()) {
|
||||
nsPIDOMWindow *win = mDocument->GetInnerWindow();
|
||||
nsCOMPtr<nsIDOMEventTarget> et = do_QueryInterface(win);
|
||||
nsCOMPtr<EventTarget> et = do_QueryInterface(win);
|
||||
nsCxPusher pusher;
|
||||
|
||||
for (uint32_t i = 0, i_end = notifyList.Length(); i != i_end; ++i) {
|
||||
|
@ -6255,9 +6255,7 @@ PresShell::HandleEvent(nsIFrame *aFrame,
|
||||
nsCOMPtr<nsIDOMTouch> oldTouch;
|
||||
gCaptureTouchList.Get(id, getter_AddRefs(oldTouch));
|
||||
if (oldTouch) {
|
||||
nsCOMPtr<nsIDOMEventTarget> targetPtr;
|
||||
oldTouch->GetTarget(getter_AddRefs(targetPtr));
|
||||
domtouch->SetTarget(targetPtr);
|
||||
domtouch->SetTarget(oldTouch->GetTarget());
|
||||
gCaptureTouchList.Put(id, touch);
|
||||
}
|
||||
}
|
||||
@ -6732,8 +6730,7 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsEventStatus* aStatus)
|
||||
if (!oldTouch) {
|
||||
continue;
|
||||
}
|
||||
nsCOMPtr<nsIDOMEventTarget> targetPtr;
|
||||
oldTouch->GetTarget(getter_AddRefs(targetPtr));
|
||||
nsCOMPtr<EventTarget> targetPtr = oldTouch->GetTarget();
|
||||
|
||||
mCurrentEventContent = do_QueryInterface(targetPtr);
|
||||
domtouch->SetTarget(targetPtr);
|
||||
@ -6770,8 +6767,7 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsEventStatus* aStatus)
|
||||
haveChanged = true;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> targetPtr;
|
||||
oldTouch->GetTarget(getter_AddRefs(targetPtr));
|
||||
nsCOMPtr<EventTarget> targetPtr = oldTouch->GetTarget();
|
||||
if (!targetPtr) {
|
||||
touches.RemoveElementAt(i);
|
||||
continue;
|
||||
@ -6923,8 +6919,7 @@ PresShell::DispatchTouchEvent(nsEvent *aEvent,
|
||||
continue;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> targetPtr;
|
||||
touch->GetTarget(getter_AddRefs(targetPtr));
|
||||
nsCOMPtr<EventTarget> targetPtr = touch->GetTarget();
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(targetPtr);
|
||||
if (!content) {
|
||||
continue;
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsIDOMWheelEvent.h"
|
||||
#include "nsIDOMDataTransfer.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMTouchEvent.h"
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsIWidget.h"
|
||||
@ -30,6 +29,7 @@
|
||||
#include "nsIVariant.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/dom/EventTarget.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -673,9 +673,9 @@ public:
|
||||
// Additional type info for user defined events
|
||||
nsCOMPtr<nsIAtom> userType;
|
||||
// Event targets, needed by DOM Events
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
nsCOMPtr<nsIDOMEventTarget> currentTarget;
|
||||
nsCOMPtr<nsIDOMEventTarget> originalTarget;
|
||||
nsCOMPtr<mozilla::dom::EventTarget> target;
|
||||
nsCOMPtr<mozilla::dom::EventTarget> currentTarget;
|
||||
nsCOMPtr<mozilla::dom::EventTarget> originalTarget;
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user