mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 825392 - Parent Touch objects to the EventTarget's global. r=bz
This commit is contained in:
parent
a228c689cc
commit
42d8c2c8cd
@ -8,6 +8,7 @@
|
||||
#include "mozilla/dom/EventTarget.h"
|
||||
#include "mozilla/dom/TouchBinding.h"
|
||||
#include "mozilla/dom/TouchEvent.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIContent.h"
|
||||
|
||||
@ -139,5 +140,22 @@ Touch::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||
return TouchBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
// Parent ourselves to the window of the target. This achieves the desirable
|
||||
// effects of parenting to the target, but avoids making the touch inaccessible
|
||||
// when the target happens to be NAC and therefore reflected into the XBL scope.
|
||||
EventTarget*
|
||||
Touch::GetParentObject()
|
||||
{
|
||||
if (!mTarget) {
|
||||
return nullptr;
|
||||
}
|
||||
nsCOMPtr<nsPIDOMWindow> outer = do_QueryInterface(mTarget->GetOwnerGlobal());
|
||||
if (!outer) {
|
||||
return nullptr;
|
||||
}
|
||||
MOZ_ASSERT(outer->IsOuterWindow());
|
||||
return static_cast<nsGlobalWindow*>(outer->GetCurrentInnerWindow());
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -58,7 +58,8 @@ public:
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
||||
EventTarget* GetParentObject() { return mTarget; }
|
||||
|
||||
EventTarget* GetParentObject();
|
||||
|
||||
// WebIDL
|
||||
int32_t Identifier() const { return mIdentifier; }
|
||||
|
Loading…
Reference in New Issue
Block a user