зеркало из https://github.com/mozilla/gecko-dev.git
Back out bug 582644 and 576716 because of mochitest-3 oranges
This commit is contained in:
Родитель
4cf3bd5d49
Коммит
da198edfb2
|
@ -1676,23 +1676,6 @@ public:
|
|||
*/
|
||||
static PRBool IsFocusedContent(nsIContent *aContent);
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#ifdef ANDROID
|
||||
static void SetActiveFrameLoader(nsFrameLoader *aFrameLoader)
|
||||
{
|
||||
sActiveFrameLoader = aFrameLoader;
|
||||
}
|
||||
|
||||
static void ClearActiveFrameLoader(const nsFrameLoader *aFrameLoader)
|
||||
{
|
||||
if (sActiveFrameLoader == aFrameLoader)
|
||||
sActiveFrameLoader = nsnull;
|
||||
}
|
||||
|
||||
static already_AddRefed<nsFrameLoader> GetActiveFrameLoader();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
static PRBool InitializeEventTable();
|
||||
|
@ -1782,12 +1765,6 @@ private:
|
|||
static nsIInterfaceRequestor* sSameOriginChecker;
|
||||
|
||||
static PRBool sIsHandlingKeyBoardEvent;
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#ifdef ANDROID
|
||||
static nsFrameLoader *sActiveFrameLoader;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
#define NS_HOLD_JS_OBJECTS(obj, clazz) \
|
||||
|
|
|
@ -266,12 +266,6 @@ PRBool nsContentUtils::sInitialized = PR_FALSE;
|
|||
nsRefPtrHashtable<nsPrefObserverHashKey, nsPrefOldCallback>
|
||||
*nsContentUtils::sPrefCallbackTable = nsnull;
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#ifdef ANDROID
|
||||
nsFrameLoader *nsContentUtils::sActiveFrameLoader = nsnull;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static PLDHashTable sEventListenerManagersHash;
|
||||
|
||||
class EventListenerManagerMapEntry : public PLDHashEntryHdr
|
||||
|
@ -6215,17 +6209,6 @@ nsContentUtils::IsFocusedContent(nsIContent* aContent)
|
|||
return fm && fm->GetFocusedContent() == aContent;
|
||||
}
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#ifdef ANDROID
|
||||
// static
|
||||
already_AddRefed<nsFrameLoader>
|
||||
nsContentUtils::GetActiveFrameLoader()
|
||||
{
|
||||
return nsCOMPtr<nsFrameLoader>(sActiveFrameLoader).forget();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void nsContentUtils::RemoveNewlines(nsString &aString)
|
||||
{
|
||||
// strip CR/LF and null
|
||||
|
|
|
@ -1170,9 +1170,6 @@ nsFrameLoader::DestroyChild()
|
|||
{
|
||||
#ifdef MOZ_IPC
|
||||
if (mRemoteBrowser) {
|
||||
#ifdef ANDROID
|
||||
nsContentUtils::ClearActiveFrameLoader(this);
|
||||
#endif
|
||||
mRemoteBrowser->SetOwnerElement(nsnull);
|
||||
// If this fails, it's most likely due to a content-process crash,
|
||||
// and auto-cleanup will kick in. Otherwise, the child side will
|
||||
|
@ -1708,9 +1705,6 @@ nsFrameLoader::ActivateRemoteFrame() {
|
|||
#ifdef MOZ_IPC
|
||||
if (mRemoteBrowser) {
|
||||
mRemoteBrowser->Activate();
|
||||
#ifdef ANDROID
|
||||
nsContentUtils::SetActiveFrameLoader(this);
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -44,12 +44,6 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#ifdef ANDROID
|
||||
#include "mozilla/dom/PBrowserParent.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
|
@ -165,12 +159,6 @@
|
|||
#import <ApplicationServices/ApplicationServices.h>
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#ifdef ANDROID
|
||||
#include "nsFrameLoader.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//#define DEBUG_DOCSHELL_FOCUS
|
||||
|
||||
#define NS_USER_INTERACTION_INTERVAL 5000 // ms
|
||||
|
@ -1381,40 +1369,6 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
|||
DoContentCommandScrollEvent(static_cast<nsContentCommandEvent*>(aEvent));
|
||||
}
|
||||
break;
|
||||
#ifdef MOZ_IPC
|
||||
#ifdef ANDROID
|
||||
case NS_TEXT_TEXT:
|
||||
{
|
||||
nsTextEvent *textEvent = static_cast<nsTextEvent*>(aEvent);
|
||||
if (IsTargetCrossProcess(textEvent)) {
|
||||
// Will not be handled locally, remote the event
|
||||
mozilla::dom::PBrowserParent *remoteBrowser = GetCrossProcessTarget();
|
||||
if (remoteBrowser &&
|
||||
remoteBrowser->SendTextEvent(*textEvent)) {
|
||||
// Cancel local dispatching
|
||||
*aStatus = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NS_COMPOSITION_START:
|
||||
case NS_COMPOSITION_END:
|
||||
{
|
||||
nsCompositionEvent *compositionEvent =
|
||||
static_cast<nsCompositionEvent*>(aEvent);
|
||||
if (IsTargetCrossProcess(compositionEvent)) {
|
||||
// Will not be handled locally, remote the event
|
||||
mozilla::dom::PBrowserParent *remoteBrowser = GetCrossProcessTarget();
|
||||
if (remoteBrowser &&
|
||||
remoteBrowser->SendCompositionEvent(*compositionEvent)) {
|
||||
// Cancel local dispatching
|
||||
*aStatus = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3245,49 +3199,6 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
|||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#ifdef ANDROID
|
||||
case NS_QUERY_SELECTED_TEXT:
|
||||
case NS_QUERY_TEXT_CONTENT:
|
||||
case NS_QUERY_CARET_RECT:
|
||||
case NS_QUERY_TEXT_RECT:
|
||||
case NS_QUERY_EDITOR_RECT:
|
||||
case NS_QUERY_CONTENT_STATE:
|
||||
// We don't remote nsITransferable yet
|
||||
//case NS_QUERY_SELECTION_AS_TRANSFERABLE:
|
||||
case NS_QUERY_CHARACTER_AT_POINT:
|
||||
{
|
||||
nsQueryContentEvent *queryEvent =
|
||||
static_cast<nsQueryContentEvent*>(aEvent);
|
||||
// If local query failed, try remote query
|
||||
if (queryEvent->mSucceeded)
|
||||
break;
|
||||
|
||||
mozilla::dom::PBrowserParent *remoteBrowser = GetCrossProcessTarget();
|
||||
if (remoteBrowser &&
|
||||
remoteBrowser->SendQueryContentEvent(*queryEvent)) {
|
||||
queryEvent->mWasAsync = PR_TRUE;
|
||||
queryEvent->mSucceeded = PR_TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NS_SELECTION_SET:
|
||||
{
|
||||
nsSelectionEvent *selectionEvent =
|
||||
static_cast<nsSelectionEvent*>(aEvent);
|
||||
// If local handler failed, try remoting the event
|
||||
if (selectionEvent->mSucceeded)
|
||||
break;
|
||||
|
||||
mozilla::dom::PBrowserParent *remoteBrowser = GetCrossProcessTarget();
|
||||
if (remoteBrowser &&
|
||||
remoteBrowser->SendSelectionEvent(*selectionEvent))
|
||||
selectionEvent->mSucceeded = PR_TRUE;
|
||||
}
|
||||
break;
|
||||
#endif // ANDROID
|
||||
#endif // MOZ_IPC
|
||||
}
|
||||
|
||||
//Reset target frame to null to avoid mistargeting after reentrant event
|
||||
|
@ -3296,27 +3207,6 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#ifdef ANDROID
|
||||
mozilla::dom::PBrowserParent*
|
||||
nsEventStateManager::GetCrossProcessTarget()
|
||||
{
|
||||
nsCOMPtr<nsFrameLoader> fl = nsContentUtils::GetActiveFrameLoader();
|
||||
NS_ENSURE_TRUE(fl, nsnull);
|
||||
return fl->GetRemoteBrowser();
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsEventStateManager::IsTargetCrossProcess(nsGUIEvent *aEvent)
|
||||
{
|
||||
nsQueryContentEvent stateEvent(PR_TRUE, NS_QUERY_CONTENT_STATE, aEvent->widget);
|
||||
nsContentEventHandler handler(mPresContext);
|
||||
handler.OnQueryContentState(&stateEvent);
|
||||
return !stateEvent.mSucceeded;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventStateManager::NotifyDestroyPresContext(nsPresContext* aPresContext)
|
||||
{
|
||||
|
|
|
@ -331,13 +331,6 @@ protected:
|
|||
nsresult DoContentCommandEvent(nsContentCommandEvent* aEvent);
|
||||
nsresult DoContentCommandScrollEvent(nsContentCommandEvent* aEvent);
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#ifdef ANDROID
|
||||
mozilla::dom::PBrowserParent *GetCrossProcessTarget();
|
||||
PRBool IsTargetCrossProcess(nsGUIEvent *aEvent);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
PRInt32 mLockCursor;
|
||||
|
||||
nsWeakFrame mCurrentTarget;
|
||||
|
|
|
@ -48,16 +48,11 @@ include "mozilla/TabTypes.h";
|
|||
include "TabMessageUtils.h";
|
||||
include "gfxMatrix.h";
|
||||
include "mozilla/net/NeckoMessageUtils.h";
|
||||
include "mozilla/widget/nsGUIEventIPC.h";
|
||||
|
||||
using IPC::URI;
|
||||
using MagicWindowHandle;
|
||||
using RemoteDOMEvent;
|
||||
using gfxMatrix;
|
||||
using nsCompositionEvent;
|
||||
using nsTextEvent;
|
||||
using nsQueryContentEvent;
|
||||
using nsSelectionEvent;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -110,8 +105,6 @@ parent:
|
|||
sync SyncMessage(nsString aMessage, nsString aJSON)
|
||||
returns (nsString[] retval);
|
||||
|
||||
QueryContentResult(nsQueryContentEvent event);
|
||||
|
||||
PGeolocationRequest(URI uri);
|
||||
|
||||
PContentDialog(PRUint32 aType, nsCString aName, nsCString aFeatures,
|
||||
|
@ -154,14 +147,6 @@ child:
|
|||
PRInt32 aModifiers,
|
||||
bool aPreventDefault);
|
||||
|
||||
CompositionEvent(nsCompositionEvent event);
|
||||
|
||||
TextEvent(nsTextEvent event);
|
||||
|
||||
QueryContentEvent(nsQueryContentEvent event);
|
||||
|
||||
SelectionEvent(nsSelectionEvent event);
|
||||
|
||||
/**
|
||||
* Activate event forwarding from client to parent.
|
||||
*/
|
||||
|
|
|
@ -80,8 +80,6 @@
|
|||
#include "nsIDOMDocument.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIView.h"
|
||||
#include "nsISecureBrowserUI.h"
|
||||
#include "nsISSLStatusProvider.h"
|
||||
#include "nsSerializationHelper.h"
|
||||
|
@ -722,76 +720,15 @@ TabChild::RecvKeyEvent(const nsString& aType,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvCompositionEvent(const nsCompositionEvent& event)
|
||||
{
|
||||
nsCompositionEvent localEvent(event);
|
||||
DispatchWidgetEvent(localEvent);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvTextEvent(const nsTextEvent& event)
|
||||
{
|
||||
nsTextEvent localEvent(event);
|
||||
DispatchWidgetEvent(localEvent);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvQueryContentEvent(const nsQueryContentEvent& event)
|
||||
{
|
||||
nsQueryContentEvent localEvent(event);
|
||||
DispatchWidgetEvent(localEvent);
|
||||
// Send result back even if query failed
|
||||
SendQueryContentResult(localEvent);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvSelectionEvent(const nsSelectionEvent& event)
|
||||
{
|
||||
nsSelectionEvent localEvent(event);
|
||||
DispatchWidgetEvent(localEvent);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::DispatchWidgetEvent(nsGUIEvent& event)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_GetInterface(mWebNav);
|
||||
NS_ENSURE_TRUE(window, false);
|
||||
|
||||
nsIDocShell *docShell = window->GetDocShell();
|
||||
NS_ENSURE_TRUE(docShell, false);
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
docShell->GetPresShell(getter_AddRefs(presShell));
|
||||
NS_ENSURE_TRUE(presShell, false);
|
||||
|
||||
nsIFrame *frame = presShell->GetRootFrame();
|
||||
NS_ENSURE_TRUE(frame, false);
|
||||
|
||||
nsIView *view = frame->GetView();
|
||||
NS_ENSURE_TRUE(view, false);
|
||||
|
||||
nsCOMPtr<nsIWidget> widget = view->GetNearestWidget(nsnull);
|
||||
NS_ENSURE_TRUE(widget, false);
|
||||
|
||||
nsEventStatus status;
|
||||
event.widget = widget;
|
||||
NS_ENSURE_SUCCESS(widget->DispatchEvent(&event, status), false);
|
||||
return true;
|
||||
}
|
||||
|
||||
mozilla::ipc::PDocumentRendererChild*
|
||||
TabChild::AllocPDocumentRenderer(const PRInt32& x,
|
||||
const PRInt32& y,
|
||||
const PRInt32& w,
|
||||
const PRInt32& h,
|
||||
const nsString& bgcolor,
|
||||
const PRUint32& flags,
|
||||
const bool& flush)
|
||||
TabChild::AllocPDocumentRenderer(
|
||||
const PRInt32& x,
|
||||
const PRInt32& y,
|
||||
const PRInt32& w,
|
||||
const PRInt32& h,
|
||||
const nsString& bgcolor,
|
||||
const PRUint32& flags,
|
||||
const bool& flush)
|
||||
{
|
||||
return new mozilla::ipc::DocumentRendererChild();
|
||||
}
|
||||
|
|
|
@ -191,10 +191,6 @@ public:
|
|||
const PRInt32& aCharCode,
|
||||
const PRInt32& aModifiers,
|
||||
const bool& aPreventDefault);
|
||||
virtual bool RecvCompositionEvent(const nsCompositionEvent& event);
|
||||
virtual bool RecvTextEvent(const nsTextEvent& event);
|
||||
virtual bool RecvQueryContentEvent(const nsQueryContentEvent& event);
|
||||
virtual bool RecvSelectionEvent(const nsSelectionEvent& event);
|
||||
virtual bool RecvActivateFrameEvent(const nsString& aType, const bool& capture);
|
||||
virtual bool RecvLoadRemoteScript(const nsString& aURL);
|
||||
virtual bool RecvAsyncMessage(const nsString& aMessage,
|
||||
|
@ -289,8 +285,6 @@ protected:
|
|||
NS_OVERRIDE
|
||||
virtual bool RecvDestroy();
|
||||
|
||||
bool DispatchWidgetEvent(nsGUIEvent& event);
|
||||
|
||||
private:
|
||||
void ActorDestroy(ActorDestroyReason why);
|
||||
|
||||
|
|
|
@ -71,11 +71,6 @@
|
|||
#include "nsIContent.h"
|
||||
#include "mozilla/unused.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
#include "AndroidBridge.h"
|
||||
using namespace mozilla;
|
||||
#endif
|
||||
|
||||
using mozilla::ipc::DocumentRendererParent;
|
||||
using mozilla::ipc::DocumentRendererShmemParent;
|
||||
using mozilla::ipc::DocumentRendererNativeIDParent;
|
||||
|
@ -572,32 +567,6 @@ TabParent::RecvAsyncMessage(const nsString& aMessage,
|
|||
return ReceiveMessage(aMessage, PR_FALSE, aJSON, nsnull);
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvQueryContentResult(const nsQueryContentEvent& event)
|
||||
{
|
||||
#ifdef ANDROID
|
||||
if (!event.mSucceeded) {
|
||||
AndroidBridge::Bridge()->ReturnIMEQueryResult(nsnull, 0, 0, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (event.message) {
|
||||
case NS_QUERY_TEXT_CONTENT:
|
||||
AndroidBridge::Bridge()->ReturnIMEQueryResult(
|
||||
event.mReply.mString.get(), event.mReply.mString.Length(), 0, 0);
|
||||
break;
|
||||
case NS_QUERY_SELECTED_TEXT:
|
||||
AndroidBridge::Bridge()->ReturnIMEQueryResult(
|
||||
event.mReply.mString.get(),
|
||||
event.mReply.mString.Length(),
|
||||
event.GetSelectionStart(),
|
||||
event.GetSelectionEnd() - event.GetSelectionStart());
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::ReceiveMessage(const nsString& aMessage,
|
||||
PRBool aSync,
|
||||
|
|
|
@ -132,7 +132,6 @@ public:
|
|||
nsTArray<nsString>* aJSONRetVal);
|
||||
virtual bool RecvAsyncMessage(const nsString& aMessage,
|
||||
const nsString& aJSON);
|
||||
virtual bool RecvQueryContentResult(const nsQueryContentEvent& event);
|
||||
virtual PContentDialogParent* AllocPContentDialog(const PRUint32& aType,
|
||||
const nsCString& aName,
|
||||
const nsCString& aFeatures,
|
||||
|
|
|
@ -284,11 +284,6 @@ var messages = [
|
|||
value: self,
|
||||
exception: true
|
||||
},
|
||||
{
|
||||
type: "object",
|
||||
value: { p: ArrayBuffer.prototype },
|
||||
exception: true
|
||||
},
|
||||
{
|
||||
type: "string",
|
||||
shouldEqual: true,
|
||||
|
|
|
@ -46,12 +46,6 @@ MODULE = widget
|
|||
XPIDL_MODULE = widget
|
||||
GRE_MODULE = 1
|
||||
|
||||
EXPORTS_NAMESPACES = mozilla/widget
|
||||
|
||||
EXPORTS_mozilla/widget = \
|
||||
nsGUIEventIPC.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
nsIWidget.h \
|
||||
nsGUIEvent.h \
|
||||
|
|
|
@ -60,15 +60,6 @@
|
|||
#include "nsITransferable.h"
|
||||
#include "nsIVariant.h"
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class PBrowserParent;
|
||||
class PBrowserChild;
|
||||
}
|
||||
}
|
||||
#endif // MOZ_IPC
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
class nsAccessible;
|
||||
#endif
|
||||
|
@ -518,12 +509,6 @@ protected:
|
|||
MOZ_COUNT_CTOR(nsEvent);
|
||||
}
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
nsEvent()
|
||||
{
|
||||
}
|
||||
#endif // MOZ_IPC
|
||||
|
||||
public:
|
||||
nsEvent(PRBool isTrusted, PRUint32 msg)
|
||||
: eventStructType(NS_EVENT),
|
||||
|
@ -575,13 +560,6 @@ protected:
|
|||
{
|
||||
}
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
nsGUIEvent()
|
||||
: pluginEvent(nsnull)
|
||||
{
|
||||
}
|
||||
#endif // MOZ_IPC
|
||||
|
||||
public:
|
||||
nsGUIEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
|
||||
: nsEvent(isTrusted, msg, NS_GUI_EVENT),
|
||||
|
@ -746,12 +724,6 @@ protected:
|
|||
{
|
||||
}
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
nsInputEvent()
|
||||
{
|
||||
}
|
||||
#endif // MOZ_IPC
|
||||
|
||||
public:
|
||||
nsInputEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
|
||||
: nsGUIEvent(isTrusted, msg, w, NS_INPUT_EVENT),
|
||||
|
@ -1048,35 +1020,6 @@ typedef nsTextRange* nsTextRangeArray;
|
|||
|
||||
class nsTextEvent : public nsInputEvent
|
||||
{
|
||||
#ifdef MOZ_IPC
|
||||
private:
|
||||
friend class mozilla::dom::PBrowserParent;
|
||||
friend class mozilla::dom::PBrowserChild;
|
||||
|
||||
nsTextEvent()
|
||||
: mOwnRangeArray(PR_FALSE), rangeArray(nsnull)
|
||||
{
|
||||
}
|
||||
|
||||
PRPackedBool mOwnRangeArray;
|
||||
|
||||
public:
|
||||
~nsTextEvent()
|
||||
{
|
||||
if (mOwnRangeArray && rangeArray)
|
||||
delete [] rangeArray;
|
||||
}
|
||||
|
||||
nsTextRangeArray AllocRangeArray(PRUint32 aCount)
|
||||
{
|
||||
NS_ASSERTION(!rangeArray, "rangeArray already allocated");
|
||||
mOwnRangeArray = PR_TRUE;
|
||||
rangeCount = aCount;
|
||||
rangeArray = new nsTextRange[aCount];
|
||||
return rangeArray;
|
||||
}
|
||||
#endif // MOZ_IPC
|
||||
|
||||
public:
|
||||
nsTextEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
|
||||
: nsInputEvent(isTrusted, msg, w, NS_TEXT_EVENT),
|
||||
|
@ -1095,16 +1038,6 @@ public:
|
|||
|
||||
class nsCompositionEvent : public nsInputEvent
|
||||
{
|
||||
#ifdef MOZ_IPC
|
||||
private:
|
||||
friend class mozilla::dom::PBrowserParent;
|
||||
friend class mozilla::dom::PBrowserChild;
|
||||
|
||||
nsCompositionEvent()
|
||||
{
|
||||
}
|
||||
#endif // MOZ_IPC
|
||||
|
||||
public:
|
||||
nsCompositionEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
|
||||
: nsInputEvent(isTrusted, msg, w, NS_COMPOSITION_EVENT)
|
||||
|
@ -1219,22 +1152,10 @@ public:
|
|||
|
||||
class nsQueryContentEvent : public nsGUIEvent
|
||||
{
|
||||
#ifdef MOZ_IPC
|
||||
private:
|
||||
friend class mozilla::dom::PBrowserParent;
|
||||
friend class mozilla::dom::PBrowserChild;
|
||||
|
||||
nsQueryContentEvent()
|
||||
{
|
||||
mReply.mContentsRoot = nsnull;
|
||||
mReply.mFocusedWidget = nsnull;
|
||||
}
|
||||
#endif // MOZ_IPC
|
||||
|
||||
public:
|
||||
nsQueryContentEvent(PRBool aIsTrusted, PRUint32 aMsg, nsIWidget *aWidget) :
|
||||
nsGUIEvent(aIsTrusted, aMsg, aWidget, NS_QUERY_CONTENT_EVENT),
|
||||
mSucceeded(PR_FALSE), mWasAsync(PR_FALSE)
|
||||
mSucceeded(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1261,22 +1182,7 @@ public:
|
|||
mInput.mLength = aLength;
|
||||
}
|
||||
|
||||
PRUint32 GetSelectionStart(void) const
|
||||
{
|
||||
NS_ASSERTION(message == NS_QUERY_SELECTED_TEXT,
|
||||
"not querying selection");
|
||||
return mReply.mOffset + (mReply.mReversed ? mReply.mString.Length() : 0);
|
||||
}
|
||||
|
||||
PRUint32 GetSelectionEnd(void) const
|
||||
{
|
||||
NS_ASSERTION(message == NS_QUERY_SELECTED_TEXT,
|
||||
"not querying selection");
|
||||
return mReply.mOffset + (mReply.mReversed ? 0 : mReply.mString.Length());
|
||||
}
|
||||
|
||||
PRBool mSucceeded;
|
||||
PRPackedBool mWasAsync;
|
||||
struct {
|
||||
PRUint32 mOffset;
|
||||
PRUint32 mLength;
|
||||
|
@ -1313,16 +1219,6 @@ public:
|
|||
|
||||
class nsSelectionEvent : public nsGUIEvent
|
||||
{
|
||||
#ifdef MOZ_IPC
|
||||
private:
|
||||
friend class mozilla::dom::PBrowserParent;
|
||||
friend class mozilla::dom::PBrowserChild;
|
||||
|
||||
nsSelectionEvent()
|
||||
{
|
||||
}
|
||||
#endif // MOZ_IPC
|
||||
|
||||
public:
|
||||
nsSelectionEvent(PRBool aIsTrusted, PRUint32 aMsg, nsIWidget *aWidget) :
|
||||
nsGUIEvent(aIsTrusted, aMsg, aWidget, NS_SELECTION_EVENT),
|
||||
|
|
|
@ -1,273 +0,0 @@
|
|||
/* -*- 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
|
||||
* The Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* 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 nsGUIEventIPC_h__
|
||||
#define nsGUIEventIPC_h__
|
||||
|
||||
#include "IPC/IPCMessageUtils.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
namespace IPC
|
||||
{
|
||||
|
||||
template<>
|
||||
struct ParamTraits<nsEvent>
|
||||
{
|
||||
typedef nsEvent paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, aParam.eventStructType);
|
||||
WriteParam(aMsg, aParam.message);
|
||||
WriteParam(aMsg, aParam.refPoint);
|
||||
WriteParam(aMsg, aParam.time);
|
||||
WriteParam(aMsg, aParam.flags);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, &aResult->eventStructType) &&
|
||||
ReadParam(aMsg, aIter, &aResult->message) &&
|
||||
ReadParam(aMsg, aIter, &aResult->refPoint) &&
|
||||
ReadParam(aMsg, aIter, &aResult->time) &&
|
||||
ReadParam(aMsg, aIter, &aResult->flags);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<nsGUIEvent>
|
||||
{
|
||||
typedef nsGUIEvent paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<nsEvent>(aParam));
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, static_cast<nsEvent*>(aResult));
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<nsInputEvent>
|
||||
{
|
||||
typedef nsInputEvent paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<nsGUIEvent>(aParam));
|
||||
WriteParam(aMsg, aParam.isShift);
|
||||
WriteParam(aMsg, aParam.isControl);
|
||||
WriteParam(aMsg, aParam.isAlt);
|
||||
WriteParam(aMsg, aParam.isMeta);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, static_cast<nsGUIEvent*>(aResult)) &&
|
||||
ReadParam(aMsg, aIter, &aResult->isShift) &&
|
||||
ReadParam(aMsg, aIter, &aResult->isControl) &&
|
||||
ReadParam(aMsg, aIter, &aResult->isAlt) &&
|
||||
ReadParam(aMsg, aIter, &aResult->isMeta);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<nsTextRangeStyle>
|
||||
{
|
||||
typedef nsTextRangeStyle paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, aParam.mDefinedStyles);
|
||||
WriteParam(aMsg, aParam.mLineStyle);
|
||||
WriteParam(aMsg, aParam.mIsBoldLine);
|
||||
WriteParam(aMsg, aParam.mForegroundColor);
|
||||
WriteParam(aMsg, aParam.mBackgroundColor);
|
||||
WriteParam(aMsg, aParam.mUnderlineColor);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, &aResult->mDefinedStyles) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mLineStyle) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mIsBoldLine) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mForegroundColor) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mBackgroundColor) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mUnderlineColor);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<nsTextRange>
|
||||
{
|
||||
typedef nsTextRange paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, aParam.mStartOffset);
|
||||
WriteParam(aMsg, aParam.mEndOffset);
|
||||
WriteParam(aMsg, aParam.mRangeType);
|
||||
WriteParam(aMsg, aParam.mRangeStyle);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, &aResult->mStartOffset) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mEndOffset) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mRangeType) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mRangeStyle);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<nsTextEvent>
|
||||
{
|
||||
typedef nsTextEvent paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<nsInputEvent>(aParam));
|
||||
WriteParam(aMsg, aParam.theText);
|
||||
WriteParam(aMsg, aParam.isChar);
|
||||
WriteParam(aMsg, aParam.rangeCount);
|
||||
for (PRUint32 index = 0; index < aParam.rangeCount; index++)
|
||||
WriteParam(aMsg, aParam.rangeArray[index]);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, static_cast<nsInputEvent*>(aResult)) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->theText) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->isChar) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->rangeCount))
|
||||
return false;
|
||||
|
||||
if (!aResult->rangeCount)
|
||||
return true;
|
||||
|
||||
if (!aResult->AllocRangeArray(aResult->rangeCount))
|
||||
return false;
|
||||
|
||||
for (PRUint32 index = 0; index < aResult->rangeCount; index++)
|
||||
if (!ReadParam(aMsg, aIter, &aResult->rangeArray[index]))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<nsCompositionEvent>
|
||||
{
|
||||
typedef nsCompositionEvent paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<nsInputEvent>(aParam));
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, static_cast<nsInputEvent*>(aResult));
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<nsQueryContentEvent>
|
||||
{
|
||||
typedef nsQueryContentEvent paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<nsGUIEvent>(aParam));
|
||||
WriteParam(aMsg, aParam.mSucceeded);
|
||||
WriteParam(aMsg, aParam.mInput.mOffset);
|
||||
WriteParam(aMsg, aParam.mInput.mLength);
|
||||
WriteParam(aMsg, aParam.mReply.mOffset);
|
||||
WriteParam(aMsg, aParam.mReply.mString);
|
||||
WriteParam(aMsg, aParam.mReply.mRect);
|
||||
WriteParam(aMsg, aParam.mReply.mReversed);
|
||||
WriteParam(aMsg, aParam.mReply.mHasSelection);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
aResult->mWasAsync = PR_TRUE;
|
||||
return ReadParam(aMsg, aIter, static_cast<nsGUIEvent*>(aResult)) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mSucceeded) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mInput.mOffset) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mInput.mLength) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mReply.mOffset) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mReply.mString) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mReply.mRect) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mReply.mReversed) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mReply.mHasSelection);
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<nsSelectionEvent>
|
||||
{
|
||||
typedef nsSelectionEvent paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, static_cast<nsGUIEvent>(aParam));
|
||||
WriteParam(aMsg, aParam.mOffset);
|
||||
WriteParam(aMsg, aParam.mLength);
|
||||
WriteParam(aMsg, aParam.mReversed);
|
||||
WriteParam(aMsg, aParam.mExpandToClusterBoundary);
|
||||
WriteParam(aMsg, aParam.mSucceeded);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, static_cast<nsGUIEvent*>(aResult)) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mOffset) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mLength) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mReversed) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mExpandToClusterBoundary) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mSucceeded);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace IPC
|
||||
|
||||
#endif // nsGUIEventIPC_h__
|
||||
|
|
@ -37,10 +37,7 @@
|
|||
|
||||
#include <android/log.h>
|
||||
|
||||
#ifdef MOZ_IPC
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#endif
|
||||
#include <pthread.h>
|
||||
#include <prthread.h>
|
||||
#include "nsXPCOMStrings.h"
|
||||
|
@ -195,12 +192,8 @@ AndroidBridge::NotifyIME(int aType, int aState)
|
|||
if (sBridge)
|
||||
JNI()->CallStaticVoidMethod(sBridge->mGeckoAppShellClass,
|
||||
sBridge->jNotifyIME, aType, aState);
|
||||
#ifdef MOZ_IPC
|
||||
// It's possible that we are in chrome process
|
||||
// but sBridge is not initialized yet
|
||||
else if (XRE_GetProcessType() == GeckoProcessType_Content)
|
||||
else
|
||||
mozilla::dom::ContentChild::GetSingleton()->SendNotifyIME(aType, aState);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -208,11 +201,9 @@ AndroidBridge::NotifyIMEChange(const PRUnichar *aText, PRUint32 aTextLen,
|
|||
int aStart, int aEnd, int aNewEnd)
|
||||
{
|
||||
if (!sBridge) {
|
||||
#ifdef MOZ_IPC
|
||||
mozilla::dom::ContentChild::GetSingleton()->
|
||||
SendNotifyIMEChange(nsAutoString(aText), aTextLen,
|
||||
aStart, aEnd, aNewEnd);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1365,11 +1365,11 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
|
|||
AndroidBridge::Bridge()->ReturnIMEQueryResult(
|
||||
nsnull, 0, 0, 0);
|
||||
return;
|
||||
} else if (!event.mWasAsync) {
|
||||
AndroidBridge::Bridge()->ReturnIMEQueryResult(
|
||||
event.mReply.mString.get(),
|
||||
event.mReply.mString.Length(), 0, 0);
|
||||
}
|
||||
|
||||
AndroidBridge::Bridge()->ReturnIMEQueryResult(
|
||||
event.mReply.mString.get(),
|
||||
event.mReply.mString.Length(), 0, 0);
|
||||
//ALOGIME("IME: -> l=%u", event.mReply.mString.Length());
|
||||
}
|
||||
return;
|
||||
|
@ -1411,13 +1411,21 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
|
|||
AndroidBridge::Bridge()->ReturnIMEQueryResult(
|
||||
nsnull, 0, 0, 0);
|
||||
return;
|
||||
} else if (!event.mWasAsync) {
|
||||
AndroidBridge::Bridge()->ReturnIMEQueryResult(
|
||||
event.mReply.mString.get(),
|
||||
event.mReply.mString.Length(),
|
||||
event.GetSelectionStart(),
|
||||
event.GetSelectionEnd() - event.GetSelectionStart());
|
||||
}
|
||||
|
||||
int selStart = int(event.mReply.mOffset +
|
||||
(event.mReply.mReversed ?
|
||||
event.mReply.mString.Length() : 0));
|
||||
|
||||
int selLength = event.mReply.mReversed ?
|
||||
int(event.mReply.mString.Length()) :
|
||||
-int(event.mReply.mString.Length());
|
||||
|
||||
AndroidBridge::Bridge()->ReturnIMEQueryResult(
|
||||
event.mReply.mString.get(),
|
||||
event.mReply.mString.Length(),
|
||||
selStart, selLength);
|
||||
|
||||
//ALOGIME("IME: -> o=%u, l=%u", event.mReply.mOffset, event.mReply.mString.Length());
|
||||
}
|
||||
return;
|
||||
|
@ -1512,9 +1520,10 @@ NS_IMETHODIMP
|
|||
nsWindow::OnIMEFocusChange(PRBool aFocus)
|
||||
{
|
||||
ALOGIME("IME: OnIMEFocusChange: f=%d", aFocus);
|
||||
|
||||
AndroidBridge::NotifyIME(AndroidBridge::NOTIFY_IME_FOCUSCHANGE,
|
||||
int(aFocus));
|
||||
|
||||
if (AndroidBridge::Bridge())
|
||||
AndroidBridge::NotifyIME(AndroidBridge::NOTIFY_IME_FOCUSCHANGE,
|
||||
int(aFocus));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче