Commit 92522114 authored by Butkovits Atila's avatar Butkovits Atila
Browse files

Backed out 7 changesets (bug 1651705) as requested by Aklotz. CLOSED TREE

Backed out changeset 60730e8394ae (bug 1651705)
Backed out changeset c441ae751191 (bug 1651705)
Backed out changeset c289f06ceba2 (bug 1651705)
Backed out changeset d4491ef94b3e (bug 1651705)
Backed out changeset 1cca90ffab83 (bug 1651705)
Backed out changeset 9b1ce53e6472 (bug 1651705)
Backed out changeset a31251ba4566 (bug 1651705)
parent 175f238a
......@@ -146,7 +146,7 @@ void DocAccessibleWrap::CacheViewportCallback(nsITimer* aTimer,
}
ipcDoc->SendBatch(eBatch_Viewport, cacheData);
} else if (RefPtr<SessionAccessibility> sessionAcc =
} else if (SessionAccessibility* sessionAcc =
SessionAccessibility::GetInstanceFor(docAcc)) {
nsTArray<AccessibleWrap*> accessibles(inViewAccs.Count());
for (auto iter = inViewAccs.Iter(); !iter.Done(); iter.Next()) {
......@@ -177,7 +177,7 @@ void DocAccessibleWrap::CacheViewportCallback(nsITimer* aTimer,
ipcDoc->GetPlatformExtension()->SendSetPivotBoundaries(
firstDoc, UNIQUE_ID(first), lastDoc, UNIQUE_ID(last));
}
} else if (RefPtr<SessionAccessibility> sessionAcc =
} else if (SessionAccessibility* sessionAcc =
SessionAccessibility::GetInstanceFor(docAcc)) {
sessionAcc->UpdateAccessibleFocusBoundaries(
first ? static_cast<AccessibleWrap*>(first) : docAcc,
......@@ -243,7 +243,7 @@ void DocAccessibleWrap::CacheFocusPath(AccessibleWrap* aAccessible) {
}
ipcDoc->SendBatch(eBatch_FocusPath, cacheData);
} else if (RefPtr<SessionAccessibility> sessionAcc =
} else if (SessionAccessibility* sessionAcc =
SessionAccessibility::GetInstanceFor(this)) {
nsTArray<AccessibleWrap*> accessibles;
for (AccessibleWrap* acc = aAccessible; acc && acc != this->Parent();
......@@ -280,7 +280,7 @@ void DocAccessibleWrap::UpdateFocusPathBounds() {
}
ipcDoc->SendBatch(eBatch_BoundsUpdate, boundsData);
} else if (RefPtr<SessionAccessibility> sessionAcc =
} else if (SessionAccessibility* sessionAcc =
SessionAccessibility::GetInstanceFor(this)) {
nsTArray<AccessibleWrap*> accessibles(mFocusPath.Count());
for (auto iter = mFocusPath.Iter(); !iter.Done(); iter.Next()) {
......
......@@ -53,7 +53,7 @@ void a11y::ProxyDestroyed(ProxyAccessible* aProxy) {
}
void a11y::ProxyEvent(ProxyAccessible* aTarget, uint32_t aEventType) {
RefPtr<SessionAccessibility> sessionAcc =
SessionAccessibility* sessionAcc =
SessionAccessibility::GetInstanceFor(aTarget);
if (!sessionAcc) {
return;
......@@ -68,7 +68,7 @@ void a11y::ProxyEvent(ProxyAccessible* aTarget, uint32_t aEventType) {
void a11y::ProxyStateChangeEvent(ProxyAccessible* aTarget, uint64_t aState,
bool aEnabled) {
RefPtr<SessionAccessibility> sessionAcc =
SessionAccessibility* sessionAcc =
SessionAccessibility::GetInstanceFor(aTarget);
if (!sessionAcc) {
......@@ -100,7 +100,7 @@ void a11y::ProxyStateChangeEvent(ProxyAccessible* aTarget, uint64_t aState,
void a11y::ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset,
bool aIsSelectionCollapsed) {
RefPtr<SessionAccessibility> sessionAcc =
SessionAccessibility* sessionAcc =
SessionAccessibility::GetInstanceFor(aTarget);
if (sessionAcc) {
......@@ -111,7 +111,7 @@ void a11y::ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset,
void a11y::ProxyTextChangeEvent(ProxyAccessible* aTarget, const nsString& aStr,
int32_t aStart, uint32_t aLen, bool aIsInsert,
bool aFromUser) {
RefPtr<SessionAccessibility> sessionAcc =
SessionAccessibility* sessionAcc =
SessionAccessibility::GetInstanceFor(aTarget);
if (sessionAcc) {
......@@ -163,7 +163,7 @@ void a11y::ProxyScrollingEvent(ProxyAccessible* aTarget, uint32_t aEventType,
uint32_t aScrollX, uint32_t aScrollY,
uint32_t aMaxScrollX, uint32_t aMaxScrollY) {
if (aEventType == nsIAccessibleEvent::EVENT_SCROLLING) {
RefPtr<SessionAccessibility> sessionAcc =
SessionAccessibility* sessionAcc =
SessionAccessibility::GetInstanceFor(aTarget);
if (sessionAcc) {
......@@ -176,7 +176,7 @@ void a11y::ProxyScrollingEvent(ProxyAccessible* aTarget, uint32_t aEventType,
void a11y::ProxyAnnouncementEvent(ProxyAccessible* aTarget,
const nsString& aAnnouncement,
uint16_t aPriority) {
RefPtr<SessionAccessibility> sessionAcc =
SessionAccessibility* sessionAcc =
SessionAccessibility::GetInstanceFor(aTarget);
if (sessionAcc) {
......@@ -188,7 +188,7 @@ void a11y::ProxyAnnouncementEvent(ProxyAccessible* aTarget,
void a11y::ProxyBatch(ProxyAccessible* aDocument, const uint64_t aBatchType,
const nsTArray<ProxyAccessible*>& aAccessibles,
const nsTArray<BatchData>& aData) {
RefPtr<SessionAccessibility> sessionAcc =
SessionAccessibility* sessionAcc =
SessionAccessibility::GetInstanceFor(aDocument);
if (!sessionAcc) {
return;
......@@ -253,4 +253,4 @@ bool a11y::LocalizeString(const char* aToken, nsAString& aLocalized,
NS_WARNING("Failed to localize string");
aLocalized.AssignLiteral("");
return false;
}
}
\ No newline at end of file
......@@ -21,7 +21,6 @@
#include "mozilla/a11y/DocAccessibleParent.h"
#include "mozilla/a11y/DocManager.h"
#include "mozilla/jni/GeckoBundleUtils.h"
#include "mozilla/widget/GeckoViewSupport.h"
#ifdef DEBUG
# include <android/log.h>
......@@ -43,6 +42,10 @@
acc->funcname(__VA_ARGS__); \
}
template <>
const char nsWindow::NativePtr<mozilla::a11y::SessionAccessibility>::sName[] =
"SessionAccessibility";
using namespace mozilla::a11y;
class Settings final
......@@ -57,13 +60,6 @@ class Settings final
}
};
SessionAccessibility::SessionAccessibility(
jni::NativeWeakPtr<widget::GeckoViewSupport> aWindow,
java::SessionAccessibility::NativeProvider::Param aSessionAccessibility)
: mWindow(aWindow), mSessionAccessibility(aSessionAccessibility) {
SetAttached(true, nullptr);
}
void SessionAccessibility::SetAttached(bool aAttached,
already_AddRefed<Runnable> aRunnable) {
if (RefPtr<nsThread> uiThread = GetAndroidUiThread()) {
......@@ -105,17 +101,11 @@ mozilla::jni::Object::LocalRef SessionAccessibility::GetNodeInfo(int32_t aID) {
}
RootAccessibleWrap* SessionAccessibility::GetRoot() {
auto acc(mWindow.Access());
if (!acc) {
return nullptr;
}
nsWindow* gkWindow = acc->GetNsWindow();
if (!gkWindow) {
if (!mWindow) {
return nullptr;
}
return static_cast<RootAccessibleWrap*>(gkWindow->GetRootAccessible());
return static_cast<RootAccessibleWrap*>(mWindow->GetRootAccessible());
}
void SessionAccessibility::SetText(int32_t aID, jni::String::Param aText) {
......@@ -160,7 +150,7 @@ void SessionAccessibility::Paste(int32_t aID) {
FORWARD_ACTION_TO_ACCESSIBLE(Paste);
}
RefPtr<SessionAccessibility> SessionAccessibility::GetInstanceFor(
SessionAccessibility* SessionAccessibility::GetInstanceFor(
ProxyAccessible* aAccessible) {
auto tab =
static_cast<dom::BrowserParent*>(aAccessible->Document()->Manager());
......@@ -174,7 +164,7 @@ RefPtr<SessionAccessibility> SessionAccessibility::GetInstanceFor(
return chromeDoc ? GetInstanceFor(chromeDoc) : nullptr;
}
RefPtr<SessionAccessibility> SessionAccessibility::GetInstanceFor(
SessionAccessibility* SessionAccessibility::GetInstanceFor(
Accessible* aAccessible) {
RootAccessible* rootAcc = aAccessible->RootAccessible();
nsViewManager* vm = rootAcc->PresShellPtr()->GetViewManager();
......
......@@ -7,7 +7,6 @@
#define mozilla_a11y_SessionAccessibility_h_
#include "mozilla/java/SessionAccessibilityNatives.h"
#include "mozilla/widget/GeckoViewSupport.h"
#include "nsAppShell.h"
#include "nsThreadUtils.h"
#include "nsWindow.h"
......@@ -29,10 +28,13 @@ class SessionAccessibility final
Base;
SessionAccessibility(
jni::NativeWeakPtr<widget::GeckoViewSupport> aWindow,
java::SessionAccessibility::NativeProvider::Param aSessionAccessibility);
nsWindow::NativePtr<SessionAccessibility>* aPtr, nsWindow* aWindow,
java::SessionAccessibility::NativeProvider::Param aSessionAccessibility)
: mWindow(aPtr, aWindow), mSessionAccessibility(aSessionAccessibility) {
SetAttached(true, nullptr);
}
void OnWeakNonIntrusiveDetach(already_AddRefed<Runnable> aDisposer) {
void OnDetach(already_AddRefed<Runnable> aDisposer) {
SetAttached(false, std::move(aDisposer));
}
......@@ -42,8 +44,8 @@ class SessionAccessibility final
}
static void Init();
static RefPtr<SessionAccessibility> GetInstanceFor(ProxyAccessible* aAccessible);
static RefPtr<SessionAccessibility> GetInstanceFor(Accessible* aAccessible);
static SessionAccessibility* GetInstanceFor(ProxyAccessible* aAccessible);
static SessionAccessibility* GetInstanceFor(Accessible* aAccessible);
// Native implementations
using Base::AttachNative;
......@@ -107,7 +109,7 @@ class SessionAccessibility final
void SetAttached(bool aAttached, already_AddRefed<Runnable> aRunnable);
RootAccessibleWrap* GetRoot();
jni::NativeWeakPtr<widget::GeckoViewSupport> mWindow; // Parent only
nsWindow::WindowPtr<SessionAccessibility> mWindow; // Parent only
java::SessionAccessibility::NativeProvider::GlobalRef mSessionAccessibility;
};
......
......@@ -20,7 +20,7 @@ mozilla::ipc::IPCResult DocAccessiblePlatformExtParent::RecvSetPivotBoundaries(
MOZ_ASSERT(aFirstDoc);
MOZ_ASSERT(aLastDoc);
RefPtr<SessionAccessibility> sessionAcc = SessionAccessibility::GetInstanceFor(
SessionAccessibility* sessionAcc = SessionAccessibility::GetInstanceFor(
static_cast<DocAccessibleParent*>(Manager()));
if (!sessionAcc) {
return IPC_OK();
......
......@@ -2,9 +2,8 @@ package org.mozilla.gecko.mozglue;
// Class that all classes with native methods extend from.
public abstract class JNIObject {
// Pointer that references the native object. This is volatile because it may be accessed
// by multiple threads simultaneously.
private volatile long mHandle;
// Pointer to a WeakPtr object that refers to the native object.
private long mHandle;
// Dispose of any reference to a native object.
//
......
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_widget_AndroidView_h
#define mozilla_widget_AndroidView_h
#include "mozilla/widget/EventDispatcher.h"
namespace mozilla {
namespace widget {
class AndroidView final : public nsIAndroidView {
virtual ~AndroidView() {}
public:
const RefPtr<mozilla::widget::EventDispatcher> mEventDispatcher{
new mozilla::widget::EventDispatcher()};
AndroidView() {}
NS_DECL_ISUPPORTS
NS_DECL_NSIANDROIDVIEW
NS_FORWARD_NSIANDROIDEVENTDISPATCHER(mEventDispatcher->)
mozilla::java::GeckoBundle::GlobalRef mInitData;
};
} // namespace widget
} // namespace mozilla
#endif // mozilla_widget_AndroidView_h
......@@ -22,7 +22,6 @@
#include "mozilla/TextEvents.h"
#include "mozilla/ToString.h"
#include "mozilla/dom/BrowserChild.h"
#include "mozilla/widget/GeckoViewSupport.h"
#include <android/api-level.h>
#include <android/input.h>
......@@ -37,6 +36,10 @@
} while (0)
#endif
template <>
const char nsWindow::NativePtr<mozilla::widget::GeckoEditableSupport>::sName[] =
"GeckoEditableSupport";
static uint32_t ConvertAndroidKeyCodeToDOMKeyCode(int32_t androidKeyCode) {
// Special-case alphanumeric keycodes because they are most common.
if (androidKeyCode >= AKEYCODE_A && androidKeyCode <= AKEYCODE_Z) {
......@@ -462,10 +465,8 @@ void GeckoEditableSupport::OnKeyEvent(int32_t aAction, int32_t aKeyCode,
: widget ? widget->GetTextEventDispatcher() : nullptr;
NS_ENSURE_TRUE_VOID(dispatcher && widget);
if (!aIsSynthesizedImeKey) {
if (nsWindow* window = GetNsWindow()) {
window->UserActivity();
}
if (!aIsSynthesizedImeKey && mWindow) {
mWindow->UserActivity();
} else if (aIsSynthesizedImeKey && mIMEMaskEventsCount > 0) {
// Don't synthesize editor keys when not focused.
return;
......@@ -858,8 +859,8 @@ bool GeckoEditableSupport::DoReplaceText(int32_t aStart, int32_t aEnd,
return false;
}
if (nsWindow* window = GetNsWindow()) {
window->UserActivity();
if (mWindow) {
mWindow->UserActivity();
}
/*
......@@ -1263,8 +1264,7 @@ nsresult GeckoEditableSupport::NotifyIME(
if (mIsRemote) {
if (!mEditableAttached) {
// Re-attach on focus; see OnRemovedFrom().
jni::NativeWeakPtrHolder<GeckoEditableSupport>::AttachExisting(
mEditable, do_AddRef(this));
AttachNative(mEditable, this);
mEditableAttached = true;
}
// Because GeckoEditableSupport in content process doesn't
......@@ -1378,7 +1378,7 @@ void GeckoEditableSupport::OnRemovedFrom(
if (mIsRemote && mEditable->HasEditableParent()) {
// When we're remote, detach every time.
OnWeakNonIntrusiveDetach(NS_NewRunnableFunction(
OnDetach(NS_NewRunnableFunction(
"GeckoEditableSupport::OnRemovedFrom",
[editable = java::GeckoEditableChild::GlobalRef(mEditable)] {
DisposeNative(editable);
......@@ -1470,7 +1470,7 @@ void GeckoEditableSupport::TransferParent(jni::Object::Param aEditableParent) {
// only, so mInputContext may be still invalid since it is set after
// we have gotton focus.
RefPtr<GeckoEditableSupport> self(this);
nsAppShell::PostEvent([self = std::move(self)] {
nsAppShell::PostEvent([self] {
NS_WARNING_ASSERTION(
self->mDispatcher,
"Text dispatcher is still null. Why don't we get focus yet?");
......@@ -1515,19 +1515,15 @@ void GeckoEditableSupport::SetOnBrowserChild(dom::BrowserChild* aBrowserChild) {
// We need to set a new listener.
const auto editableChild = java::GeckoEditableChild::New(
/* parent */ nullptr, /* default */ false);
// Temporarily attach so we can receive the initial editable parent.
auto editableSupport =
jni::NativeWeakPtrHolder<GeckoEditableSupport>::Attach(editableChild,
editableChild);
auto accEditableSupport(editableSupport.Access());
MOZ_RELEASE_ASSERT(accEditableSupport);
RefPtr<widget::GeckoEditableSupport> editableSupport =
new widget::GeckoEditableSupport(editableChild);
// Tell PuppetWidget to use our listener for IME operations.
widget->SetNativeTextEventDispatcherListener(
accEditableSupport.AsRefPtr().get());
widget->SetNativeTextEventDispatcherListener(editableSupport);
accEditableSupport->mEditableAttached = true;
// Temporarily attach so we can receive the initial editable parent.
AttachNative(editableChild, editableSupport);
editableSupport->mEditableAttached = true;
// Connect the new child to a parent that corresponds to the BrowserChild.
java::GeckoServiceChildProcess::GetEditableParent(editableChild, contentId,
......@@ -1549,8 +1545,7 @@ void GeckoEditableSupport::SetOnBrowserChild(dom::BrowserChild* aBrowserChild) {
static_cast<widget::GeckoEditableSupport*>(listener.get());
if (!support->mEditableAttached) {
// Temporarily attach so we can receive the initial editable parent.
jni::NativeWeakPtrHolder<GeckoEditableSupport>::AttachExisting(
support->GetJavaEditable(), do_AddRef(support));
AttachNative(support->GetJavaEditable(), support);
support->mEditableAttached = true;
}
......@@ -1559,21 +1554,5 @@ void GeckoEditableSupport::SetOnBrowserChild(dom::BrowserChild* aBrowserChild) {
contentId, tabId);
}
nsIWidget* GeckoEditableSupport::GetWidget() const {
MOZ_ASSERT(NS_IsMainThread());
return mDispatcher ? mDispatcher->GetWidget() : GetNsWindow();
}
nsWindow* GeckoEditableSupport::GetNsWindow() const {
MOZ_ASSERT(NS_IsMainThread());
auto acc(mWindow.Access());
if (!acc) {
return nullptr;
}
return acc->GetNsWindow();
}
} // namespace widget
} // namespace mozilla
......@@ -78,7 +78,7 @@ class GeckoEditableSupport final
enum RemoveCompositionFlag { CANCEL_IME_COMPOSITION, COMMIT_IME_COMPOSITION };
const bool mIsRemote;
jni::NativeWeakPtr<GeckoViewSupport> mWindow; // Parent only
nsWindow::WindowPtr<GeckoEditableSupport> mWindow; // Parent only
RefPtr<TextEventDispatcher> mDispatcher;
java::GeckoEditableChild::GlobalRef mEditable;
bool mEditableAttached;
......@@ -95,8 +95,9 @@ class GeckoEditableSupport final
bool mIMETextChangedDuringFlush;
bool mIMEMonitorCursor;
nsIWidget* GetWidget() const;
nsWindow* GetNsWindow() const;
nsIWidget* GetWidget() const {
return mDispatcher ? mDispatcher->GetWidget() : mWindow;
}
nsresult BeginInputTransaction(TextEventDispatcher* aDispatcher) {
if (mIsRemote) {
......@@ -155,14 +156,16 @@ class GeckoEditableSupport final
static void SetOnBrowserChild(dom::BrowserChild* aBrowserChild);
// Constructor for main process GeckoEditableChild.
GeckoEditableSupport(jni::NativeWeakPtr<GeckoViewSupport> aWindow,
GeckoEditableSupport(nsWindow::NativePtr<GeckoEditableSupport>* aPtr,
nsWindow* aWindow,
java::GeckoEditableChild::Param aEditableChild)
: mIsRemote(!aWindow.IsAttached()),
mWindow(aWindow),
: mIsRemote(!aWindow),
mWindow(aPtr, aWindow),
mEditable(aEditableChild),
mEditableAttached(!mIsRemote),
mIMERanges(new TextRangeArray()),
mIMEMaskEventsCount(1), // Mask IME events since there's no focus yet
mIMEMaskEventsCount(1) // Mask IME events since there's no focus yet
,
mIMEFocusCount(0),
mIMEDelaySynchronizeReply(false),
mIMEActiveSynchronizeCount(0),
......@@ -172,7 +175,7 @@ class GeckoEditableSupport final
// Constructor for content process GeckoEditableChild.
explicit GeckoEditableSupport(java::GeckoEditableChild::Param aEditableChild)
: GeckoEditableSupport(nullptr, aEditableChild) {}
: GeckoEditableSupport(nullptr, nullptr, aEditableChild) {}
NS_DECL_ISUPPORTS
......@@ -201,13 +204,12 @@ class GeckoEditableSupport final
const java::GeckoEditableChild::Ref& GetJavaEditable() { return mEditable; }
void OnWeakNonIntrusiveDetach(already_AddRefed<Runnable> aDisposer) {
void OnDetach(already_AddRefed<Runnable> aDisposer) {
RefPtr<GeckoEditableSupport> self(this);
nsAppShell::PostEvent(
[self = std::move(self), disposer = RefPtr<Runnable>(aDisposer)] {
self->mEditableAttached = false;
disposer->Run();
});
nsAppShell::PostEvent([this, self, disposer = RefPtr<Runnable>(aDisposer)] {
mEditableAttached = false;
disposer->Run();
});
}
// Transfer to a new parent.
......
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_widget_GeckoViewSupport_h
#define mozilla_widget_GeckoViewSupport_h
#include "mozilla/java/GeckoResultWrappers.h"
#include "mozilla/java/GeckoSessionNatives.h"
#include "mozilla/java/WebResponseWrappers.h"
#include "mozilla/widget/WindowEvent.h"
class nsWindow;
namespace mozilla {
namespace widget {
class GeckoViewSupport final
: public java::GeckoSession::Window::Natives<GeckoViewSupport> {
RefPtr<nsWindow> mWindow;
// We hold a WeakRef because we want to allow the
// GeckoSession.Window to be garbage collected.
// Callers need to create a LocalRef from this
// before calling methods.
java::GeckoSession::Window::WeakRef mGeckoViewWindow;
public:
typedef java::GeckoSession::Window::Natives<GeckoViewSupport> Base;
template <typename Functor>
static void OnNativeCall(Functor&& aCall) {
NS_DispatchToMainThread(new WindowEvent<Functor>(std::move(aCall)));
}
GeckoViewSupport(nsWindow* aWindow,
const java::GeckoSession::Window::LocalRef& aInstance,
nsPIDOMWindowOuter* aDOMWindow)
: mWindow(aWindow), mGeckoViewWindow(aInstance), mDOMWindow(aDOMWindow) {}
~GeckoViewSupport();
nsWindow* GetNsWindow() const { return mWindow; }
using Base::DisposeNative;
/**
* GeckoView methods
*/
private:
nsCOMPtr<nsPIDOMWindowOuter> mDOMWindow;
bool mIsReady{false};
public:
// Create and attach a window.
static void Open(const jni::Class::LocalRef& aCls,
java::GeckoSession::Window::Param aWindow,
jni::Object::Param aQueue, jni::Object::Param aCompositor,
jni::Object::Param aDispatcher,
jni::Object::Param aSessionAccessibility,
jni::Object::Param aInitData, jni::String::Param aId,
jni::String::Param aChromeURI, int32_t aScreenId,
bool aPrivateMode, bool aRemote);
// Close and destroy the nsWindow.
void Close();
// Transfer this nsWindow to new GeckoSession objects.
void Transfer(const java::GeckoSession::Window::LocalRef& inst,
jni::Object::Param aQueue, jni::Object::Param aCompositor,
jni::Object::Param aDispatcher,
jni::Object::Param aSessionAccessibility,
jni::Object::Param aInitData);
void AttachEditable(const java::GeckoSession::Window::LocalRef& inst,
jni::Object::Param aEditableParent);
void AttachAccessibility(const java::GeckoSession::Window::LocalRef& inst,
jni::Object::Param aSessionAccessibility);
void OnReady(jni::Object::Param aQueue = nullptr);
auto OnLoadRequest(mozilla::jni::String::Param aUri, int32_t aWindowType,
int32_t aFlags, mozilla::jni::String::Param aTriggeringUri,
bool aHasUserGesture, bool aIsTopLevel) const
-> java::GeckoResult::LocalRef;
void PassExternalResponse(java::WebResponse::Param aResponse);
void AttachMediaSessionController(
const java::GeckoSession::Window::LocalRef& inst,
jni::Object::Param aController, const int64_t aId);
void DetachMediaSessionController(
const java::GeckoSession::Window::LocalRef& inst,
jni::Object::Param aController);
void OnWeakNonIntrusiveDetach(already_AddRefed<Runnable> aDisposer) {
RefPtr<Runnable> disposer(aDisposer);
disposer->Run();
}
};
} // namespace widget
} // namespace mozilla
#endif // mozilla_widget_GeckoViewSupport_h
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_widget_WindowEvent_h
#define mozilla_widget_WindowEvent_h
#include "nsThreadUtils.h"
#include "mozilla/jni/Natives.h"
namespace mozilla {
namespace widget {
// An Event subclass that guards against stale events.
// (See the implmentation of mozilla::jni::detail::ProxyNativeCall for info
// about the default template parameters for this class)
template <typename Lambda, bool IsStatic = Lambda::isStatic,
typename InstanceType = typename Lambda::ThisArgType,
class Impl = typename Lambda::TargetClass>
class WindowEvent : public Runnable {
bool IsStaleCall() {
if (IsStatic) {
// Static calls are never stale.
return false;
}
return jni::NativePtrTrai