gecko-dev/widget/android/GeckoEditableSupport.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

255 строки
9.2 KiB
C
Исходник Обычный вид История

/* -*- Mode: c++; c-basic-offset: 2; tab-width: 20; indent-tabs-mode: nil; -*-
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
* 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_GeckoEditableSupport_h
#define mozilla_widget_GeckoEditableSupport_h
#include "GeneratedJNIWrappers.h"
#include "nsAppShell.h"
#include "nsIWidget.h"
#include "nsTArray.h"
#include "mozilla/TextEventDispatcher.h"
#include "mozilla/TextEventDispatcherListener.h"
#include "mozilla/UniquePtr.h"
class nsWindow;
namespace mozilla {
class TextComposition;
namespace dom {
class BrowserChild;
}
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
namespace widget {
class GeckoEditableSupport final
: public TextEventDispatcherListener,
Bug 1339685 - Split GeckoEditable into parent and child classes; r=nalexander r=esawin r=snorp Bug 1339685 - 1. Support compiling GeckoView aidl from multiple packages; r=nalexander Specify a list of AIDL files for GeckoView so we can include AIDLs from multiple packages, and not just those from the org.mozilla.gecko.process package. Bug 1339685 - 2. Add AIDLs for GeckoEditable; r=esawin Add IGeckoEditableParent.aidl and IGeckoEditableChild.aidl for two-way communication between the parent, which lives in the main process, and the child, which lives in the main process or a child content process. Bug 1339685 - 3. Refactor some GeckoEditable code; r=esawin Auto-generate native constants for the constants in GeckoEditableClient, instead of keeping a separate set of constants in native code. Bug 1339685 - 4. Add GeckoEditableChild; r=esawin Add the GeckoEditableChild class, which is currently only used in the main process as the interface between the native nsWindow and GeckoEditable. Eventually, it will be expanded to child content processes as the interface between the native PuppetWidget and main process GeckoEditable. Bug 1339685 - 5. Use GeckoEditableChild from GeckoEditable; r=esawin Make calls to GeckoEditableChild from GeckoEditable, and remove code that exists in GeckoEditableChild from GeckoEditable. Bug 1339685 - 6. Add GetNativeObject member to proxied native calls; r=snorp Add a convenience function for getting the C++ object that is the target of the native call. Bug 1339685 - 7. Use GeckoEditableChild from native code; r=esawin Make nsWindow and GeckoEditableSupport use GeckoEditableChild for communication. nsWindow still keeps a reference to GeckoEditable for switching views. Bug 1339685 - 8. Updated generated bindings; r=me
2017-03-02 21:47:14 +03:00
public java::GeckoEditableChild::Natives<GeckoEditableSupport> {
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
/*
Rules for managing IME between Gecko and Java:
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
* Gecko controls the text content, and Java shadows the Gecko text
through text updates
* Gecko and Java maintain separate selections, and synchronize when
needed through selection updates and set-selection events
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
* Java controls the composition, and Gecko shadows the Java
composition through update composition events
*/
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
using EditableBase = java::GeckoEditableChild::Natives<GeckoEditableSupport>;
using EditableClient = java::SessionTextInput::EditableClient;
using EditableListener = java::SessionTextInput::EditableListener;
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
struct IMETextChange final {
int32_t mStart, mOldEnd, mNewEnd;
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
IMETextChange() : mStart(-1), mOldEnd(-1), mNewEnd(-1) {}
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
explicit IMETextChange(const IMENotification& aIMENotification)
: mStart(aIMENotification.mTextChangeData.mStartOffset),
mOldEnd(aIMENotification.mTextChangeData.mRemovedEndOffset),
mNewEnd(aIMENotification.mTextChangeData.mAddedEndOffset) {
MOZ_ASSERT(aIMENotification.mMessage == NOTIFY_IME_OF_TEXT_CHANGE,
"IMETextChange initialized with wrong notification");
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
MOZ_ASSERT(aIMENotification.mTextChangeData.IsValid(),
"The text change notification isn't initialized");
Bug 1343075 - Use GeckoEditableSupport from PuppetWidget; r=masayuki r=rbarker r=snorp r=esawin Bug 1343075 - 1a. Add TextEventDispatcherListener::GetIMEUpdatePreference; r=masayuki Add a GetIMEUpdatePreference method to TextEventDispatcherListener to optionally control which IME notifications are received by NotifyIME. This patch also makes nsBaseWidget forward its GetIMEUpdatePreference call to the widget's native TextEventDispatcherListener. Bug 1343075 - 1b. Implement GetIMEUpdatePreference for all TextEventDispatcherListener; r=masayuki This patch implements GetIMEUpdatePreference for all TextEventDispatcherListener implementations, by moving previous implementations of nsIWidget::GetIMEUpdatePreference. Bug 1343075 - 2. Allow setting a PuppetWidget's native TextEventDispatcherListener; r=masayuki In PuppetWidget, add getter and setter for the widget's native TextEventDispatcherListener. This allows overriding of PuppetWidget's default IME handling. For example, on Android, the PuppetWidget's native TextEventDispatcherListener will communicate directly with Java IME code in the main process. Bug 1343075 - 3. Add AIDL interface for main process; r=rbarker Add AIDL definition and implementation for an interface for the main process that child processes can access. Bug 1343075 - 4. Set Gecko thread JNIEnv for child process; r=snorp Add a JNIEnv* parameter to XRE_SetAndroidChildFds, which is used to set the Gecko thread JNIEnv for child processes. XRE_SetAndroidChildFds is the only Android-specific entry point for child processes, so I think it's the most logical place to initialize JNI. Bug 1343075 - 5. Support multiple remote GeckoEditableChild; r=esawin Support remote GeckoEditableChild instances that are created in the content processes and connect to the parent process GeckoEditableParent through binders. Support having multiple GeckoEditableChild instances in GeckoEditable by keeping track of which child is currently focused, and only allow calls to/from the focused child by using access tokens. Bug 1343075 - 6. Add method to get GeckoEditableParent instance; r=esawin Add IProcessManager.getEditableParent, which a content process can call to get the GeckoEditableParent instance that corresponds to a given content process tab, from the main process. Bug 1343075 - 7. Support GeckoEditableSupport in content processes; r=esawin Support creating and running GeckoEditableSupport attached to a PuppetWidget in content processes. Because we don't know PuppetWidget's lifetime as well as nsWindow's, when attached to PuppetWidget, we need to attach/detach our native object on focus/blur, respectively. Bug 1343075 - 8. Connect GeckoEditableSupport on PuppetWidget creation; r=esawin Listen to the "tab-child-created" notification and attach our content process GeckoEditableSupport to the new PuppetWidget. Bug 1343075 - 9. Update auto-generated bindings; r=me
2017-03-08 06:34:39 +03:00
MOZ_ASSERT(aIMENotification.mTextChangeData.IsInInt32Range(),
"The text change notification is out of range");
}
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
bool IsEmpty() const { return mStart < 0; }
};
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
enum FlushChangesFlag {
// Not retrying.
FLUSH_FLAG_NONE,
// Retrying due to IME text changes during flush.
FLUSH_FLAG_RETRY,
// Retrying due to IME sync exceptions during flush.
FLUSH_FLAG_RECOVER
Bug 1339685 - Split GeckoEditable into parent and child classes; r=nalexander r=esawin r=snorp Bug 1339685 - 1. Support compiling GeckoView aidl from multiple packages; r=nalexander Specify a list of AIDL files for GeckoView so we can include AIDLs from multiple packages, and not just those from the org.mozilla.gecko.process package. Bug 1339685 - 2. Add AIDLs for GeckoEditable; r=esawin Add IGeckoEditableParent.aidl and IGeckoEditableChild.aidl for two-way communication between the parent, which lives in the main process, and the child, which lives in the main process or a child content process. Bug 1339685 - 3. Refactor some GeckoEditable code; r=esawin Auto-generate native constants for the constants in GeckoEditableClient, instead of keeping a separate set of constants in native code. Bug 1339685 - 4. Add GeckoEditableChild; r=esawin Add the GeckoEditableChild class, which is currently only used in the main process as the interface between the native nsWindow and GeckoEditable. Eventually, it will be expanded to child content processes as the interface between the native PuppetWidget and main process GeckoEditable. Bug 1339685 - 5. Use GeckoEditableChild from GeckoEditable; r=esawin Make calls to GeckoEditableChild from GeckoEditable, and remove code that exists in GeckoEditableChild from GeckoEditable. Bug 1339685 - 6. Add GetNativeObject member to proxied native calls; r=snorp Add a convenience function for getting the C++ object that is the target of the native call. Bug 1339685 - 7. Use GeckoEditableChild from native code; r=esawin Make nsWindow and GeckoEditableSupport use GeckoEditableChild for communication. nsWindow still keeps a reference to GeckoEditable for switching views. Bug 1339685 - 8. Updated generated bindings; r=me
2017-03-02 21:47:14 +03:00
};
enum RemoveCompositionFlag { CANCEL_IME_COMPOSITION, COMMIT_IME_COMPOSITION };
Bug 1339685 - Split GeckoEditable into parent and child classes; r=nalexander r=esawin r=snorp Bug 1339685 - 1. Support compiling GeckoView aidl from multiple packages; r=nalexander Specify a list of AIDL files for GeckoView so we can include AIDLs from multiple packages, and not just those from the org.mozilla.gecko.process package. Bug 1339685 - 2. Add AIDLs for GeckoEditable; r=esawin Add IGeckoEditableParent.aidl and IGeckoEditableChild.aidl for two-way communication between the parent, which lives in the main process, and the child, which lives in the main process or a child content process. Bug 1339685 - 3. Refactor some GeckoEditable code; r=esawin Auto-generate native constants for the constants in GeckoEditableClient, instead of keeping a separate set of constants in native code. Bug 1339685 - 4. Add GeckoEditableChild; r=esawin Add the GeckoEditableChild class, which is currently only used in the main process as the interface between the native nsWindow and GeckoEditable. Eventually, it will be expanded to child content processes as the interface between the native PuppetWidget and main process GeckoEditable. Bug 1339685 - 5. Use GeckoEditableChild from GeckoEditable; r=esawin Make calls to GeckoEditableChild from GeckoEditable, and remove code that exists in GeckoEditableChild from GeckoEditable. Bug 1339685 - 6. Add GetNativeObject member to proxied native calls; r=snorp Add a convenience function for getting the C++ object that is the target of the native call. Bug 1339685 - 7. Use GeckoEditableChild from native code; r=esawin Make nsWindow and GeckoEditableSupport use GeckoEditableChild for communication. nsWindow still keeps a reference to GeckoEditable for switching views. Bug 1339685 - 8. Updated generated bindings; r=me
2017-03-02 21:47:14 +03:00
const bool mIsRemote;
nsWindow::WindowPtr<GeckoEditableSupport> mWindow; // Parent only
RefPtr<TextEventDispatcher> mDispatcher;
java::GeckoEditableChild::GlobalRef mEditable;
Bug 1343075 - Use GeckoEditableSupport from PuppetWidget; r=masayuki r=rbarker r=snorp r=esawin Bug 1343075 - 1a. Add TextEventDispatcherListener::GetIMEUpdatePreference; r=masayuki Add a GetIMEUpdatePreference method to TextEventDispatcherListener to optionally control which IME notifications are received by NotifyIME. This patch also makes nsBaseWidget forward its GetIMEUpdatePreference call to the widget's native TextEventDispatcherListener. Bug 1343075 - 1b. Implement GetIMEUpdatePreference for all TextEventDispatcherListener; r=masayuki This patch implements GetIMEUpdatePreference for all TextEventDispatcherListener implementations, by moving previous implementations of nsIWidget::GetIMEUpdatePreference. Bug 1343075 - 2. Allow setting a PuppetWidget's native TextEventDispatcherListener; r=masayuki In PuppetWidget, add getter and setter for the widget's native TextEventDispatcherListener. This allows overriding of PuppetWidget's default IME handling. For example, on Android, the PuppetWidget's native TextEventDispatcherListener will communicate directly with Java IME code in the main process. Bug 1343075 - 3. Add AIDL interface for main process; r=rbarker Add AIDL definition and implementation for an interface for the main process that child processes can access. Bug 1343075 - 4. Set Gecko thread JNIEnv for child process; r=snorp Add a JNIEnv* parameter to XRE_SetAndroidChildFds, which is used to set the Gecko thread JNIEnv for child processes. XRE_SetAndroidChildFds is the only Android-specific entry point for child processes, so I think it's the most logical place to initialize JNI. Bug 1343075 - 5. Support multiple remote GeckoEditableChild; r=esawin Support remote GeckoEditableChild instances that are created in the content processes and connect to the parent process GeckoEditableParent through binders. Support having multiple GeckoEditableChild instances in GeckoEditable by keeping track of which child is currently focused, and only allow calls to/from the focused child by using access tokens. Bug 1343075 - 6. Add method to get GeckoEditableParent instance; r=esawin Add IProcessManager.getEditableParent, which a content process can call to get the GeckoEditableParent instance that corresponds to a given content process tab, from the main process. Bug 1343075 - 7. Support GeckoEditableSupport in content processes; r=esawin Support creating and running GeckoEditableSupport attached to a PuppetWidget in content processes. Because we don't know PuppetWidget's lifetime as well as nsWindow's, when attached to PuppetWidget, we need to attach/detach our native object on focus/blur, respectively. Bug 1343075 - 8. Connect GeckoEditableSupport on PuppetWidget creation; r=esawin Listen to the "tab-child-created" notification and attach our content process GeckoEditableSupport to the new PuppetWidget. Bug 1343075 - 9. Update auto-generated bindings; r=me
2017-03-08 06:34:39 +03:00
bool mEditableAttached;
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
InputContext mInputContext;
AutoTArray<UniquePtr<mozilla::WidgetEvent>, 4> mIMEKeyEvents;
Bug 1343075 - Use GeckoEditableSupport from PuppetWidget; r=masayuki r=rbarker r=snorp r=esawin Bug 1343075 - 1a. Add TextEventDispatcherListener::GetIMEUpdatePreference; r=masayuki Add a GetIMEUpdatePreference method to TextEventDispatcherListener to optionally control which IME notifications are received by NotifyIME. This patch also makes nsBaseWidget forward its GetIMEUpdatePreference call to the widget's native TextEventDispatcherListener. Bug 1343075 - 1b. Implement GetIMEUpdatePreference for all TextEventDispatcherListener; r=masayuki This patch implements GetIMEUpdatePreference for all TextEventDispatcherListener implementations, by moving previous implementations of nsIWidget::GetIMEUpdatePreference. Bug 1343075 - 2. Allow setting a PuppetWidget's native TextEventDispatcherListener; r=masayuki In PuppetWidget, add getter and setter for the widget's native TextEventDispatcherListener. This allows overriding of PuppetWidget's default IME handling. For example, on Android, the PuppetWidget's native TextEventDispatcherListener will communicate directly with Java IME code in the main process. Bug 1343075 - 3. Add AIDL interface for main process; r=rbarker Add AIDL definition and implementation for an interface for the main process that child processes can access. Bug 1343075 - 4. Set Gecko thread JNIEnv for child process; r=snorp Add a JNIEnv* parameter to XRE_SetAndroidChildFds, which is used to set the Gecko thread JNIEnv for child processes. XRE_SetAndroidChildFds is the only Android-specific entry point for child processes, so I think it's the most logical place to initialize JNI. Bug 1343075 - 5. Support multiple remote GeckoEditableChild; r=esawin Support remote GeckoEditableChild instances that are created in the content processes and connect to the parent process GeckoEditableParent through binders. Support having multiple GeckoEditableChild instances in GeckoEditable by keeping track of which child is currently focused, and only allow calls to/from the focused child by using access tokens. Bug 1343075 - 6. Add method to get GeckoEditableParent instance; r=esawin Add IProcessManager.getEditableParent, which a content process can call to get the GeckoEditableParent instance that corresponds to a given content process tab, from the main process. Bug 1343075 - 7. Support GeckoEditableSupport in content processes; r=esawin Support creating and running GeckoEditableSupport attached to a PuppetWidget in content processes. Because we don't know PuppetWidget's lifetime as well as nsWindow's, when attached to PuppetWidget, we need to attach/detach our native object on focus/blur, respectively. Bug 1343075 - 8. Connect GeckoEditableSupport on PuppetWidget creation; r=esawin Listen to the "tab-child-created" notification and attach our content process GeckoEditableSupport to the new PuppetWidget. Bug 1343075 - 9. Update auto-generated bindings; r=me
2017-03-08 06:34:39 +03:00
AutoTArray<IMETextChange, 4> mIMETextChanges;
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
RefPtr<TextRangeArray> mIMERanges;
int32_t mIMEMaskEventsCount; // Mask events when > 0.
int32_t mIMEFocusCount; // We are focused when > 0.
bool mIMEDelaySynchronizeReply; // We reply asynchronously when true.
int32_t mIMEActiveSynchronizeCount; // The number of replies being delayed.
int32_t mIMEActiveCompositionCount; // The number of compositions expected.
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
bool mIMESelectionChanged;
bool mIMETextChangedDuringFlush;
bool mIMEMonitorCursor;
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
static bool sDispatchKeyEventsInCompositionForAnyApps;
void ObservePrefs();
nsIWidget* GetWidget() const {
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
return mDispatcher ? mDispatcher->GetWidget() : mWindow;
}
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
nsresult BeginInputTransaction(TextEventDispatcher* aDispatcher) {
if (mIsRemote) {
return aDispatcher->BeginInputTransaction(this);
} else {
return aDispatcher->BeginNativeInputTransaction();
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
}
}
virtual ~GeckoEditableSupport() {}
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
RefPtr<TextComposition> GetComposition() const;
bool RemoveComposition(RemoveCompositionFlag aFlag = COMMIT_IME_COMPOSITION);
void SendIMEDummyKeyEvent(nsIWidget* aWidget, EventMessage msg);
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
void AddIMETextChange(const IMETextChange& aChange);
void PostFlushIMEChanges();
void FlushIMEChanges(FlushChangesFlag aFlags = FLUSH_FLAG_NONE);
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
void FlushIMEText(FlushChangesFlag aFlags = FLUSH_FLAG_NONE);
void AsyncNotifyIME(int32_t aNotification);
void UpdateCompositionRects();
bool DoReplaceText(int32_t aStart, int32_t aEnd, jni::String::Param aText);
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
bool DoUpdateComposition(int32_t aStart, int32_t aEnd, int32_t aFlags);
void OnNotifyIMEOfCompositionEventHandled();
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
void NotifyIMEContext(const InputContext& aContext,
const InputContextAction& aAction);
public:
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
template <typename Functor>
static void OnNativeCall(Functor&& aCall) {
struct IMEEvent : nsAppShell::LambdaEvent<Functor> {
explicit IMEEvent(Functor&& l)
: nsAppShell::LambdaEvent<Functor>(std::move(l)) {}
bool IsUIEvent() const override {
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
using GES = GeckoEditableSupport;
if (this->lambda.IsTarget(&GES::OnKeyEvent) ||
this->lambda.IsTarget(&GES::OnImeReplaceText) ||
this->lambda.IsTarget(&GES::OnImeUpdateComposition)) {
return true;
}
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
return false;
}
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
void Run() override {
if (!this->lambda.GetNativeObject()) {
// Ignore stale calls after disposal.
jni::GetGeckoThreadEnv()->ExceptionClear();
return;
}
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
nsAppShell::LambdaEvent<Functor>::Run();
}
};
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
nsAppShell::PostEvent(mozilla::MakeUnique<IMEEvent>(std::move(aCall)));
}
static void SetOnBrowserChild(dom::BrowserChild* aBrowserChild);
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
// Constructor for main process GeckoEditableChild.
GeckoEditableSupport(nsWindow::NativePtr<GeckoEditableSupport>* aPtr,
nsWindow* aWindow,
Bug 1339685 - Split GeckoEditable into parent and child classes; r=nalexander r=esawin r=snorp Bug 1339685 - 1. Support compiling GeckoView aidl from multiple packages; r=nalexander Specify a list of AIDL files for GeckoView so we can include AIDLs from multiple packages, and not just those from the org.mozilla.gecko.process package. Bug 1339685 - 2. Add AIDLs for GeckoEditable; r=esawin Add IGeckoEditableParent.aidl and IGeckoEditableChild.aidl for two-way communication between the parent, which lives in the main process, and the child, which lives in the main process or a child content process. Bug 1339685 - 3. Refactor some GeckoEditable code; r=esawin Auto-generate native constants for the constants in GeckoEditableClient, instead of keeping a separate set of constants in native code. Bug 1339685 - 4. Add GeckoEditableChild; r=esawin Add the GeckoEditableChild class, which is currently only used in the main process as the interface between the native nsWindow and GeckoEditable. Eventually, it will be expanded to child content processes as the interface between the native PuppetWidget and main process GeckoEditable. Bug 1339685 - 5. Use GeckoEditableChild from GeckoEditable; r=esawin Make calls to GeckoEditableChild from GeckoEditable, and remove code that exists in GeckoEditableChild from GeckoEditable. Bug 1339685 - 6. Add GetNativeObject member to proxied native calls; r=snorp Add a convenience function for getting the C++ object that is the target of the native call. Bug 1339685 - 7. Use GeckoEditableChild from native code; r=esawin Make nsWindow and GeckoEditableSupport use GeckoEditableChild for communication. nsWindow still keeps a reference to GeckoEditable for switching views. Bug 1339685 - 8. Updated generated bindings; r=me
2017-03-02 21:47:14 +03:00
java::GeckoEditableChild::Param aEditableChild)
Bug 1343075 - Use GeckoEditableSupport from PuppetWidget; r=masayuki r=rbarker r=snorp r=esawin Bug 1343075 - 1a. Add TextEventDispatcherListener::GetIMEUpdatePreference; r=masayuki Add a GetIMEUpdatePreference method to TextEventDispatcherListener to optionally control which IME notifications are received by NotifyIME. This patch also makes nsBaseWidget forward its GetIMEUpdatePreference call to the widget's native TextEventDispatcherListener. Bug 1343075 - 1b. Implement GetIMEUpdatePreference for all TextEventDispatcherListener; r=masayuki This patch implements GetIMEUpdatePreference for all TextEventDispatcherListener implementations, by moving previous implementations of nsIWidget::GetIMEUpdatePreference. Bug 1343075 - 2. Allow setting a PuppetWidget's native TextEventDispatcherListener; r=masayuki In PuppetWidget, add getter and setter for the widget's native TextEventDispatcherListener. This allows overriding of PuppetWidget's default IME handling. For example, on Android, the PuppetWidget's native TextEventDispatcherListener will communicate directly with Java IME code in the main process. Bug 1343075 - 3. Add AIDL interface for main process; r=rbarker Add AIDL definition and implementation for an interface for the main process that child processes can access. Bug 1343075 - 4. Set Gecko thread JNIEnv for child process; r=snorp Add a JNIEnv* parameter to XRE_SetAndroidChildFds, which is used to set the Gecko thread JNIEnv for child processes. XRE_SetAndroidChildFds is the only Android-specific entry point for child processes, so I think it's the most logical place to initialize JNI. Bug 1343075 - 5. Support multiple remote GeckoEditableChild; r=esawin Support remote GeckoEditableChild instances that are created in the content processes and connect to the parent process GeckoEditableParent through binders. Support having multiple GeckoEditableChild instances in GeckoEditable by keeping track of which child is currently focused, and only allow calls to/from the focused child by using access tokens. Bug 1343075 - 6. Add method to get GeckoEditableParent instance; r=esawin Add IProcessManager.getEditableParent, which a content process can call to get the GeckoEditableParent instance that corresponds to a given content process tab, from the main process. Bug 1343075 - 7. Support GeckoEditableSupport in content processes; r=esawin Support creating and running GeckoEditableSupport attached to a PuppetWidget in content processes. Because we don't know PuppetWidget's lifetime as well as nsWindow's, when attached to PuppetWidget, we need to attach/detach our native object on focus/blur, respectively. Bug 1343075 - 8. Connect GeckoEditableSupport on PuppetWidget creation; r=esawin Listen to the "tab-child-created" notification and attach our content process GeckoEditableSupport to the new PuppetWidget. Bug 1343075 - 9. Update auto-generated bindings; r=me
2017-03-08 06:34:39 +03:00
: mIsRemote(!aWindow),
mWindow(aPtr, aWindow),
Bug 1339685 - Split GeckoEditable into parent and child classes; r=nalexander r=esawin r=snorp Bug 1339685 - 1. Support compiling GeckoView aidl from multiple packages; r=nalexander Specify a list of AIDL files for GeckoView so we can include AIDLs from multiple packages, and not just those from the org.mozilla.gecko.process package. Bug 1339685 - 2. Add AIDLs for GeckoEditable; r=esawin Add IGeckoEditableParent.aidl and IGeckoEditableChild.aidl for two-way communication between the parent, which lives in the main process, and the child, which lives in the main process or a child content process. Bug 1339685 - 3. Refactor some GeckoEditable code; r=esawin Auto-generate native constants for the constants in GeckoEditableClient, instead of keeping a separate set of constants in native code. Bug 1339685 - 4. Add GeckoEditableChild; r=esawin Add the GeckoEditableChild class, which is currently only used in the main process as the interface between the native nsWindow and GeckoEditable. Eventually, it will be expanded to child content processes as the interface between the native PuppetWidget and main process GeckoEditable. Bug 1339685 - 5. Use GeckoEditableChild from GeckoEditable; r=esawin Make calls to GeckoEditableChild from GeckoEditable, and remove code that exists in GeckoEditableChild from GeckoEditable. Bug 1339685 - 6. Add GetNativeObject member to proxied native calls; r=snorp Add a convenience function for getting the C++ object that is the target of the native call. Bug 1339685 - 7. Use GeckoEditableChild from native code; r=esawin Make nsWindow and GeckoEditableSupport use GeckoEditableChild for communication. nsWindow still keeps a reference to GeckoEditable for switching views. Bug 1339685 - 8. Updated generated bindings; r=me
2017-03-02 21:47:14 +03:00
mEditable(aEditableChild),
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
mEditableAttached(!mIsRemote),
mIMERanges(new TextRangeArray()),
mIMEMaskEventsCount(1) // Mask IME events since there's no focus yet
,
mIMEFocusCount(0),
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
mIMEDelaySynchronizeReply(false),
mIMEActiveSynchronizeCount(0),
mIMESelectionChanged(false),
mIMETextChangedDuringFlush(false),
mIMEMonitorCursor(false) {
ObservePrefs();
}
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
// Constructor for content process GeckoEditableChild.
explicit GeckoEditableSupport(java::GeckoEditableChild::Param aEditableChild)
Bug 1343075 - Use GeckoEditableSupport from PuppetWidget; r=masayuki r=rbarker r=snorp r=esawin Bug 1343075 - 1a. Add TextEventDispatcherListener::GetIMEUpdatePreference; r=masayuki Add a GetIMEUpdatePreference method to TextEventDispatcherListener to optionally control which IME notifications are received by NotifyIME. This patch also makes nsBaseWidget forward its GetIMEUpdatePreference call to the widget's native TextEventDispatcherListener. Bug 1343075 - 1b. Implement GetIMEUpdatePreference for all TextEventDispatcherListener; r=masayuki This patch implements GetIMEUpdatePreference for all TextEventDispatcherListener implementations, by moving previous implementations of nsIWidget::GetIMEUpdatePreference. Bug 1343075 - 2. Allow setting a PuppetWidget's native TextEventDispatcherListener; r=masayuki In PuppetWidget, add getter and setter for the widget's native TextEventDispatcherListener. This allows overriding of PuppetWidget's default IME handling. For example, on Android, the PuppetWidget's native TextEventDispatcherListener will communicate directly with Java IME code in the main process. Bug 1343075 - 3. Add AIDL interface for main process; r=rbarker Add AIDL definition and implementation for an interface for the main process that child processes can access. Bug 1343075 - 4. Set Gecko thread JNIEnv for child process; r=snorp Add a JNIEnv* parameter to XRE_SetAndroidChildFds, which is used to set the Gecko thread JNIEnv for child processes. XRE_SetAndroidChildFds is the only Android-specific entry point for child processes, so I think it's the most logical place to initialize JNI. Bug 1343075 - 5. Support multiple remote GeckoEditableChild; r=esawin Support remote GeckoEditableChild instances that are created in the content processes and connect to the parent process GeckoEditableParent through binders. Support having multiple GeckoEditableChild instances in GeckoEditable by keeping track of which child is currently focused, and only allow calls to/from the focused child by using access tokens. Bug 1343075 - 6. Add method to get GeckoEditableParent instance; r=esawin Add IProcessManager.getEditableParent, which a content process can call to get the GeckoEditableParent instance that corresponds to a given content process tab, from the main process. Bug 1343075 - 7. Support GeckoEditableSupport in content processes; r=esawin Support creating and running GeckoEditableSupport attached to a PuppetWidget in content processes. Because we don't know PuppetWidget's lifetime as well as nsWindow's, when attached to PuppetWidget, we need to attach/detach our native object on focus/blur, respectively. Bug 1343075 - 8. Connect GeckoEditableSupport on PuppetWidget creation; r=esawin Listen to the "tab-child-created" notification and attach our content process GeckoEditableSupport to the new PuppetWidget. Bug 1343075 - 9. Update auto-generated bindings; r=me
2017-03-08 06:34:39 +03:00
: GeckoEditableSupport(nullptr, nullptr, aEditableChild) {}
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
NS_DECL_ISUPPORTS
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
// TextEventDispatcherListener methods
NS_IMETHOD NotifyIME(TextEventDispatcher* aTextEventDispatcher,
const IMENotification& aNotification) override;
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
NS_IMETHOD_(IMENotificationRequests) GetIMENotificationRequests() override;
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
NS_IMETHOD_(void)
OnRemovedFrom(TextEventDispatcher* aTextEventDispatcher) override;
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
NS_IMETHOD_(void)
WillDispatchKeyboardEvent(TextEventDispatcher* aTextEventDispatcher,
WidgetKeyboardEvent& aKeyboardEvent,
uint32_t aIndexOfKeypress, void* aData) override;
void SetInputContext(const InputContext& aContext,
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
const InputContextAction& aAction);
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
InputContext GetInputContext();
Bug 1339685 - Split GeckoEditable into parent and child classes; r=nalexander r=esawin r=snorp Bug 1339685 - 1. Support compiling GeckoView aidl from multiple packages; r=nalexander Specify a list of AIDL files for GeckoView so we can include AIDLs from multiple packages, and not just those from the org.mozilla.gecko.process package. Bug 1339685 - 2. Add AIDLs for GeckoEditable; r=esawin Add IGeckoEditableParent.aidl and IGeckoEditableChild.aidl for two-way communication between the parent, which lives in the main process, and the child, which lives in the main process or a child content process. Bug 1339685 - 3. Refactor some GeckoEditable code; r=esawin Auto-generate native constants for the constants in GeckoEditableClient, instead of keeping a separate set of constants in native code. Bug 1339685 - 4. Add GeckoEditableChild; r=esawin Add the GeckoEditableChild class, which is currently only used in the main process as the interface between the native nsWindow and GeckoEditable. Eventually, it will be expanded to child content processes as the interface between the native PuppetWidget and main process GeckoEditable. Bug 1339685 - 5. Use GeckoEditableChild from GeckoEditable; r=esawin Make calls to GeckoEditableChild from GeckoEditable, and remove code that exists in GeckoEditableChild from GeckoEditable. Bug 1339685 - 6. Add GetNativeObject member to proxied native calls; r=snorp Add a convenience function for getting the C++ object that is the target of the native call. Bug 1339685 - 7. Use GeckoEditableChild from native code; r=esawin Make nsWindow and GeckoEditableSupport use GeckoEditableChild for communication. nsWindow still keeps a reference to GeckoEditable for switching views. Bug 1339685 - 8. Updated generated bindings; r=me
2017-03-02 21:47:14 +03:00
// GeckoEditableChild methods
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
using EditableBase::AttachNative;
using EditableBase::DisposeNative;
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
const java::GeckoEditableChild::Ref& GetJavaEditable() { return mEditable; }
void OnDetach(already_AddRefed<Runnable> aDisposer) {
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
RefPtr<GeckoEditableSupport> self(this);
nsAppShell::PostEvent([this, self, disposer = RefPtr<Runnable>(aDisposer)] {
Bug 1343075 - Use GeckoEditableSupport from PuppetWidget; r=masayuki r=rbarker r=snorp r=esawin Bug 1343075 - 1a. Add TextEventDispatcherListener::GetIMEUpdatePreference; r=masayuki Add a GetIMEUpdatePreference method to TextEventDispatcherListener to optionally control which IME notifications are received by NotifyIME. This patch also makes nsBaseWidget forward its GetIMEUpdatePreference call to the widget's native TextEventDispatcherListener. Bug 1343075 - 1b. Implement GetIMEUpdatePreference for all TextEventDispatcherListener; r=masayuki This patch implements GetIMEUpdatePreference for all TextEventDispatcherListener implementations, by moving previous implementations of nsIWidget::GetIMEUpdatePreference. Bug 1343075 - 2. Allow setting a PuppetWidget's native TextEventDispatcherListener; r=masayuki In PuppetWidget, add getter and setter for the widget's native TextEventDispatcherListener. This allows overriding of PuppetWidget's default IME handling. For example, on Android, the PuppetWidget's native TextEventDispatcherListener will communicate directly with Java IME code in the main process. Bug 1343075 - 3. Add AIDL interface for main process; r=rbarker Add AIDL definition and implementation for an interface for the main process that child processes can access. Bug 1343075 - 4. Set Gecko thread JNIEnv for child process; r=snorp Add a JNIEnv* parameter to XRE_SetAndroidChildFds, which is used to set the Gecko thread JNIEnv for child processes. XRE_SetAndroidChildFds is the only Android-specific entry point for child processes, so I think it's the most logical place to initialize JNI. Bug 1343075 - 5. Support multiple remote GeckoEditableChild; r=esawin Support remote GeckoEditableChild instances that are created in the content processes and connect to the parent process GeckoEditableParent through binders. Support having multiple GeckoEditableChild instances in GeckoEditable by keeping track of which child is currently focused, and only allow calls to/from the focused child by using access tokens. Bug 1343075 - 6. Add method to get GeckoEditableParent instance; r=esawin Add IProcessManager.getEditableParent, which a content process can call to get the GeckoEditableParent instance that corresponds to a given content process tab, from the main process. Bug 1343075 - 7. Support GeckoEditableSupport in content processes; r=esawin Support creating and running GeckoEditableSupport attached to a PuppetWidget in content processes. Because we don't know PuppetWidget's lifetime as well as nsWindow's, when attached to PuppetWidget, we need to attach/detach our native object on focus/blur, respectively. Bug 1343075 - 8. Connect GeckoEditableSupport on PuppetWidget creation; r=esawin Listen to the "tab-child-created" notification and attach our content process GeckoEditableSupport to the new PuppetWidget. Bug 1343075 - 9. Update auto-generated bindings; r=me
2017-03-08 06:34:39 +03:00
mEditableAttached = false;
disposer->Run();
});
}
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
// Transfer to a new parent.
void TransferParent(jni::Object::Param aEditableParent);
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
// Handle an Android KeyEvent.
void OnKeyEvent(int32_t aAction, int32_t aKeyCode, int32_t aScanCode,
int32_t aMetaState, int32_t aKeyPressMetaState, int64_t aTime,
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
int32_t aDomPrintableKeyValue, int32_t aRepeatCount,
int32_t aFlags, bool aIsSynthesizedImeKey,
jni::Object::Param originalEvent);
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
// Synchronize Gecko thread with the InputConnection thread.
void OnImeSynchronize();
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
// Replace a range of text with new text.
void OnImeReplaceText(int32_t aStart, int32_t aEnd, jni::String::Param aText);
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
// Add styling for a range within the active composition.
void OnImeAddCompositionRange(int32_t aStart, int32_t aEnd,
int32_t aRangeType, int32_t aRangeStyle,
int32_t aRangeLineStyle, bool aRangeBoldLine,
int32_t aRangeForeColor,
int32_t aRangeBackColor,
int32_t aRangeLineColor);
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
// Update styling for the active composition using previous-added ranges.
void OnImeUpdateComposition(int32_t aStart, int32_t aEnd, int32_t aFlags);
Bug 1137567 - Make nsWindow for Android use TextEventDispatcher; r=esawin r=rbarker r=masayuki r=snorp Bug 1137567 - 1. Allow dispatching key events during composition; r=esawin We potentially dispatch key events during composition to provide compatibility for pages that only listen to key events. Bug 1137567 - 2. Allow keyboard events in DispatchInputEvent when not on APZ thread; r=rbarker We use nsIWidget::DispatchInputEvent to dispatch our keyboard events on the Gecko thread, which on Android is not the APZ controller thread. We should allow these events to pass instead of crashing. Bug 1137567 - 3. Add GeckoEditableSupport class to support TextEventDispatcher; r=masayuki Add a separate GeckoEditableSupport class, which implements TextEventDispatcherListener and uses TextEventDispatcher for IME operations. The new class is entirely separate from nsWindow to allow it to be independently used in content processes as well. Most of the code is copied from nsWindow::GeckoViewSupport, and adapted to use TextEventDispatcher. Bug 1137567 - 4. Make nsWindow::WindowPtr available for outside classes; r=snorp Make nsWindow::WindowPtr available not just for classes inside nsWindow but for outside classes as well. Also, add support for RefPtr native objects to nsWindow::NativePtr. Bug 1137567 - 5. Use GeckoEditableSupport in nsWindow; r=esawin Use the new GeckoEditableSupport class in nsWindow to replace the previous code in nsWindow::GeckoViewSupport. GeckoEditable native methods now go to GeckoEditableSupport instead of GeckoViewSupport. Several native methods in GeckoEditable are changed from dispatchTo="proxy" to dispatchTo="gecko", because we no longer need the special nsWindow::WindowEvent wrapper for our native calls. Bug 1137567 - 6. Use pushPrefEnv in test_assign_event_data.html; r=masayuki setAndObserveCompositionPref in test_assign_event_data.html does not invoke the callback if the pref is already set. This patch changes it to use SpecialPowers.pushPrefEnv so the callback is always invoked.
2017-03-01 23:29:30 +03:00
// Set cursor mode whether IME requests
void OnImeRequestCursorUpdates(int aRequestMode);
};
} // namespace widget
} // namespace mozilla
#endif // mozilla_widget_GeckoEditableSupport_h