2010-08-21 03:24:40 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* vim: sw=2 ts=8 et :
|
|
|
|
*/
|
2012-05-21 15:12:37 +04: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/. */
|
2010-08-21 03:24:40 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This "puppet widget" isn't really a platform widget. It's intended
|
|
|
|
* to be used in widgetless rendering contexts, such as sandboxed
|
|
|
|
* content processes. If any "real" widgetry is needed, the request
|
|
|
|
* is forwarded to and/or data received from elsewhere.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef mozilla_widget_PuppetWidget_h__
|
|
|
|
#define mozilla_widget_PuppetWidget_h__
|
|
|
|
|
2014-06-10 10:02:21 +04:00
|
|
|
#include "mozilla/gfx/2D.h"
|
2015-10-18 08:24:48 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
2010-08-21 03:24:40 +04:00
|
|
|
#include "nsBaseWidget.h"
|
Bug 1257759 part.5 PluginInstanceChild should post received native key event to chrome process if the key combination may be a shortcut key r=jimm
When PluginInstanceChild receives native key events, it should post the events to the chrome process first for checking if the key combination is reserved. However, posting all key events to the chrome process may make damage to the performance of text input. Therefore, this patch starts to post a key event whose key combination may be a shortcut key. However, for avoiding to shuffle the event order, it posts following key events until all posted key events are handled by the chrome process.
For receiving response from widget, this patch defines nsIKeyEventInPluginCallback. It's specified by nsIWidget::OnWindowedPluginKeyEvent() for ensuring the caller will receive the reply. Basically, the caller of nsIWidget::OnWindowedPluginKeyEvent() should reply to the child process. However, if the widget is a PuppetWidget, it cannot return the result synchronously. Therefore, PuppetWidget::OnWindowedPluginKeyEvent() returns NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY and stores the callback to mKeyEventInPluginCallbacks. Then, TabParent::HandledWindowedPluginKeyEvent() will call PuppetWidget::HandledWindowedPluginKeyEvent().
MozReview-Commit-ID: G6brOU26NwQ
--HG--
extra : rebase_source : 8140456de278956d2d594e85c7b397ae366b4962
2016-04-19 14:09:37 +03:00
|
|
|
#include "nsCOMArray.h"
|
2010-08-21 03:24:40 +04:00
|
|
|
#include "nsThreadUtils.h"
|
2012-06-19 05:28:00 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2015-06-05 12:28:20 +03:00
|
|
|
#include "mozilla/ContentCache.h"
|
2014-03-20 19:46:29 +04:00
|
|
|
#include "mozilla/EventForwards.h"
|
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
|
|
|
#include "mozilla/TextEventDispatcherListener.h"
|
2018-08-10 18:15:18 +03:00
|
|
|
#include "mozilla/layers/MemoryPressureObserver.h"
|
2010-08-21 03:24:40 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
2022-02-15 11:00:05 +03:00
|
|
|
enum class NativeKeyBindingsType : uint8_t;
|
2012-07-18 03:59:45 +04:00
|
|
|
|
|
|
|
namespace dom {
|
2019-04-10 01:39:01 +03:00
|
|
|
class BrowserChild;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
2012-07-18 03:59:45 +04:00
|
|
|
|
2021-09-06 01:36:45 +03:00
|
|
|
namespace layers {
|
|
|
|
class WebRenderLayerManager;
|
|
|
|
} // namespace layers
|
|
|
|
|
2010-08-21 03:24:40 +04:00
|
|
|
namespace widget {
|
|
|
|
|
2014-06-19 04:57:51 +04:00
|
|
|
struct AutoCacheNativeKeyCommands;
|
2014-04-22 00:40:09 +04:00
|
|
|
|
2015-02-18 09:27:53 +03:00
|
|
|
class PuppetWidget : public nsBaseWidget,
|
Bug 1217700 part.1 nsIWidget should return reference to IMENotificationRequests r=m_kato
IMEContentObserver may need to change notifications to send when TextInputProcessor begins input transaction. In current design, IMEContentObserver needs to retrieve IMENotificationRequests at every change. However, if nsIWidget returns a reference to its IMENotificationRequests, IMEContentObserver can call it only once.
For that purpose, this patch changes nsIWidget::GetIMENotificationRequests() to nsIWidget::IMENotificationRequestsRef() and make it return |const IMENotificationRequests&|. However, if the lifetime of the instance of IMENotificationRequest is shorter than the widget instance's, it's dangerous. Therefore, it always returns TextEventDispatcher::mIMENotificationRequests. TextEventDispatcher's lifetime is longer than the widget. Therefore, this guarantees the lifetime.
On the other hand, widget needs to update TextEventDispatcher::mIMENotificationRequests before calls of nsIWidget::IMENotificationRequestsRef(). Therefore, this patch makes TextEventDispatcher update proper IMENotificationRequests when it gets focus or starts new input transaction and clear mIMENotificationRequests when it loses focus.
Note that TextEventDispatcher gets proper requests both from native text event dispatcher listener (typically, implemented by native IME handler class) and TextInputProcessor when TextInputProcessor has input transaction because even if TextInputProcessor overrides native IME, native IME still needs to know the content changes since they may get new input transaction after that.
However, there may not be native IME handler in content process. If it runs in Android, PuppetWidget may have native IME handler because widget directly handles IME in e10s mode for Android. Otherwise, native IME handler is in its parent process. So, if TextInputHandler has input transaction in content process, PuppetWidget needs to behave as native event handler. Therefore, this patch makes PuppetWidget inherit TextEventDispatcherListener and implements PuppetWidget::IMENotificationRequestsRef().
MozReview-Commit-ID: 2SW3moONTOX
--HG--
extra : rebase_source : d2634ada6c33dbf7a966fadb68608411ee24bfab
2017-04-14 19:35:58 +03:00
|
|
|
public TextEventDispatcherListener,
|
2018-08-10 18:15:18 +03:00
|
|
|
public layers::MemoryPressureListener {
|
Bug 1217700 part.1 nsIWidget should return reference to IMENotificationRequests r=m_kato
IMEContentObserver may need to change notifications to send when TextInputProcessor begins input transaction. In current design, IMEContentObserver needs to retrieve IMENotificationRequests at every change. However, if nsIWidget returns a reference to its IMENotificationRequests, IMEContentObserver can call it only once.
For that purpose, this patch changes nsIWidget::GetIMENotificationRequests() to nsIWidget::IMENotificationRequestsRef() and make it return |const IMENotificationRequests&|. However, if the lifetime of the instance of IMENotificationRequest is shorter than the widget instance's, it's dangerous. Therefore, it always returns TextEventDispatcher::mIMENotificationRequests. TextEventDispatcher's lifetime is longer than the widget. Therefore, this guarantees the lifetime.
On the other hand, widget needs to update TextEventDispatcher::mIMENotificationRequests before calls of nsIWidget::IMENotificationRequestsRef(). Therefore, this patch makes TextEventDispatcher update proper IMENotificationRequests when it gets focus or starts new input transaction and clear mIMENotificationRequests when it loses focus.
Note that TextEventDispatcher gets proper requests both from native text event dispatcher listener (typically, implemented by native IME handler class) and TextInputProcessor when TextInputProcessor has input transaction because even if TextInputProcessor overrides native IME, native IME still needs to know the content changes since they may get new input transaction after that.
However, there may not be native IME handler in content process. If it runs in Android, PuppetWidget may have native IME handler because widget directly handles IME in e10s mode for Android. Otherwise, native IME handler is in its parent process. So, if TextInputHandler has input transaction in content process, PuppetWidget needs to behave as native event handler. Therefore, this patch makes PuppetWidget inherit TextEventDispatcherListener and implements PuppetWidget::IMENotificationRequestsRef().
MozReview-Commit-ID: 2SW3moONTOX
--HG--
extra : rebase_source : d2634ada6c33dbf7a966fadb68608411ee24bfab
2017-04-14 19:35:58 +03:00
|
|
|
typedef mozilla::CSSRect CSSRect;
|
2019-04-10 01:39:01 +03:00
|
|
|
typedef mozilla::dom::BrowserChild BrowserChild;
|
2014-06-10 10:02:21 +04:00
|
|
|
typedef mozilla::gfx::DrawTarget DrawTarget;
|
2021-09-06 01:36:45 +03:00
|
|
|
typedef mozilla::layers::WebRenderLayerManager WebRenderLayerManager;
|
Bug 1217700 part.1 nsIWidget should return reference to IMENotificationRequests r=m_kato
IMEContentObserver may need to change notifications to send when TextInputProcessor begins input transaction. In current design, IMEContentObserver needs to retrieve IMENotificationRequests at every change. However, if nsIWidget returns a reference to its IMENotificationRequests, IMEContentObserver can call it only once.
For that purpose, this patch changes nsIWidget::GetIMENotificationRequests() to nsIWidget::IMENotificationRequestsRef() and make it return |const IMENotificationRequests&|. However, if the lifetime of the instance of IMENotificationRequest is shorter than the widget instance's, it's dangerous. Therefore, it always returns TextEventDispatcher::mIMENotificationRequests. TextEventDispatcher's lifetime is longer than the widget. Therefore, this guarantees the lifetime.
On the other hand, widget needs to update TextEventDispatcher::mIMENotificationRequests before calls of nsIWidget::IMENotificationRequestsRef(). Therefore, this patch makes TextEventDispatcher update proper IMENotificationRequests when it gets focus or starts new input transaction and clear mIMENotificationRequests when it loses focus.
Note that TextEventDispatcher gets proper requests both from native text event dispatcher listener (typically, implemented by native IME handler class) and TextInputProcessor when TextInputProcessor has input transaction because even if TextInputProcessor overrides native IME, native IME still needs to know the content changes since they may get new input transaction after that.
However, there may not be native IME handler in content process. If it runs in Android, PuppetWidget may have native IME handler because widget directly handles IME in e10s mode for Android. Otherwise, native IME handler is in its parent process. So, if TextInputHandler has input transaction in content process, PuppetWidget needs to behave as native event handler. Therefore, this patch makes PuppetWidget inherit TextEventDispatcherListener and implements PuppetWidget::IMENotificationRequestsRef().
MozReview-Commit-ID: 2SW3moONTOX
--HG--
extra : rebase_source : d2634ada6c33dbf7a966fadb68608411ee24bfab
2017-04-14 19:35:58 +03:00
|
|
|
|
|
|
|
// Avoiding to make compiler confused between mozilla::widget and nsIWidget.
|
|
|
|
typedef mozilla::widget::TextEventDispatcher TextEventDispatcher;
|
|
|
|
typedef mozilla::widget::TextEventDispatcherListener
|
|
|
|
TextEventDispatcherListener;
|
|
|
|
|
2010-08-21 03:24:40 +04:00
|
|
|
typedef nsBaseWidget Base;
|
|
|
|
|
2010-08-21 03:24:40 +04:00
|
|
|
// The width and height of the "widget" are clamped to this.
|
|
|
|
static const size_t kMaxDimension;
|
|
|
|
|
|
|
|
public:
|
2019-04-10 01:39:01 +03:00
|
|
|
explicit PuppetWidget(BrowserChild* aBrowserChild);
|
2014-07-09 01:23:18 +04:00
|
|
|
|
|
|
|
protected:
|
2010-08-21 03:24:40 +04:00
|
|
|
virtual ~PuppetWidget();
|
|
|
|
|
2014-07-09 01:23:18 +04:00
|
|
|
public:
|
2010-08-21 03:24:40 +04:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2016-08-19 02:03:17 +03:00
|
|
|
// PuppetWidget creation is infallible, hence InfallibleCreate(), which
|
|
|
|
// Create() calls.
|
2016-01-13 10:32:55 +03:00
|
|
|
using nsBaseWidget::Create; // for Create signature not overridden here
|
2016-08-19 02:03:17 +03:00
|
|
|
virtual nsresult Create(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
|
|
|
const LayoutDeviceIntRect& aRect,
|
|
|
|
nsWidgetInitData* aInitData = nullptr) override;
|
|
|
|
void InfallibleCreate(nsIWidget* aParent, nsNativeWidget aNativeParent,
|
|
|
|
const LayoutDeviceIntRect& aRect,
|
|
|
|
nsWidgetInitData* aInitData = nullptr);
|
2010-08-21 03:24:40 +04:00
|
|
|
|
2012-08-29 19:26:18 +04:00
|
|
|
void InitIMEState();
|
|
|
|
|
2010-08-21 03:24:40 +04:00
|
|
|
virtual already_AddRefed<nsIWidget> CreateChild(
|
2015-11-16 11:35:18 +03:00
|
|
|
const LayoutDeviceIntRect& aRect, nsWidgetInitData* aInitData = nullptr,
|
|
|
|
bool aForceUseIWidgetParent = false) override;
|
2010-08-21 03:24:40 +04:00
|
|
|
|
2016-08-10 03:04:11 +03:00
|
|
|
virtual void Destroy() override;
|
2010-08-21 03:24:40 +04:00
|
|
|
|
2016-12-21 03:12:54 +03:00
|
|
|
virtual void Show(bool aState) override;
|
2012-07-19 12:57:50 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsVisible() const override { return mVisible; }
|
2010-08-21 03:24:40 +04:00
|
|
|
|
2016-08-25 06:43:27 +03:00
|
|
|
virtual void ConstrainPosition(bool /*ignored aAllowSlop*/, int32_t* aX,
|
|
|
|
int32_t* aY) override {
|
|
|
|
*aX = kMaxDimension;
|
|
|
|
*aY = kMaxDimension;
|
|
|
|
}
|
2010-08-21 03:24:40 +04:00
|
|
|
|
2019-04-10 01:39:01 +03:00
|
|
|
// Widget position is controlled by the parent process via BrowserChild.
|
2016-12-19 12:54:03 +03:00
|
|
|
virtual void Move(double aX, double aY) override {}
|
|
|
|
|
|
|
|
virtual void Resize(double aWidth, double aHeight, bool aRepaint) override;
|
|
|
|
virtual void Resize(double aX, double aY, double aWidth, double aHeight,
|
|
|
|
bool aRepaint) override {
|
2018-01-10 19:14:16 +03:00
|
|
|
if (!mBounds.IsEqualXY(aX, aY)) {
|
2015-03-31 23:39:02 +03:00
|
|
|
NotifyWindowMoved(aX, aY);
|
|
|
|
}
|
2018-01-10 19:14:16 +03:00
|
|
|
mBounds.MoveTo(aX, aY);
|
2015-03-31 23:39:02 +03:00
|
|
|
return Resize(aWidth, aHeight, aRepaint);
|
|
|
|
}
|
2010-08-21 03:24:40 +04:00
|
|
|
|
|
|
|
// XXX/cjones: copying gtk behavior here; unclear what disabling a
|
|
|
|
// widget is supposed to entail
|
2016-12-19 12:54:16 +03:00
|
|
|
virtual void Enable(bool aState) override { mEnabled = aState; }
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsEnabled() const override { return mEnabled; }
|
2010-08-21 03:24:40 +04:00
|
|
|
|
2022-05-02 17:06:17 +03:00
|
|
|
virtual nsSizeMode SizeMode() override { return mSizeMode; }
|
|
|
|
virtual void SetSizeMode(nsSizeMode aMode) override { mSizeMode = aMode; }
|
|
|
|
|
2020-01-16 17:38:40 +03:00
|
|
|
virtual void SetFocus(Raise, mozilla::dom::CallerType aCallerType) override;
|
2010-08-21 03:24:40 +04:00
|
|
|
|
2016-12-20 01:55:32 +03:00
|
|
|
virtual void Invalidate(const LayoutDeviceIntRect& aRect) override;
|
2010-08-21 03:24:40 +04:00
|
|
|
|
|
|
|
// PuppetWidgets don't have native data, as they're purely nonnative.
|
2021-04-19 16:02:33 +03:00
|
|
|
virtual void* GetNativeData(uint32_t aDataType) override { return nullptr; }
|
2010-08-21 03:24:40 +04:00
|
|
|
|
2015-04-07 16:00:05 +03:00
|
|
|
// PuppetWidgets don't have any concept of titles.
|
2016-12-21 03:13:08 +03:00
|
|
|
virtual nsresult SetTitle(const nsAString& aTitle) override {
|
2010-08-21 03:24:40 +04:00
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
}
|
2015-04-07 16:00:05 +03:00
|
|
|
|
2019-04-09 13:26:31 +03:00
|
|
|
virtual mozilla::LayoutDeviceToLayoutDeviceMatrix4x4
|
|
|
|
WidgetToTopLevelWidgetTransform() override;
|
|
|
|
|
2020-02-12 04:44:28 +03:00
|
|
|
virtual LayoutDeviceIntPoint WidgetToScreenOffset() override;
|
2010-08-21 03:24:40 +04:00
|
|
|
|
2019-04-09 13:26:31 +03:00
|
|
|
virtual LayoutDeviceIntPoint TopLevelWidgetToScreenOffset() override {
|
|
|
|
return GetWindowPosition();
|
|
|
|
}
|
|
|
|
|
2022-06-14 18:01:52 +03:00
|
|
|
int32_t RoundsWidgetCoordinatesTo() override { return mRounding; }
|
2016-09-27 09:37:07 +03:00
|
|
|
|
2015-11-10 08:37:32 +03:00
|
|
|
void InitEvent(WidgetGUIEvent& aEvent,
|
2015-11-13 12:37:02 +03:00
|
|
|
LayoutDeviceIntPoint* aPoint = nullptr);
|
2010-09-24 07:28:15 +04:00
|
|
|
|
2016-12-21 03:18:40 +03:00
|
|
|
virtual nsresult DispatchEvent(WidgetGUIEvent* aEvent,
|
|
|
|
nsEventStatus& aStatus) override;
|
2021-04-14 08:07:56 +03:00
|
|
|
ContentAndAPZEventStatus DispatchInputEvent(
|
|
|
|
WidgetInputEvent* aEvent) override;
|
2015-04-14 19:24:32 +03:00
|
|
|
void SetConfirmedTargetAPZC(
|
|
|
|
uint64_t aInputBlockId,
|
2020-03-27 20:44:21 +03:00
|
|
|
const nsTArray<ScrollableLayerGuid>& aTargets) const override;
|
2015-06-17 19:32:42 +03:00
|
|
|
void UpdateZoomConstraints(
|
2018-11-01 23:15:46 +03:00
|
|
|
const uint32_t& aPresShellId, const ScrollableLayerGuid::ViewID& aViewId,
|
2015-06-17 19:32:42 +03:00
|
|
|
const mozilla::Maybe<ZoomConstraints>& aConstraints) override;
|
2015-06-04 23:51:10 +03:00
|
|
|
bool AsyncPanZoomEnabled() const override;
|
2010-08-21 03:24:40 +04:00
|
|
|
|
Bug 1685491 - part 5: Move the code remapping arrow keys in vertical content to `NativeKeyBindings` r=smaug,jfkthame
Currently, this feature is implemented only on Linux and macOS (see also
bug 1077515 and bug 1301497), and the code is really similar each other.
Additionally, it always tries to query selection to check whether the caret is
in vertical content or not if arrow keys are pressed. For avoiding a lot of
query, this patch makes `TextEventDispatcher` cache writing mode at every
selection change notification. However, unfortunately, it's not available when
non-editable content has focus, but it should be out of scope of this bug since
it requires a lot of changes.
Anyway, with this patch, we can write a mochitest only on Linux and macOS.
The following patch adds a test for this as a fix of bug 1103374.
Differential Revision: https://phabricator.services.mozilla.com/D102881
2021-02-02 06:29:31 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT virtual bool GetEditCommands(
|
2017-05-19 11:49:41 +03:00
|
|
|
NativeKeyBindingsType aType, const mozilla::WidgetKeyboardEvent& aEvent,
|
|
|
|
nsTArray<mozilla::CommandInt>& aCommands) override;
|
2014-03-20 19:46:29 +04:00
|
|
|
|
2014-06-19 04:57:51 +04:00
|
|
|
friend struct AutoCacheNativeKeyCommands;
|
2014-03-20 19:46:29 +04:00
|
|
|
|
2010-08-21 03:24:40 +04:00
|
|
|
//
|
|
|
|
// nsBaseWidget methods we override
|
|
|
|
//
|
|
|
|
|
2013-11-26 00:12:20 +04:00
|
|
|
// Documents loaded in child processes are always subdocuments of
|
|
|
|
// other docs in an ancestor process. To ensure that the
|
|
|
|
// backgrounds of those documents are painted like those of
|
|
|
|
// same-process subdocuments, we force the widget here to be
|
|
|
|
// transparent, which in turn will cause layout to use a transparent
|
|
|
|
// backstop background color.
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsTransparencyMode GetTransparencyMode() override {
|
2013-11-26 00:12:20 +04:00
|
|
|
return eTransparencyTransparent;
|
|
|
|
}
|
2012-09-05 20:23:45 +04:00
|
|
|
|
2021-07-23 01:58:57 +03:00
|
|
|
virtual WindowRenderer* GetWindowRenderer() override;
|
2010-08-21 03:24:40 +04:00
|
|
|
|
2017-10-13 17:32:36 +03:00
|
|
|
// This is used for creating remote layer managers and for re-creating
|
|
|
|
// them after a compositor reset. The lambda aInitializeFunc is used to
|
|
|
|
// perform any caller-required initialization for the newly created layer
|
2017-07-18 16:35:07 +03:00
|
|
|
// manager; in the event of a failure, return false and it will destroy the
|
|
|
|
// new layer manager without changing the state of the widget.
|
2017-10-13 17:32:36 +03:00
|
|
|
bool CreateRemoteLayerManager(
|
2021-09-06 01:36:45 +03:00
|
|
|
const std::function<bool(WebRenderLayerManager*)>& aInitializeFunc);
|
2017-10-13 17:32:36 +03:00
|
|
|
|
2016-12-21 07:27:20 +03:00
|
|
|
virtual void SetInputContext(const InputContext& aContext,
|
|
|
|
const InputContextAction& aAction) override;
|
|
|
|
virtual InputContext GetInputContext() override;
|
|
|
|
virtual NativeIMEContext GetNativeIMEContext() override;
|
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
|
|
|
TextEventDispatcherListener* GetNativeTextEventDispatcherListener() override {
|
Bug 1217700 part.1 nsIWidget should return reference to IMENotificationRequests r=m_kato
IMEContentObserver may need to change notifications to send when TextInputProcessor begins input transaction. In current design, IMEContentObserver needs to retrieve IMENotificationRequests at every change. However, if nsIWidget returns a reference to its IMENotificationRequests, IMEContentObserver can call it only once.
For that purpose, this patch changes nsIWidget::GetIMENotificationRequests() to nsIWidget::IMENotificationRequestsRef() and make it return |const IMENotificationRequests&|. However, if the lifetime of the instance of IMENotificationRequest is shorter than the widget instance's, it's dangerous. Therefore, it always returns TextEventDispatcher::mIMENotificationRequests. TextEventDispatcher's lifetime is longer than the widget. Therefore, this guarantees the lifetime.
On the other hand, widget needs to update TextEventDispatcher::mIMENotificationRequests before calls of nsIWidget::IMENotificationRequestsRef(). Therefore, this patch makes TextEventDispatcher update proper IMENotificationRequests when it gets focus or starts new input transaction and clear mIMENotificationRequests when it loses focus.
Note that TextEventDispatcher gets proper requests both from native text event dispatcher listener (typically, implemented by native IME handler class) and TextInputProcessor when TextInputProcessor has input transaction because even if TextInputProcessor overrides native IME, native IME still needs to know the content changes since they may get new input transaction after that.
However, there may not be native IME handler in content process. If it runs in Android, PuppetWidget may have native IME handler because widget directly handles IME in e10s mode for Android. Otherwise, native IME handler is in its parent process. So, if TextInputHandler has input transaction in content process, PuppetWidget needs to behave as native event handler. Therefore, this patch makes PuppetWidget inherit TextEventDispatcherListener and implements PuppetWidget::IMENotificationRequestsRef().
MozReview-Commit-ID: 2SW3moONTOX
--HG--
extra : rebase_source : d2634ada6c33dbf7a966fadb68608411ee24bfab
2017-04-14 19:35:58 +03:00
|
|
|
return mNativeTextEventDispatcherListener
|
|
|
|
? mNativeTextEventDispatcherListener.get()
|
|
|
|
: this;
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
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
|
|
|
void SetNativeTextEventDispatcherListener(
|
|
|
|
TextEventDispatcherListener* aListener) {
|
|
|
|
mNativeTextEventDispatcherListener = aListener;
|
Bug 1217700 part.1 nsIWidget should return reference to IMENotificationRequests r=m_kato
IMEContentObserver may need to change notifications to send when TextInputProcessor begins input transaction. In current design, IMEContentObserver needs to retrieve IMENotificationRequests at every change. However, if nsIWidget returns a reference to its IMENotificationRequests, IMEContentObserver can call it only once.
For that purpose, this patch changes nsIWidget::GetIMENotificationRequests() to nsIWidget::IMENotificationRequestsRef() and make it return |const IMENotificationRequests&|. However, if the lifetime of the instance of IMENotificationRequest is shorter than the widget instance's, it's dangerous. Therefore, it always returns TextEventDispatcher::mIMENotificationRequests. TextEventDispatcher's lifetime is longer than the widget. Therefore, this guarantees the lifetime.
On the other hand, widget needs to update TextEventDispatcher::mIMENotificationRequests before calls of nsIWidget::IMENotificationRequestsRef(). Therefore, this patch makes TextEventDispatcher update proper IMENotificationRequests when it gets focus or starts new input transaction and clear mIMENotificationRequests when it loses focus.
Note that TextEventDispatcher gets proper requests both from native text event dispatcher listener (typically, implemented by native IME handler class) and TextInputProcessor when TextInputProcessor has input transaction because even if TextInputProcessor overrides native IME, native IME still needs to know the content changes since they may get new input transaction after that.
However, there may not be native IME handler in content process. If it runs in Android, PuppetWidget may have native IME handler because widget directly handles IME in e10s mode for Android. Otherwise, native IME handler is in its parent process. So, if TextInputHandler has input transaction in content process, PuppetWidget needs to behave as native event handler. Therefore, this patch makes PuppetWidget inherit TextEventDispatcherListener and implements PuppetWidget::IMENotificationRequestsRef().
MozReview-Commit-ID: 2SW3moONTOX
--HG--
extra : rebase_source : d2634ada6c33dbf7a966fadb68608411ee24bfab
2017-04-14 19:35:58 +03:00
|
|
|
}
|
2010-09-24 07:28:15 +04:00
|
|
|
|
2021-04-20 12:47:32 +03:00
|
|
|
virtual void SetCursor(const Cursor&) override;
|
2011-06-22 04:32:43 +04:00
|
|
|
|
2022-06-14 18:01:52 +03:00
|
|
|
float GetDPI() override { return mDPI; }
|
|
|
|
double GetDefaultScaleInternal() override { return mDefaultScale; }
|
2010-12-03 04:24:04 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool NeedsPaint() override;
|
2012-11-08 07:51:55 +04:00
|
|
|
|
2016-07-23 02:36:45 +03:00
|
|
|
// Paint the widget immediately if any paints are queued up.
|
|
|
|
void PaintNowIfNeeded();
|
|
|
|
|
2019-04-10 01:39:01 +03:00
|
|
|
virtual BrowserChild* GetOwningBrowserChild() override {
|
|
|
|
return mBrowserChild;
|
|
|
|
}
|
2015-08-13 17:42:19 +03:00
|
|
|
|
2016-09-27 09:37:07 +03:00
|
|
|
void UpdateBackingScaleCache(float aDpi, int32_t aRounding, double aScale) {
|
2015-08-13 17:42:19 +03:00
|
|
|
mDPI = aDpi;
|
2016-09-27 09:37:07 +03:00
|
|
|
mRounding = aRounding;
|
2015-08-13 17:42:19 +03:00
|
|
|
mDefaultScale = aScale;
|
2014-05-23 18:36:50 +04:00
|
|
|
}
|
2012-09-25 08:15:18 +04:00
|
|
|
|
2020-03-04 11:16:31 +03:00
|
|
|
// safe area insets support
|
|
|
|
virtual ScreenIntMargin GetSafeAreaInsets() const override;
|
|
|
|
void UpdateSafeAreaInsets(const ScreenIntMargin& aSafeAreaInsets);
|
|
|
|
|
2017-11-22 22:21:37 +03:00
|
|
|
// Get the offset to the chrome of the window that this tab belongs to.
|
2020-02-12 04:44:28 +03:00
|
|
|
//
|
|
|
|
// NOTE: In OOP iframes this value is zero. You should use
|
|
|
|
// WidgetToTopLevelWidgetTransform instead which is already including the
|
|
|
|
// chrome offset.
|
2017-11-22 22:21:37 +03:00
|
|
|
LayoutDeviceIntPoint GetChromeOffset();
|
2014-12-11 17:44:07 +03:00
|
|
|
|
|
|
|
// Get the screen position of the application window.
|
2017-11-22 22:21:37 +03:00
|
|
|
LayoutDeviceIntPoint GetWindowPosition();
|
2014-12-11 17:44:07 +03:00
|
|
|
|
2016-08-19 02:03:04 +03:00
|
|
|
virtual LayoutDeviceIntRect GetScreenBounds() override;
|
2015-03-31 23:39:02 +03:00
|
|
|
|
2015-04-14 18:36:36 +03:00
|
|
|
virtual nsresult SynthesizeNativeKeyEvent(
|
|
|
|
int32_t aNativeKeyboardLayout, int32_t aNativeKeyCode,
|
|
|
|
uint32_t aModifierFlags, const nsAString& aCharacters,
|
|
|
|
const nsAString& aUnmodifiedCharacters, nsIObserver* aObserver) override;
|
Bug 1691622 - part 4: Make `synthesizeNativeMouseClick*()` aware of modifiers r=smaug,geckoview-reviewers,m_kato
Surprisingly, they don't take modifiers, and
`nsIWidget::SynthesizeNativeMouseEvent()` which are implementations of
`nsIDOMWindowUtils::SendNativeMouseEvent()` treat given modifier flags
are native's ones, and handle modifiers only on macOS. Therefore, this
patch makes them handle native modifiers of Gecko.
Unfortunately, I'm not so familiar with Android API, and in the short
term, I don't need the support on Android. Therefore, this patch just
adds a TODO comment on Android widget.
Additionally, we don't have a simple way to set modifier only while
posting a mouse input on Windows too. It requires complicated code.
Therefore, I don't add the support for it on Windows too.
Differential Revision: https://phabricator.services.mozilla.com/D105758
2021-02-24 04:27:07 +03:00
|
|
|
virtual nsresult SynthesizeNativeMouseEvent(
|
2021-02-24 04:27:10 +03:00
|
|
|
LayoutDeviceIntPoint aPoint, NativeMouseMessage aNativeMessage,
|
|
|
|
MouseButton aButton, nsIWidget::Modifiers aModifierFlags,
|
|
|
|
nsIObserver* aObserver) override;
|
2015-11-13 12:37:02 +03:00
|
|
|
virtual nsresult SynthesizeNativeMouseMove(LayoutDeviceIntPoint aPoint,
|
2015-04-14 18:36:36 +03:00
|
|
|
nsIObserver* aObserver) override;
|
2015-11-13 12:37:02 +03:00
|
|
|
virtual nsresult SynthesizeNativeMouseScrollEvent(
|
|
|
|
LayoutDeviceIntPoint aPoint, uint32_t aNativeMessage, double aDeltaX,
|
2015-04-14 18:36:36 +03:00
|
|
|
double aDeltaY, double aDeltaZ, uint32_t aModifierFlags,
|
|
|
|
uint32_t aAdditionalFlags, nsIObserver* aObserver) override;
|
|
|
|
virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
|
|
|
|
TouchPointerState aPointerState,
|
2016-04-15 13:39:36 +03:00
|
|
|
LayoutDeviceIntPoint aPoint,
|
2015-04-14 18:36:36 +03:00
|
|
|
double aPointerPressure,
|
|
|
|
uint32_t aPointerOrientation,
|
|
|
|
nsIObserver* aObserver) override;
|
2021-02-19 08:35:40 +03:00
|
|
|
virtual nsresult SynthesizeNativeTouchPadPinch(
|
2021-08-09 01:04:17 +03:00
|
|
|
TouchpadGesturePhase aEventPhase, float aScale,
|
|
|
|
LayoutDeviceIntPoint aPoint, int32_t aModifierFlags) override;
|
2016-04-15 13:39:36 +03:00
|
|
|
virtual nsresult SynthesizeNativeTouchTap(LayoutDeviceIntPoint aPoint,
|
2015-04-14 18:36:36 +03:00
|
|
|
bool aLongTap,
|
|
|
|
nsIObserver* aObserver) override;
|
|
|
|
virtual nsresult ClearNativeTouchSequence(nsIObserver* aObserver) override;
|
2015-05-08 04:29:00 +03:00
|
|
|
virtual uint32_t GetMaxTouchPoints() const override;
|
2021-09-06 14:50:34 +03:00
|
|
|
virtual nsresult SynthesizeNativePenInput(uint32_t aPointerId,
|
|
|
|
TouchPointerState aPointerState,
|
|
|
|
LayoutDeviceIntPoint aPoint,
|
|
|
|
double aPressure,
|
|
|
|
uint32_t aRotation, int32_t aTiltX,
|
|
|
|
int32_t aTiltY, int32_t aButton,
|
|
|
|
nsIObserver* aObserver) override;
|
2015-04-14 18:36:36 +03:00
|
|
|
|
2021-03-12 05:10:43 +03:00
|
|
|
virtual nsresult SynthesizeNativeTouchpadDoubleTap(
|
|
|
|
LayoutDeviceIntPoint aPoint, uint32_t aModifierFlags) override;
|
|
|
|
|
2021-08-09 01:04:18 +03:00
|
|
|
virtual nsresult SynthesizeNativeTouchpadPan(TouchpadGesturePhase aEventPhase,
|
|
|
|
LayoutDeviceIntPoint aPoint,
|
|
|
|
double aDeltaX, double aDeltaY,
|
2022-04-06 01:53:35 +03:00
|
|
|
int32_t aModifierFlags,
|
|
|
|
nsIObserver* aObserver) override;
|
2021-08-09 01:04:18 +03:00
|
|
|
|
2021-04-22 17:56:43 +03:00
|
|
|
virtual void LockNativePointer() override;
|
|
|
|
virtual void UnlockNativePointer() override;
|
|
|
|
|
2015-09-29 00:00:25 +03:00
|
|
|
virtual void StartAsyncScrollbarDrag(
|
|
|
|
const AsyncDragMetrics& aDragMetrics) override;
|
2015-12-29 16:57:38 +03:00
|
|
|
|
2016-01-20 04:44:44 +03:00
|
|
|
virtual void ZoomToRect(const uint32_t& aPresShellId,
|
2018-11-01 23:15:46 +03:00
|
|
|
const ScrollableLayerGuid::ViewID& aViewId,
|
2016-01-20 04:44:44 +03:00
|
|
|
const CSSRect& aRect,
|
|
|
|
const uint32_t& aFlags) override;
|
2016-03-29 10:03:54 +03:00
|
|
|
|
|
|
|
virtual bool HasPendingInputEvent() override;
|
|
|
|
|
2016-04-26 11:18:04 +03:00
|
|
|
virtual void LookUpDictionary(
|
|
|
|
const nsAString& aText,
|
|
|
|
const nsTArray<mozilla::FontRange>& aFontRangeArray,
|
|
|
|
const bool aIsVertical, const LayoutDeviceIntPoint& aPoint) override;
|
|
|
|
|
2018-08-07 05:58:36 +03:00
|
|
|
nsresult SetSystemFont(const nsCString& aFontName) override;
|
|
|
|
nsresult GetSystemFont(nsCString& aFontName) override;
|
|
|
|
|
Bug 1217700 part.1 nsIWidget should return reference to IMENotificationRequests r=m_kato
IMEContentObserver may need to change notifications to send when TextInputProcessor begins input transaction. In current design, IMEContentObserver needs to retrieve IMENotificationRequests at every change. However, if nsIWidget returns a reference to its IMENotificationRequests, IMEContentObserver can call it only once.
For that purpose, this patch changes nsIWidget::GetIMENotificationRequests() to nsIWidget::IMENotificationRequestsRef() and make it return |const IMENotificationRequests&|. However, if the lifetime of the instance of IMENotificationRequest is shorter than the widget instance's, it's dangerous. Therefore, it always returns TextEventDispatcher::mIMENotificationRequests. TextEventDispatcher's lifetime is longer than the widget. Therefore, this guarantees the lifetime.
On the other hand, widget needs to update TextEventDispatcher::mIMENotificationRequests before calls of nsIWidget::IMENotificationRequestsRef(). Therefore, this patch makes TextEventDispatcher update proper IMENotificationRequests when it gets focus or starts new input transaction and clear mIMENotificationRequests when it loses focus.
Note that TextEventDispatcher gets proper requests both from native text event dispatcher listener (typically, implemented by native IME handler class) and TextInputProcessor when TextInputProcessor has input transaction because even if TextInputProcessor overrides native IME, native IME still needs to know the content changes since they may get new input transaction after that.
However, there may not be native IME handler in content process. If it runs in Android, PuppetWidget may have native IME handler because widget directly handles IME in e10s mode for Android. Otherwise, native IME handler is in its parent process. So, if TextInputHandler has input transaction in content process, PuppetWidget needs to behave as native event handler. Therefore, this patch makes PuppetWidget inherit TextEventDispatcherListener and implements PuppetWidget::IMENotificationRequestsRef().
MozReview-Commit-ID: 2SW3moONTOX
--HG--
extra : rebase_source : d2634ada6c33dbf7a966fadb68608411ee24bfab
2017-04-14 19:35:58 +03:00
|
|
|
// TextEventDispatcherListener
|
|
|
|
using nsBaseWidget::NotifyIME;
|
|
|
|
NS_IMETHOD NotifyIME(TextEventDispatcher* aTextEventDispatcher,
|
|
|
|
const IMENotification& aNotification) override;
|
|
|
|
NS_IMETHOD_(IMENotificationRequests) GetIMENotificationRequests() override;
|
|
|
|
NS_IMETHOD_(void)
|
|
|
|
OnRemovedFrom(TextEventDispatcher* aTextEventDispatcher) override;
|
|
|
|
NS_IMETHOD_(void)
|
|
|
|
WillDispatchKeyboardEvent(TextEventDispatcher* aTextEventDispatcher,
|
|
|
|
WidgetKeyboardEvent& aKeyboardEvent,
|
|
|
|
uint32_t aIndexOfKeypress, void* aData) override;
|
2015-01-28 09:27:31 +03:00
|
|
|
|
2018-08-10 18:15:18 +03:00
|
|
|
virtual void OnMemoryPressure(layers::MemoryPressureReason aWhy) override;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2010-08-21 03:24:40 +04:00
|
|
|
private:
|
2021-03-22 23:49:04 +03:00
|
|
|
void Paint();
|
|
|
|
|
2010-08-21 03:24:40 +04:00
|
|
|
void SetChild(PuppetWidget* aChild);
|
|
|
|
|
2015-12-11 09:15:58 +03:00
|
|
|
nsresult RequestIMEToCommitComposition(bool aCancel);
|
2015-06-05 12:28:20 +03:00
|
|
|
nsresult NotifyIMEOfFocusChange(const IMENotification& aIMENotification);
|
2014-02-26 04:48:02 +04:00
|
|
|
nsresult NotifyIMEOfSelectionChange(const IMENotification& aIMENotification);
|
2015-07-17 07:30:01 +03:00
|
|
|
nsresult NotifyIMEOfCompositionUpdate(
|
|
|
|
const IMENotification& aIMENotification);
|
2014-02-18 04:00:15 +04:00
|
|
|
nsresult NotifyIMEOfTextChange(const IMENotification& aIMENotification);
|
2014-09-11 17:46:17 +04:00
|
|
|
nsresult NotifyIMEOfMouseButtonEvent(const IMENotification& aIMENotification);
|
2015-06-05 12:28:20 +03:00
|
|
|
nsresult NotifyIMEOfPositionChange(const IMENotification& aIMENotification);
|
2014-12-15 12:37:00 +03:00
|
|
|
|
2015-06-05 12:28:20 +03:00
|
|
|
bool CacheEditorRect();
|
|
|
|
bool CacheCompositionRects(uint32_t& aStartOffset,
|
2015-11-13 12:37:02 +03:00
|
|
|
nsTArray<LayoutDeviceIntRect>& aRectArray,
|
2015-06-05 12:28:20 +03:00
|
|
|
uint32_t& aTargetCauseOffset);
|
2015-11-13 12:37:02 +03:00
|
|
|
bool GetCaretRect(LayoutDeviceIntRect& aCaretRect, uint32_t aCaretOffset);
|
2014-12-15 12:37:00 +03:00
|
|
|
uint32_t GetCaretOffset();
|
2010-09-24 07:28:15 +04:00
|
|
|
|
2015-07-22 04:09:02 +03:00
|
|
|
nsIWidgetListener* GetCurrentWidgetListener();
|
|
|
|
|
2018-05-17 08:47:55 +03:00
|
|
|
// When this widget caches input context and currently managed by
|
|
|
|
// IMEStateManager, the cache is valid.
|
|
|
|
bool HaveValidInputContextCache() const;
|
|
|
|
|
2021-03-22 23:49:04 +03:00
|
|
|
class WidgetPaintTask : public Runnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
explicit WidgetPaintTask(PuppetWidget* widget)
|
|
|
|
: Runnable("PuppetWidget::WidgetPaintTask"), mWidget(widget) {}
|
|
|
|
void Revoke() { mWidget = nullptr; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
PuppetWidget* mWidget;
|
|
|
|
};
|
|
|
|
|
2020-10-17 21:07:03 +03:00
|
|
|
nsRefreshDriver* GetTopLevelRefreshDriver() const;
|
2010-08-21 03:24:40 +04:00
|
|
|
|
2019-04-10 01:39:01 +03:00
|
|
|
// BrowserChild normally holds a strong reference to this PuppetWidget
|
2012-07-18 03:59:45 +04:00
|
|
|
// or its root ancestor, but each PuppetWidget also needs a
|
2019-04-10 01:39:01 +03:00
|
|
|
// reference back to BrowserChild (e.g. to delegate nsIWidget IME calls
|
|
|
|
// to chrome) So we hold a weak reference to BrowserChild here. Since
|
|
|
|
// it's possible for BrowserChild to outlive the PuppetWidget, we clear
|
2012-07-18 03:59:45 +04:00
|
|
|
// this weak reference in Destroy()
|
2019-04-10 01:39:01 +03:00
|
|
|
BrowserChild* mBrowserChild;
|
2010-08-21 03:24:40 +04:00
|
|
|
// The "widget" to which we delegate events if we don't have an
|
|
|
|
// event handler.
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<PuppetWidget> mChild;
|
2021-03-22 23:49:04 +03:00
|
|
|
nsRevocableEventPtr<WidgetPaintTask> mWidgetPaintTask;
|
2018-08-10 18:15:18 +03:00
|
|
|
RefPtr<layers::MemoryPressureObserver> mMemoryPressureObserver;
|
2010-08-21 03:24:40 +04:00
|
|
|
// XXX/cjones: keeping this around until we teach LayerManager to do
|
|
|
|
// retained-content-only transactions
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<DrawTarget> mDrawTarget;
|
2010-09-24 07:28:15 +04:00
|
|
|
// IME
|
2017-04-11 15:24:55 +03:00
|
|
|
IMENotificationRequests mIMENotificationRequestsOfParent;
|
2015-10-10 04:21:02 +03:00
|
|
|
InputContext mInputContext;
|
2015-12-11 09:15:57 +03:00
|
|
|
// mNativeIMEContext is initialized when this dispatches every composition
|
|
|
|
// event both from parent process's widget and TextEventDispatcher in same
|
|
|
|
// process. If it hasn't been started composition yet, this isn't necessary
|
|
|
|
// for XP code since there is no TextComposition instance which is caused by
|
|
|
|
// the PuppetWidget instance.
|
|
|
|
NativeIMEContext mNativeIMEContext;
|
2015-06-26 02:21:13 +03:00
|
|
|
ContentCacheInChild mContentCache;
|
2010-12-03 04:24:04 +03:00
|
|
|
|
2022-06-14 18:01:52 +03:00
|
|
|
// The DPI of the parent widget containing this widget.
|
|
|
|
float mDPI = 96;
|
|
|
|
int32_t mRounding = 1;
|
|
|
|
double mDefaultScale = 1.0f;
|
2014-03-20 19:46:29 +04:00
|
|
|
|
2020-03-04 11:16:31 +03:00
|
|
|
ScreenIntMargin mSafeAreaInsets;
|
|
|
|
|
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
|
|
|
RefPtr<TextEventDispatcherListener> mNativeTextEventDispatcherListener;
|
|
|
|
|
2015-12-11 09:15:57 +03:00
|
|
|
protected:
|
|
|
|
bool mEnabled;
|
|
|
|
bool mVisible;
|
|
|
|
|
|
|
|
private:
|
2022-05-02 17:06:17 +03:00
|
|
|
nsSizeMode mSizeMode;
|
|
|
|
|
2015-12-11 09:15:57 +03:00
|
|
|
bool mNeedIMEStateInit;
|
2017-11-27 14:34:01 +03:00
|
|
|
// When remote process requests to commit/cancel a composition, the
|
|
|
|
// composition may have already been committed in the main process. In such
|
|
|
|
// case, this will receive remaining composition events for the old
|
|
|
|
// composition even after requesting to commit/cancel the old composition
|
2021-01-28 11:23:33 +03:00
|
|
|
// but the TextComposition for the old composition has already been
|
|
|
|
// destroyed. So, until this meets new eCompositionStart, following
|
|
|
|
// composition events should be ignored if this is set to true.
|
2017-11-27 14:34:01 +03:00
|
|
|
bool mIgnoreCompositionEvents;
|
2014-04-22 00:40:09 +04:00
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace widget
|
|
|
|
} // namespace mozilla
|
2010-08-21 03:24:40 +04:00
|
|
|
|
|
|
|
#endif // mozilla_widget_PuppetWidget_h__
|