mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 523356 - Remote event listeners for Electrolysis, r=bsmedberg
This commit is contained in:
parent
d0250ab7c3
commit
cab5358845
@ -100,6 +100,10 @@ interface nsIFrameLoader : nsISupports
|
||||
in long aModifiers,
|
||||
[optional] in boolean aIgnoreRootScrollFrame);
|
||||
|
||||
/**
|
||||
* Activate event forwarding from client (remote frame) to parent.
|
||||
*/
|
||||
void activateFrameEvent(in AString aType, in boolean capture);
|
||||
};
|
||||
|
||||
native alreadyAddRefed_nsFrameLoader(already_AddRefed<nsFrameLoader>);
|
||||
|
@ -1493,3 +1493,16 @@ nsFrameLoader::SendCrossProcessMouseEvent(const nsAString& aType,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameLoader::ActivateFrameEvent(const nsAString& aType,
|
||||
PRBool aCapture)
|
||||
{
|
||||
#ifdef MOZ_IPC
|
||||
if (mChildProcess) {
|
||||
mChildProcess->SendactivateFrameEvent(nsString(aType), aCapture);
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -486,6 +486,15 @@ public:
|
||||
{
|
||||
return mInner->SetTrusted(aTrusted);
|
||||
}
|
||||
virtual void Serialize(IPC::Message* aMsg,
|
||||
PRBool aSerializeInterfaceType)
|
||||
{
|
||||
mInner->Serialize(aMsg, aSerializeInterfaceType);
|
||||
}
|
||||
virtual PRBool Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
{
|
||||
return mInner->Deserialize(aMsg, aIter);
|
||||
}
|
||||
|
||||
protected:
|
||||
// Use nsDOMProgressEvent so that we can forward
|
||||
|
@ -41,8 +41,8 @@
|
||||
#include "nsISupports.h"
|
||||
|
||||
#define NS_IPRIVATEDOMEVENT_IID \
|
||||
{ 0x1da4c501, 0xe87e, 0x49b4, \
|
||||
{ 0xb0, 0x49, 0xdf, 0x9f, 0xc3, 0x6b, 0x56, 0xd4 } }
|
||||
{ 0x26f5f0e9, 0x2960, 0x4405, \
|
||||
{ 0xa1, 0x7e, 0xd8, 0x9f, 0xb0, 0xd9, 0x4c, 0x71 } }
|
||||
|
||||
class nsIDOMEventTarget;
|
||||
class nsIDOMEvent;
|
||||
@ -50,6 +50,9 @@ class nsEvent;
|
||||
class nsCommandEvent;
|
||||
class nsPresContext;
|
||||
class nsInvalidateRequestList;
|
||||
namespace IPC {
|
||||
class Message;
|
||||
}
|
||||
|
||||
class nsIPrivateDOMEvent : public nsISupports
|
||||
{
|
||||
@ -61,6 +64,9 @@ public:
|
||||
NS_IMETHOD_(PRBool) IsDispatchStopped() = 0;
|
||||
NS_IMETHOD_(nsEvent*) GetInternalNSEvent() = 0;
|
||||
NS_IMETHOD SetTrusted(PRBool aTrusted) = 0;
|
||||
virtual void Serialize(IPC::Message* aMsg,
|
||||
PRBool aSerializeInterfaceType) = 0;
|
||||
virtual PRBool Deserialize(const IPC::Message* aMsg, void** aIter) = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIPrivateDOMEvent, NS_IPRIVATEDOMEVENT_IID)
|
||||
|
@ -86,9 +86,11 @@ CPPSRCS = \
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
include $(topsrcdir)/ipc/chromium/chromium-config.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(srcdir)/../../base/src \
|
||||
-I$(srcdir)/../../html/base/src \
|
||||
-I$(srcdir)/../../xul/content/src \
|
||||
|
@ -37,6 +37,10 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#include "base/basictypes.h"
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#endif
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsEventStateManager.h"
|
||||
@ -1533,6 +1537,61 @@ nsDOMEvent::GetPreventDefault(PRBool* aReturn)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMEvent::Serialize(IPC::Message* aMsg, PRBool aSerializeInterfaceType)
|
||||
{
|
||||
#ifdef MOZ_IPC
|
||||
if (aSerializeInterfaceType) {
|
||||
IPC::WriteParam(aMsg, NS_LITERAL_STRING("event"));
|
||||
}
|
||||
|
||||
nsString type;
|
||||
GetType(type);
|
||||
IPC::WriteParam(aMsg, type);
|
||||
|
||||
PRBool bubbles = PR_FALSE;
|
||||
GetBubbles(&bubbles);
|
||||
IPC::WriteParam(aMsg, bubbles);
|
||||
|
||||
PRBool cancelable = PR_FALSE;
|
||||
GetCancelable(&cancelable);
|
||||
IPC::WriteParam(aMsg, cancelable);
|
||||
|
||||
PRBool trusted = PR_FALSE;
|
||||
GetIsTrusted(&trusted);
|
||||
IPC::WriteParam(aMsg, trusted);
|
||||
|
||||
// No timestamp serialization for now!
|
||||
#endif
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsDOMEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
{
|
||||
#ifdef MOZ_IPC
|
||||
nsString type;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &type), PR_FALSE);
|
||||
|
||||
PRBool bubbles = PR_FALSE;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &bubbles), PR_FALSE);
|
||||
|
||||
PRBool cancelable = PR_FALSE;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &cancelable), PR_FALSE);
|
||||
|
||||
PRBool trusted = PR_FALSE;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &trusted), PR_FALSE);
|
||||
|
||||
nsresult rv = InitEvent(type, bubbles, cancelable);
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
SetTrusted(trusted);
|
||||
|
||||
return PR_TRUE;
|
||||
#else
|
||||
return PR_FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
nsresult NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsPresContext* aPresContext,
|
||||
nsEvent *aEvent)
|
||||
|
@ -193,6 +193,9 @@ public:
|
||||
NS_IMETHOD_(nsEvent*) GetInternalNSEvent();
|
||||
NS_IMETHOD SetTrusted(PRBool aTrusted);
|
||||
|
||||
virtual void Serialize(IPC::Message* aMsg, PRBool aSerializeInterfaceType);
|
||||
virtual PRBool Deserialize(const IPC::Message* aMsg, void** aIter);
|
||||
|
||||
static PopupControlState GetEventPopupControlState(nsEvent *aEvent);
|
||||
|
||||
static void PopupAllowedEventsChanged();
|
||||
|
@ -36,6 +36,10 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#include "base/basictypes.h"
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#endif
|
||||
#include "nsDOMNotifyPaintEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsClientRect.h"
|
||||
@ -142,6 +146,50 @@ nsDOMNotifyPaintEvent::GetPaintRequests(nsIDOMPaintRequestList** aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
void
|
||||
nsDOMNotifyPaintEvent::Serialize(IPC::Message* aMsg,
|
||||
PRBool aSerializeInterfaceType)
|
||||
{
|
||||
if (aSerializeInterfaceType) {
|
||||
IPC::WriteParam(aMsg, NS_LITERAL_STRING("notifypaintevent"));
|
||||
}
|
||||
|
||||
nsDOMEvent::Serialize(aMsg, PR_FALSE);
|
||||
|
||||
PRUint32 length = mInvalidateRequests.Length();
|
||||
IPC::WriteParam(aMsg, length);
|
||||
for (PRUint32 i = 0; i < length; ++i) {
|
||||
IPC::WriteParam(aMsg, mInvalidateRequests[i].mRect.x);
|
||||
IPC::WriteParam(aMsg, mInvalidateRequests[i].mRect.y);
|
||||
IPC::WriteParam(aMsg, mInvalidateRequests[i].mRect.width);
|
||||
IPC::WriteParam(aMsg, mInvalidateRequests[i].mRect.height);
|
||||
IPC::WriteParam(aMsg, mInvalidateRequests[i].mFlags);
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsDOMNotifyPaintEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
{
|
||||
NS_ENSURE_TRUE(nsDOMEvent::Deserialize(aMsg, aIter), PR_FALSE);
|
||||
|
||||
PRUint32 length = 0;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &length), PR_FALSE);
|
||||
mInvalidateRequests.SetCapacity(length);
|
||||
for (PRUint32 i = 0; i < length; ++i) {
|
||||
nsInvalidateRequestList::Request req;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &req.mRect.x), PR_FALSE);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &req.mRect.y), PR_FALSE);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &req.mRect.width), PR_FALSE);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &req.mRect.height), PR_FALSE);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &req.mFlags), PR_FALSE);
|
||||
mInvalidateRequests.AppendElement(req);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult NS_NewDOMNotifyPaintEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsPresContext* aPresContext,
|
||||
nsEvent *aEvent,
|
||||
|
@ -61,6 +61,10 @@ public:
|
||||
// Forward to base class
|
||||
NS_FORWARD_TO_NSDOMEVENT
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
virtual void Serialize(IPC::Message* aMsg, PRBool aSerializeInterfaceType);
|
||||
virtual PRBool Deserialize(const IPC::Message* aMsg, void** aIter);
|
||||
#endif
|
||||
private:
|
||||
nsRegion GetRegion();
|
||||
|
||||
|
@ -35,6 +35,10 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#include "base/basictypes.h"
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#endif
|
||||
#include "nsDOMScrollAreaEvent.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsClientRect.h"
|
||||
@ -106,6 +110,64 @@ nsDOMScrollAreaEvent::InitScrollAreaEvent(const nsAString &aEventType,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
void
|
||||
nsDOMScrollAreaEvent::Serialize(IPC::Message* aMsg,
|
||||
PRBool aSerializeInterfaceType)
|
||||
{
|
||||
if (aSerializeInterfaceType) {
|
||||
IPC::WriteParam(aMsg, NS_LITERAL_STRING("scrollareaevent"));
|
||||
}
|
||||
|
||||
nsDOMUIEvent::Serialize(aMsg, PR_FALSE);
|
||||
|
||||
NS_ASSERTION(sizeof(PRInt32) == sizeof(float),
|
||||
"PRInt32 and float should be the same size!");
|
||||
|
||||
float x = 0.0f;
|
||||
GetX(&x);
|
||||
IPC::WriteParam(aMsg, reinterpret_cast<PRInt32&>(x));
|
||||
|
||||
float y = 0.0f;
|
||||
GetY(&y);
|
||||
IPC::WriteParam(aMsg, reinterpret_cast<PRInt32&>(y));
|
||||
|
||||
float width = 0.0f;
|
||||
GetWidth(&width);
|
||||
IPC::WriteParam(aMsg, reinterpret_cast<PRInt32&>(width));
|
||||
|
||||
float height = 0.0f;
|
||||
GetHeight(&height);
|
||||
IPC::WriteParam(aMsg, reinterpret_cast<PRInt32&>(height));
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsDOMScrollAreaEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
{
|
||||
NS_ENSURE_TRUE(nsDOMUIEvent::Deserialize(aMsg, aIter), PR_FALSE);
|
||||
|
||||
PRInt32 x_;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &x_), PR_FALSE);
|
||||
float x = reinterpret_cast<float&>(x_);
|
||||
|
||||
PRInt32 y_;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &y_), PR_FALSE);
|
||||
float y = reinterpret_cast<float&>(y_);
|
||||
|
||||
PRInt32 width_;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &width_), PR_FALSE);
|
||||
float width = reinterpret_cast<float&>(width_);
|
||||
|
||||
PRInt32 height_;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &height_), PR_FALSE);
|
||||
float height = reinterpret_cast<float&>(height_);
|
||||
|
||||
mClientArea.SetRect(x, y, width, height);
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
NS_NewDOMScrollAreaEvent(nsIDOMEvent **aInstancePtrResult,
|
||||
nsPresContext *aPresContext,
|
||||
|
@ -58,6 +58,10 @@ public:
|
||||
|
||||
NS_FORWARD_TO_NSDOMUIEVENT
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
virtual void Serialize(IPC::Message* aMsg, PRBool aSerializeInterfaceType);
|
||||
virtual PRBool Deserialize(const IPC::Message* aMsg, void** aIter);
|
||||
#endif
|
||||
protected:
|
||||
nsClientRect mClientArea;
|
||||
};
|
||||
|
@ -37,6 +37,10 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#include "base/basictypes.h"
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#endif
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsIPresShell.h"
|
||||
@ -395,6 +399,30 @@ nsDOMUIEvent::DuplicatePrivateData()
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
void
|
||||
nsDOMUIEvent::Serialize(IPC::Message* aMsg, PRBool aSerializeInterfaceType)
|
||||
{
|
||||
if (aSerializeInterfaceType) {
|
||||
IPC::WriteParam(aMsg, NS_LITERAL_STRING("uievent"));
|
||||
}
|
||||
|
||||
nsDOMEvent::Serialize(aMsg, PR_FALSE);
|
||||
|
||||
PRInt32 detail = 0;
|
||||
GetDetail(&detail);
|
||||
IPC::WriteParam(aMsg, detail);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsDOMUIEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
{
|
||||
NS_ENSURE_TRUE(nsDOMEvent::Deserialize(aMsg, aIter), PR_FALSE);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &mDetail), PR_FALSE);
|
||||
return PR_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsPresContext* aPresContext,
|
||||
nsGUIEvent *aEvent)
|
||||
|
@ -64,7 +64,10 @@ public:
|
||||
|
||||
// nsIPrivateDOMEvent interface
|
||||
NS_IMETHOD DuplicatePrivateData();
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
virtual void Serialize(IPC::Message* aMsg, PRBool aSerializeInterfaceType);
|
||||
virtual PRBool Deserialize(const IPC::Message* aMsg, void** aIter);
|
||||
#endif
|
||||
// nsIPrivateCompositionEvent interface
|
||||
NS_IMETHOD GetCompositionReply(nsTextEventReply** aReply);
|
||||
|
||||
|
@ -47,6 +47,8 @@ LIBXUL_LIBRARY = 1
|
||||
FORCE_STATIC_LIB = 1
|
||||
EXPORT_LIBRARY = 1
|
||||
|
||||
EXPORTS = TabMessageUtils.h
|
||||
|
||||
EXPORTS_NAMESPACES = mozilla mozilla/dom
|
||||
|
||||
EXPORTS_mozilla = \
|
||||
@ -65,6 +67,7 @@ CPPSRCS = \
|
||||
ContentProcessChild.cpp \
|
||||
TabParent.cpp \
|
||||
TabChild.cpp \
|
||||
TabMessageUtils.cpp \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
@ -41,10 +41,12 @@ include protocol "PContentProcess.ipdl";
|
||||
include protocol "PDocumentRenderer.ipdl";
|
||||
|
||||
include "mozilla/TabTypes.h";
|
||||
include "TabMessageUtils.h";
|
||||
|
||||
using PRUint32;
|
||||
using PRInt32;
|
||||
using MagicWindowHandle;
|
||||
using RemoteDOMEvent;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -61,6 +63,7 @@ parent:
|
||||
*/
|
||||
moveFocus(bool forward);
|
||||
|
||||
sendEvent(RemoteDOMEvent aEvent);
|
||||
child:
|
||||
createWidget(MagicWindowHandle parentWidget);
|
||||
destroyWidget();
|
||||
@ -88,6 +91,11 @@ child:
|
||||
PRInt32 aModifiers,
|
||||
bool aIgnoreRootScrollFrame);
|
||||
|
||||
/**
|
||||
* Activate event forwarding from client to parent.
|
||||
*/
|
||||
activateFrameEvent(nsString aType, bool capture);
|
||||
|
||||
PDocumentRenderer(PRInt32 x, PRInt32 y, PRInt32 w, PRInt32 h, nsString bgcolor, PRUint32 flags, bool flush);
|
||||
|
||||
parent:
|
||||
|
@ -52,6 +52,8 @@
|
||||
#include "nsIDOMWindowUtils.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsIWebBrowserFocus.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
#include <gdk/gdkx.h>
|
||||
@ -60,6 +62,18 @@
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
NS_IMPL_ISUPPORTS1(ContentListener, nsIDOMEventListener)
|
||||
|
||||
NS_IMETHODIMP
|
||||
ContentListener::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
RemoteDOMEvent remoteEvent;
|
||||
remoteEvent.mEvent = do_QueryInterface(aEvent);
|
||||
NS_ENSURE_STATE(remoteEvent.mEvent);
|
||||
mTabChild->SendsendEvent(remoteEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
TabChild::TabChild()
|
||||
{
|
||||
printf("creating %d!\n", NS_IsMainThread());
|
||||
@ -390,3 +404,17 @@ TabChild::RecvPDocumentRendererConstructor(
|
||||
|
||||
return SendPDocumentRendererDestructor(__a, width, height, data);
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvactivateFrameEvent(const nsString& aType, const bool& capture)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_GetInterface(mWebNav);
|
||||
NS_ENSURE_TRUE(window, true);
|
||||
nsCOMPtr<nsIDOMEventTarget> chromeHandler =
|
||||
do_QueryInterface(window->GetChromeEventHandler());
|
||||
NS_ENSURE_TRUE(chromeHandler, true);
|
||||
nsRefPtr<ContentListener> listener = new ContentListener(this);
|
||||
NS_ENSURE_TRUE(listener, true);
|
||||
chromeHandler->AddEventListener(aType, listener, capture);
|
||||
return true;
|
||||
}
|
||||
|
@ -46,10 +46,24 @@
|
||||
#include "nsIWebBrowserChrome2.h"
|
||||
#include "nsIEmbeddingSiteWindow2.h"
|
||||
#include "nsIWebBrowserChromeFocus.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class TabChild;
|
||||
|
||||
class ContentListener : public nsIDOMEventListener
|
||||
{
|
||||
public:
|
||||
ContentListener(TabChild* aTabChild) : mTabChild(aTabChild) {}
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDOMEVENTLISTENER
|
||||
protected:
|
||||
TabChild* mTabChild;
|
||||
};
|
||||
|
||||
class TabChild : public PIFrameEmbeddingChild,
|
||||
public nsIWebBrowserChrome2,
|
||||
public nsIEmbeddingSiteWindow2,
|
||||
@ -82,6 +96,7 @@ public:
|
||||
const PRInt32& aClickCount,
|
||||
const PRInt32& aModifiers,
|
||||
const bool& aIgnoreRootScrollFrame);
|
||||
virtual bool RecvactivateFrameEvent(const nsString& aType, const bool& capture);
|
||||
virtual mozilla::ipc::PDocumentRendererChild* AllocPDocumentRenderer(
|
||||
const PRInt32& x,
|
||||
const PRInt32& y,
|
||||
|
69
dom/ipc/TabMessageUtils.cpp
Normal file
69
dom/ipc/TabMessageUtils.cpp
Normal file
@ -0,0 +1,69 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Corporation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Olli Pettay <Olli.Pettay@helsinki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "TabMessageUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
|
||||
#ifdef CreateEvent
|
||||
#undef CreateEvent
|
||||
#endif
|
||||
|
||||
#include "nsEventDispatcher.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
bool
|
||||
ReadRemoteEvent(const IPC::Message* aMsg, void** aIter,
|
||||
RemoteDOMEvent* aResult)
|
||||
{
|
||||
aResult->mEvent = nsnull;
|
||||
nsString type;
|
||||
NS_ENSURE_TRUE(ReadParam(aMsg, aIter, &type), false);
|
||||
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
nsEventDispatcher::CreateEvent(nsnull, nsnull, type, getter_AddRefs(event));
|
||||
aResult->mEvent = do_QueryInterface(event);
|
||||
NS_ENSURE_TRUE(aResult->mEvent, false);
|
||||
|
||||
return aResult->mEvent->Deserialize(aMsg, aIter);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
85
dom/ipc/TabMessageUtils.h
Normal file
85
dom/ipc/TabMessageUtils.h
Normal file
@ -0,0 +1,85 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Corporation
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Olli Pettay <Olli.Pettay@helsinki.fi>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef TABMESSAGE_UTILS_H
|
||||
#define TABMESSAGE_UTILS_H
|
||||
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
struct RemoteDOMEvent
|
||||
{
|
||||
nsCOMPtr<nsIPrivateDOMEvent> mEvent;
|
||||
};
|
||||
|
||||
bool ReadRemoteEvent(const IPC::Message* aMsg, void** aIter,
|
||||
mozilla::dom::RemoteDOMEvent* aResult);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
namespace IPC {
|
||||
|
||||
template<>
|
||||
struct ParamTraits<mozilla::dom::RemoteDOMEvent>
|
||||
{
|
||||
typedef mozilla::dom::RemoteDOMEvent paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
aParam.mEvent->Serialize(aMsg, PR_TRUE);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
return mozilla::dom::ReadRemoteEvent(aMsg, aIter, aResult);
|
||||
}
|
||||
|
||||
static void Log(const paramType& aParam, std::wstring* aLog)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
@ -46,6 +46,10 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
|
||||
using mozilla::ipc::BrowserProcessSubThread;
|
||||
using mozilla::ipc::DocumentRendererParent;
|
||||
@ -75,6 +79,20 @@ TabParent::RecvmoveFocus(const bool& aForward)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvsendEvent(const RemoteDOMEvent& aEvent)
|
||||
{
|
||||
nsCOMPtr<nsIDOMEvent> event = do_QueryInterface(aEvent.mEvent);
|
||||
NS_ENSURE_TRUE(event, true);
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(mFrameElement);
|
||||
NS_ENSURE_TRUE(target, true);
|
||||
|
||||
PRBool dummy;
|
||||
target->DispatchEvent(event, &dummy);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
TabParent::LoadURL(nsIURI* aURI)
|
||||
{
|
||||
|
@ -57,6 +57,7 @@ public:
|
||||
void SetOwnerElement(nsIDOMElement* aElement) { mFrameElement = aElement; }
|
||||
|
||||
virtual bool RecvmoveFocus(const bool& aForward);
|
||||
virtual bool RecvsendEvent(const RemoteDOMEvent& aEvent);
|
||||
|
||||
void LoadURL(nsIURI* aURI);
|
||||
void Move(PRUint32 x, PRUint32 y, PRUint32 width, PRUint32 height);
|
||||
|
@ -3,11 +3,55 @@
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
width="800" height="800" orient="vertical">
|
||||
<script>
|
||||
|
||||
function dumpClientRect(r) {
|
||||
dump(r.left + "," + r.top + "," + r.right + "," +
|
||||
r.bottom + "," + r.width + "," + r.height + "\n");
|
||||
}
|
||||
|
||||
function handleMozAfterPaint(e) {
|
||||
return;
|
||||
dump(e.type + "\n")
|
||||
var rects = e.clientRects;
|
||||
var i;
|
||||
dump("\tclientRects:\n");
|
||||
for (i = 0; i < rects.length; ++i) {
|
||||
var r = rects.item(i);
|
||||
dump("\t\t");
|
||||
dumpClientRect(rects.item(i));
|
||||
}
|
||||
|
||||
dump("\tboundingClientRect\n\t\t");
|
||||
dumpClientRect(e.boundingClientRect);
|
||||
|
||||
var paintRequests = e.paintRequests;
|
||||
dump("\tpaintRequests\n");
|
||||
for (i = 0; i < paintRequests.length; ++i) {
|
||||
var pr = paintRequests.item(i);
|
||||
dump("\t\t");
|
||||
dumpClientRect(pr.clientRect);
|
||||
if (pr.reason)
|
||||
dump("\t\t" + pr.reason + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
function handleMozScrolledAreaChanged(e) {
|
||||
return;
|
||||
dump(e.type + "\n");
|
||||
dump("\t" + e.x + "," + e.y + "," + e.width + "," + e.height + "\n");
|
||||
}
|
||||
|
||||
function restart() {
|
||||
var y = document.getElementById('page');
|
||||
var p = y.parentNode;
|
||||
p.removeChild(y);
|
||||
p.appendChild(y);
|
||||
|
||||
var fl = y.QueryInterface(Components.interfaces.nsIFrameLoaderOwner).frameLoader;
|
||||
fl.activateFrameEvent("MozAfterPaint", true);
|
||||
fl.activateFrameEvent("MozScrolledAreaChanged", true);
|
||||
y.addEventListener("MozAfterPaint", handleMozAfterPaint, true);
|
||||
y.addEventListener("MozScrolledAreaChanged", handleMozScrolledAreaChanged, true);
|
||||
}
|
||||
|
||||
function loadURL(url) {
|
||||
|
@ -128,6 +128,20 @@ NS_IMETHODIMP nsSmartCardEvent::SetTrusted(PRBool aResult)
|
||||
return mPrivate->SetTrusted(aResult);
|
||||
}
|
||||
|
||||
void
|
||||
nsSmartCardEvent::Serialize(IPC::Message* aMsg,
|
||||
PRBool aSerializeInterfaceType)
|
||||
{
|
||||
NS_ASSERTION(mPrivate, "SmartCardEvent called without Init");
|
||||
mPrivate->Serialize(aMsg, aSerializeInterfaceType);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsSmartCardEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
{
|
||||
NS_ASSERTION(mPrivate, "SmartCardEvent called without Init");
|
||||
return mPrivate->Deserialize(aMsg, aIter);
|
||||
}
|
||||
|
||||
// IDOMNSEvent maps
|
||||
NS_IMETHODIMP nsSmartCardEvent::GetOriginalTarget(nsIDOMEventTarget * *aOriginalTarget)
|
||||
|
@ -66,6 +66,9 @@ public:
|
||||
NS_IMETHOD_(nsEvent*) GetInternalNSEvent();
|
||||
NS_IMETHOD_(PRBool ) IsDispatchStopped();
|
||||
NS_IMETHOD SetTrusted(PRBool aResult);
|
||||
virtual void Serialize(IPC::Message* aMsg,
|
||||
PRBool aSerializeInterfaceType);
|
||||
virtual PRBool Deserialize(const IPC::Message* aMsg, void** aIter);
|
||||
|
||||
NS_DECL_NSIDOMEVENT
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user