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"
|
|
|
|
#include "mozilla/RefPtr.h"
|
2012-05-09 01:36:07 +04:00
|
|
|
#include "nsBaseScreen.h"
|
2010-08-21 03:24:40 +04:00
|
|
|
#include "nsBaseWidget.h"
|
2012-05-09 01:36:07 +04:00
|
|
|
#include "nsIScreenManager.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"
|
2010-08-21 03:24:40 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
2012-07-18 03:59:45 +04:00
|
|
|
|
|
|
|
namespace dom {
|
|
|
|
class TabChild;
|
|
|
|
}
|
|
|
|
|
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
|
2010-08-21 03:24:40 +04:00
|
|
|
{
|
2012-07-18 03:59:45 +04:00
|
|
|
typedef mozilla::dom::TabChild TabChild;
|
2014-06-10 10:02:21 +04:00
|
|
|
typedef mozilla::gfx::DrawTarget DrawTarget;
|
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:
|
2014-09-01 07:33:13 +04:00
|
|
|
explicit PuppetWidget(TabChild* aTabChild);
|
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
|
|
|
|
|
|
|
|
NS_IMETHOD Create(nsIWidget* aParent,
|
|
|
|
nsNativeWidget aNativeParent,
|
|
|
|
const nsIntRect& aRect,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsWidgetInitData* aInitData = nullptr) override;
|
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(const nsIntRect &aRect,
|
2012-07-30 18:20:58 +04:00
|
|
|
nsWidgetInitData *aInitData = nullptr,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aForceUseIWidgetParent = false) override;
|
2010-08-21 03:24:40 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD Destroy() override;
|
2010-08-21 03:24:40 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD 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
|
2012-07-19 12:57:50 +04:00
|
|
|
{ return mVisible; }
|
2010-08-21 03:24:40 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
NS_IMETHOD ConstrainPosition(bool /*ignored aAllowSlop*/,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t* aX,
|
2015-03-21 19:28:04 +03:00
|
|
|
int32_t* aY) override
|
2010-08-21 03:24:40 +04:00
|
|
|
{ *aX = kMaxDimension; *aY = kMaxDimension; return NS_OK; }
|
|
|
|
|
2015-03-31 23:39:02 +03:00
|
|
|
// Widget position is controlled by the parent process via TabChild.
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD Move(double aX, double aY) override
|
2010-08-21 03:24:40 +04:00
|
|
|
{ return NS_OK; }
|
|
|
|
|
2012-12-12 13:57:38 +04:00
|
|
|
NS_IMETHOD Resize(double aWidth,
|
|
|
|
double aHeight,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aRepaint) override;
|
2012-12-12 13:57:38 +04:00
|
|
|
NS_IMETHOD Resize(double aX,
|
|
|
|
double aY,
|
|
|
|
double aWidth,
|
|
|
|
double aHeight,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aRepaint) override
|
2015-03-31 23:39:02 +03:00
|
|
|
{
|
|
|
|
if (mBounds.x != aX || mBounds.y != aY) {
|
|
|
|
NotifyWindowMoved(aX, aY);
|
|
|
|
}
|
|
|
|
mBounds.x = aX;
|
|
|
|
mBounds.y = aY;
|
|
|
|
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
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD Enable(bool aState) override
|
2010-08-21 03:24:40 +04:00
|
|
|
{ mEnabled = aState; return NS_OK; }
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsEnabled() const override
|
2012-07-23 09:19:08 +04:00
|
|
|
{ return mEnabled; }
|
2010-08-21 03:24:40 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD SetFocus(bool aRaise = false) override;
|
2010-08-21 03:24:40 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations) override;
|
2010-08-21 03:24:40 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD Invalidate(const nsIntRect& aRect) override;
|
2010-08-21 03:24:40 +04:00
|
|
|
|
|
|
|
// This API is going away, steer clear.
|
|
|
|
virtual void Scroll(const nsIntPoint& aDelta,
|
|
|
|
const nsTArray<nsIntRect>& aDestRects,
|
|
|
|
const nsTArray<Configuration>& aReconfigureChildren)
|
|
|
|
{ /* dead man walking */ }
|
|
|
|
|
|
|
|
// PuppetWidgets don't have native data, as they're purely nonnative.
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void* GetNativeData(uint32_t aDataType) override;
|
|
|
|
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent) override
|
2010-09-18 15:28:50 +04:00
|
|
|
{ return NS_ERROR_UNEXPECTED; }
|
2010-08-21 03:24:40 +04:00
|
|
|
|
2015-04-07 16:00:05 +03:00
|
|
|
// PuppetWidgets don't have any concept of titles.
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD 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
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset() override
|
2015-03-31 23:39:02 +03:00
|
|
|
{ return LayoutDeviceIntPoint::FromUntyped(GetWindowPosition() + GetChromeDimensions()); }
|
2010-08-21 03:24:40 +04:00
|
|
|
|
2013-10-02 07:46:03 +04:00
|
|
|
void InitEvent(WidgetGUIEvent& aEvent, nsIntPoint* aPoint = nullptr);
|
2010-09-24 07:28:15 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD DispatchEvent(WidgetGUIEvent* aEvent, nsEventStatus& aStatus) override;
|
|
|
|
nsEventStatus DispatchAPZAwareEvent(WidgetInputEvent* aEvent) override;
|
2015-03-25 01:00:52 +03:00
|
|
|
nsEventStatus DispatchInputEvent(WidgetInputEvent* aEvent) override;
|
2015-04-14 19:24:32 +03:00
|
|
|
void SetConfirmedTargetAPZC(uint64_t aInputBlockId,
|
|
|
|
const nsTArray<ScrollableLayerGuid>& aTargets) const override;
|
2015-06-17 19:32:42 +03:00
|
|
|
void UpdateZoomConstraints(const uint32_t& aPresShellId,
|
|
|
|
const FrameMetrics::ViewID& aViewId,
|
|
|
|
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
|
|
|
|
2011-11-08 23:59:07 +04:00
|
|
|
NS_IMETHOD CaptureRollupEvents(nsIRollupListener* aListener,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool aDoCapture) override
|
2010-08-21 03:24:40 +04:00
|
|
|
{ return NS_ERROR_UNEXPECTED; }
|
|
|
|
|
2014-03-20 19:46:29 +04:00
|
|
|
NS_IMETHOD_(bool)
|
|
|
|
ExecuteNativeKeyBinding(NativeKeyBindingsType aType,
|
|
|
|
const mozilla::WidgetKeyboardEvent& aEvent,
|
|
|
|
DoCommandCallback aCallback,
|
2015-03-21 19:28:04 +03:00
|
|
|
void* aCallbackData) 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
|
|
|
|
2011-08-09 23:38:26 +04:00
|
|
|
virtual LayerManager*
|
2013-04-24 22:42:40 +04:00
|
|
|
GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
|
2014-01-23 22:26:41 +04:00
|
|
|
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
|
2011-08-09 23:38:26 +04:00
|
|
|
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool* aAllowRetaining = nullptr) override;
|
2010-08-21 03:24:40 +04:00
|
|
|
|
2011-11-27 15:51:52 +04:00
|
|
|
NS_IMETHOD_(void) SetInputContext(const InputContext& aContext,
|
2015-03-21 19:28:04 +03:00
|
|
|
const InputContextAction& aAction) override;
|
|
|
|
NS_IMETHOD_(InputContext) GetInputContext() override;
|
|
|
|
virtual nsIMEUpdatePreference GetIMEUpdatePreference() override;
|
2010-09-24 07:28:15 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD SetCursor(nsCursor aCursor) override;
|
2012-05-09 01:36:07 +04:00
|
|
|
NS_IMETHOD SetCursor(imgIContainer* aCursor,
|
2015-05-20 04:28:57 +03:00
|
|
|
uint32_t aHotspotX, uint32_t aHotspotY) override;
|
|
|
|
|
|
|
|
virtual void ClearCachedCursor() override;
|
2011-06-22 04:32:43 +04:00
|
|
|
|
2010-12-03 04:24:04 +03:00
|
|
|
// Gets the DPI of the screen corresponding to this widget.
|
|
|
|
// Contacts the parent process which gets the DPI from the
|
|
|
|
// proper widget there. TODO: Handle DPI changes that happen
|
|
|
|
// later on.
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual float GetDPI() override;
|
|
|
|
virtual double GetDefaultScaleInternal() override;
|
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
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual TabChild* GetOwningTabChild() override { return mTabChild; }
|
2014-05-23 18:36:50 +04:00
|
|
|
virtual void ClearBackingScaleCache()
|
|
|
|
{
|
|
|
|
mDPI = -1;
|
|
|
|
mDefaultScale = -1;
|
|
|
|
}
|
2012-09-25 08:15:18 +04:00
|
|
|
|
2014-12-11 17:44:07 +03:00
|
|
|
nsIntSize GetScreenDimensions();
|
|
|
|
|
|
|
|
// Get the size of the chrome of the window that this tab belongs to.
|
|
|
|
nsIntPoint GetChromeDimensions();
|
|
|
|
|
|
|
|
// Get the screen position of the application window.
|
|
|
|
nsIntPoint GetWindowPosition();
|
|
|
|
|
2015-03-31 23:39:02 +03:00
|
|
|
NS_IMETHOD GetScreenBounds(nsIntRect &aRect) override;
|
|
|
|
|
2015-02-20 19:37:02 +03:00
|
|
|
NS_IMETHOD StartPluginIME(const mozilla::WidgetKeyboardEvent& aKeyboardEvent,
|
|
|
|
int32_t aPanelX, int32_t aPanelY,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsString& aCommitted) override;
|
2015-02-20 19:37:02 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD SetPluginFocused(bool& aFocused) override;
|
2015-02-20 19:37: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;
|
|
|
|
virtual nsresult SynthesizeNativeMouseEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
|
|
|
uint32_t aNativeMessage,
|
|
|
|
uint32_t aModifierFlags,
|
|
|
|
nsIObserver* aObserver) override;
|
|
|
|
virtual nsresult SynthesizeNativeMouseMove(mozilla::LayoutDeviceIntPoint aPoint,
|
|
|
|
nsIObserver* aObserver) override;
|
|
|
|
virtual nsresult SynthesizeNativeMouseScrollEvent(mozilla::LayoutDeviceIntPoint aPoint,
|
|
|
|
uint32_t aNativeMessage,
|
|
|
|
double aDeltaX,
|
|
|
|
double aDeltaY,
|
|
|
|
double aDeltaZ,
|
|
|
|
uint32_t aModifierFlags,
|
|
|
|
uint32_t aAdditionalFlags,
|
|
|
|
nsIObserver* aObserver) override;
|
|
|
|
virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
|
|
|
|
TouchPointerState aPointerState,
|
|
|
|
nsIntPoint aPointerScreenPoint,
|
|
|
|
double aPointerPressure,
|
|
|
|
uint32_t aPointerOrientation,
|
|
|
|
nsIObserver* aObserver) override;
|
|
|
|
virtual nsresult SynthesizeNativeTouchTap(nsIntPoint aPointerScreenPoint,
|
|
|
|
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;
|
2015-04-14 18:36:36 +03:00
|
|
|
|
2014-11-12 23:59:19 +03:00
|
|
|
protected:
|
|
|
|
bool mEnabled;
|
|
|
|
bool mVisible;
|
|
|
|
|
2015-01-28 09:27:31 +03:00
|
|
|
virtual nsresult NotifyIMEInternal(
|
2015-03-21 19:28:04 +03:00
|
|
|
const IMENotification& aIMENotification) override;
|
2015-01-28 09:27:31 +03:00
|
|
|
|
2010-08-21 03:24:40 +04:00
|
|
|
private:
|
2012-08-15 22:52:42 +04:00
|
|
|
nsresult Paint();
|
2010-08-21 03:24:40 +04:00
|
|
|
|
|
|
|
void SetChild(PuppetWidget* aChild);
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
nsresult IMEEndComposition(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-06-05 12:28:20 +03:00
|
|
|
nsresult NotifyIMEOfUpdateComposition(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,
|
|
|
|
nsTArray<mozilla::LayoutDeviceIntRect>& aRectArray,
|
|
|
|
uint32_t& aTargetCauseOffset);
|
2015-02-04 23:21:03 +03:00
|
|
|
bool GetCaretRect(mozilla::LayoutDeviceIntRect& aCaretRect, uint32_t aCaretOffset);
|
2014-12-15 12:37:00 +03:00
|
|
|
uint32_t GetCaretOffset();
|
2010-09-24 07:28:15 +04:00
|
|
|
|
2010-08-21 03:24:40 +04:00
|
|
|
class PaintTask : public nsRunnable {
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
2014-09-01 07:33:13 +04:00
|
|
|
explicit PaintTask(PuppetWidget* widget) : mWidget(widget) {}
|
2012-07-30 18:20:58 +04:00
|
|
|
void Revoke() { mWidget = nullptr; }
|
2010-08-21 03:24:40 +04:00
|
|
|
private:
|
|
|
|
PuppetWidget* mWidget;
|
|
|
|
};
|
|
|
|
|
2015-05-20 10:45:41 +03:00
|
|
|
class MemoryPressureObserver : public nsIObserver {
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
explicit MemoryPressureObserver(PuppetWidget* aWidget) : mWidget(aWidget) {}
|
|
|
|
void Remove();
|
|
|
|
private:
|
|
|
|
virtual ~MemoryPressureObserver() {}
|
|
|
|
PuppetWidget* mWidget;
|
|
|
|
};
|
|
|
|
friend class MemoryPressureObserver;
|
|
|
|
|
2010-09-24 07:28:15 +04:00
|
|
|
// TabChild 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
|
|
|
|
// reference back to TabChild (e.g. to delegate nsIWidget IME calls
|
|
|
|
// to chrome) So we hold a weak reference to TabChild here. Since
|
|
|
|
// it's possible for TabChild to outlive the PuppetWidget, we clear
|
|
|
|
// this weak reference in Destroy()
|
|
|
|
TabChild* mTabChild;
|
2010-08-21 03:24:40 +04:00
|
|
|
// The "widget" to which we delegate events if we don't have an
|
|
|
|
// event handler.
|
|
|
|
nsRefPtr<PuppetWidget> mChild;
|
|
|
|
nsIntRegion mDirtyRegion;
|
|
|
|
nsRevocableEventPtr<PaintTask> mPaintTask;
|
2015-05-20 10:45:41 +03:00
|
|
|
nsRefPtr<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
|
2014-06-10 10:02:21 +04:00
|
|
|
mozilla::RefPtr<DrawTarget> mDrawTarget;
|
2010-09-24 07:28:15 +04:00
|
|
|
// IME
|
2014-01-29 13:32:39 +04:00
|
|
|
nsIMEUpdatePreference mIMEPreferenceOfParent;
|
2015-06-26 02:21:13 +03:00
|
|
|
ContentCacheInChild mContentCache;
|
2012-08-29 19:26:18 +04:00
|
|
|
bool mNeedIMEStateInit;
|
2010-12-03 04:24:04 +03:00
|
|
|
|
|
|
|
// The DPI of the screen corresponding to this widget
|
|
|
|
float mDPI;
|
2013-05-02 03:06:19 +04:00
|
|
|
double mDefaultScale;
|
2014-03-20 19:46:29 +04:00
|
|
|
|
|
|
|
// Precomputed answers for ExecuteNativeKeyBinding
|
2014-04-22 00:40:09 +04:00
|
|
|
bool mNativeKeyCommandsValid;
|
2014-03-20 19:46:29 +04:00
|
|
|
InfallibleTArray<mozilla::CommandInt> mSingleLineCommands;
|
|
|
|
InfallibleTArray<mozilla::CommandInt> mMultiLineCommands;
|
|
|
|
InfallibleTArray<mozilla::CommandInt> mRichTextCommands;
|
2015-05-20 04:28:57 +03:00
|
|
|
|
|
|
|
nsCOMPtr<imgIContainer> mCustomCursor;
|
|
|
|
uint32_t mCursorHotspotX, mCursorHotspotY;
|
2010-08-21 03:24:40 +04:00
|
|
|
};
|
|
|
|
|
2014-04-22 00:40:09 +04:00
|
|
|
struct AutoCacheNativeKeyCommands
|
|
|
|
{
|
2014-09-01 07:33:13 +04:00
|
|
|
explicit AutoCacheNativeKeyCommands(PuppetWidget* aWidget)
|
2014-04-22 00:40:09 +04:00
|
|
|
: mWidget(aWidget)
|
|
|
|
{
|
|
|
|
mSavedValid = mWidget->mNativeKeyCommandsValid;
|
|
|
|
mSavedSingleLine = mWidget->mSingleLineCommands;
|
|
|
|
mSavedMultiLine = mWidget->mMultiLineCommands;
|
|
|
|
mSavedRichText = mWidget->mRichTextCommands;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Cache(const InfallibleTArray<mozilla::CommandInt>& aSingleLineCommands,
|
|
|
|
const InfallibleTArray<mozilla::CommandInt>& aMultiLineCommands,
|
|
|
|
const InfallibleTArray<mozilla::CommandInt>& aRichTextCommands)
|
|
|
|
{
|
|
|
|
mWidget->mNativeKeyCommandsValid = true;
|
|
|
|
mWidget->mSingleLineCommands = aSingleLineCommands;
|
|
|
|
mWidget->mMultiLineCommands = aMultiLineCommands;
|
|
|
|
mWidget->mRichTextCommands = aRichTextCommands;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CacheNoCommands()
|
|
|
|
{
|
|
|
|
mWidget->mNativeKeyCommandsValid = true;
|
|
|
|
mWidget->mSingleLineCommands.Clear();
|
|
|
|
mWidget->mMultiLineCommands.Clear();
|
|
|
|
mWidget->mRichTextCommands.Clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
~AutoCacheNativeKeyCommands()
|
|
|
|
{
|
|
|
|
mWidget->mNativeKeyCommandsValid = mSavedValid;
|
|
|
|
mWidget->mSingleLineCommands = mSavedSingleLine;
|
|
|
|
mWidget->mMultiLineCommands = mSavedMultiLine;
|
|
|
|
mWidget->mRichTextCommands = mSavedRichText;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
PuppetWidget* mWidget;
|
|
|
|
bool mSavedValid;
|
|
|
|
InfallibleTArray<mozilla::CommandInt> mSavedSingleLine;
|
|
|
|
InfallibleTArray<mozilla::CommandInt> mSavedMultiLine;
|
|
|
|
InfallibleTArray<mozilla::CommandInt> mSavedRichText;
|
|
|
|
};
|
|
|
|
|
2012-05-09 01:36:07 +04:00
|
|
|
class PuppetScreen : public nsBaseScreen
|
|
|
|
{
|
|
|
|
public:
|
2014-09-01 07:33:13 +04:00
|
|
|
explicit PuppetScreen(void* nativeScreen);
|
2012-05-09 01:36:07 +04:00
|
|
|
~PuppetScreen();
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD GetId(uint32_t* aId) override;
|
|
|
|
NS_IMETHOD GetRect(int32_t* aLeft, int32_t* aTop, int32_t* aWidth, int32_t* aHeight) override;
|
|
|
|
NS_IMETHOD GetAvailRect(int32_t* aLeft, int32_t* aTop, int32_t* aWidth, int32_t* aHeight) override;
|
|
|
|
NS_IMETHOD GetPixelDepth(int32_t* aPixelDepth) override;
|
|
|
|
NS_IMETHOD GetColorDepth(int32_t* aColorDepth) override;
|
|
|
|
NS_IMETHOD GetRotation(uint32_t* aRotation) override;
|
|
|
|
NS_IMETHOD SetRotation(uint32_t aRotation) override;
|
2012-05-09 01:36:07 +04:00
|
|
|
};
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class PuppetScreenManager final : public nsIScreenManager
|
2012-05-09 01:36:07 +04:00
|
|
|
{
|
2014-06-24 20:36:44 +04:00
|
|
|
~PuppetScreenManager();
|
|
|
|
|
2012-05-09 01:36:07 +04:00
|
|
|
public:
|
|
|
|
PuppetScreenManager();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSISCREENMANAGER
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsCOMPtr<nsIScreen> mOneScreen;
|
|
|
|
};
|
|
|
|
|
2010-08-21 03:24:40 +04:00
|
|
|
} // namespace widget
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_widget_PuppetWidget_h__
|