Bug 549223 - [E10s] MozAfterPaint events aren't activated when event listener is added to tabChildGlobal, r=bsmedberg

This commit is contained in:
Olli Pettay 2010-03-01 16:47:27 +02:00
Родитель f59bc4ae38
Коммит 09d871e464
4 изменённых файлов: 22 добавлений и 4 удалений

Просмотреть файл

@ -48,10 +48,10 @@ class nsIControllers;
class nsIController;
struct JSContext;
// a9f58a8b-55cd-47fb-aeaa-f54010ffd154
// 2e26a297-6e40-41c1-81c9-7306571f955e
#define NS_IWINDOWROOT_IID \
{ 0xa9f58a8b, 0x55cd, 0x47fb, \
{ 0xae, 0xaa, 0xf5, 0x40, 0x10, 0xff, 0xd1, 0x54 } }
{ 0x2e26a297, 0x6e40, 0x41c1, \
{ 0x81, 0xc9, 0x73, 0x06, 0x57, 0x1f, 0x95, 0x5e } }
class nsPIWindowRoot : public nsPIDOMEventTarget {
public:
@ -67,6 +67,7 @@ public:
virtual nsresult GetControllers(nsIControllers** aResult) = 0;
virtual void SetParentTarget(nsPIDOMEventTarget* aTarget) = 0;
virtual nsPIDOMEventTarget* GetParentTarget() = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsPIWindowRoot, NS_IWINDOWROOT_IID)

Просмотреть файл

@ -102,6 +102,7 @@ public:
{
mParent = aTarget;
}
virtual nsPIDOMEventTarget* GetParentTarget() { return mParent; }
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsWindowRoot, nsIDOMEventTarget)

Просмотреть файл

@ -164,6 +164,15 @@
messageManager.addMessageListener("async-echo", echoListener);
messageManager.sendAsyncMessage("async-echo");
}
var MozAfterPaintCount = 0;
function enableMozAfterPaint() {
messageManager.addMessageListener("MozAfterPaint",
function(m) {
document.getElementById("messageLog").value = m.name + "[" + (++MozAfterPaintCount) + "]";
});
messageManager.loadFrameScript("data:,addEventListener('MozAfterPaint', function(e) { sendAsyncMessage('MozAfterPaint'); },true);", false);
}
</script>
<toolbar id="controls">
@ -176,6 +185,7 @@
<toolbarbutton onclick="randomClick()" label="random click"/>
<toolbarbutton onclick="messageSpeed()" label="test message handling speed"/>
<toolbarbutton onclick="listenerAddRemove()" label="test listener add/remove"/>
<toolbarbutton onclick="enableMozAfterPaint()" label="MozAfterPaint"/>
<toolbarbutton onclick="openWindow()" label="open new window"/>
<toolbarbutton onclick="closeWindow()" label="close this window"/>
</toolbar>

Просмотреть файл

@ -105,6 +105,7 @@
#endif // IBMBIDI
#include "nsContentUtils.h"
#include "nsPIWindowRoot.h"
// Needed for Start/Stop of Image Animation
#include "imgIContainer.h"
@ -2068,7 +2069,12 @@ MayHavePaintEventListener(nsPIDOMWindow* aInnerWindow)
if (manager && manager->MayHavePaintEventListener())
return PR_TRUE;
return PR_FALSE;
nsCOMPtr<nsPIWindowRoot> root = do_QueryInterface(chromeEventHandler);
nsPIDOMEventTarget* tabChildGlobal;
return root &&
(tabChildGlobal = root->GetParentTarget()) &&
(manager = tabChildGlobal->GetListenerManager(PR_FALSE)) &&
manager->MayHavePaintEventListener();
}
PRBool