2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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/. */
|
1998-09-23 23:19:23 +04:00
|
|
|
#ifndef nsBaseWidget_h__
|
|
|
|
#define nsBaseWidget_h__
|
|
|
|
|
2016-07-26 03:33:09 +03:00
|
|
|
#include "InputData.h"
|
2013-09-25 15:21:18 +04:00
|
|
|
#include "mozilla/EventForwards.h"
|
2018-03-07 18:53:05 +03:00
|
|
|
#include "mozilla/Mutex.h"
|
2016-04-20 01:29:16 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
|
|
|
#include "mozilla/UniquePtr.h"
|
2012-07-24 23:01:09 +04:00
|
|
|
#include "mozilla/WidgetUtils.h"
|
2015-09-11 19:27:49 +03:00
|
|
|
#include "mozilla/layers/APZCCallbackHelper.h"
|
2017-07-20 16:20:22 +03:00
|
|
|
#include "mozilla/layers/CompositorOptions.h"
|
1998-11-24 17:57:09 +03:00
|
|
|
#include "nsRect.h"
|
1998-09-23 23:19:23 +04:00
|
|
|
#include "nsIWidget.h"
|
2010-08-20 23:29:02 +04:00
|
|
|
#include "nsWidgetsCID.h"
|
2012-06-06 06:08:30 +04:00
|
|
|
#include "nsIFile.h"
|
1998-09-23 23:19:23 +04:00
|
|
|
#include "nsString.h"
|
1999-05-27 01:12:54 +04:00
|
|
|
#include "nsCOMPtr.h"
|
2012-06-23 05:13:56 +04:00
|
|
|
#include "nsIRollupListener.h"
|
2013-06-17 06:50:32 +04:00
|
|
|
#include "nsIObserver.h"
|
2013-09-24 14:04:14 +04:00
|
|
|
#include "nsIWidgetListener.h"
|
|
|
|
#include "nsPIDOMWindow.h"
|
2015-02-18 09:27:53 +03:00
|
|
|
#include "nsWeakReference.h"
|
2018-10-23 15:49:21 +03:00
|
|
|
|
2013-01-15 16:22:03 +04:00
|
|
|
#include <algorithm>
|
2016-07-18 11:54:02 +03:00
|
|
|
|
|
|
|
#if defined(XP_WIN)
|
|
|
|
// Scroll capture constants
|
|
|
|
const uint32_t kScrollCaptureFillColor = 0xFFa0a0a0; // gray
|
|
|
|
const mozilla::gfx::SurfaceFormat kScrollCaptureFormat =
|
|
|
|
mozilla::gfx::SurfaceFormat::X8R8G8B8_UINT32;
|
|
|
|
#endif
|
|
|
|
|
2007-12-03 19:33:42 +03:00
|
|
|
class nsIContent;
|
2010-03-01 11:03:49 +03:00
|
|
|
class gfxContext;
|
2007-12-03 19:33:42 +03:00
|
|
|
|
2012-11-18 06:01:44 +04:00
|
|
|
namespace mozilla {
|
2016-05-04 03:39:23 +03:00
|
|
|
class CompositorVsyncDispatcher;
|
2017-02-01 18:38:16 +03:00
|
|
|
class LiveResizeListener;
|
|
|
|
|
2012-08-15 22:52:37 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
2012-11-18 06:01:44 +04:00
|
|
|
namespace a11y {
|
2012-08-15 22:52:37 +04:00
|
|
|
class Accessible;
|
2012-11-18 06:01:44 +04:00
|
|
|
}
|
2012-08-15 22:52:37 +04:00
|
|
|
#endif
|
|
|
|
|
2016-03-24 07:41:43 +03:00
|
|
|
namespace gfx {
|
|
|
|
class DrawTarget;
|
2016-07-18 11:54:02 +03:00
|
|
|
class SourceSurface;
|
2016-03-24 07:41:43 +03:00
|
|
|
} // namespace gfx
|
|
|
|
|
2012-01-19 18:45:37 +04:00
|
|
|
namespace layers {
|
2012-07-31 04:42:26 +04:00
|
|
|
class BasicLayerManager;
|
2016-03-22 21:08:38 +03:00
|
|
|
class CompositorBridgeChild;
|
|
|
|
class CompositorBridgeParent;
|
2016-07-20 14:37:00 +03:00
|
|
|
class IAPZCTreeManager;
|
2014-12-15 12:47:15 +03:00
|
|
|
class GeckoContentController;
|
2015-02-07 03:45:23 +03:00
|
|
|
class APZEventState;
|
2016-05-18 08:33:22 +03:00
|
|
|
class CompositorSession;
|
2016-07-18 11:54:02 +03:00
|
|
|
class ImageContainer;
|
2014-12-19 02:25:03 +03:00
|
|
|
struct ScrollableLayerGuid;
|
2016-11-06 22:01:52 +03:00
|
|
|
class RemoteCompositorSession;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layers
|
2014-12-18 19:30:05 +03:00
|
|
|
|
2016-07-01 11:15:16 +03:00
|
|
|
namespace widget {
|
2016-07-01 11:15:16 +03:00
|
|
|
class CompositorWidgetDelegate;
|
2016-07-01 11:15:16 +03:00
|
|
|
class InProcessCompositorWidget;
|
2016-11-08 05:16:52 +03:00
|
|
|
class WidgetRenderingContext;
|
2016-07-01 11:15:16 +03:00
|
|
|
} // namespace widget
|
|
|
|
|
2014-12-19 23:52:42 +03:00
|
|
|
class CompositorVsyncDispatcher;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace mozilla
|
2012-01-19 18:45:37 +04:00
|
|
|
|
|
|
|
namespace base {
|
|
|
|
class Thread;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace base
|
2012-01-19 18:45:37 +04:00
|
|
|
|
2013-12-15 00:40:56 +04:00
|
|
|
// Windows specific constant indicating the maximum number of touch points the
|
|
|
|
// inject api will allow. This also sets the maximum numerical value for touch
|
|
|
|
// ids we can use when injecting touch points on Windows.
|
|
|
|
#define TOUCH_INJECT_MAX_POINTS 256
|
|
|
|
|
2013-06-17 06:50:32 +04:00
|
|
|
class nsBaseWidget;
|
|
|
|
|
2015-04-16 18:16:04 +03:00
|
|
|
// Helper class used in shutting down gfx related code.
|
2015-03-21 19:28:04 +03:00
|
|
|
class WidgetShutdownObserver final : public nsIObserver {
|
2015-04-16 18:16:04 +03:00
|
|
|
~WidgetShutdownObserver();
|
2014-06-24 20:36:44 +04:00
|
|
|
|
2013-06-17 06:50:32 +04:00
|
|
|
public:
|
2015-04-16 18:16:04 +03:00
|
|
|
explicit WidgetShutdownObserver(nsBaseWidget* aWidget);
|
2013-06-17 06:50:32 +04:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
|
2015-04-16 18:16:04 +03:00
|
|
|
void Register();
|
|
|
|
void Unregister();
|
|
|
|
|
2013-06-17 06:50:32 +04:00
|
|
|
nsBaseWidget* mWidget;
|
2015-04-16 18:16:04 +03:00
|
|
|
bool mRegistered;
|
2013-06-17 06:50:32 +04:00
|
|
|
};
|
|
|
|
|
1998-09-23 23:19:23 +04:00
|
|
|
/**
|
|
|
|
* Common widget implementation used as base class for native
|
2016-07-22 11:56:13 +03:00
|
|
|
* or crossplatform implementations of Widgets.
|
|
|
|
* All cross-platform behavior that all widgets need to implement
|
|
|
|
* should be placed in this class.
|
1998-09-23 23:19:23 +04:00
|
|
|
* (Note: widget implementations are not required to use this
|
|
|
|
* class, but it gives them a head start.)
|
|
|
|
*/
|
|
|
|
|
2015-02-18 09:27:53 +03:00
|
|
|
class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
|
2015-11-19 03:33:00 +03:00
|
|
|
friend class DispatchWheelEventOnMainThread;
|
2016-07-01 11:15:16 +03:00
|
|
|
friend class mozilla::widget::InProcessCompositorWidget;
|
2016-11-06 22:01:52 +03:00
|
|
|
friend class mozilla::layers::RemoteCompositorSession;
|
1998-09-23 23:19:23 +04:00
|
|
|
|
2010-07-16 01:08:04 +04:00
|
|
|
protected:
|
2012-07-24 23:01:09 +04:00
|
|
|
typedef base::Thread Thread;
|
2016-03-24 07:41:43 +03:00
|
|
|
typedef mozilla::gfx::DrawTarget DrawTarget;
|
2016-07-18 11:54:02 +03:00
|
|
|
typedef mozilla::gfx::SourceSurface SourceSurface;
|
2010-07-16 01:08:04 +04:00
|
|
|
typedef mozilla::layers::BasicLayerManager BasicLayerManager;
|
2012-07-31 04:42:26 +04:00
|
|
|
typedef mozilla::layers::BufferMode BufferMode;
|
2016-03-22 21:08:38 +03:00
|
|
|
typedef mozilla::layers::CompositorBridgeChild CompositorBridgeChild;
|
|
|
|
typedef mozilla::layers::CompositorBridgeParent CompositorBridgeParent;
|
2016-07-20 14:37:00 +03:00
|
|
|
typedef mozilla::layers::IAPZCTreeManager IAPZCTreeManager;
|
2014-12-15 12:47:15 +03:00
|
|
|
typedef mozilla::layers::GeckoContentController GeckoContentController;
|
2019-03-22 21:28:42 +03:00
|
|
|
typedef mozilla::layers::SLGuidAndRenderRoot SLGuidAndRenderRoot;
|
2014-12-19 02:25:03 +03:00
|
|
|
typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
|
2015-02-07 03:45:23 +03:00
|
|
|
typedef mozilla::layers::APZEventState APZEventState;
|
2015-03-19 13:33:33 +03:00
|
|
|
typedef mozilla::layers::SetAllowedTouchBehaviorCallback
|
|
|
|
SetAllowedTouchBehaviorCallback;
|
2015-11-13 12:37:02 +03:00
|
|
|
typedef mozilla::CSSIntRect CSSIntRect;
|
2016-01-20 04:44:44 +03:00
|
|
|
typedef mozilla::CSSRect CSSRect;
|
2012-07-24 23:01:09 +04:00
|
|
|
typedef mozilla::ScreenRotation ScreenRotation;
|
2016-07-01 11:15:16 +03:00
|
|
|
typedef mozilla::widget::CompositorWidgetDelegate CompositorWidgetDelegate;
|
2016-05-18 08:33:22 +03:00
|
|
|
typedef mozilla::layers::CompositorSession CompositorSession;
|
2016-07-18 11:54:02 +03:00
|
|
|
typedef mozilla::layers::ImageContainer ImageContainer;
|
2010-07-16 01:08:04 +04:00
|
|
|
|
2014-06-24 20:36:44 +04:00
|
|
|
virtual ~nsBaseWidget();
|
|
|
|
|
1998-09-23 23:19:23 +04:00
|
|
|
public:
|
1999-09-28 05:31:41 +04:00
|
|
|
nsBaseWidget();
|
2012-07-31 04:42:26 +04:00
|
|
|
|
1999-09-28 05:31:41 +04:00
|
|
|
NS_DECL_ISUPPORTS
|
2012-07-31 04:42:26 +04:00
|
|
|
|
1999-09-28 05:31:41 +04:00
|
|
|
// nsIWidget interface
|
2016-08-25 07:10:02 +03:00
|
|
|
virtual void CaptureMouse(bool aCapture) override {}
|
2016-08-25 06:43:27 +03:00
|
|
|
virtual void CaptureRollupEvents(nsIRollupListener* aListener,
|
|
|
|
bool aDoCapture) override {}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIWidgetListener* GetWidgetListener() override;
|
|
|
|
virtual void SetWidgetListener(nsIWidgetListener* alistener) override;
|
2016-08-10 03:04:11 +03:00
|
|
|
virtual void Destroy() override;
|
2016-12-16 02:54:11 +03:00
|
|
|
virtual void SetParent(nsIWidget* aNewParent) override{};
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIWidget* GetParent(void) override;
|
|
|
|
virtual nsIWidget* GetTopLevelWidget() override;
|
|
|
|
virtual nsIWidget* GetSheetWindowParent(void) override;
|
|
|
|
virtual float GetDPI() override;
|
|
|
|
virtual void AddChild(nsIWidget* aChild) override;
|
|
|
|
virtual void RemoveChild(nsIWidget* aChild) override;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
void SetZIndex(int32_t aZIndex) override;
|
2016-08-25 06:43:27 +03:00
|
|
|
virtual void PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
|
|
|
|
nsIWidget* aWidget, bool aActivate) override {}
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2016-08-22 02:15:49 +03:00
|
|
|
virtual void SetSizeMode(nsSizeMode aMode) override;
|
2015-08-29 04:12:41 +03:00
|
|
|
virtual nsSizeMode SizeMode() override { return mSizeMode; }
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-05-26 13:09:34 +03:00
|
|
|
virtual bool IsFullyOccluded() const override { return mIsFullyOccluded; }
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2019-01-15 16:56:52 +03:00
|
|
|
virtual void SetCursor(nsCursor aDefaultCursor, imgIContainer* aCursor,
|
|
|
|
uint32_t aHotspotX, uint32_t aHotspotY) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ClearCachedCursor() override { mUpdateCursor = true; }
|
|
|
|
virtual void SetTransparencyMode(nsTransparencyMode aMode) override;
|
|
|
|
virtual nsTransparencyMode GetTransparencyMode() override;
|
2015-12-03 01:32:55 +03:00
|
|
|
virtual void GetWindowClipRegion(
|
|
|
|
nsTArray<LayoutDeviceIntRect>* aRects) override;
|
2016-08-25 06:43:27 +03:00
|
|
|
virtual void SetWindowShadowStyle(int32_t aStyle) override {}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void SetShowsToolbarButton(bool aShow) override {}
|
|
|
|
virtual void SetShowsFullScreenButton(bool aShow) override {}
|
|
|
|
virtual void SetWindowAnimationType(WindowAnimationType aType) override {}
|
2016-12-16 02:54:12 +03:00
|
|
|
virtual void HideWindowChrome(bool aShouldHide) override {}
|
2015-07-13 13:44:36 +03:00
|
|
|
virtual bool PrepareForFullscreenTransition(nsISupports** aData) override {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
virtual void PerformFullscreenTransition(FullscreenTransitionStage aStage,
|
|
|
|
uint16_t aDuration,
|
|
|
|
nsISupports* aData,
|
|
|
|
nsIRunnable* aCallback) override;
|
2018-04-03 04:42:12 +03:00
|
|
|
virtual void CleanupFullscreenTransition() override{};
|
2016-09-29 09:23:56 +03:00
|
|
|
virtual already_AddRefed<nsIScreen> GetWidgetScreen() override;
|
2016-08-19 02:27:28 +03:00
|
|
|
virtual nsresult MakeFullScreen(bool aFullScreen,
|
|
|
|
nsIScreen* aScreen = nullptr) override;
|
|
|
|
void InfallibleMakeFullScreen(bool aFullScreen, nsIScreen* aScreen = nullptr);
|
2015-07-13 13:44:36 +03:00
|
|
|
|
2013-04-24 22:42:40 +04:00
|
|
|
virtual LayerManager* GetLayerManager(
|
|
|
|
PLayerTransactionChild* aShadowManager = nullptr,
|
2014-01-23 22:26:41 +04:00
|
|
|
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
|
2016-06-24 03:53:27 +03:00
|
|
|
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT) override;
|
2011-03-25 18:03:35 +03:00
|
|
|
|
2016-09-20 11:16:03 +03:00
|
|
|
// A remote compositor session tied to this window has been lost and IPC
|
|
|
|
// messages will no longer work. The widget must clean up any lingering
|
|
|
|
// resources and possibly schedule another paint.
|
|
|
|
//
|
|
|
|
// A reference to the session object is held until this function has
|
|
|
|
// returned.
|
2017-06-15 21:34:00 +03:00
|
|
|
void NotifyCompositorSessionLost(
|
|
|
|
mozilla::layers::CompositorSession* aSession);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-12-18 21:33:56 +03:00
|
|
|
already_AddRefed<mozilla::CompositorVsyncDispatcher>
|
|
|
|
GetCompositorVsyncDispatcher();
|
2015-01-02 09:25:48 +03:00
|
|
|
void CreateCompositorVsyncDispatcher();
|
2012-01-19 18:45:37 +04:00
|
|
|
virtual void CreateCompositor();
|
2013-03-21 02:45:07 +04:00
|
|
|
virtual void CreateCompositor(int aWidth, int aHeight);
|
Bug 1373739 - Make headless compositing Windows-compatible, in addition to Linux. r=dvander
To make the HeadlessCompositorWidget work under Windows as well as Linux, I had
to change the way that I hooked it into the existing CompositorWidget system.
Under GTK, the CompositorWidgetInitData and CompositorWidgetDelegate types
provided the information needed by the headless compositor widget already (the
widget client size). On Windows, however, the definitions of these types
differ, and the client size information is simply retrieved from the platform
APIs when needed.
After this patch, CompositorWidgetDelegate is renamed to
PlatformCompositorWidgetDelegate, and a new base class called
CompositorWidgetDelegate is added with "AsPlatformSpecificDelegate()" and
"AsHeadlessCompositorWidget()" methods. In non-headless mode, widgets use
AsPlatformSpecificDelegate() to access the Windows- and GTK-specific delegate
APIs. In headless mode, AsHeadlessCompositorWidget() is used to access the
singular CompositorWidget implementation for headless. Meanwhile, the
CompositorWidgetInitData IPDL type is made into a union which always contains a
headless-specific HeadlessCompositorWidgetInitData struct and under GTK and
Windows also contains an {X11,Win}CompositorWidgetInitData struct.
This also includes a small patch to ensure that the GPU process and
hardware-accelerated compositing are always disabled under headless mode. These
features weren't activated by default in the Linux environments I tested in, but
did end up activating (and then promptly crashing Firefox) when I tested on
Windows.
MozReview-Commit-ID: CocPoHBDV7H
--HG--
extra : rebase_source : 4581fa63aa3a9f32a8dc2672015a35b9be01b20f
2017-07-07 03:45:34 +03:00
|
|
|
virtual void SetCompositorWidgetDelegate(CompositorWidgetDelegate* delegate) {
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void PrepareWindowEffects() override {}
|
|
|
|
virtual void UpdateThemeGeometries(
|
|
|
|
const nsTArray<ThemeGeometry>& aThemeGeometries) override {}
|
2016-08-25 06:43:26 +03:00
|
|
|
virtual void SetModal(bool aModal) override {}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual uint32_t GetMaxTouchPoints() const override;
|
2016-08-25 06:43:27 +03:00
|
|
|
virtual void SetWindowClass(const nsAString& xulWinType) override {}
|
2015-12-03 01:32:55 +03:00
|
|
|
virtual nsresult SetWindowClipRegion(
|
|
|
|
const nsTArray<LayoutDeviceIntRect>& aRects,
|
|
|
|
bool aIntersectWithExisting) override;
|
2013-04-15 16:17:22 +04:00
|
|
|
// Return whether this widget interprets parameters to Move and Resize APIs
|
2015-11-25 22:11:58 +03:00
|
|
|
// as "desktop pixels" rather than "device pixels", and therefore
|
2013-04-15 16:17:22 +04:00
|
|
|
// applies its GetDefaultScale() value to them before using them as mBounds
|
|
|
|
// etc (which are always stored in device pixels).
|
|
|
|
// Note that APIs that -get- the widget's position/size/bounds, rather than
|
|
|
|
// -setting- them (i.e. moving or resizing the widget) will always return
|
|
|
|
// values in the widget's device pixels.
|
2015-11-25 22:11:58 +03:00
|
|
|
bool BoundsUseDesktopPixels() const {
|
2013-04-15 16:17:22 +04:00
|
|
|
return mWindowType <= eWindowType_popup;
|
|
|
|
}
|
2015-12-04 19:58:05 +03:00
|
|
|
// Default implementation, to be overridden by platforms where desktop coords
|
|
|
|
// are virtualized and may not correspond to device pixels on the screen.
|
|
|
|
mozilla::DesktopToLayoutDeviceScale GetDesktopToDeviceScale() override {
|
|
|
|
return mozilla::DesktopToLayoutDeviceScale(1.0);
|
|
|
|
}
|
2018-10-23 15:49:21 +03:00
|
|
|
mozilla::DesktopToLayoutDeviceScale GetDesktopToDeviceScaleByScreen()
|
|
|
|
override;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2016-08-25 06:43:27 +03:00
|
|
|
virtual void ConstrainPosition(bool aAllowSlop, int32_t* aX,
|
|
|
|
int32_t* aY) override {}
|
2016-12-19 06:38:19 +03:00
|
|
|
virtual void MoveClient(double aX, double aY) override;
|
|
|
|
virtual void ResizeClient(double aWidth, double aHeight,
|
|
|
|
bool aRepaint) override;
|
|
|
|
virtual void ResizeClient(double aX, double aY, double aWidth, double aHeight,
|
|
|
|
bool aRepaint) override;
|
2016-08-19 02:03:04 +03:00
|
|
|
virtual LayoutDeviceIntRect GetBounds() override;
|
|
|
|
virtual LayoutDeviceIntRect GetClientBounds() override;
|
|
|
|
virtual LayoutDeviceIntRect GetScreenBounds() override;
|
2016-12-16 02:54:02 +03:00
|
|
|
virtual MOZ_MUST_USE nsresult
|
2016-08-19 02:03:04 +03:00
|
|
|
GetRestoredBounds(LayoutDeviceIntRect& aRect) override;
|
2016-12-21 03:13:08 +03:00
|
|
|
virtual nsresult SetNonClientMargins(
|
|
|
|
LayoutDeviceIntMargin& aMargins) override;
|
2015-11-13 12:37:02 +03:00
|
|
|
virtual LayoutDeviceIntPoint GetClientOffset() override;
|
2016-08-22 02:16:50 +03:00
|
|
|
virtual void EnableDragDrop(bool aEnable) override{};
|
2017-08-30 21:18:25 +03:00
|
|
|
virtual nsresult AsyncEnableDragDrop(bool aEnable) override;
|
2016-12-16 02:54:02 +03:00
|
|
|
virtual MOZ_MUST_USE nsresult GetAttention(int32_t aCycleCount) override {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool HasPendingInputEvent() override;
|
2016-12-16 02:54:11 +03:00
|
|
|
virtual void SetIcon(const nsAString& aIconSpec) override {}
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void SetDrawsInTitlebar(bool aState) override {}
|
2015-11-19 06:10:38 +03:00
|
|
|
virtual bool ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void FreeNativeData(void* data, uint32_t aDataType) override {}
|
2016-12-16 02:54:02 +03:00
|
|
|
virtual MOZ_MUST_USE nsresult BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
|
2013-10-02 07:46:03 +04:00
|
|
|
int32_t aHorizontal,
|
2016-12-16 02:54:02 +03:00
|
|
|
int32_t aVertical) override {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
2016-12-16 02:54:02 +03:00
|
|
|
virtual nsresult ActivateNativeMenuItemAt(
|
2013-10-02 07:46:03 +04:00
|
|
|
const nsAString& indexString) override {
|
2015-02-20 19:37:02 +03:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
2013-10-02 07:46:03 +04:00
|
|
|
virtual nsresult ForceUpdateNativeMenuAt(
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsAString& indexString) override {
|
2015-02-20 19:37:02 +03:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
2018-02-09 08:22:43 +03:00
|
|
|
nsresult NotifyIME(const IMENotification& aIMENotification) final;
|
2013-10-02 07:46:03 +04:00
|
|
|
virtual MOZ_MUST_USE nsresult StartPluginIME(
|
|
|
|
const mozilla::WidgetKeyboardEvent& aKeyboardEvent, int32_t aPanelX,
|
2016-12-16 02:54:02 +03:00
|
|
|
int32_t aPanelY, nsString& aCommitted) override {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
virtual void SetPluginFocused(bool& aFocused) override {}
|
2016-02-02 11:05:56 +03:00
|
|
|
virtual void SetCandidateWindowForPlugin(
|
|
|
|
const mozilla::widget::CandidateWindowPosition& aPosition) override {}
|
2015-12-29 16:57:38 +03:00
|
|
|
virtual void DefaultProcOfPluginEvent(
|
|
|
|
const mozilla::WidgetPluginEvent& aEvent) override {}
|
2016-12-16 02:54:02 +03:00
|
|
|
virtual MOZ_MUST_USE nsresult
|
|
|
|
AttachNativeKeyEvent(mozilla::WidgetKeyboardEvent& aEvent) override {
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
2015-03-21 19:28:04 +03:00
|
|
|
}
|
|
|
|
bool ComputeShouldAccelerate();
|
|
|
|
virtual bool WidgetTypeSupportsAcceleration() { return true; }
|
2016-12-16 02:55:18 +03:00
|
|
|
virtual MOZ_MUST_USE nsresult
|
2015-03-21 19:28:04 +03:00
|
|
|
OnDefaultButtonLoaded(const LayoutDeviceIntRect& aButtonRect) override {
|
2015-02-20 19:37:02 +03:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
2015-12-29 16:57:38 +03:00
|
|
|
}
|
2010-08-20 23:29:02 +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;
|
2016-08-10 03:04:08 +03:00
|
|
|
virtual void AttachViewToTopLevel(bool aUseAttachedEvents) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIWidgetListener* GetAttachedWidgetListener() override;
|
|
|
|
virtual void SetAttachedWidgetListener(nsIWidgetListener* aListener) override;
|
2015-07-22 04:09:02 +03:00
|
|
|
virtual nsIWidgetListener* GetPreviouslyAttachedWidgetListener() override;
|
|
|
|
virtual void SetPreviouslyAttachedWidgetListener(
|
|
|
|
nsIWidgetListener* aListener) override;
|
2018-07-17 16:31:51 +03:00
|
|
|
virtual NativeIMEContext GetNativeIMEContext() override;
|
2018-02-09 08:22:43 +03:00
|
|
|
TextEventDispatcher* GetTextEventDispatcher() final;
|
2016-03-16 07:47:47 +03:00
|
|
|
virtual TextEventDispatcherListener* GetNativeTextEventDispatcherListener()
|
|
|
|
override;
|
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-01-31 22:44:58 +03:00
|
|
|
// Dispatch an event that must be first be routed through APZ.
|
2016-03-11 02:25:48 +03:00
|
|
|
nsEventStatus DispatchInputEvent(mozilla::WidgetInputEvent* aEvent) override;
|
2016-04-18 21:24:28 +03:00
|
|
|
void DispatchEventToAPZOnly(mozilla::WidgetInputEvent* aEvent) override;
|
2016-01-31 22:44:58 +03:00
|
|
|
|
2015-04-14 19:24:32 +03:00
|
|
|
void SetConfirmedTargetAPZC(
|
|
|
|
uint64_t aInputBlockId,
|
2019-03-22 21:28:42 +03:00
|
|
|
const nsTArray<SLGuidAndRenderRoot>& aTargets) const override;
|
2015-04-14 19:24:32 +03:00
|
|
|
|
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;
|
|
|
|
|
2012-08-15 22:52:41 +04:00
|
|
|
void NotifyWindowDestroyed();
|
2012-08-15 22:52:35 +04:00
|
|
|
void NotifySizeMoveDone();
|
2014-02-28 11:45:08 +04:00
|
|
|
void NotifyWindowMoved(int32_t aX, int32_t aY);
|
2012-08-15 22:52:35 +04:00
|
|
|
|
2015-01-29 22:41:53 +03:00
|
|
|
// Register plugin windows for remote updates from the compositor
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void RegisterPluginWindowForRemoteUpdates() override;
|
|
|
|
virtual void UnregisterPluginWindowForRemoteUpdates() override;
|
2015-01-29 22:41:53 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void SetNativeData(uint32_t aDataType, uintptr_t aVal) override{};
|
2015-01-29 22:41:57 +03:00
|
|
|
|
2012-08-15 22:52:35 +04:00
|
|
|
// Should be called by derived implementations to notify on system color and
|
|
|
|
// theme changes.
|
|
|
|
void NotifySysColorChanged();
|
|
|
|
void NotifyThemeChanged();
|
2019-06-03 18:29:06 +03:00
|
|
|
void NotifyUIStateChanged(UIStateChangeType aShowFocusRings);
|
2012-08-15 22:52:35 +04:00
|
|
|
|
2012-08-15 22:52:37 +04:00
|
|
|
#ifdef ACCESSIBILITY
|
|
|
|
// Get the accessible for the window.
|
2013-06-27 19:03:58 +04:00
|
|
|
mozilla::a11y::Accessible* GetRootAccessible();
|
2012-08-15 22:52:37 +04:00
|
|
|
#endif
|
|
|
|
|
2016-04-21 13:20:31 +03:00
|
|
|
// Return true if this is a simple widget (that is typically not worth
|
|
|
|
// accelerating)
|
|
|
|
bool IsSmallPopup() const;
|
|
|
|
|
2010-07-27 17:38:03 +04:00
|
|
|
nsPopupLevel PopupLevel() { return mPopupLevel; }
|
|
|
|
|
2015-11-13 12:37:02 +03:00
|
|
|
virtual LayoutDeviceIntSize ClientToWindowSize(
|
|
|
|
const LayoutDeviceIntSize& aClientSize) override {
|
2010-07-27 17:38:03 +04:00
|
|
|
return aClientSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
// return true if this is a popup widget with a native titlebar
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsPopupWithTitleBar() const {
|
2016-07-22 11:56:13 +03:00
|
|
|
return (mWindowType == eWindowType_popup &&
|
2010-07-27 17:38:03 +04:00
|
|
|
mBorderStyle != eBorderStyle_default &&
|
|
|
|
mBorderStyle & eBorderStyle_title);
|
|
|
|
}
|
|
|
|
|
2016-08-25 06:43:26 +03:00
|
|
|
virtual void ReparentNativeWidget(nsIWidget* aNewParent) override {}
|
2012-01-26 06:05:34 +04:00
|
|
|
|
2015-12-04 19:59:14 +03:00
|
|
|
virtual const SizeConstraints GetSizeConstraints() override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void SetSizeConstraints(const SizeConstraints& aConstraints) override;
|
2012-07-31 04:43:29 +04:00
|
|
|
|
2015-09-29 00:00:25 +03:00
|
|
|
virtual void StartAsyncScrollbarDrag(
|
|
|
|
const AsyncDragMetrics& aDragMetrics) override;
|
|
|
|
|
2017-10-19 01:18:13 +03:00
|
|
|
virtual bool StartAsyncAutoscroll(const ScreenPoint& aAnchorLocation,
|
2019-03-22 21:28:42 +03:00
|
|
|
const SLGuidAndRenderRoot& aGuid) override;
|
2017-07-27 02:33:02 +03:00
|
|
|
|
2019-03-22 21:28:42 +03:00
|
|
|
virtual void StopAsyncAutoscroll(const SLGuidAndRenderRoot& aGuid) override;
|
2017-07-27 02:33:02 +03:00
|
|
|
|
2010-03-01 11:03:49 +03:00
|
|
|
/**
|
|
|
|
* Use this when GetLayerManager() returns a BasicLayerManager
|
|
|
|
* (nsBaseWidget::GetLayerManager() does). This sets up the widget's
|
|
|
|
* layer manager to temporarily render into aTarget.
|
2012-07-24 23:01:09 +04:00
|
|
|
*
|
|
|
|
* |aNaturalWidgetBounds| is the un-rotated bounds of |aWidget|.
|
|
|
|
* |aRotation| is the "virtual rotation" to apply when rendering to
|
|
|
|
* the target. When |aRotation| is ROTATION_0,
|
|
|
|
* |aNaturalWidgetBounds| is not used.
|
2010-03-01 11:03:49 +03:00
|
|
|
*/
|
|
|
|
class AutoLayerManagerSetup {
|
|
|
|
public:
|
2010-07-16 01:08:04 +04:00
|
|
|
AutoLayerManagerSetup(nsBaseWidget* aWidget, gfxContext* aTarget,
|
2012-07-31 04:42:26 +04:00
|
|
|
BufferMode aDoubleBuffering,
|
2012-07-24 23:01:09 +04:00
|
|
|
ScreenRotation aRotation = mozilla::ROTATION_0);
|
2010-03-01 11:03:49 +03:00
|
|
|
~AutoLayerManagerSetup();
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2010-03-01 11:03:49 +03:00
|
|
|
private:
|
|
|
|
nsBaseWidget* mWidget;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<BasicLayerManager> mLayerManager;
|
2010-03-01 11:03:49 +03:00
|
|
|
};
|
|
|
|
friend class AutoLayerManagerSetup;
|
|
|
|
|
2013-03-04 22:32:20 +04:00
|
|
|
virtual bool ShouldUseOffMainThreadCompositing();
|
2012-10-26 17:15:22 +04:00
|
|
|
|
|
|
|
static nsIRollupListener* GetActiveRollupListener();
|
|
|
|
|
2013-06-17 06:50:32 +04:00
|
|
|
void Shutdown();
|
|
|
|
|
2019-06-17 07:51:29 +03:00
|
|
|
void QuitIME();
|
|
|
|
|
2016-07-18 11:54:02 +03:00
|
|
|
#if defined(XP_WIN)
|
|
|
|
uint64_t CreateScrollCaptureContainer() override;
|
|
|
|
#endif
|
|
|
|
|
2017-02-01 18:38:16 +03:00
|
|
|
// These functions should be called at the start and end of a "live" widget
|
|
|
|
// resize (i.e. when the window contents are repainting during the resize,
|
|
|
|
// such as when the user drags a window border). It will suppress the
|
|
|
|
// displayport during the live resize to avoid unneccessary overpainting.
|
|
|
|
void NotifyLiveResizeStarted();
|
|
|
|
void NotifyLiveResizeStopped();
|
|
|
|
|
2017-04-06 01:42:50 +03:00
|
|
|
#if defined(MOZ_WIDGET_ANDROID)
|
|
|
|
void RecvToolbarAnimatorMessageFromCompositor(int32_t) override{};
|
2017-07-07 21:56:10 +03:00
|
|
|
void UpdateRootFrameMetrics(const ScreenPoint& aScrollOffset,
|
|
|
|
const CSSToScreenScale& aZoom) override{};
|
2017-04-06 01:42:50 +03:00
|
|
|
void RecvScreenPixels(mozilla::ipc::Shmem&& aMem,
|
|
|
|
const ScreenIntSize& aSize) override{};
|
|
|
|
#endif
|
|
|
|
|
2017-11-16 15:35:58 +03:00
|
|
|
/**
|
|
|
|
* Whether context menus should only appear on mouseup instead of mousedown,
|
|
|
|
* on OSes where they normally appear on mousedown (macOS, *nix).
|
|
|
|
*/
|
|
|
|
static bool ShowContextMenuAfterMouseUp();
|
|
|
|
|
1998-09-23 23:19:23 +04:00
|
|
|
protected:
|
2016-07-01 11:15:16 +03:00
|
|
|
// These are methods for CompositorWidgetWrapper, and should only be
|
2016-04-30 02:23:17 +03:00
|
|
|
// accessed from that class. Derived widgets can choose which methods to
|
|
|
|
// implement, or none if supporting out-of-process compositing.
|
2016-11-08 05:16:52 +03:00
|
|
|
virtual bool PreRender(mozilla::widget::WidgetRenderingContext* aContext) {
|
2016-04-30 02:23:17 +03:00
|
|
|
return true;
|
|
|
|
}
|
2016-11-08 05:16:52 +03:00
|
|
|
virtual void PostRender(mozilla::widget::WidgetRenderingContext* aContext) {}
|
|
|
|
virtual void DrawWindowUnderlay(
|
|
|
|
mozilla::widget::WidgetRenderingContext* aContext,
|
2016-04-30 02:23:17 +03:00
|
|
|
LayoutDeviceIntRect aRect) {}
|
2016-11-08 05:16:52 +03:00
|
|
|
virtual void DrawWindowOverlay(
|
|
|
|
mozilla::widget::WidgetRenderingContext* aContext,
|
2016-04-30 02:23:17 +03:00
|
|
|
LayoutDeviceIntRect aRect) {}
|
|
|
|
virtual already_AddRefed<DrawTarget> StartRemoteDrawing();
|
|
|
|
virtual already_AddRefed<DrawTarget> StartRemoteDrawingInRegion(
|
|
|
|
LayoutDeviceIntRegion& aInvalidRegion, BufferMode* aBufferMode) {
|
|
|
|
return StartRemoteDrawing();
|
|
|
|
}
|
|
|
|
virtual void EndRemoteDrawing() {}
|
|
|
|
virtual void EndRemoteDrawingInRegion(DrawTarget* aDrawTarget,
|
|
|
|
LayoutDeviceIntRegion& aInvalidRegion) {
|
|
|
|
EndRemoteDrawing();
|
|
|
|
}
|
|
|
|
virtual void CleanupRemoteDrawing() {}
|
|
|
|
virtual void CleanupWindowEffects() {}
|
|
|
|
virtual bool InitCompositor(mozilla::layers::Compositor* aCompositor) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
virtual uint32_t GetGLFrameBufferFormat();
|
2019-07-16 04:28:32 +03:00
|
|
|
virtual bool CompositorInitiallyPaused() { return false; }
|
1998-09-23 23:19:23 +04:00
|
|
|
|
2016-04-30 02:23:17 +03:00
|
|
|
protected:
|
2015-01-02 09:25:48 +03:00
|
|
|
void ResolveIconName(const nsAString& aIconName, const nsAString& aIconSuffix,
|
|
|
|
nsIFile** aResult);
|
2015-02-05 08:18:30 +03:00
|
|
|
virtual void OnDestroy();
|
|
|
|
void BaseCreate(nsIWidget* aParent, nsWidgetInitData* aInitData);
|
1998-09-23 23:19:23 +04:00
|
|
|
|
2014-12-15 12:47:15 +03:00
|
|
|
virtual void ConfigureAPZCTreeManager();
|
2015-03-27 00:23:02 +03:00
|
|
|
virtual void ConfigureAPZControllerThread();
|
2014-12-15 12:47:15 +03:00
|
|
|
virtual already_AddRefed<GeckoContentController>
|
|
|
|
CreateRootContentController();
|
|
|
|
|
2015-03-07 01:26:59 +03:00
|
|
|
// Dispatch an event that has already been routed through APZ.
|
|
|
|
nsEventStatus ProcessUntransformedAPZEvent(mozilla::WidgetInputEvent* aEvent,
|
|
|
|
const ScrollableLayerGuid& aGuid,
|
2015-03-25 19:20:20 +03:00
|
|
|
uint64_t aInputBlockId,
|
|
|
|
nsEventStatus aApzResponse);
|
2014-12-19 02:25:03 +03:00
|
|
|
|
2015-12-03 01:32:55 +03:00
|
|
|
const LayoutDeviceIntRegion RegionFromArray(
|
|
|
|
const nsTArray<LayoutDeviceIntRect>& aRects);
|
|
|
|
void ArrayFromRegion(const LayoutDeviceIntRegion& aRegion,
|
|
|
|
nsTArray<LayoutDeviceIntRect>& aRects);
|
2014-11-12 23:59:19 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual nsresult SynthesizeNativeKeyEvent(
|
|
|
|
int32_t aNativeKeyboardLayout, int32_t aNativeKeyCode,
|
2008-05-07 08:46:37 +04:00
|
|
|
uint32_t aModifierFlags, const nsAString& aCharacters,
|
2015-04-14 18:36:36 +03:00
|
|
|
const nsAString& aUnmodifiedCharacters, nsIObserver* aObserver) override {
|
|
|
|
mozilla::widget::AutoObserverNotifier notifier(aObserver, "keyevent");
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
}
|
2008-05-06 03:01:07 +04:00
|
|
|
|
2015-11-13 12:37:02 +03:00
|
|
|
virtual nsresult SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t aNativeMessage,
|
2015-04-14 18:36:36 +03:00
|
|
|
uint32_t aModifierFlags,
|
|
|
|
nsIObserver* aObserver) override {
|
|
|
|
mozilla::widget::AutoObserverNotifier notifier(aObserver, "mouseevent");
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
}
|
2009-09-23 06:31:37 +04:00
|
|
|
|
2015-11-13 12:37:02 +03:00
|
|
|
virtual nsresult SynthesizeNativeMouseMove(LayoutDeviceIntPoint aPoint,
|
2015-04-14 18:36:36 +03:00
|
|
|
nsIObserver* aObserver) override {
|
|
|
|
mozilla::widget::AutoObserverNotifier notifier(aObserver, "mouseevent");
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
}
|
2012-04-12 01:55:21 +04:00
|
|
|
|
2015-11-13 12:37:02 +03:00
|
|
|
virtual nsresult SynthesizeNativeMouseScrollEvent(
|
|
|
|
LayoutDeviceIntPoint aPoint, uint32_t aNativeMessage, double aDeltaX,
|
2012-08-22 19:56:38 +04:00
|
|
|
double aDeltaY, double aDeltaZ, uint32_t aModifierFlags,
|
2015-04-14 18:36:36 +03:00
|
|
|
uint32_t aAdditionalFlags, nsIObserver* aObserver) override {
|
|
|
|
mozilla::widget::AutoObserverNotifier notifier(aObserver,
|
|
|
|
"mousescrollevent");
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
}
|
2012-03-22 04:59:12 +04:00
|
|
|
|
2013-12-15 00:40:56 +04:00
|
|
|
virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
|
|
|
|
TouchPointerState aPointerState,
|
2016-04-15 13:39:36 +03:00
|
|
|
LayoutDeviceIntPoint aPoint,
|
2013-12-15 00:40:56 +04:00
|
|
|
double aPointerPressure,
|
2015-04-14 18:36:36 +03:00
|
|
|
uint32_t aPointerOrientation,
|
|
|
|
nsIObserver* aObserver) override {
|
|
|
|
mozilla::widget::AutoObserverNotifier notifier(aObserver, "touchpoint");
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
}
|
2013-12-15 00:40:56 +04:00
|
|
|
|
2016-03-16 07:47:47 +03:00
|
|
|
/**
|
|
|
|
* GetPseudoIMEContext() returns pseudo IME context when TextEventDispatcher
|
|
|
|
* has non-native input transaction. Otherwise, returns nullptr.
|
|
|
|
*/
|
|
|
|
void* GetPseudoIMEContext();
|
|
|
|
|
2013-12-15 00:40:56 +04:00
|
|
|
protected:
|
2015-01-28 18:15:54 +03:00
|
|
|
// Utility to check if an array of clip rects is equal to our
|
|
|
|
// internally stored clip rect array mClipRects.
|
2015-12-03 01:32:55 +03:00
|
|
|
bool IsWindowClipRegionEqual(const nsTArray<LayoutDeviceIntRect>& aRects);
|
2015-01-28 18:15:54 +03:00
|
|
|
|
|
|
|
// Stores the clip rectangles in aRects into mClipRects.
|
2015-12-03 01:32:55 +03:00
|
|
|
void StoreWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects);
|
2009-07-22 04:44:55 +04:00
|
|
|
|
2010-08-20 23:29:02 +04:00
|
|
|
virtual already_AddRefed<nsIWidget> AllocateChildPopupWidget() {
|
2018-08-20 16:47:00 +03:00
|
|
|
return nsIWidget::CreateChildWindow();
|
2010-08-20 23:29:02 +04:00
|
|
|
}
|
|
|
|
|
2013-09-02 02:20:45 +04:00
|
|
|
LayerManager* CreateBasicLayerManager();
|
2010-09-15 03:40:23 +04:00
|
|
|
|
2012-05-31 21:52:09 +04:00
|
|
|
nsPopupType PopupType() const { return mPopupType; }
|
|
|
|
|
2017-05-17 20:16:25 +03:00
|
|
|
bool HasRemoteContent() const { return mHasRemoteContent; }
|
|
|
|
|
2012-10-26 17:15:22 +04:00
|
|
|
void NotifyRollupGeometryChange() {
|
|
|
|
// XULPopupManager isn't interested in this notification, so only
|
|
|
|
// send it if gRollupListener is set.
|
|
|
|
if (gRollupListener) {
|
|
|
|
gRollupListener->NotifyGeometryChange();
|
2012-06-23 05:13:56 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-31 04:43:29 +04:00
|
|
|
/**
|
|
|
|
* Apply the current size constraints to the given size.
|
|
|
|
*
|
|
|
|
* @param aWidth width to constrain
|
|
|
|
* @param aHeight height to constrain
|
|
|
|
*/
|
2015-12-04 19:59:14 +03:00
|
|
|
void ConstrainSize(int32_t* aWidth, int32_t* aHeight) {
|
|
|
|
SizeConstraints c = GetSizeConstraints();
|
|
|
|
*aWidth = std::max(c.mMinSize.width, std::min(c.mMaxSize.width, *aWidth));
|
|
|
|
*aHeight =
|
|
|
|
std::max(c.mMinSize.height, std::min(c.mMaxSize.height, *aHeight));
|
2012-07-31 04:43:29 +04:00
|
|
|
}
|
|
|
|
|
2016-03-22 21:08:38 +03:00
|
|
|
virtual CompositorBridgeChild* GetRemoteRenderer() override;
|
2012-10-04 11:05:24 +04:00
|
|
|
|
2013-08-09 03:32:26 +04:00
|
|
|
/**
|
|
|
|
* Notify the widget that this window is being used with OMTC.
|
|
|
|
*/
|
|
|
|
virtual void WindowUsesOMTC() {}
|
2015-04-29 23:29:34 +03:00
|
|
|
virtual void RegisterTouchWindow() {}
|
2013-08-09 03:32:26 +04:00
|
|
|
|
2019-01-02 16:05:23 +03:00
|
|
|
mozilla::dom::Document* GetDocument() const;
|
2015-02-07 02:11:30 +03:00
|
|
|
|
2016-04-30 02:23:17 +03:00
|
|
|
void EnsureTextEventDispatcher();
|
2016-03-16 07:47:47 +03:00
|
|
|
|
2016-02-29 09:53:15 +03:00
|
|
|
// Notify the compositor that a device reset has occurred.
|
2017-05-12 08:44:27 +03:00
|
|
|
void OnRenderingDeviceReset();
|
2016-02-29 09:53:15 +03:00
|
|
|
|
2016-04-30 02:20:42 +03:00
|
|
|
bool UseAPZ();
|
|
|
|
|
2018-01-15 16:38:19 +03:00
|
|
|
bool AllowWebRenderForThisWindow();
|
|
|
|
|
2016-07-26 03:33:09 +03:00
|
|
|
/**
|
|
|
|
* For widgets that support synthesizing native touch events, this function
|
|
|
|
* can be used to manage the current state of synthetic pointers. Each widget
|
|
|
|
* must maintain its own MultiTouchInput instance and pass it in as the state,
|
|
|
|
* along with the desired parameters for the changes. This function returns
|
|
|
|
* a new MultiTouchInput object that is ready to be dispatched.
|
|
|
|
*/
|
|
|
|
mozilla::MultiTouchInput UpdateSynthesizedTouchState(
|
2016-08-03 19:06:58 +03:00
|
|
|
mozilla::MultiTouchInput* aState, uint32_t aTime,
|
|
|
|
mozilla::TimeStamp aTimeStamp, uint32_t aPointerId,
|
2016-07-26 03:33:09 +03:00
|
|
|
TouchPointerState aPointerState, LayoutDeviceIntPoint aPoint,
|
|
|
|
double aPointerPressure, uint32_t aPointerOrientation);
|
2016-07-18 11:54:02 +03:00
|
|
|
|
2016-08-03 19:06:58 +03:00
|
|
|
/**
|
|
|
|
* Dispatch the given MultiTouchInput through APZ to Gecko (if APZ is enabled)
|
|
|
|
* or directly to gecko (if APZ is not enabled). This function must only
|
|
|
|
* be called from the main thread, and if APZ is enabled, that must also be
|
|
|
|
* the APZ controller thread.
|
|
|
|
*/
|
|
|
|
void DispatchTouchInput(mozilla::MultiTouchInput& aInput);
|
|
|
|
|
2019-06-20 23:18:45 +03:00
|
|
|
/**
|
|
|
|
* Dispatch the given PanGestureInput through APZ to Gecko (if APZ is enabled)
|
|
|
|
* or directly to gecko (if APZ is not enabled). This function must only
|
|
|
|
* be called from the main thread, and if APZ is enabled, that must also be
|
|
|
|
* the APZ controller thread.
|
|
|
|
*/
|
|
|
|
void DispatchPanGestureInput(mozilla::PanGestureInput& aInput);
|
|
|
|
|
2016-07-18 11:54:02 +03:00
|
|
|
#if defined(XP_WIN)
|
|
|
|
void UpdateScrollCapture() override;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* To be overridden by derived classes to return a snapshot that can be used
|
|
|
|
* during scrolling. Returning null means we won't update the container.
|
|
|
|
* @return an already AddRefed SourceSurface containing the snapshot
|
|
|
|
*/
|
|
|
|
virtual already_AddRefed<SourceSurface> CreateScrollSnapshot() {
|
|
|
|
return nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Used by derived classes to create a fallback scroll image.
|
|
|
|
* @param aSnapshotDrawTarget DrawTarget to fill with fallback image.
|
|
|
|
*/
|
|
|
|
void DefaultFillScrollCapture(DrawTarget* aSnapshotDrawTarget);
|
|
|
|
|
|
|
|
RefPtr<ImageContainer> mScrollCaptureContainer;
|
|
|
|
#endif
|
|
|
|
|
2011-09-01 02:58:19 +04:00
|
|
|
protected:
|
2016-05-18 08:33:21 +03:00
|
|
|
// Returns whether compositing should use an external surface size.
|
|
|
|
virtual bool UseExternalCompositingSurface() const { return false; }
|
|
|
|
|
2012-05-23 18:17:44 +04:00
|
|
|
/**
|
|
|
|
* Starts the OMTC compositor destruction sequence.
|
|
|
|
*
|
2016-07-22 11:56:13 +03:00
|
|
|
* When this function returns, the compositor should not be
|
2012-05-23 18:17:44 +04:00
|
|
|
* able to access the opengl context anymore.
|
|
|
|
* It is safe to call it several times if platform implementations
|
|
|
|
* require the compositor to be destroyed before ~nsBaseWidget is
|
|
|
|
* reached (This is the case with gtk2 for instance).
|
|
|
|
*/
|
2015-07-24 21:28:28 +03:00
|
|
|
virtual void DestroyCompositor();
|
2015-03-09 20:43:39 +03:00
|
|
|
void DestroyLayerManager();
|
2016-06-29 00:53:21 +03:00
|
|
|
void ReleaseContentController();
|
2016-11-22 07:12:55 +03:00
|
|
|
void RevokeTransactionIdAllocator();
|
2012-05-23 18:17:44 +04:00
|
|
|
|
2015-04-16 18:16:04 +03:00
|
|
|
void FreeShutdownObserver();
|
|
|
|
|
2012-08-15 22:52:42 +04:00
|
|
|
nsIWidgetListener* mWidgetListener;
|
2012-08-15 22:53:14 +04:00
|
|
|
nsIWidgetListener* mAttachedWidgetListener;
|
2015-07-22 04:09:02 +03:00
|
|
|
nsIWidgetListener* mPreviouslyAttachedWidgetListener;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<LayerManager> mLayerManager;
|
2016-05-18 08:33:22 +03:00
|
|
|
RefPtr<CompositorSession> mCompositorSession;
|
2016-03-22 21:08:38 +03:00
|
|
|
RefPtr<CompositorBridgeChild> mCompositorBridgeChild;
|
2018-03-07 18:53:05 +03:00
|
|
|
|
|
|
|
mozilla::UniquePtr<mozilla::Mutex> mCompositorVsyncDispatcherLock;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<mozilla::CompositorVsyncDispatcher> mCompositorVsyncDispatcher;
|
2018-03-07 18:53:05 +03:00
|
|
|
|
2016-07-20 14:37:00 +03:00
|
|
|
RefPtr<IAPZCTreeManager> mAPZC;
|
2016-04-22 23:01:30 +03:00
|
|
|
RefPtr<GeckoContentController> mRootContentController;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<APZEventState> mAPZEventState;
|
2015-09-11 19:27:49 +03:00
|
|
|
SetAllowedTouchBehaviorCallback mSetAllowedTouchBehaviorCallback;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<WidgetShutdownObserver> mShutdownObserver;
|
|
|
|
RefPtr<TextEventDispatcher> mTextEventDispatcher;
|
1999-09-28 05:31:41 +04:00
|
|
|
nsCursor mCursor;
|
|
|
|
nsBorderStyle mBorderStyle;
|
2015-11-23 07:32:29 +03:00
|
|
|
LayoutDeviceIntRect mBounds;
|
2015-12-04 19:58:05 +03:00
|
|
|
LayoutDeviceIntRect* mOriginalBounds;
|
2009-07-22 04:44:55 +04:00
|
|
|
// When this pointer is null, the widget is not clipped
|
2015-12-03 01:32:55 +03:00
|
|
|
mozilla::UniquePtr<LayoutDeviceIntRect[]> mClipRects;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mClipRectCount;
|
2000-03-09 04:55:48 +03:00
|
|
|
nsSizeMode mSizeMode;
|
2010-07-27 17:38:03 +04:00
|
|
|
nsPopupLevel mPopupLevel;
|
2012-05-31 21:52:09 +04:00
|
|
|
nsPopupType mPopupType;
|
2012-07-31 04:43:29 +04:00
|
|
|
SizeConstraints mSizeConstraints;
|
2017-05-17 20:16:25 +03:00
|
|
|
bool mHasRemoteContent;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-08-06 09:57:58 +03:00
|
|
|
bool mUpdateCursor;
|
|
|
|
bool mUseAttachedEvents;
|
|
|
|
bool mIMEHasFocus;
|
2019-06-17 07:51:29 +03:00
|
|
|
bool mIMEHasQuit;
|
2017-05-26 13:09:34 +03:00
|
|
|
bool mIsFullyOccluded;
|
2012-10-26 17:15:22 +04:00
|
|
|
static nsIRollupListener* gRollupListener;
|
|
|
|
|
2015-10-28 00:03:49 +03:00
|
|
|
struct InitialZoomConstraints {
|
|
|
|
InitialZoomConstraints(const uint32_t& aPresShellID,
|
2018-11-01 23:15:46 +03:00
|
|
|
const ScrollableLayerGuid::ViewID& aViewID,
|
2015-10-28 00:03:49 +03:00
|
|
|
const ZoomConstraints& aConstraints)
|
|
|
|
: mPresShellID(aPresShellID),
|
|
|
|
mViewID(aViewID),
|
|
|
|
mConstraints(aConstraints) {}
|
|
|
|
|
|
|
|
uint32_t mPresShellID;
|
2018-11-01 23:15:46 +03:00
|
|
|
ScrollableLayerGuid::ViewID mViewID;
|
2015-10-28 00:03:49 +03:00
|
|
|
ZoomConstraints mConstraints;
|
|
|
|
};
|
|
|
|
|
|
|
|
mozilla::Maybe<InitialZoomConstraints> mInitialZoomConstraints;
|
|
|
|
|
2017-02-01 18:38:16 +03:00
|
|
|
// This points to the resize listeners who have been notified that a live
|
|
|
|
// resize is in progress. This should always be empty when a live-resize is
|
|
|
|
// not in progress.
|
|
|
|
nsTArray<RefPtr<mozilla::LiveResizeListener>> mLiveResizeListeners;
|
|
|
|
|
2002-01-24 04:18:36 +03:00
|
|
|
#ifdef DEBUG
|
1999-09-09 06:32:54 +04:00
|
|
|
protected:
|
2013-10-02 07:46:03 +04:00
|
|
|
static nsAutoString debug_GuiEventToString(
|
|
|
|
mozilla::WidgetGUIEvent* aGuiEvent);
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool debug_WantPaintFlashing();
|
1999-09-09 06:32:54 +04:00
|
|
|
|
2015-11-17 08:18:31 +03:00
|
|
|
static void debug_DumpInvalidate(FILE* aFileOut, nsIWidget* aWidget,
|
|
|
|
const LayoutDeviceIntRect* aRect,
|
2016-03-31 21:42:13 +03:00
|
|
|
const char* aWidgetName, int32_t aWindowID);
|
1999-09-09 06:32:54 +04:00
|
|
|
|
2013-10-02 07:46:03 +04:00
|
|
|
static void debug_DumpEvent(FILE* aFileOut, nsIWidget* aWidget,
|
|
|
|
mozilla::WidgetGUIEvent* aGuiEvent,
|
2016-03-31 21:42:13 +03:00
|
|
|
const char* aWidgetName, int32_t aWindowID);
|
2011-09-01 02:58:19 +04:00
|
|
|
|
1999-09-09 06:32:54 +04:00
|
|
|
static void debug_DumpPaintEvent(FILE* aFileOut, nsIWidget* aWidget,
|
2012-08-15 22:52:42 +04:00
|
|
|
const nsIntRegion& aPaintEvent,
|
2016-03-31 21:42:13 +03:00
|
|
|
const char* aWidgetName, int32_t aWindowID);
|
1999-09-09 06:32:54 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool debug_GetCachedBoolPref(const char* aPrefName);
|
1999-07-09 16:11:12 +04:00
|
|
|
#endif
|
2017-07-20 16:20:22 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
already_AddRefed<LayerManager> CreateCompositorSession(
|
|
|
|
int aWidth, int aHeight, mozilla::layers::CompositorOptions* aOptionsOut);
|
1998-09-23 23:19:23 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsBaseWidget_h__
|