Issue #1792 - Part 2: Move GetParentObject() to EventTarget.h for re-use.

This commit is contained in:
Moonchild 2021-07-12 02:56:48 +00:00 • committed by roytam1
commit dd06472de7
2 changed files with 7 additions and 4 deletions

View file

@ -146,10 +146,7 @@ public:
void BindToOwner(nsPIDOMWindowInner* aOwner); void BindToOwner(nsPIDOMWindowInner* aOwner);
void BindToOwner(DOMEventTargetHelper* aOther); void BindToOwner(DOMEventTargetHelper* aOther);
virtual void DisconnectFromOwner(); virtual void DisconnectFromOwner();
nsIGlobalObject* GetParentObject() const using EventTarget::GetParentObject;
{
return GetOwnerGlobal();
}
virtual nsIGlobalObject* GetOwnerGlobal() const override virtual nsIGlobalObject* GetOwnerGlobal() const override
{ {
nsCOMPtr<nsIGlobalObject> parentObject = do_QueryReferent(mParentObject); nsCOMPtr<nsIGlobalObject> parentObject = do_QueryReferent(mParentObject);

View file

@ -26,6 +26,7 @@ class Event;
class EventListener; class EventListener;
class EventListenerOptionsOrBoolean; class EventListenerOptionsOrBoolean;
class EventHandlerNonNull; class EventHandlerNonNull;
class GlobalObject;
template <class T> struct Nullable; template <class T> struct Nullable;
@ -55,6 +56,11 @@ public:
ErrorResult& aRv); ErrorResult& aRv);
bool DispatchEvent(JSContext* aCx, Event& aEvent, ErrorResult& aRv); bool DispatchEvent(JSContext* aCx, Event& aEvent, ErrorResult& aRv);
nsIGlobalObject* GetParentObject() const
{
return GetOwnerGlobal();
}
// Note, this takes the type in onfoo form! // Note, this takes the type in onfoo form!
EventHandlerNonNull* GetEventHandler(const nsAString& aType) EventHandlerNonNull* GetEventHandler(const nsAString& aType)
{ {