2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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 19:19:23 +00:00
|
|
|
#ifndef nsBaseWidget_h__
|
|
|
|
#define nsBaseWidget_h__
|
|
|
|
|
2013-09-25 11:21:18 +00:00
|
|
|
#include "mozilla/EventForwards.h"
|
2016-04-19 22:29:16 +00:00
|
|
|
#include "mozilla/RefPtr.h"
|
|
|
|
#include "mozilla/UniquePtr.h"
|
2012-07-24 19:01:09 +00:00
|
|
|
#include "mozilla/WidgetUtils.h"
|
2015-09-11 16:27:49 +00:00
|
|
|
#include "mozilla/layers/APZCCallbackHelper.h"
|
1998-11-24 14:57:09 +00:00
|
|
|
#include "nsRect.h"
|
1998-09-23 19:19:23 +00:00
|
|
|
#include "nsIWidget.h"
|
2010-08-20 19:29:02 +00:00
|
|
|
#include "nsWidgetsCID.h"
|
2012-06-06 02:08:30 +00:00
|
|
|
#include "nsIFile.h"
|
1998-09-23 19:19:23 +00:00
|
|
|
#include "nsString.h"
|
1999-05-26 21:12:54 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2012-06-23 01:13:56 +00:00
|
|
|
#include "nsIRollupListener.h"
|
2013-06-17 02:50:32 +00:00
|
|
|
#include "nsIObserver.h"
|
2013-09-24 10:04:14 +00:00
|
|
|
#include "nsIWidgetListener.h"
|
|
|
|
#include "nsPIDOMWindow.h"
|
2015-02-18 06:27:53 +00:00
|
|
|
#include "nsWeakReference.h"
|
2016-04-29 23:23:17 +00:00
|
|
|
#include "CompositorWidgetProxy.h"
|
2013-01-15 12:22:03 +00:00
|
|
|
#include <algorithm>
|
2007-12-03 16:33:42 +00:00
|
|
|
class nsIContent;
|
|
|
|
class nsAutoRollup;
|
2010-03-01 08:03:49 +00:00
|
|
|
class gfxContext;
|
2007-12-03 16:33:42 +00:00
|
|
|
|
2012-11-18 02:01:44 +00:00
|
|
|
namespace mozilla {
|
2016-05-04 00:39:23 +00:00
|
|
|
class CompositorVsyncDispatcher;
|
2012-08-15 18:52:37 +00:00
|
|
|
#ifdef ACCESSIBILITY
|
2012-11-18 02:01:44 +00:00
|
|
|
namespace a11y {
|
2012-08-15 18:52:37 +00:00
|
|
|
class Accessible;
|
2012-11-18 02:01:44 +00:00
|
|
|
}
|
2012-08-15 18:52:37 +00:00
|
|
|
#endif
|
|
|
|
|
2016-03-24 04:41:43 +00:00
|
|
|
namespace gfx {
|
|
|
|
class DrawTarget;
|
|
|
|
} // namespace gfx
|
|
|
|
|
2012-01-19 14:45:37 +00:00
|
|
|
namespace layers {
|
2012-07-31 00:42:26 +00:00
|
|
|
class BasicLayerManager;
|
2016-03-22 18:08:38 +00:00
|
|
|
class CompositorBridgeChild;
|
|
|
|
class CompositorBridgeParent;
|
2014-12-15 09:47:15 +00:00
|
|
|
class APZCTreeManager;
|
|
|
|
class GeckoContentController;
|
2015-02-07 00:45:23 +00:00
|
|
|
class APZEventState;
|
2016-05-18 05:33:22 +00:00
|
|
|
class CompositorSession;
|
2014-12-18 23:25:03 +00:00
|
|
|
struct ScrollableLayerGuid;
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace layers
|
2014-12-18 16:30:05 +00:00
|
|
|
|
2014-12-19 20:52:42 +00:00
|
|
|
class CompositorVsyncDispatcher;
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace mozilla
|
2012-01-19 14:45:37 +00:00
|
|
|
|
|
|
|
namespace base {
|
|
|
|
class Thread;
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace base
|
2012-01-19 14:45:37 +00:00
|
|
|
|
2013-12-14 20:40:56 +00: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 02:50:32 +00:00
|
|
|
class nsBaseWidget;
|
|
|
|
|
2015-04-16 15:16:04 +00:00
|
|
|
// Helper class used in shutting down gfx related code.
|
2015-03-21 16:28:04 +00:00
|
|
|
class WidgetShutdownObserver final : public nsIObserver
|
2013-06-17 02:50:32 +00:00
|
|
|
{
|
2015-04-16 15:16:04 +00:00
|
|
|
~WidgetShutdownObserver();
|
2014-06-24 16:36:44 +00:00
|
|
|
|
2013-06-17 02:50:32 +00:00
|
|
|
public:
|
2015-04-16 15:16:04 +00:00
|
|
|
explicit WidgetShutdownObserver(nsBaseWidget* aWidget);
|
2013-06-17 02:50:32 +00:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
|
2015-04-16 15:16:04 +00:00
|
|
|
void Register();
|
|
|
|
void Unregister();
|
|
|
|
|
2013-06-17 02:50:32 +00:00
|
|
|
nsBaseWidget *mWidget;
|
2015-04-16 15:16:04 +00:00
|
|
|
bool mRegistered;
|
2013-06-17 02:50:32 +00:00
|
|
|
};
|
|
|
|
|
1998-09-23 19:19:23 +00:00
|
|
|
/**
|
|
|
|
* Common widget implementation used as base class for native
|
|
|
|
* or crossplatform implementations of Widgets.
|
|
|
|
* All cross-platform behavior that all widgets need to implement
|
|
|
|
* should be placed in this class.
|
|
|
|
* (Note: widget implementations are not required to use this
|
|
|
|
* class, but it gives them a head start.)
|
|
|
|
*/
|
|
|
|
|
2015-02-18 06:27:53 +00:00
|
|
|
class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference
|
1998-09-23 19:19:23 +00:00
|
|
|
{
|
2007-12-03 16:33:42 +00:00
|
|
|
friend class nsAutoRollup;
|
2015-11-19 00:33:00 +00:00
|
|
|
friend class DispatchWheelEventOnMainThread;
|
2016-04-29 23:23:17 +00:00
|
|
|
friend class mozilla::widget::CompositorWidgetProxyWrapper;
|
1998-09-23 19:19:23 +00:00
|
|
|
|
2010-07-15 21:08:04 +00:00
|
|
|
protected:
|
2012-07-24 19:01:09 +00:00
|
|
|
typedef base::Thread Thread;
|
2016-03-24 04:41:43 +00:00
|
|
|
typedef mozilla::gfx::DrawTarget DrawTarget;
|
2010-07-15 21:08:04 +00:00
|
|
|
typedef mozilla::layers::BasicLayerManager BasicLayerManager;
|
2012-07-31 00:42:26 +00:00
|
|
|
typedef mozilla::layers::BufferMode BufferMode;
|
2016-03-22 18:08:38 +00:00
|
|
|
typedef mozilla::layers::CompositorBridgeChild CompositorBridgeChild;
|
|
|
|
typedef mozilla::layers::CompositorBridgeParent CompositorBridgeParent;
|
2014-12-15 09:47:15 +00:00
|
|
|
typedef mozilla::layers::APZCTreeManager APZCTreeManager;
|
|
|
|
typedef mozilla::layers::GeckoContentController GeckoContentController;
|
2014-12-18 23:25:03 +00:00
|
|
|
typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
|
2015-02-07 00:45:23 +00:00
|
|
|
typedef mozilla::layers::APZEventState APZEventState;
|
2015-03-19 10:33:33 +00:00
|
|
|
typedef mozilla::layers::SetAllowedTouchBehaviorCallback SetAllowedTouchBehaviorCallback;
|
2015-11-13 09:37:02 +00:00
|
|
|
typedef mozilla::CSSIntRect CSSIntRect;
|
2016-01-20 01:44:44 +00:00
|
|
|
typedef mozilla::CSSRect CSSRect;
|
2012-07-24 19:01:09 +00:00
|
|
|
typedef mozilla::ScreenRotation ScreenRotation;
|
2016-04-29 23:23:17 +00:00
|
|
|
typedef mozilla::widget::CompositorWidgetProxy CompositorWidgetProxy;
|
2016-05-18 05:33:22 +00:00
|
|
|
typedef mozilla::layers::CompositorSession CompositorSession;
|
2010-07-15 21:08:04 +00:00
|
|
|
|
2014-06-24 16:36:44 +00:00
|
|
|
virtual ~nsBaseWidget();
|
|
|
|
|
1998-09-23 19:19:23 +00:00
|
|
|
public:
|
1999-09-28 01:31:41 +00:00
|
|
|
nsBaseWidget();
|
2012-07-31 00:42:26 +00:00
|
|
|
|
1999-09-28 01:31:41 +00:00
|
|
|
NS_DECL_ISUPPORTS
|
2012-07-31 00:42:26 +00:00
|
|
|
|
1999-09-28 01:31:41 +00:00
|
|
|
// nsIWidget interface
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD CaptureMouse(bool aCapture) override;
|
|
|
|
virtual nsIWidgetListener* GetWidgetListener() override;
|
|
|
|
virtual void SetWidgetListener(nsIWidgetListener* alistener) override;
|
|
|
|
NS_IMETHOD Destroy() override;
|
|
|
|
NS_IMETHOD SetParent(nsIWidget* aNewParent) override;
|
|
|
|
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;
|
|
|
|
|
|
|
|
void SetZIndex(int32_t aZIndex) override;
|
2003-10-07 01:19:51 +00:00
|
|
|
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsIWidget *aWidget, bool aActivate) override;
|
1999-09-28 01:31:41 +00:00
|
|
|
|
2015-08-29 01:12:41 +00:00
|
|
|
NS_IMETHOD SetSizeMode(nsSizeMode aMode) override;
|
|
|
|
virtual nsSizeMode SizeMode() override
|
2013-04-26 06:49:47 +00:00
|
|
|
{
|
|
|
|
return mSizeMode;
|
|
|
|
}
|
2000-03-09 01:55:48 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsCursor GetCursor() override;
|
|
|
|
NS_IMETHOD SetCursor(nsCursor aCursor) override;
|
2005-07-01 04:29:42 +00:00
|
|
|
NS_IMETHOD SetCursor(imgIContainer* aCursor,
|
2015-03-21 16:28:04 +00:00
|
|
|
uint32_t aHotspotX, uint32_t aHotspotY) override;
|
|
|
|
virtual void ClearCachedCursor() override { mUpdateCursor = true; }
|
|
|
|
virtual void SetTransparencyMode(nsTransparencyMode aMode) override;
|
|
|
|
virtual nsTransparencyMode GetTransparencyMode() override;
|
2015-12-02 22:32:55 +00:00
|
|
|
virtual void GetWindowClipRegion(nsTArray<LayoutDeviceIntRect>* aRects) override;
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD SetWindowShadowStyle(int32_t aStyle) override;
|
|
|
|
virtual void SetShowsToolbarButton(bool aShow) override {}
|
|
|
|
virtual void SetShowsFullScreenButton(bool aShow) override {}
|
|
|
|
virtual void SetWindowAnimationType(WindowAnimationType aType) override {}
|
|
|
|
NS_IMETHOD HideWindowChrome(bool aShouldHide) override;
|
2015-07-13 10:44:36 +00:00
|
|
|
virtual bool PrepareForFullscreenTransition(nsISupports** aData) override { return false; }
|
|
|
|
virtual void PerformFullscreenTransition(FullscreenTransitionStage aStage,
|
|
|
|
uint16_t aDuration,
|
|
|
|
nsISupports* aData,
|
|
|
|
nsIRunnable* aCallback) override;
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD MakeFullScreen(bool aFullScreen, nsIScreen* aScreen = nullptr) override;
|
2015-07-13 10:44:36 +00:00
|
|
|
|
2013-04-24 18:42:40 +00:00
|
|
|
virtual LayerManager* GetLayerManager(PLayerTransactionChild* aShadowManager = nullptr,
|
2014-01-23 18:26:41 +00:00
|
|
|
LayersBackend aBackendHint = mozilla::layers::LayersBackend::LAYERS_NONE,
|
2011-08-09 19:38:26 +00:00
|
|
|
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
|
2015-03-21 16:28:04 +00:00
|
|
|
bool* aAllowRetaining = nullptr) override;
|
2011-03-25 15:03:35 +00:00
|
|
|
|
2016-05-04 00:39:23 +00:00
|
|
|
mozilla::CompositorVsyncDispatcher* GetCompositorVsyncDispatcher();
|
2015-01-02 06:25:48 +00:00
|
|
|
void CreateCompositorVsyncDispatcher();
|
2012-01-19 14:45:37 +00:00
|
|
|
virtual void CreateCompositor();
|
2013-03-20 22:45:07 +00:00
|
|
|
virtual void CreateCompositor(int aWidth, int aHeight);
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void PrepareWindowEffects() override {}
|
|
|
|
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) override {}
|
|
|
|
NS_IMETHOD SetModal(bool aModal) override;
|
|
|
|
virtual uint32_t GetMaxTouchPoints() const override;
|
|
|
|
NS_IMETHOD SetWindowClass(const nsAString& xulWinType) override;
|
2015-12-02 22:32:55 +00:00
|
|
|
virtual nsresult SetWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects, bool aIntersectWithExisting) override;
|
2013-04-15 12:17:22 +00:00
|
|
|
// Return whether this widget interprets parameters to Move and Resize APIs
|
2015-11-25 19:11:58 +00:00
|
|
|
// as "desktop pixels" rather than "device pixels", and therefore
|
2013-04-15 12:17:22 +00: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 19:11:58 +00:00
|
|
|
bool BoundsUseDesktopPixels() const {
|
2013-04-15 12:17:22 +00:00
|
|
|
return mWindowType <= eWindowType_popup;
|
|
|
|
}
|
2015-12-04 16:58:05 +00: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);
|
|
|
|
}
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD MoveClient(double aX, double aY) override;
|
|
|
|
NS_IMETHOD ResizeClient(double aWidth, double aHeight, bool aRepaint) override;
|
|
|
|
NS_IMETHOD ResizeClient(double aX, double aY, double aWidth, double aHeight, bool aRepaint) override;
|
2015-11-13 09:37:02 +00:00
|
|
|
NS_IMETHOD GetBounds(LayoutDeviceIntRect& aRect) override;
|
|
|
|
NS_IMETHOD GetClientBounds(LayoutDeviceIntRect& aRect) override;
|
|
|
|
NS_IMETHOD GetScreenBounds(LayoutDeviceIntRect& aRect) override;
|
|
|
|
NS_IMETHOD GetRestoredBounds(LayoutDeviceIntRect& aRect) override;
|
|
|
|
NS_IMETHOD GetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
|
|
|
|
NS_IMETHOD SetNonClientMargins(LayoutDeviceIntMargin& aMargins) override;
|
|
|
|
virtual LayoutDeviceIntPoint GetClientOffset() override;
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD EnableDragDrop(bool aEnable) override;
|
|
|
|
NS_IMETHOD GetAttention(int32_t aCycleCount) override;
|
|
|
|
virtual bool HasPendingInputEvent() override;
|
|
|
|
NS_IMETHOD SetIcon(const nsAString &anIconSpec) override;
|
|
|
|
NS_IMETHOD SetWindowTitlebarColor(nscolor aColor, bool aActive) override;
|
|
|
|
virtual void SetDrawsInTitlebar(bool aState) override {}
|
2015-11-19 03:10:38 +00:00
|
|
|
virtual bool ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect) override;
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void FreeNativeData(void * data, uint32_t aDataType) override {}
|
2013-10-02 03:46:03 +00:00
|
|
|
NS_IMETHOD BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
|
|
|
|
int32_t aHorizontal,
|
2015-03-21 16:28:04 +00:00
|
|
|
int32_t aVertical) override;
|
|
|
|
NS_IMETHOD BeginMoveDrag(mozilla::WidgetMouseEvent* aEvent) override;
|
|
|
|
virtual nsresult ActivateNativeMenuItemAt(const nsAString& indexString) override { return NS_ERROR_NOT_IMPLEMENTED; }
|
|
|
|
virtual nsresult ForceUpdateNativeMenuAt(const nsAString& indexString) override { return NS_ERROR_NOT_IMPLEMENTED; }
|
|
|
|
NS_IMETHOD NotifyIME(const IMENotification& aIMENotification) override final;
|
2015-02-20 16:37:02 +00:00
|
|
|
NS_IMETHOD StartPluginIME(const mozilla::WidgetKeyboardEvent& aKeyboardEvent,
|
|
|
|
int32_t aPanelX, int32_t aPanelY,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsString& aCommitted) override
|
2015-02-20 16:37:02 +00:00
|
|
|
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD SetPluginFocused(bool& aFocused) override
|
2015-02-20 16:37:02 +00:00
|
|
|
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
2016-02-02 08:05:56 +00:00
|
|
|
virtual void SetCandidateWindowForPlugin(
|
|
|
|
const mozilla::widget::CandidateWindowPosition&
|
|
|
|
aPosition) override
|
2015-12-29 13:57:38 +00:00
|
|
|
{ }
|
2015-12-29 13:57:38 +00:00
|
|
|
virtual void DefaultProcOfPluginEvent(
|
|
|
|
const mozilla::WidgetPluginEvent& aEvent) override
|
|
|
|
{ }
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD AttachNativeKeyEvent(mozilla::WidgetKeyboardEvent& aEvent) override { return NS_ERROR_NOT_IMPLEMENTED; }
|
2014-03-14 13:13:31 +00:00
|
|
|
NS_IMETHOD_(bool) ExecuteNativeKeyBinding(
|
|
|
|
NativeKeyBindingsType aType,
|
|
|
|
const mozilla::WidgetKeyboardEvent& aEvent,
|
|
|
|
DoCommandCallback aCallback,
|
2015-03-21 16:28:04 +00:00
|
|
|
void* aCallbackData) override { return false; }
|
2015-07-16 22:18:05 +00:00
|
|
|
virtual bool ComputeShouldAccelerate();
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsIMEUpdatePreference GetIMEUpdatePreference() override { return nsIMEUpdatePreference(); }
|
2015-11-13 09:37:02 +00:00
|
|
|
NS_IMETHOD OnDefaultButtonLoaded(const LayoutDeviceIntRect& aButtonRect) override { return NS_ERROR_NOT_IMPLEMENTED; }
|
2010-08-20 19:29:02 +00:00
|
|
|
virtual already_AddRefed<nsIWidget>
|
2015-11-16 08:35:18 +00:00
|
|
|
CreateChild(const LayoutDeviceIntRect& aRect,
|
|
|
|
nsWidgetInitData* aInitData = nullptr,
|
|
|
|
bool aForceUseIWidgetParent = false) override;
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD AttachViewToTopLevel(bool aUseAttachedEvents) override;
|
|
|
|
virtual nsIWidgetListener* GetAttachedWidgetListener() override;
|
|
|
|
virtual void SetAttachedWidgetListener(nsIWidgetListener* aListener) override;
|
2015-07-22 01:09:02 +00:00
|
|
|
virtual nsIWidgetListener* GetPreviouslyAttachedWidgetListener() override;
|
|
|
|
virtual void SetPreviouslyAttachedWidgetListener(nsIWidgetListener* aListener) override;
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD_(TextEventDispatcher*) GetTextEventDispatcher() override final;
|
2016-03-16 04:47:47 +00:00
|
|
|
NS_IMETHOD_(TextEventDispatcherListener*)
|
|
|
|
GetNativeTextEventDispatcherListener() override;
|
2016-01-20 01:44:44 +00:00
|
|
|
virtual void ZoomToRect(const uint32_t& aPresShellId,
|
|
|
|
const FrameMetrics::ViewID& aViewId,
|
|
|
|
const CSSRect& aRect,
|
|
|
|
const uint32_t& aFlags) override;
|
2016-01-31 19:44:58 +00:00
|
|
|
// Dispatch an event that must be first be routed through APZ.
|
2016-03-10 23:25:48 +00:00
|
|
|
nsEventStatus DispatchInputEvent(mozilla::WidgetInputEvent* aEvent) override;
|
2016-04-18 18:24:28 +00:00
|
|
|
void DispatchEventToAPZOnly(mozilla::WidgetInputEvent* aEvent) override;
|
2016-01-31 19:44:58 +00:00
|
|
|
|
2015-04-14 16:24:32 +00:00
|
|
|
void SetConfirmedTargetAPZC(uint64_t aInputBlockId,
|
|
|
|
const nsTArray<ScrollableLayerGuid>& aTargets) const override;
|
|
|
|
|
2015-06-17 16:32:42 +00:00
|
|
|
void UpdateZoomConstraints(const uint32_t& aPresShellId,
|
|
|
|
const FrameMetrics::ViewID& aViewId,
|
|
|
|
const mozilla::Maybe<ZoomConstraints>& aConstraints) override;
|
|
|
|
|
2015-06-04 20:51:10 +00:00
|
|
|
bool AsyncPanZoomEnabled() const override;
|
|
|
|
|
2012-08-15 18:52:41 +00:00
|
|
|
void NotifyWindowDestroyed();
|
2012-08-15 18:52:35 +00:00
|
|
|
void NotifySizeMoveDone();
|
2014-02-28 07:45:08 +00:00
|
|
|
void NotifyWindowMoved(int32_t aX, int32_t aY);
|
2012-08-15 18:52:35 +00:00
|
|
|
|
2015-01-29 19:41:53 +00:00
|
|
|
// Register plugin windows for remote updates from the compositor
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void RegisterPluginWindowForRemoteUpdates() override;
|
|
|
|
virtual void UnregisterPluginWindowForRemoteUpdates() override;
|
2015-01-29 19:41:53 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void SetNativeData(uint32_t aDataType, uintptr_t aVal) override {};
|
2015-01-29 19:41:57 +00:00
|
|
|
|
2012-08-15 18:52:35 +00:00
|
|
|
// Should be called by derived implementations to notify on system color and
|
|
|
|
// theme changes.
|
|
|
|
void NotifySysColorChanged();
|
|
|
|
void NotifyThemeChanged();
|
2012-08-15 18:52:40 +00:00
|
|
|
void NotifyUIStateChanged(UIStateChangeType aShowAccelerators,
|
|
|
|
UIStateChangeType aShowFocusRings);
|
2012-08-15 18:52:35 +00:00
|
|
|
|
2012-08-15 18:52:37 +00:00
|
|
|
#ifdef ACCESSIBILITY
|
|
|
|
// Get the accessible for the window.
|
2013-06-27 15:03:58 +00:00
|
|
|
mozilla::a11y::Accessible* GetRootAccessible();
|
2012-08-15 18:52:37 +00:00
|
|
|
#endif
|
|
|
|
|
2016-04-21 10:20:31 +00:00
|
|
|
// Return true if this is a simple widget (that is typically not worth
|
|
|
|
// accelerating)
|
|
|
|
bool IsSmallPopup() const;
|
|
|
|
|
2010-07-27 13:38:03 +00:00
|
|
|
nsPopupLevel PopupLevel() { return mPopupLevel; }
|
|
|
|
|
2015-11-13 09:37:02 +00:00
|
|
|
virtual LayoutDeviceIntSize
|
|
|
|
ClientToWindowSize(const LayoutDeviceIntSize& aClientSize) override
|
2010-07-27 13:38:03 +00:00
|
|
|
{
|
|
|
|
return aClientSize;
|
|
|
|
}
|
|
|
|
|
2015-07-13 10:44:36 +00:00
|
|
|
// return the screen the widget is in.
|
|
|
|
already_AddRefed<nsIScreen> GetWidgetScreen();
|
|
|
|
|
2010-07-27 13:38:03 +00:00
|
|
|
// return true if this is a popup widget with a native titlebar
|
2011-09-29 06:19:26 +00:00
|
|
|
bool IsPopupWithTitleBar() const
|
2010-07-27 13:38:03 +00:00
|
|
|
{
|
|
|
|
return (mWindowType == eWindowType_popup &&
|
|
|
|
mBorderStyle != eBorderStyle_default &&
|
|
|
|
mBorderStyle & eBorderStyle_title);
|
|
|
|
}
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent) override = 0;
|
2012-01-26 02:05:34 +00:00
|
|
|
|
2015-12-04 16:59:14 +00:00
|
|
|
virtual const SizeConstraints GetSizeConstraints() override;
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void SetSizeConstraints(const SizeConstraints& aConstraints) override;
|
2012-07-31 00:43:29 +00:00
|
|
|
|
2015-09-28 21:00:25 +00:00
|
|
|
virtual void StartAsyncScrollbarDrag(const AsyncDragMetrics& aDragMetrics) override;
|
|
|
|
|
2010-03-01 08:03:49 +00: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 19:01:09 +00: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 08:03:49 +00:00
|
|
|
*/
|
|
|
|
class AutoLayerManagerSetup {
|
|
|
|
public:
|
2010-07-15 21:08:04 +00:00
|
|
|
AutoLayerManagerSetup(nsBaseWidget* aWidget, gfxContext* aTarget,
|
2012-07-31 00:42:26 +00:00
|
|
|
BufferMode aDoubleBuffering,
|
2012-07-24 19:01:09 +00:00
|
|
|
ScreenRotation aRotation = mozilla::ROTATION_0);
|
2010-03-01 08:03:49 +00:00
|
|
|
~AutoLayerManagerSetup();
|
|
|
|
private:
|
|
|
|
nsBaseWidget* mWidget;
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<BasicLayerManager> mLayerManager;
|
2010-03-01 08:03:49 +00:00
|
|
|
};
|
|
|
|
friend class AutoLayerManagerSetup;
|
|
|
|
|
2013-03-04 18:32:20 +00:00
|
|
|
virtual bool ShouldUseOffMainThreadCompositing();
|
2012-10-26 13:15:22 +00:00
|
|
|
|
|
|
|
static nsIRollupListener* GetActiveRollupListener();
|
|
|
|
|
2013-06-17 02:50:32 +00:00
|
|
|
void Shutdown();
|
|
|
|
|
2016-04-29 23:23:17 +00:00
|
|
|
// Return a new CompositorWidgetProxy for this widget.
|
|
|
|
virtual CompositorWidgetProxy* NewCompositorWidgetProxy();
|
2016-04-29 23:20:40 +00:00
|
|
|
|
1998-09-23 19:19:23 +00:00
|
|
|
protected:
|
2016-04-29 23:23:17 +00:00
|
|
|
// These are methods for CompositorWidgetProxyWrapper, and should only be
|
|
|
|
// accessed from that class. Derived widgets can choose which methods to
|
|
|
|
// implement, or none if supporting out-of-process compositing.
|
|
|
|
virtual bool PreRender(mozilla::layers::LayerManagerComposite* aManager) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
virtual void PostRender(mozilla::layers::LayerManagerComposite* aManager)
|
|
|
|
{}
|
|
|
|
virtual void DrawWindowUnderlay(mozilla::layers::LayerManagerComposite* aManager,
|
|
|
|
LayoutDeviceIntRect aRect)
|
|
|
|
{}
|
|
|
|
virtual void DrawWindowOverlay(mozilla::layers::LayerManagerComposite* aManager,
|
|
|
|
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();
|
|
|
|
virtual mozilla::layers::Composer2D* GetComposer2D() {
|
|
|
|
return nullptr;
|
|
|
|
}
|
1998-09-23 19:19:23 +00:00
|
|
|
|
2016-04-29 23:23:17 +00:00
|
|
|
protected:
|
2015-01-02 06:25:48 +00:00
|
|
|
void ResolveIconName(const nsAString &aIconName,
|
|
|
|
const nsAString &aIconSuffix,
|
|
|
|
nsIFile **aResult);
|
2015-02-05 05:18:30 +00:00
|
|
|
virtual void OnDestroy();
|
|
|
|
void BaseCreate(nsIWidget *aParent,
|
2015-11-16 08:35:18 +00:00
|
|
|
nsWidgetInitData* aInitData);
|
1998-09-23 19:19:23 +00:00
|
|
|
|
2014-12-15 09:47:15 +00:00
|
|
|
virtual void ConfigureAPZCTreeManager();
|
2015-03-26 21:23:02 +00:00
|
|
|
virtual void ConfigureAPZControllerThread();
|
2014-12-15 09:47:15 +00:00
|
|
|
virtual already_AddRefed<GeckoContentController> CreateRootContentController();
|
|
|
|
|
2015-03-06 22:26:59 +00:00
|
|
|
// Dispatch an event that has already been routed through APZ.
|
|
|
|
nsEventStatus ProcessUntransformedAPZEvent(mozilla::WidgetInputEvent* aEvent,
|
|
|
|
const ScrollableLayerGuid& aGuid,
|
2015-03-25 16:20:20 +00:00
|
|
|
uint64_t aInputBlockId,
|
|
|
|
nsEventStatus aApzResponse);
|
2014-12-18 23:25:03 +00:00
|
|
|
|
2015-12-02 22:32:55 +00:00
|
|
|
const LayoutDeviceIntRegion RegionFromArray(const nsTArray<LayoutDeviceIntRect>& aRects);
|
|
|
|
void ArrayFromRegion(const LayoutDeviceIntRegion& aRegion,
|
|
|
|
nsTArray<LayoutDeviceIntRect>& aRects);
|
2014-11-12 20:59:19 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsIContent* GetLastRollup() override
|
2007-12-03 16:33:42 +00:00
|
|
|
{
|
|
|
|
return mLastRollup;
|
|
|
|
}
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual nsresult SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
|
|
|
|
int32_t aNativeKeyCode,
|
|
|
|
uint32_t aModifierFlags,
|
2008-05-07 04:46:37 +00:00
|
|
|
const nsAString& aCharacters,
|
2015-04-14 15:36:36 +00:00
|
|
|
const nsAString& aUnmodifiedCharacters,
|
|
|
|
nsIObserver* aObserver) override
|
|
|
|
{
|
|
|
|
mozilla::widget::AutoObserverNotifier notifier(aObserver, "keyevent");
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
}
|
2008-05-05 23:01:07 +00:00
|
|
|
|
2015-11-13 09:37:02 +00:00
|
|
|
virtual nsresult SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aNativeMessage,
|
2015-04-14 15:36:36 +00:00
|
|
|
uint32_t aModifierFlags,
|
|
|
|
nsIObserver* aObserver) override
|
|
|
|
{
|
|
|
|
mozilla::widget::AutoObserverNotifier notifier(aObserver, "mouseevent");
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
}
|
2009-09-23 02:31:37 +00:00
|
|
|
|
2015-11-13 09:37:02 +00:00
|
|
|
virtual nsresult SynthesizeNativeMouseMove(LayoutDeviceIntPoint aPoint,
|
2015-04-14 15:36:36 +00:00
|
|
|
nsIObserver* aObserver) override
|
|
|
|
{
|
|
|
|
mozilla::widget::AutoObserverNotifier notifier(aObserver, "mouseevent");
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
}
|
2012-04-11 21:55:21 +00:00
|
|
|
|
2015-11-13 09:37:02 +00:00
|
|
|
virtual nsresult SynthesizeNativeMouseScrollEvent(LayoutDeviceIntPoint aPoint,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aNativeMessage,
|
2012-03-22 00:59:12 +00:00
|
|
|
double aDeltaX,
|
|
|
|
double aDeltaY,
|
|
|
|
double aDeltaZ,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aModifierFlags,
|
2015-04-14 15:36:36 +00:00
|
|
|
uint32_t aAdditionalFlags,
|
|
|
|
nsIObserver* aObserver) override
|
|
|
|
{
|
|
|
|
mozilla::widget::AutoObserverNotifier notifier(aObserver, "mousescrollevent");
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
}
|
2012-03-22 00:59:12 +00:00
|
|
|
|
2013-12-14 20:40:56 +00:00
|
|
|
virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
|
|
|
|
TouchPointerState aPointerState,
|
2016-04-15 10:39:36 +00:00
|
|
|
LayoutDeviceIntPoint aPoint,
|
2013-12-14 20:40:56 +00:00
|
|
|
double aPointerPressure,
|
2015-04-14 15:36:36 +00:00
|
|
|
uint32_t aPointerOrientation,
|
|
|
|
nsIObserver* aObserver) override
|
|
|
|
{
|
|
|
|
mozilla::widget::AutoObserverNotifier notifier(aObserver, "touchpoint");
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
}
|
2013-12-14 20:40:56 +00:00
|
|
|
|
2015-01-28 06:27:31 +00:00
|
|
|
virtual nsresult NotifyIMEInternal(const IMENotification& aIMENotification)
|
|
|
|
{ return NS_ERROR_NOT_IMPLEMENTED; }
|
|
|
|
|
2016-03-16 04:47:47 +00:00
|
|
|
/**
|
|
|
|
* GetPseudoIMEContext() returns pseudo IME context when TextEventDispatcher
|
|
|
|
* has non-native input transaction. Otherwise, returns nullptr.
|
|
|
|
*/
|
|
|
|
void* GetPseudoIMEContext();
|
|
|
|
|
2013-12-14 20:40:56 +00:00
|
|
|
protected:
|
2015-01-28 15:15:54 +00:00
|
|
|
// Utility to check if an array of clip rects is equal to our
|
|
|
|
// internally stored clip rect array mClipRects.
|
2015-12-02 22:32:55 +00:00
|
|
|
bool IsWindowClipRegionEqual(const nsTArray<LayoutDeviceIntRect>& aRects);
|
2015-01-28 15:15:54 +00:00
|
|
|
|
|
|
|
// Stores the clip rectangles in aRects into mClipRects.
|
2015-12-02 22:32:55 +00:00
|
|
|
void StoreWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects);
|
2009-07-22 00:44:55 +00:00
|
|
|
|
2010-08-20 19:29:02 +00:00
|
|
|
virtual already_AddRefed<nsIWidget>
|
|
|
|
AllocateChildPopupWidget()
|
|
|
|
{
|
|
|
|
static NS_DEFINE_IID(kCPopUpCID, NS_CHILD_CID);
|
|
|
|
nsCOMPtr<nsIWidget> widget = do_CreateInstance(kCPopUpCID);
|
|
|
|
return widget.forget();
|
|
|
|
}
|
|
|
|
|
2013-09-01 22:20:45 +00:00
|
|
|
LayerManager* CreateBasicLayerManager();
|
2010-09-14 23:40:23 +00:00
|
|
|
|
2012-05-31 17:52:09 +00:00
|
|
|
nsPopupType PopupType() const { return mPopupType; }
|
|
|
|
|
2012-10-26 13:15:22 +00:00
|
|
|
void NotifyRollupGeometryChange()
|
2012-06-23 01:13:56 +00:00
|
|
|
{
|
2012-10-26 13:15:22 +00:00
|
|
|
// XULPopupManager isn't interested in this notification, so only
|
|
|
|
// send it if gRollupListener is set.
|
|
|
|
if (gRollupListener) {
|
|
|
|
gRollupListener->NotifyGeometryChange();
|
2012-06-23 01:13:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-31 00:43:29 +00:00
|
|
|
/**
|
|
|
|
* Apply the current size constraints to the given size.
|
|
|
|
*
|
|
|
|
* @param aWidth width to constrain
|
|
|
|
* @param aHeight height to constrain
|
|
|
|
*/
|
2015-12-04 16:59:14 +00:00
|
|
|
void ConstrainSize(int32_t* aWidth, int32_t* aHeight)
|
2012-07-31 00:43:29 +00:00
|
|
|
{
|
2015-12-04 16:59:14 +00:00
|
|
|
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 00:43:29 +00:00
|
|
|
}
|
|
|
|
|
2016-03-22 18:08:38 +00:00
|
|
|
virtual CompositorBridgeChild* GetRemoteRenderer() override;
|
2012-10-04 07:05:24 +00:00
|
|
|
|
2013-08-08 23:32:26 +00:00
|
|
|
/**
|
|
|
|
* Notify the widget that this window is being used with OMTC.
|
|
|
|
*/
|
|
|
|
virtual void WindowUsesOMTC() {}
|
2015-04-29 20:29:34 +00:00
|
|
|
virtual void RegisterTouchWindow() {}
|
2013-08-08 23:32:26 +00:00
|
|
|
|
2015-02-06 23:11:30 +00:00
|
|
|
nsIDocument* GetDocument() const;
|
|
|
|
|
2016-04-29 23:23:17 +00:00
|
|
|
void EnsureTextEventDispatcher();
|
2016-03-16 04:47:47 +00:00
|
|
|
|
2016-02-29 06:53:15 +00:00
|
|
|
// Notify the compositor that a device reset has occurred.
|
|
|
|
void OnRenderingDeviceReset();
|
|
|
|
|
2016-04-29 23:20:42 +00:00
|
|
|
bool UseAPZ();
|
|
|
|
|
2011-08-31 22:58:19 +00:00
|
|
|
protected:
|
2016-05-18 05:33:21 +00:00
|
|
|
// Returns whether compositing should use an external surface size.
|
|
|
|
virtual bool UseExternalCompositingSurface() const {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-05-23 14:17:44 +00:00
|
|
|
/**
|
|
|
|
* Starts the OMTC compositor destruction sequence.
|
|
|
|
*
|
|
|
|
* When this function returns, the compositor should not be
|
|
|
|
* 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 18:28:28 +00:00
|
|
|
virtual void DestroyCompositor();
|
2015-03-09 17:43:39 +00:00
|
|
|
void DestroyLayerManager();
|
2012-05-23 14:17:44 +00:00
|
|
|
|
2015-04-16 15:16:04 +00:00
|
|
|
void FreeShutdownObserver();
|
|
|
|
|
2012-08-15 18:52:42 +00:00
|
|
|
nsIWidgetListener* mWidgetListener;
|
2012-08-15 18:53:14 +00:00
|
|
|
nsIWidgetListener* mAttachedWidgetListener;
|
2015-07-22 01:09:02 +00:00
|
|
|
nsIWidgetListener* mPreviouslyAttachedWidgetListener;
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<LayerManager> mLayerManager;
|
2016-05-18 05:33:22 +00:00
|
|
|
RefPtr<CompositorSession> mCompositorSession;
|
2016-03-22 18:08:38 +00:00
|
|
|
RefPtr<CompositorBridgeChild> mCompositorBridgeChild;
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<mozilla::CompositorVsyncDispatcher> mCompositorVsyncDispatcher;
|
|
|
|
RefPtr<APZCTreeManager> mAPZC;
|
2016-04-22 20:01:30 +00:00
|
|
|
RefPtr<GeckoContentController> mRootContentController;
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<APZEventState> mAPZEventState;
|
2015-09-11 16:27:49 +00:00
|
|
|
SetAllowedTouchBehaviorCallback mSetAllowedTouchBehaviorCallback;
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<WidgetShutdownObserver> mShutdownObserver;
|
|
|
|
RefPtr<TextEventDispatcher> mTextEventDispatcher;
|
1999-09-28 01:31:41 +00:00
|
|
|
nsCursor mCursor;
|
|
|
|
nsBorderStyle mBorderStyle;
|
2015-11-23 04:32:29 +00:00
|
|
|
LayoutDeviceIntRect mBounds;
|
2015-12-04 16:58:05 +00:00
|
|
|
LayoutDeviceIntRect* mOriginalBounds;
|
2009-07-22 00:44:55 +00:00
|
|
|
// When this pointer is null, the widget is not clipped
|
2015-12-02 22:32:55 +00:00
|
|
|
mozilla::UniquePtr<LayoutDeviceIntRect[]> mClipRects;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mClipRectCount;
|
2000-03-09 01:55:48 +00:00
|
|
|
nsSizeMode mSizeMode;
|
2010-07-27 13:38:03 +00:00
|
|
|
nsPopupLevel mPopupLevel;
|
2012-05-31 17:52:09 +00:00
|
|
|
nsPopupType mPopupType;
|
2012-07-31 00:43:29 +00:00
|
|
|
SizeConstraints mSizeConstraints;
|
2007-12-03 16:33:42 +00:00
|
|
|
|
2016-04-29 23:23:17 +00:00
|
|
|
RefPtr<CompositorWidgetProxy> mCompositorWidgetProxy;
|
|
|
|
|
2015-08-06 06:57:58 +00:00
|
|
|
bool mUpdateCursor;
|
|
|
|
bool mUseAttachedEvents;
|
|
|
|
bool mIMEHasFocus;
|
2016-06-05 12:59:38 +00:00
|
|
|
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_GTK)
|
2015-12-21 14:54:06 +00:00
|
|
|
bool mAccessibilityInUseFlag;
|
|
|
|
#endif
|
2012-10-26 13:15:22 +00:00
|
|
|
static nsIRollupListener* gRollupListener;
|
|
|
|
|
2007-12-03 16:33:42 +00:00
|
|
|
// the last rolled up popup. Only set this when an nsAutoRollup is in scope,
|
|
|
|
// so it can be cleared automatically.
|
|
|
|
static nsIContent* mLastRollup;
|
2011-08-31 22:58:19 +00:00
|
|
|
|
2015-10-27 21:03:49 +00:00
|
|
|
struct InitialZoomConstraints {
|
|
|
|
InitialZoomConstraints(const uint32_t& aPresShellID,
|
|
|
|
const FrameMetrics::ViewID& aViewID,
|
|
|
|
const ZoomConstraints& aConstraints)
|
|
|
|
: mPresShellID(aPresShellID), mViewID(aViewID), mConstraints(aConstraints)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t mPresShellID;
|
|
|
|
FrameMetrics::ViewID mViewID;
|
|
|
|
ZoomConstraints mConstraints;
|
|
|
|
};
|
|
|
|
|
|
|
|
mozilla::Maybe<InitialZoomConstraints> mInitialZoomConstraints;
|
|
|
|
|
2002-01-24 01:18:36 +00:00
|
|
|
#ifdef DEBUG
|
1999-09-09 02:32:54 +00:00
|
|
|
protected:
|
2013-10-02 03:46:03 +00:00
|
|
|
static nsAutoString debug_GuiEventToString(mozilla::WidgetGUIEvent* aGuiEvent);
|
2011-09-29 06:19:26 +00:00
|
|
|
static bool debug_WantPaintFlashing();
|
1999-09-09 02:32:54 +00:00
|
|
|
|
2015-11-17 05:18:31 +00:00
|
|
|
static void debug_DumpInvalidate(FILE* aFileOut,
|
|
|
|
nsIWidget* aWidget,
|
|
|
|
const LayoutDeviceIntRect* aRect,
|
2016-03-31 18:42:13 +00:00
|
|
|
const char* aWidgetName,
|
2015-11-17 05:18:31 +00:00
|
|
|
int32_t aWindowID);
|
1999-09-09 02:32:54 +00:00
|
|
|
|
2013-10-02 03:46:03 +00:00
|
|
|
static void debug_DumpEvent(FILE* aFileOut,
|
|
|
|
nsIWidget* aWidget,
|
|
|
|
mozilla::WidgetGUIEvent* aGuiEvent,
|
2016-03-31 18:42:13 +00:00
|
|
|
const char* aWidgetName,
|
2013-10-02 03:46:03 +00:00
|
|
|
int32_t aWindowID);
|
2011-08-31 22:58:19 +00:00
|
|
|
|
1999-09-09 02:32:54 +00:00
|
|
|
static void debug_DumpPaintEvent(FILE * aFileOut,
|
|
|
|
nsIWidget * aWidget,
|
2012-08-15 18:52:42 +00:00
|
|
|
const nsIntRegion & aPaintEvent,
|
2016-03-31 18:42:13 +00:00
|
|
|
const char * aWidgetName,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aWindowID);
|
1999-09-09 02:32:54 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
static bool debug_GetCachedBoolPref(const char* aPrefName);
|
1999-07-09 12:11:12 +00:00
|
|
|
#endif
|
1998-09-23 19:19:23 +00:00
|
|
|
};
|
|
|
|
|
2007-12-03 16:33:42 +00:00
|
|
|
// A situation can occur when a mouse event occurs over a menu label while the
|
|
|
|
// menu popup is already open. The expected behaviour is to close the popup.
|
|
|
|
// This happens by calling nsIRollupListener::Rollup before the mouse event is
|
|
|
|
// processed. However, in cases where the mouse event is not consumed, this
|
|
|
|
// event will then get targeted at the menu label causing the menu to open
|
|
|
|
// again. To prevent this, we store in mLastRollup a reference to the popup
|
|
|
|
// that was closed during the Rollup call, and prevent this popup from
|
|
|
|
// reopening while processing the mouse event.
|
|
|
|
// mLastRollup should only be set while an nsAutoRollup is in scope;
|
|
|
|
// when it goes out of scope mLastRollup is cleared automatically.
|
|
|
|
// As mLastRollup is static, it can be retrieved by calling
|
|
|
|
// nsIWidget::GetLastRollup on any widget.
|
|
|
|
class nsAutoRollup
|
|
|
|
{
|
2011-09-29 06:19:26 +00:00
|
|
|
bool wasClear;
|
2007-12-03 16:33:42 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
nsAutoRollup();
|
|
|
|
~nsAutoRollup();
|
|
|
|
};
|
|
|
|
|
1998-09-23 19:19:23 +00:00
|
|
|
#endif // nsBaseWidget_h__
|