зеркало из https://github.com/mozilla/gecko-dev.git
Bug 571438 - MayHavePaintEventListener fails for non-e10s message manager, r=jst
This commit is contained in:
Родитель
754fb4784e
Коммит
e599b170aa
|
@ -2372,6 +2372,21 @@ nsGlobalWindow::SetOpenerWindow(nsIDOMWindowInternal* aOpener,
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::UpdateParentTarget()
|
||||
{
|
||||
nsCOMPtr<nsIFrameLoaderOwner> flo = do_QueryInterface(mChromeEventHandler);
|
||||
if (flo) {
|
||||
nsRefPtr<nsFrameLoader> fl = flo->GetFrameLoader();
|
||||
if (fl) {
|
||||
mParentTarget = fl->GetTabChildGlobalAsEventTarget();
|
||||
}
|
||||
}
|
||||
if (!mParentTarget) {
|
||||
mParentTarget = mChromeEventHandler;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGlobalWindow::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
{
|
||||
|
@ -2414,19 +2429,7 @@ nsGlobalWindow::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
|||
}
|
||||
}
|
||||
|
||||
if (!mParentTarget) {
|
||||
nsCOMPtr<nsIFrameLoaderOwner> flo = do_QueryInterface(mChromeEventHandler);
|
||||
if (flo) {
|
||||
nsRefPtr<nsFrameLoader> fl = flo->GetFrameLoader();
|
||||
if (fl) {
|
||||
mParentTarget = fl->GetTabChildGlobalAsEventTarget();
|
||||
}
|
||||
}
|
||||
if (!mParentTarget) {
|
||||
mParentTarget = mChromeEventHandler;
|
||||
}
|
||||
}
|
||||
aVisitor.mParentTarget = mParentTarget;
|
||||
aVisitor.mParentTarget = GetParentTarget();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -684,6 +684,8 @@ protected:
|
|||
|
||||
void ClearStatus();
|
||||
|
||||
virtual void UpdateParentTarget();
|
||||
|
||||
// When adding new member variables, be careful not to create cycles
|
||||
// through JavaScript. If there is any chance that a member variable
|
||||
// could own objects that are implemented in JavaScript, then those
|
||||
|
|
|
@ -78,8 +78,8 @@ class nsIArray;
|
|||
class nsPIWindowRoot;
|
||||
|
||||
#define NS_PIDOMWINDOW_IID \
|
||||
{ 0x7cbe5277, 0x5de8, 0x45e4, \
|
||||
{ 0x9c, 0x2d, 0x81, 0x37, 0xa9, 0x5b, 0x42, 0xc6 } }
|
||||
{ 0x4beac1da, 0x513e, 0x4a8b, \
|
||||
{ 0x96, 0x94, 0x1c, 0xf6, 0x4f, 0xba, 0xa8, 0x1c } }
|
||||
|
||||
class nsPIDOMWindow : public nsIDOMWindowInternal
|
||||
{
|
||||
|
@ -110,6 +110,14 @@ public:
|
|||
|
||||
virtual void SetChromeEventHandler(nsPIDOMEventTarget* aChromeEventHandler) = 0;
|
||||
|
||||
nsPIDOMEventTarget* GetParentTarget()
|
||||
{
|
||||
if (!mParentTarget) {
|
||||
UpdateParentTarget();
|
||||
}
|
||||
return mParentTarget;
|
||||
}
|
||||
|
||||
PRBool HasMutationListeners(PRUint32 aMutationEventType) const
|
||||
{
|
||||
const nsPIDOMWindow *win;
|
||||
|
@ -528,6 +536,8 @@ protected:
|
|||
mParentTarget = nsnull;
|
||||
}
|
||||
|
||||
virtual void UpdateParentTarget() = 0;
|
||||
|
||||
// These two variables are special in that they're set to the same
|
||||
// value on both the outer window and the current inner window. Make
|
||||
// sure you keep them in sync!
|
||||
|
|
|
@ -2062,38 +2062,35 @@ MayHavePaintEventListener(nsPIDOMWindow* aInnerWindow)
|
|||
if (aInnerWindow->HasPaintEventListeners())
|
||||
return PR_TRUE;
|
||||
|
||||
nsPIDOMEventTarget* chromeEventHandler = aInnerWindow->GetChromeEventHandler();
|
||||
if (!chromeEventHandler)
|
||||
nsPIDOMEventTarget* parentTarget = aInnerWindow->GetParentTarget();
|
||||
if (!parentTarget)
|
||||
return PR_FALSE;
|
||||
|
||||
nsIEventListenerManager* manager = nsnull;
|
||||
if ((manager = parentTarget->GetListenerManager(PR_FALSE)) &&
|
||||
manager->MayHavePaintEventListener()) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsINode> node;
|
||||
nsCOMPtr<nsIInProcessContentFrameMessageManager> mm =
|
||||
do_QueryInterface(chromeEventHandler);
|
||||
if (mm) {
|
||||
nsCOMPtr<nsPIDOMEventTarget> target = do_QueryInterface(mm);
|
||||
if (target && (manager = target->GetListenerManager(PR_FALSE)) &&
|
||||
manager->MayHavePaintEventListener()) {
|
||||
return PR_TRUE;
|
||||
if (parentTarget != aInnerWindow->GetChromeEventHandler()) {
|
||||
nsCOMPtr<nsIInProcessContentFrameMessageManager> mm =
|
||||
do_QueryInterface(parentTarget);
|
||||
if (mm) {
|
||||
node = mm->GetOwnerContent();
|
||||
}
|
||||
node = mm->GetOwnerContent();
|
||||
}
|
||||
|
||||
if (!node) {
|
||||
node = do_QueryInterface(chromeEventHandler);
|
||||
node = do_QueryInterface(parentTarget);
|
||||
}
|
||||
if (node)
|
||||
return MayHavePaintEventListener(node->GetOwnerDoc()->GetInnerWindow());
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(chromeEventHandler);
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(parentTarget);
|
||||
if (window)
|
||||
return MayHavePaintEventListener(window);
|
||||
|
||||
manager =
|
||||
chromeEventHandler->GetListenerManager(PR_FALSE);
|
||||
if (manager && manager->MayHavePaintEventListener())
|
||||
return PR_TRUE;
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче