1 /* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9 #include "mozilla/UniquePtr.h"
10 #include "nsISupports.h"
16 #include "nsWidgetInitData.h"
20 #include "nsRegionFwd.h"
21 #include "nsXULAppAPI.h"
22 #include "mozilla/Maybe.h"
23 #include "mozilla/EventForwards.h"
24 #include "mozilla/layers/ScrollableLayerGuid.h"
25 #include "mozilla/layers/ZoomConstraints.h"
26 #include "mozilla/RefPtr.h"
27 #include "mozilla/TimeStamp.h"
28 #include "mozilla/gfx/Point.h"
29 #include "mozilla/widget/IMEData.h"
30 #include "VsyncSource.h"
31 #include "nsDataHashtable.h"
32 #include "nsIObserver.h"
33 #include "nsIWidgetListener.h"
35 #include "mozilla/dom/BindingDeclarations.h"
37 // forward declarations
38 class nsIBidiKeyboard
;
39 class nsIRollupListener
;
45 class nsIKeyEventInPluginCallback
;
49 enum class StyleWindowShadow
: uint8_t;
51 #if defined(MOZ_WIDGET_ANDROID)
55 #endif // defined(MOZ_WIDGET_ANDROID)
60 class PluginWidgetChild
;
61 } // namespace plugins
63 class AsyncDragMetrics
;
65 class CompositorBridgeChild
;
68 class LayerManagerComposite
;
69 class PLayerTransactionChild
;
70 class WebRenderBridgeChild
;
77 class TextEventDispatcher
;
78 class TextEventDispatcherListener
;
79 class CompositorWidget
;
80 class CompositorWidgetInitData
;
83 class DisplayListBuilder
;
84 class IpcResourceUpdateQueue
;
85 enum class RenderRoot
: uint8_t;
87 } // namespace mozilla
90 * Callback function that processes events.
92 * The argument is actually a subtype (subclass) of WidgetEvent which carries
93 * platform specific information about the event. Platform specific code
94 * knows how to deal with it.
96 * The return value determines whether or not the default action should take
99 typedef nsEventStatus (*EVENT_CALLBACK
)(mozilla::WidgetGUIEvent
* aEvent
);
101 // Hide the native window system's real window type so as to avoid
102 // including native window system types and APIs. This is necessary
103 // to ensure cross-platform code.
104 typedef void* nsNativeWidget
;
107 * Flags for the GetNativeData and SetNativeData functions
109 #define NS_NATIVE_WINDOW 0
110 #define NS_NATIVE_GRAPHIC 1
111 #define NS_NATIVE_TMP_WINDOW 2
112 #define NS_NATIVE_WIDGET 3
113 #define NS_NATIVE_DISPLAY 4
114 #define NS_NATIVE_REGION 5
115 #define NS_NATIVE_OFFSETX 6
116 #define NS_NATIVE_OFFSETY 7
117 #define NS_NATIVE_PLUGIN_PORT 8
118 #define NS_NATIVE_SCREEN 9
119 // The toplevel GtkWidget containing this nsIWidget:
120 #define NS_NATIVE_SHELLWIDGET 10
121 // Has to match to NPNVnetscapeWindow, and shareable across processes
122 // HWND on Windows and XID on X11
123 #define NS_NATIVE_SHAREABLE_WINDOW 11
124 #define NS_NATIVE_OPENGL_CONTEXT 12
125 // See RegisterPluginWindowForRemoteUpdates
126 #define NS_NATIVE_PLUGIN_ID 13
127 // This is available only with GetNativeData() in parent process. Anybody
128 // shouldn't access this pointer as a valid pointer since the result may be
129 // special value like NS_ONLY_ONE_NATIVE_IME_CONTEXT. So, the result is just
130 // an identifier of distinguishing a text composition is caused by which native
131 // IME context. Note that the result is only valid in the process. So,
132 // XP code should use nsIWidget::GetNativeIMEContext() instead of using this.
133 #define NS_RAW_NATIVE_IME_CONTEXT 14
135 # define NS_NATIVE_PLUGIN_PORT_QD 100
136 # define NS_NATIVE_PLUGIN_PORT_CG 101
139 # define NS_NATIVE_TSF_THREAD_MGR 100
140 # define NS_NATIVE_TSF_CATEGORY_MGR 101
141 # define NS_NATIVE_TSF_DISPLAY_ATTR_MGR 102
142 # define NS_NATIVE_ICOREWINDOW 103 // winrt specific
143 # define NS_NATIVE_CHILD_WINDOW 104
144 # define NS_NATIVE_CHILD_OF_SHAREABLE_WINDOW 105
146 #if defined(MOZ_WIDGET_GTK)
147 // set/get nsPluginNativeWindowGtk, e10s specific
148 # define NS_NATIVE_PLUGIN_OBJECT_PTR 104
150 # define NS_NATIVE_COMPOSITOR_DISPLAY 105
152 # define NS_NATIVE_EGL_WINDOW 106
154 #ifdef MOZ_WIDGET_ANDROID
155 # define NS_JAVA_SURFACE 100
156 # define NS_PRESENTATION_WINDOW 101
157 # define NS_PRESENTATION_SURFACE 102
160 // Must be kept in sync with xpcom/rust/xpcom/src/interfaces/nonidl.rs
161 #define NS_IWIDGET_IID \
163 0x06396bf6, 0x2dd8, 0x45e5, { \
164 0xac, 0x45, 0x75, 0x26, 0x53, 0xb1, 0xc9, 0x80 \
172 enum nsTransparencyMode
{
173 eTransparencyOpaque
= 0, // Fully opaque
174 eTransparencyTransparent
, // Parts of the window may be transparent
175 eTransparencyGlass
, // Transparent parts of the window have Vista AeroGlass
177 eTransparencyBorderlessGlass
// As above, but without a border around the
178 // opaque areas when there would otherwise be
179 // one with eTransparencyGlass
180 // If you add to the end here, you must update the serialization code in
181 // WidgetMessageUtils.h
188 enum nsCursor
{ ///(normal cursor, usually rendered as an arrow)
190 ///(system is busy, usually rendered as a hourglass or watch)
192 ///(Selecting something, usually rendered as an IBeam)
194 ///(can hyper-link, usually rendered as a human hand)
196 ///(north/south/west/east edge sizing)
209 eCursor_copy
, // CSS3
211 eCursor_context_menu
,
222 eCursor_vertical_text
,
229 // This one is used for array sizing, and so better be the last
230 // one in this list...
233 // ...except for this one.
234 eCursorInvalid
= eCursorCount
+ 1
237 enum nsTopLevelWidgetZPlacement
{ // for PlaceBehind()
238 eZPlacementBottom
= 0, // bottom of the window stack
239 eZPlacementBelow
, // just below another widget
240 eZPlacementTop
// top of the window stack
244 * Before the OS goes to sleep, this topic is notified.
246 #define NS_WIDGET_SLEEP_OBSERVER_TOPIC "sleep_notification"
249 * After the OS wakes up, this topic is notified.
251 #define NS_WIDGET_WAKE_OBSERVER_TOPIC "wake_notification"
254 * Before the OS suspends the current process, this topic is notified. Some
255 * OS will kill processes that are suspended instead of resuming them.
256 * For that reason this topic may be useful to safely close down resources.
258 #define NS_WIDGET_SUSPEND_PROCESS_OBSERVER_TOPIC "suspend_process_notification"
261 * After the current process resumes from being suspended, this topic is
264 #define NS_WIDGET_RESUME_PROCESS_OBSERVER_TOPIC "resume_process_notification"
267 * When an app(-shell) is activated by the OS, this topic is notified.
268 * Currently, this only happens on Mac OSX.
270 #define NS_WIDGET_MAC_APP_ACTIVATE_OBSERVER_TOPIC "mac_app_activate"
276 * Size constraints for setting the minimum and maximum size of a widget.
277 * Values are in device pixels.
279 struct SizeConstraints
{
280 SizeConstraints() : mMaxSize(NS_MAXSIZE
, NS_MAXSIZE
) {}
282 SizeConstraints(mozilla::LayoutDeviceIntSize aMinSize
,
283 mozilla::LayoutDeviceIntSize aMaxSize
)
284 : mMinSize(aMinSize
), mMaxSize(aMaxSize
) {}
286 mozilla::LayoutDeviceIntSize mMinSize
;
287 mozilla::LayoutDeviceIntSize mMaxSize
;
290 struct AutoObserverNotifier
{
291 AutoObserverNotifier(nsIObserver
* aObserver
, const char* aTopic
)
292 : mObserver(aObserver
), mTopic(aTopic
) {}
294 void SkipNotification() { mObserver
= nullptr; }
296 uint64_t SaveObserver() {
300 uint64_t observerId
= ++sObserverId
;
301 sSavedObservers
.Put(observerId
, mObserver
);
306 ~AutoObserverNotifier() {
308 mObserver
->Observe(nullptr, mTopic
, nullptr);
312 static void NotifySavedObserver(const uint64_t& aObserverId
,
313 const char* aTopic
) {
314 nsCOMPtr
<nsIObserver
> observer
= sSavedObservers
.Get(aObserverId
);
316 MOZ_ASSERT(aObserverId
== 0,
317 "We should always find a saved observer for nonzero IDs");
321 sSavedObservers
.Remove(aObserverId
);
322 observer
->Observe(nullptr, aTopic
, nullptr);
326 nsCOMPtr
<nsIObserver
> mObserver
;
330 static uint64_t sObserverId
;
331 static nsDataHashtable
<nsUint64HashKey
, nsCOMPtr
<nsIObserver
>>
335 } // namespace widget
336 } // namespace mozilla
339 * The base class for all the widgets. It provides the interface for
340 * all basic and necessary functionality.
342 class nsIWidget
: public nsISupports
{
344 typedef mozilla::dom::BrowserChild BrowserChild
;
347 typedef mozilla::layers::CompositorBridgeChild CompositorBridgeChild
;
348 typedef mozilla::layers::AsyncDragMetrics AsyncDragMetrics
;
349 typedef mozilla::layers::FrameMetrics FrameMetrics
;
350 typedef mozilla::layers::LayerManager LayerManager
;
351 typedef mozilla::layers::LayerManagerComposite LayerManagerComposite
;
352 typedef mozilla::layers::LayersBackend LayersBackend
;
353 typedef mozilla::layers::PLayerTransactionChild PLayerTransactionChild
;
354 typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid
;
355 typedef mozilla::layers::ZoomConstraints ZoomConstraints
;
356 typedef mozilla::widget::IMEMessage IMEMessage
;
357 typedef mozilla::widget::IMENotification IMENotification
;
358 typedef mozilla::widget::IMENotificationRequests IMENotificationRequests
;
359 typedef mozilla::widget::IMEState IMEState
;
360 typedef mozilla::widget::InputContext InputContext
;
361 typedef mozilla::widget::InputContextAction InputContextAction
;
362 typedef mozilla::widget::NativeIMEContext NativeIMEContext
;
363 typedef mozilla::widget::SizeConstraints SizeConstraints
;
364 typedef mozilla::widget::TextEventDispatcher TextEventDispatcher
;
365 typedef mozilla::widget::TextEventDispatcherListener
366 TextEventDispatcherListener
;
367 typedef mozilla::LayoutDeviceIntMargin LayoutDeviceIntMargin
;
368 typedef mozilla::LayoutDeviceIntPoint LayoutDeviceIntPoint
;
369 typedef mozilla::LayoutDeviceIntRect LayoutDeviceIntRect
;
370 typedef mozilla::LayoutDeviceIntRegion LayoutDeviceIntRegion
;
371 typedef mozilla::LayoutDeviceIntSize LayoutDeviceIntSize
;
372 typedef mozilla::ScreenIntPoint ScreenIntPoint
;
373 typedef mozilla::ScreenIntMargin ScreenIntMargin
;
374 typedef mozilla::ScreenIntSize ScreenIntSize
;
375 typedef mozilla::ScreenPoint ScreenPoint
;
376 typedef mozilla::CSSToScreenScale CSSToScreenScale
;
377 typedef mozilla::DesktopIntRect DesktopIntRect
;
378 typedef mozilla::DesktopPoint DesktopPoint
;
379 typedef mozilla::DesktopRect DesktopRect
;
380 typedef mozilla::DesktopSize DesktopSize
;
381 typedef mozilla::CSSPoint CSSPoint
;
382 typedef mozilla::CSSRect CSSRect
;
384 // Used in UpdateThemeGeometries.
385 struct ThemeGeometry
{
386 // The ThemeGeometryType value for the themed widget, see
387 // nsITheme::ThemeGeometryTypeForWidget.
388 nsITheme::ThemeGeometryType mType
;
389 // The device-pixel rect within the window for the themed widget
390 LayoutDeviceIntRect mRect
;
392 ThemeGeometry(nsITheme::ThemeGeometryType aType
,
393 const LayoutDeviceIntRect
& aRect
)
394 : mType(aType
), mRect(aRect
) {}
397 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IWIDGET_IID
)
400 : mLastChild(nullptr),
401 mPrevSibling(nullptr),
402 mOnDestroyCalled(false),
403 mWindowType(eWindowType_child
),
407 ClearNativeTouchSequence(nullptr);
411 * Create and initialize a widget.
413 * All the arguments can be null in which case a top level window
414 * with size 0 is created. The event callback function has to be
415 * provided only if the caller wants to deal with the events this
416 * widget receives. The event callback is basically a preprocess
417 * hook called synchronously. The return value determines whether
418 * the event goes to the default window procedure or it is hidden
419 * to the os. The assumption is that if the event handler returns
420 * false the widget does not see the event. The widget should not
421 * automatically clear the window to the background color. The
422 * calling code must handle paint messages and clear the background
425 * In practice at least one of aParent and aNativeParent will be null. If
426 * both are null the widget isn't parented (e.g. context menus or
427 * independent top level windows).
429 * The dimensions given in aRect are specified in the parent's
430 * device coordinate system.
431 * This must not be called for parentless widgets such as top-level
432 * windows, which use the desktop pixel coordinate system; a separate
433 * method is provided for these.
435 * @param aParent parent nsIWidget
436 * @param aNativeParent native parent widget
437 * @param aRect the widget dimension
438 * @param aInitData data that is used for widget initialization
441 [[nodiscard
]] virtual nsresult
Create(
442 nsIWidget
* aParent
, nsNativeWidget aNativeParent
,
443 const LayoutDeviceIntRect
& aRect
,
444 nsWidgetInitData
* aInitData
= nullptr) = 0;
447 * As above, but with aRect specified in DesktopPixel units (for top-level
449 * Default implementation just converts aRect to device pixels and calls
450 * through to device-pixel Create, but platforms may override this if the
451 * mapping is not straightforward or the native platform needs to use the
452 * desktop pixel values directly.
454 [[nodiscard
]] virtual nsresult
Create(nsIWidget
* aParent
,
455 nsNativeWidget aNativeParent
,
456 const DesktopIntRect
& aRect
,
457 nsWidgetInitData
* aInitData
= nullptr) {
458 LayoutDeviceIntRect devPixRect
=
459 RoundedToInt(aRect
* GetDesktopToDeviceScale());
460 return Create(aParent
, aNativeParent
, devPixRect
, aInitData
);
464 * Allocate, initialize, and return a widget that is a child of
465 * |this|. The returned widget (if nonnull) has gone through the
466 * equivalent of CreateInstance(widgetCID) + Create(...).
468 * |CreateChild()| lets widget backends decide whether to parent
469 * the new child widget to this, nonnatively parent it, or both.
470 * This interface exists to support the PuppetWidget backend,
471 * which is entirely non-native. All other params are the same as
474 * |aForceUseIWidgetParent| forces |CreateChild()| to only use the
475 * |nsIWidget*| this, not its native widget (if it exists), when
476 * calling |Create()|. This is a timid hack around poorly
477 * understood code, and shouldn't be used in new code.
479 virtual already_AddRefed
<nsIWidget
> CreateChild(
480 const LayoutDeviceIntRect
& aRect
, nsWidgetInitData
* aInitData
= nullptr,
481 bool aForceUseIWidgetParent
= false) = 0;
484 * Attach to a top level widget.
486 * In cases where a top level chrome widget is being used as a content
487 * container, attach a secondary listener and update the device
488 * context. The primary widget listener will continue to be called for
489 * notifications relating to the top-level window, whereas other
490 * notifications such as painting and events will instead be called via
491 * the attached listener. SetAttachedWidgetListener should be used to
492 * assign the attached listener.
494 * aUseAttachedEvents if true, events are sent to the attached listener
495 * instead of the normal listener.
497 virtual void AttachViewToTopLevel(bool aUseAttachedEvents
) = 0;
500 * Accessor functions to get and set the attached listener. Used by
501 * nsView in connection with AttachViewToTopLevel above.
503 virtual void SetAttachedWidgetListener(nsIWidgetListener
* aListener
) = 0;
504 virtual nsIWidgetListener
* GetAttachedWidgetListener() = 0;
505 virtual void SetPreviouslyAttachedWidgetListener(
506 nsIWidgetListener
* aListener
) = 0;
507 virtual nsIWidgetListener
* GetPreviouslyAttachedWidgetListener() = 0;
510 * Accessor functions to get and set the listener which handles various
511 * actions for the widget.
514 virtual nsIWidgetListener
* GetWidgetListener() = 0;
515 virtual void SetWidgetListener(nsIWidgetListener
* alistener
) = 0;
519 * Close and destroy the internal native window.
520 * This method does not delete the widget.
523 virtual void Destroy() = 0;
526 * Destroyed() returns true if Destroy() has been called already.
529 bool Destroyed() const { return mOnDestroyCalled
; }
534 * Change the widget's parent. Null parents are allowed.
536 * @param aNewParent new parent
538 virtual void SetParent(nsIWidget
* aNewParent
) = 0;
541 * Return the parent Widget of this Widget or nullptr if this is a
544 * @return the parent widget or nullptr if it does not have a parent
547 virtual nsIWidget
* GetParent(void) = 0;
550 * Return the top level Widget of this Widget
552 * @return the top level widget
554 virtual nsIWidget
* GetTopLevelWidget() = 0;
557 * Return the top (non-sheet) parent of this Widget if it's a sheet,
558 * or nullptr if this isn't a sheet (or some other error occurred).
559 * Sheets are only supported on some platforms (currently only OS X).
561 * @return the top (non-sheet) parent widget or nullptr
564 virtual nsIWidget
* GetSheetWindowParent(void) = 0;
567 * Return the physical DPI of the screen containing the window ...
568 * the number of device pixels per inch.
570 virtual float GetDPI() = 0;
573 * Return the scaling factor between device pixels and the platform-
574 * dependent "desktop pixels" used to manage window positions on a
575 * potentially multi-screen, mixed-resolution desktop.
577 virtual mozilla::DesktopToLayoutDeviceScale
GetDesktopToDeviceScale() = 0;
580 * Return the scaling factor between device pixels and the platform-
581 * dependent "desktop pixels" by looking up the screen by the position
584 virtual mozilla::DesktopToLayoutDeviceScale
585 GetDesktopToDeviceScaleByScreen() = 0;
588 * Return the default scale factor for the window. This is the
589 * default number of device pixels per CSS pixel to use. This should
590 * depend on OS/platform settings such as the Mac's "UI scale factor"
591 * or Windows' "font DPI". This will take into account Gecko preferences
592 * overriding the system setting.
594 mozilla::CSSToLayoutDeviceScale
GetDefaultScale();
597 * Return the Gecko override of the system default scale, if any;
598 * returns <= 0.0 if the system scale should be used as-is.
599 * nsIWidget::GetDefaultScale() [above] takes this into account.
600 * It is exposed here so that code that wants to check for a
601 * default-scale override without having a widget on hand can
602 * easily access the same value.
603 * Note that any scale override is a browser-wide value, whereas
604 * the default GetDefaultScale value (when no override is present)
605 * may vary between widgets (or screens).
607 static double DefaultScaleOverride();
610 * Return the first child of this widget. Will return null if
611 * there are no children.
613 nsIWidget
* GetFirstChild() const { return mFirstChild
; }
616 * Return the last child of this widget. Will return null if
617 * there are no children.
619 nsIWidget
* GetLastChild() const { return mLastChild
; }
622 * Return the next sibling of this widget
624 nsIWidget
* GetNextSibling() const { return mNextSibling
; }
627 * Set the next sibling of this widget
629 void SetNextSibling(nsIWidget
* aSibling
) { mNextSibling
= aSibling
; }
632 * Return the previous sibling of this widget
634 nsIWidget
* GetPrevSibling() const { return mPrevSibling
; }
637 * Set the previous sibling of this widget
639 void SetPrevSibling(nsIWidget
* aSibling
) { mPrevSibling
= aSibling
; }
642 * Show or hide this widget
644 * @param aState true to show the Widget, false to hide it
647 virtual void Show(bool aState
) = 0;
650 * Make the window modal.
652 virtual void SetModal(bool aModal
) = 0;
655 * Make the non-modal window opened by modal window fake-modal, that will
656 * call SetFakeModal(false) on destroy on Cocoa.
658 virtual void SetFakeModal(bool aModal
) { SetModal(aModal
); }
661 * Are we app modal. Currently only implemented on Cocoa.
663 virtual bool IsRunningAppModal() { return false; }
666 * The maximum number of simultaneous touch contacts supported by the device.
667 * In the case of devices with multiple digitizers (e.g. multiple touch
668 * screens), the value will be the maximum of the set of maximum supported
669 * contacts by each individual digitizer.
671 virtual uint32_t GetMaxTouchPoints() const = 0;
674 * Returns whether the window is visible
677 virtual bool IsVisible() const = 0;
680 * Perform platform-dependent sanity check on a potential window position.
681 * This is guaranteed to work only for top-level windows.
683 * @param aAllowSlop: if true, allow the window to slop offscreen;
684 * the window should be partially visible. if false,
685 * force the entire window onscreen (or at least
686 * the upper-left corner, if it's too large).
687 * @param aX in: an x position expressed in screen coordinates.
688 * out: the x position constrained to fit on the screen(s).
689 * @param aY in: an y position expressed in screen coordinates.
690 * out: the y position constrained to fit on the screen(s).
693 virtual void ConstrainPosition(bool aAllowSlop
, int32_t* aX
, int32_t* aY
) = 0;
698 * For a top-level window widget, the "parent's coordinate system" is the
699 * "global" display pixel coordinate space, *not* device pixels (which
700 * may be inconsistent between multiple screens, at least in the Mac OS
701 * case with mixed hi-dpi and lo-dpi displays). This applies to all the
702 * following Move and Resize widget APIs.
704 * The display-/device-pixel distinction becomes important for (at least)
705 * Mac OS X with Hi-DPI (retina) displays, and Windows when the UI scale
706 * factor is set to other than 100%.
708 * The Move and Resize methods take floating-point parameters, rather than
709 * integer ones. This is important when manipulating top-level widgets,
710 * where the coordinate system may not be an integral multiple of the
711 * device-pixel space.
717 * Coordinates refer to the top-left of the widget. For toplevel windows
718 * with decorations, this is the top-left of the titlebar and frame .
720 * @param aX the new x position expressed in the parent's coordinate system
721 * @param aY the new y position expressed in the parent's coordinate system
724 virtual void Move(double aX
, double aY
) = 0;
727 * Reposition this widget so that the client area has the given offset.
729 * @param aOffset the new offset of the client area expressed as an
730 * offset from the origin of the client area of the parent
731 * widget (for root widgets and popup widgets it is in
732 * screen coordinates)
734 virtual void MoveClient(const DesktopPoint
& aOffset
) = 0;
737 * Resize this widget. Any size constraints set for the window by a
738 * previous call to SetSizeConstraints will be applied.
740 * @param aWidth the new width expressed in the parent's coordinate system
741 * @param aHeight the new height expressed in the parent's coordinate
743 * @param aRepaint whether the widget should be repainted
745 virtual void Resize(double aWidth
, double aHeight
, bool aRepaint
) = 0;
748 * Lock the aspect ratio of a Window
750 * @param aShouldLock bool
753 virtual void LockAspectRatio(bool aShouldLock
){};
756 * Move or resize this widget. Any size constraints set for the window by
757 * a previous call to SetSizeConstraints will be applied.
759 * @param aX the new x position expressed in the parent's coordinate
761 * @param aY the new y position expressed in the parent's coordinate
763 * @param aWidth the new width expressed in the parent's coordinate system
764 * @param aHeight the new height expressed in the parent's coordinate
766 * @param aRepaint whether the widget should be repainted if the size
770 virtual void Resize(double aX
, double aY
, double aWidth
, double aHeight
,
773 virtual mozilla::Maybe
<bool> IsResizingNativeWidget() {
774 return mozilla::Nothing();
778 * Resize the widget so that the inner client area has the given size.
780 * @param aSize the new size of the client area.
781 * @param aRepaint whether the widget should be repainted
783 virtual void ResizeClient(const DesktopSize
& aSize
, bool aRepaint
) = 0;
786 * Resize and reposition the widget so tht inner client area has the given
789 * @param aRect the new offset and size of the client area. The offset is
790 * expressed as an offset from the origin of the client area
791 * of the parent widget (for root widgets and popup widgets it
792 * is in screen coordinates).
793 * @param aRepaint whether the widget should be repainted
795 virtual void ResizeClient(const DesktopRect
& aRect
, bool aRepaint
) = 0;
798 * Sets the widget's z-index.
800 virtual void SetZIndex(int32_t aZIndex
) = 0;
803 * Gets the widget's z-index.
805 int32_t GetZIndex() { return mZIndex
; }
808 * Position this widget just behind the given widget. (Used to
809 * control z-order for top-level widgets. Get/SetZIndex by contrast
810 * control z-order for child widgets of other widgets.)
811 * @param aPlacement top, bottom, or below a widget
812 * (if top or bottom, param aWidget is ignored)
813 * @param aWidget widget to place this widget behind
814 * (only if aPlacement is eZPlacementBelow).
815 * null is equivalent to aPlacement of eZPlacementTop
816 * @param aActivate true to activate the widget after placing it
818 virtual void PlaceBehind(nsTopLevelWidgetZPlacement aPlacement
,
819 nsIWidget
* aWidget
, bool aActivate
) = 0;
822 * Minimize, maximize or normalize the window size.
823 * Takes a value from nsSizeMode (see nsIWidgetListener.h)
825 virtual void SetSizeMode(nsSizeMode aMode
) = 0;
827 virtual void GetWorkspaceID(nsAString
& workspaceID
) = 0;
829 virtual void MoveToWorkspace(const nsAString
& workspaceID
) = 0;
832 * Suppress animations that are applied to a window by OS.
834 virtual void SuppressAnimation(bool aSuppress
) {}
837 * Return size mode (minimized, maximized, normalized).
838 * Returns a value from nsSizeMode (see nsIWidgetListener.h)
840 virtual nsSizeMode
SizeMode() = 0;
843 * Ask whether the window is tiled.
845 virtual bool IsTiled() const = 0;
848 * Ask wether the widget is fully occluded
850 virtual bool IsFullyOccluded() const = 0;
853 * Enable or disable this Widget
855 * @param aState true to enable the Widget, false to disable it.
857 virtual void Enable(bool aState
) = 0;
860 * Ask whether the widget is enabled
862 virtual bool IsEnabled() const = 0;
865 * Whether we should request activation of this widget's toplevel window.
873 * Request activation of this window or give focus to this widget.
875 virtual void SetFocus(Raise
, mozilla::dom::CallerType aCallerType
) = 0;
878 * Get this widget's outside dimensions relative to its parent widget. For
879 * popup widgets the returned rect is in screen coordinates and not
880 * relative to its parent widget.
882 * @return the x, y, width and height of this widget.
884 virtual LayoutDeviceIntRect
GetBounds() = 0;
887 * Get this widget's outside dimensions in device coordinates. This
888 * includes any title bar on the window.
890 * @return the x, y, width and height of this widget.
892 virtual LayoutDeviceIntRect
GetScreenBounds() = 0;
895 * Similar to GetScreenBounds except that this function will always
896 * get the size when the widget is in the nsSizeMode_Normal size mode
897 * even if the current size mode is not nsSizeMode_Normal.
898 * This method will fail if the size mode is not nsSizeMode_Normal and
899 * the platform doesn't have the ability.
900 * This method will always succeed if the current size mode is
903 * @param aRect On return it holds the x, y, width and height of
906 [[nodiscard
]] virtual nsresult
GetRestoredBounds(
907 LayoutDeviceIntRect
& aRect
) = 0;
910 * Get this widget's client area bounds, if the window has a 3D border
911 * appearance this returns the area inside the border. The position is the
912 * position of the client area relative to the client area of the parent
913 * widget (for root widgets and popup widgets it is in screen coordinates).
915 * @return the x, y, width and height of the client area of this widget.
917 virtual LayoutDeviceIntRect
GetClientBounds() = 0;
920 * Sets the non-client area dimensions of the window. Pass -1 to restore
921 * the system default frame size for that border. Pass zero to remove
922 * a border, or pass a specific value adjust a border. Units are in
923 * pixels. (DPI dependent)
926 * Windows: shrinking top non-client height will remove application
927 * icon and window title text. Glass desktops will refuse to set
928 * dimensions between zero and size < system default.
930 virtual nsresult
SetNonClientMargins(LayoutDeviceIntMargin
& aMargins
) = 0;
933 * Get the client offset from the window origin.
935 * @return the x and y of the offset.
937 virtual LayoutDeviceIntPoint
GetClientOffset() = 0;
940 * Equivalent to GetClientBounds but only returns the size.
942 virtual LayoutDeviceIntSize
GetClientSize() {
943 // Depending on the backend, overloading this method may be useful if
944 // requesting the client offset is expensive.
945 return GetClientBounds().Size();
949 * Get the size of the bounds of this widget that will be visible when
952 * @return the width and height of the composition size of this widget.
954 virtual LayoutDeviceIntSize
GetCompositionSize() {
955 return GetBounds().Size();
959 * Set the background color for this widget
961 * @param aColor the new background color
965 virtual void SetBackgroundColor(const nscolor
& aColor
) {}
968 * If a cursor type is currently cached locally for this widget, clear the
969 * cached cursor to force an update on the next SetCursor call.
972 virtual void ClearCachedCursor() = 0;
975 * Sets the cursor cursor for this widget.
977 * @param aDefaultCursor the default cursor to be set
978 * @param aCursorImage a custom cursor, maybe null.
979 * @param aX the X coordinate of the hotspot for aCursorImage (from left).
980 * @param aY the Y coordinate of the hotspot for aCursorImage (from top).
982 virtual void SetCursor(nsCursor aDefaultCursor
, imgIContainer
* aCursorImage
,
983 uint32_t aHotspotX
, uint32_t aHotspotY
) = 0;
986 * Get the window type of this widget.
988 nsWindowType
WindowType() { return mWindowType
; }
991 * Determines if this widget is one of the three types of plugin widgets.
994 return mWindowType
== eWindowType_plugin
||
995 mWindowType
== eWindowType_plugin_ipc_chrome
||
996 mWindowType
== eWindowType_plugin_ipc_content
;
1000 * Set the transparency mode of the top-level window containing this widget.
1001 * So, e.g., if you call this on the widget for an IFRAME, the top level
1002 * browser window containing the IFRAME actually gets set. Be careful.
1004 * This can fail if the platform doesn't support
1005 * transparency/glass. By default widgets are not
1006 * transparent. This will also fail if the toplevel window is not
1007 * a Mozilla window, e.g., if the widget is in an embedded
1010 * After transparency/glass has been enabled, the initial alpha channel
1011 * value for all pixels is 1, i.e., opaque.
1012 * If the window is resized then the alpha channel values for
1013 * all pixels are reset to 1.
1014 * Pixel RGB color values are already premultiplied with alpha channel values.
1016 virtual void SetTransparencyMode(nsTransparencyMode aMode
) = 0;
1019 * Get the transparency mode of the top-level window that contains this
1022 virtual nsTransparencyMode
GetTransparencyMode() = 0;
1025 * This represents a command to set the bounds and clip region of
1028 struct Configuration
{
1029 nsCOMPtr
<nsIWidget
> mChild
;
1030 uintptr_t mWindowID
; // e10s specific, the unique plugin port id
1031 bool mVisible
; // e10s specific, widget visibility
1032 LayoutDeviceIntRect mBounds
;
1033 nsTArray
<LayoutDeviceIntRect
> mClipRegion
;
1037 * Sets the clip region of each mChild (which must actually be a child
1038 * of this widget) to the union of the pixel rects given in
1039 * mClipRegion, all relative to the top-left of the child
1040 * widget. Clip regions are not implemented on all platforms and only
1041 * need to actually work for children that are plugins.
1043 * Also sets the bounds of each child to mBounds.
1045 * This will invalidate areas of the children that have changed, but
1046 * does not need to invalidate any part of this widget.
1048 * Children should be moved in the order given; the array is
1049 * sorted so to minimize unnecessary invalidation if children are
1050 * moved in that order.
1052 virtual nsresult
ConfigureChildren(
1053 const nsTArray
<Configuration
>& aConfigurations
) = 0;
1054 virtual nsresult
SetWindowClipRegion(
1055 const nsTArray
<LayoutDeviceIntRect
>& aRects
,
1056 bool aIntersectWithExisting
) = 0;
1059 * Appends to aRects the rectangles constituting this widget's clip
1060 * region. If this widget is not clipped, appends a single rectangle
1061 * (0, 0, bounds.width, bounds.height).
1063 virtual void GetWindowClipRegion(nsTArray
<LayoutDeviceIntRect
>* aRects
) = 0;
1066 * Register or unregister native plugin widgets which receive Configuration
1067 * data from the content process via the compositor.
1069 * Lookups are used by the main thread via the compositor to lookup widgets
1070 * based on a unique window id. On Windows and Linux this is the
1071 * NS_NATIVE_PLUGIN_PORT (hwnd/XID). This tracking maintains a reference to
1072 * widgets held. Consumers are responsible for removing widgets from this
1075 virtual void RegisterPluginWindowForRemoteUpdates() = 0;
1076 virtual void UnregisterPluginWindowForRemoteUpdates() = 0;
1077 static nsIWidget
* LookupRegisteredPluginWindow(uintptr_t aWindowID
);
1080 * Iterates across the list of registered plugin widgets and updates thier
1081 * visibility based on which plugins are included in the 'visible' list.
1083 * The compositor knows little about tabs, but it does know which plugin
1084 * widgets are currently included in the visible layer tree. It calls this
1085 * helper to hide widgets it knows nothing about.
1087 static void UpdateRegisteredPluginWindowVisibility(
1088 uintptr_t aOwnerWidget
, nsTArray
<uintptr_t>& aPluginIds
);
1092 * Iterates over the list of registered plugins and for any that are owned
1093 * by aOwnerWidget and visible it takes a snapshot.
1095 * @param aOwnerWidget only captures visible widgets owned by this
1097 static void CaptureRegisteredPlugins(uintptr_t aOwnerWidget
);
1100 * Take a scroll capture for this widget if possible.
1102 virtual void UpdateScrollCapture() = 0;
1105 * Creates an async ImageContainer to hold scroll capture images that can be
1106 * used if the plugin is hidden during scroll.
1107 * @return the async container ID of the created ImageContainer.
1109 virtual uint64_t CreateScrollCaptureContainer() = 0;
1113 * Set the shadow style of the window.
1115 * Ignored on child widgets and on non-Mac platforms.
1117 virtual void SetWindowShadowStyle(mozilla::StyleWindowShadow aStyle
) = 0;
1120 * Set the opacity of the window.
1121 * Values need to be between 0.0f (invisible) and 1.0f (fully opaque).
1123 * Ignored on child widgets and on non-Mac platforms.
1125 virtual void SetWindowOpacity(float aOpacity
) {}
1128 * Set the transform of the window. Values are in device pixels,
1129 * the origin is the top left corner of the window.
1131 * Ignored on child widgets and on non-Mac platforms.
1133 virtual void SetWindowTransform(const mozilla::gfx::Matrix
& aTransform
) {}
1136 * Set whether the window should ignore mouse events or not.
1138 * This is only used on popup windows.
1140 virtual void SetWindowMouseTransparent(bool aIsTransparent
) {}
1143 * On Mac OS X, this method shows or hides the pill button in the titlebar
1144 * that's used to collapse the toolbar.
1146 * Ignored on child widgets and on non-Mac platforms.
1148 virtual void SetShowsToolbarButton(bool aShow
) = 0;
1151 * On Mac OS X Lion, this method shows or hides the full screen button in
1152 * the titlebar that handles native full screen mode.
1154 * Ignored on child widgets, non-Mac platforms, & pre-Lion Mac.
1156 virtual void SetShowsFullScreenButton(bool aShow
) = 0;
1158 enum WindowAnimationType
{
1159 eGenericWindowAnimation
,
1160 eDocumentWindowAnimation
1164 * Sets the kind of top-level window animation this widget should have. On
1165 * Mac OS X, this causes a particular kind of animation to be shown when the
1166 * window is first made visible.
1168 * Ignored on child widgets and on non-Mac platforms.
1170 virtual void SetWindowAnimationType(WindowAnimationType aType
) = 0;
1173 * Specifies whether the window title should be drawn even if the window
1174 * contents extend into the titlebar. Ignored on windows that don't draw
1175 * in the titlebar. Only implemented on OS X.
1177 virtual void SetDrawsTitle(bool aDrawTitle
) {}
1180 * Indicates whether the widget should attempt to make titlebar controls
1181 * easier to see on dark titlebar backgrounds.
1183 virtual void SetUseBrightTitlebarForeground(bool aBrightForeground
) {}
1186 * Hide window chrome (borders, buttons) for this widget.
1189 virtual void HideWindowChrome(bool aShouldHide
) = 0;
1191 enum FullscreenTransitionStage
{
1192 eBeforeFullscreenToggle
,
1193 eAfterFullscreenToggle
1197 * Prepares for fullscreen transition and returns whether the widget
1198 * supports fullscreen transition. If this method returns false,
1199 * PerformFullscreenTransition() must never be called. Otherwise,
1200 * caller should call that method twice with "before" and "after"
1201 * stages respectively in order. In the latter case, this method may
1202 * return some data via aData pointer. Caller must pass that data to
1203 * PerformFullscreenTransition() if any, and caller is responsible
1204 * for releasing that data.
1206 virtual bool PrepareForFullscreenTransition(nsISupports
** aData
) = 0;
1209 * Performs fullscreen transition. This method returns immediately,
1210 * and will post aCallback to the main thread when the transition
1213 virtual void PerformFullscreenTransition(FullscreenTransitionStage aStage
,
1216 nsIRunnable
* aCallback
) = 0;
1219 * Perform any actions needed after the fullscreen transition has ended.
1221 virtual void CleanupFullscreenTransition() = 0;
1224 * Return the screen the widget is in, or null if we don't know.
1226 virtual already_AddRefed
<nsIScreen
> GetWidgetScreen() = 0;
1229 * Put the toplevel window into or out of fullscreen mode.
1230 * If aTargetScreen is given, attempt to go fullscreen on that screen,
1231 * if possible. (If not, it behaves as if aTargetScreen is null.)
1232 * If !aFullScreen, aTargetScreen is ignored.
1233 * aTargetScreen support is currently only implemented on Windows.
1235 * @return NS_OK if the widget is setup properly for fullscreen and
1236 * FullscreenChanged callback has been or will be called. If other
1237 * value is returned, the caller should continue the change itself.
1239 virtual nsresult
MakeFullScreen(bool aFullScreen
,
1240 nsIScreen
* aTargetScreen
= nullptr) = 0;
1243 * Same as MakeFullScreen, except that, on systems which natively
1244 * support fullscreen transition, calling this method explicitly
1245 * requests that behavior.
1246 * It is currently only supported on OS X 10.7+.
1248 virtual nsresult
MakeFullScreenWithNativeTransition(
1249 bool aFullScreen
, nsIScreen
* aTargetScreen
= nullptr) {
1250 return MakeFullScreen(aFullScreen
, aTargetScreen
);
1254 * Invalidate a specified rect for a widget so that it will be repainted
1257 virtual void Invalidate(const LayoutDeviceIntRect
& aRect
) = 0;
1259 enum LayerManagerPersistence
{
1260 LAYER_MANAGER_CURRENT
= 0,
1261 LAYER_MANAGER_PERSISTENT
1265 * Return the widget's LayerManager. The layer tree for that
1266 * LayerManager is what gets rendered to the widget.
1268 inline LayerManager
* GetLayerManager() {
1269 return GetLayerManager(nullptr, mozilla::layers::LayersBackend::LAYERS_NONE
,
1270 LAYER_MANAGER_CURRENT
);
1273 inline LayerManager
* GetLayerManager(LayerManagerPersistence aPersistence
) {
1274 return GetLayerManager(nullptr, mozilla::layers::LayersBackend::LAYERS_NONE
,
1279 * Like GetLayerManager(), but prefers creating a layer manager of
1280 * type |aBackendHint| instead of what would normally be created.
1281 * LayersBackend::LAYERS_NONE means "no hint".
1283 virtual LayerManager
* GetLayerManager(
1284 PLayerTransactionChild
* aShadowManager
, LayersBackend aBackendHint
,
1285 LayerManagerPersistence aPersistence
= LAYER_MANAGER_CURRENT
) = 0;
1288 * Called before each layer manager transaction to allow any preparation
1289 * for DrawWindowUnderlay/Overlay that needs to be on the main thread.
1291 * Always called on the main thread.
1293 virtual void PrepareWindowEffects() = 0;
1296 * Called on the main thread at the end of WebRender display list building.
1298 virtual void AddWindowOverlayWebRenderCommands(
1299 mozilla::layers::WebRenderBridgeChild
* aWrBridge
,
1300 mozilla::wr::DisplayListBuilder
& aBuilder
,
1301 mozilla::wr::IpcResourceUpdateQueue
& aResources
) {}
1304 * Called when Gecko knows which themed widgets exist in this window.
1305 * The passed array contains an entry for every themed widget of the right
1306 * type (currently only StyleAppearance::Toolbar) within the window, except
1307 * for themed widgets which are transformed or have effects applied to them
1308 * (e.g. CSS opacity or filters).
1309 * This could sometimes be called during display list construction
1310 * outside of painting.
1311 * If called during painting, it will be called before we actually
1314 virtual void UpdateThemeGeometries(
1315 const nsTArray
<ThemeGeometry
>& aThemeGeometries
) = 0;
1318 * Informs the widget about the region of the window that is opaque.
1320 * @param aOpaqueRegion the region of the window that is opaque.
1322 virtual void UpdateOpaqueRegion(const LayoutDeviceIntRegion
& aOpaqueRegion
) {}
1325 * Informs the widget about the region of the window that is draggable.
1327 virtual void UpdateWindowDraggingRegion(
1328 const LayoutDeviceIntRegion
& aRegion
) {}
1331 * Tells the widget whether the given input block results in a swipe.
1332 * Should be called in response to a WidgetWheelEvent that has
1333 * mFlags.mCanTriggerSwipe set on it.
1335 virtual void ReportSwipeStarted(uint64_t aInputBlockId
, bool aStartSwipe
) {}
1342 virtual void AddChild(nsIWidget
* aChild
) = 0;
1343 virtual void RemoveChild(nsIWidget
* aChild
) = 0;
1344 virtual void* GetNativeData(uint32_t aDataType
) = 0;
1345 virtual void SetNativeData(uint32_t aDataType
, uintptr_t aVal
) = 0;
1346 virtual void FreeNativeData(void* data
, uint32_t aDataType
) = 0; //~~~
1351 * Set the widget's title.
1352 * Must be called after Create.
1354 * @param aTitle string displayed as the title of the widget
1356 virtual nsresult
SetTitle(const nsAString
& aTitle
) = 0;
1359 * Set the widget's icon.
1360 * Must be called after Create.
1362 * @param aIconSpec string specifying the icon to use; convention is to
1363 * pass a resource: URL from which a platform-dependent
1364 * resource file name will be constructed
1366 virtual void SetIcon(const nsAString
& aIconSpec
) = 0;
1369 * Return this widget's origin in screen coordinates.
1371 * @return screen coordinates stored in the x,y members
1373 virtual LayoutDeviceIntPoint
WidgetToScreenOffset() = 0;
1376 * The same as WidgetToScreenOffset(), except in the case of
1377 * PuppetWidget where this method omits the chrome offset.
1379 virtual LayoutDeviceIntPoint
TopLevelWidgetToScreenOffset() {
1380 return WidgetToScreenOffset();
1384 * For a PuppetWidget, returns the transform from the coordinate
1385 * space of the PuppetWidget to the coordinate space of the
1386 * top-level native widget.
1388 * Identity transform in other cases.
1390 virtual mozilla::LayoutDeviceToLayoutDeviceMatrix4x4
1391 WidgetToTopLevelWidgetTransform() {
1392 return mozilla::LayoutDeviceToLayoutDeviceMatrix4x4();
1396 * Given the specified client size, return the corresponding window size,
1397 * which includes the area for the borders and titlebar. This method
1398 * should work even when the window is not yet visible.
1400 virtual LayoutDeviceIntSize
ClientToWindowSize(
1401 const LayoutDeviceIntSize
& aClientSize
) = 0;
1404 * Dispatches an event to the widget
1406 virtual nsresult
DispatchEvent(mozilla::WidgetGUIEvent
* event
,
1407 nsEventStatus
& aStatus
) = 0;
1410 * Dispatches an event to APZ only.
1411 * No-op in the child process.
1413 virtual void DispatchEventToAPZOnly(mozilla::WidgetInputEvent
* aEvent
) = 0;
1416 * Dispatches an event that must be handled by APZ first, when APZ is
1417 * enabled. If invoked in the child process, it is forwarded to the
1418 * parent process synchronously.
1420 virtual nsEventStatus
DispatchInputEvent(
1421 mozilla::WidgetInputEvent
* aEvent
) = 0;
1424 * Confirm an APZ-aware event target. This should be used when APZ will
1425 * not need a layers update to process the event.
1427 virtual void SetConfirmedTargetAPZC(
1428 uint64_t aInputBlockId
,
1429 const nsTArray
<ScrollableLayerGuid
>& aTargets
) const = 0;
1432 * Returns true if APZ is in use, false otherwise.
1434 virtual bool AsyncPanZoomEnabled() const = 0;
1437 * Enables the dropping of files to a widget.
1439 virtual void EnableDragDrop(bool aEnable
) = 0;
1440 virtual nsresult
AsyncEnableDragDrop(bool aEnable
) = 0;
1443 * Enables/Disables system mouse capture.
1444 * @param aCapture true enables mouse capture, false disables mouse capture
1447 virtual void CaptureMouse(bool aCapture
) = 0;
1450 * Classify the window for the window manager. Mostly for X11.
1452 virtual void SetWindowClass(const nsAString
& xulWinType
) = 0;
1455 * Enables/Disables system capture of any and all events that would cause a
1456 * popup to be rolled up. aListener should be set to a non-null value for
1457 * any popups that are not managed by the popup manager.
1458 * @param aDoCapture true enables capture, false disables capture
1461 virtual void CaptureRollupEvents(nsIRollupListener
* aListener
,
1462 bool aDoCapture
) = 0;
1465 * Bring this window to the user's attention. This is intended to be a more
1466 * gentle notification than popping the window to the top or putting up an
1467 * alert. See, for example, Win32 FlashWindow or the NotificationManager on
1468 * the Mac. The notification should be suppressed if the window is already
1469 * in the foreground and should be dismissed when the user brings this window
1470 * to the foreground.
1471 * @param aCycleCount Maximum number of times to animate the window per system
1472 * conventions. If set to -1, cycles indefinitely until
1473 * window is brought into the foreground.
1475 [[nodiscard
]] virtual nsresult
GetAttention(int32_t aCycleCount
) = 0;
1478 * Ask whether there user input events pending. All input events are
1479 * included, including those not targeted at this nsIwidget instance.
1481 virtual bool HasPendingInputEvent() = 0;
1484 * If set to true, the window will draw its contents into the titlebar
1485 * instead of below it.
1487 * Ignored on any platform that does not support it. Ignored by widgets that
1488 * do not represent windows.
1489 * May result in a resize event, so should only be called from places where
1490 * reflow and painting is allowed.
1492 * @param aState Whether drawing into the titlebar should be activated.
1494 virtual void SetDrawsInTitlebar(bool aState
) = 0;
1497 * Determine whether the widget shows a resize widget. If it does,
1498 * aResizerRect returns the resizer's rect.
1500 * Returns false on any platform that does not support it.
1502 * @param aResizerRect The resizer's rect in device pixels.
1503 * @return Whether a resize widget is shown.
1505 virtual bool ShowsResizeIndicator(LayoutDeviceIntRect
* aResizerRect
) = 0;
1508 * Begin a window resizing drag, based on the event passed in.
1510 [[nodiscard
]] virtual nsresult
BeginResizeDrag(
1511 mozilla::WidgetGUIEvent
* aEvent
, int32_t aHorizontal
,
1512 int32_t aVertical
) = 0;
1515 CAPS_LOCK
= 0x00000001, // when CapsLock is active
1516 NUM_LOCK
= 0x00000002, // when NumLock is active
1517 SHIFT_L
= 0x00000100,
1518 SHIFT_R
= 0x00000200,
1519 CTRL_L
= 0x00000400,
1520 CTRL_R
= 0x00000800,
1521 ALT_L
= 0x00001000, // includes Option
1523 COMMAND_L
= 0x00004000,
1524 COMMAND_R
= 0x00008000,
1526 ALTGRAPH
= 0x00020000, // AltGr key on Windows. This emulates
1527 // AltRight key behavior of keyboard
1528 // layouts which maps AltGr to AltRight
1530 FUNCTION
= 0x00100000,
1531 NUMERIC_KEY_PAD
= 0x01000000 // when the key is coming from the keypad
1534 * Utility method intended for testing. Dispatches native key events
1535 * to this widget to simulate the press and release of a key.
1536 * @param aNativeKeyboardLayout a *platform-specific* constant.
1537 * On Mac, this is the resource ID for a 'uchr' or 'kchr' resource.
1538 * On Windows, it is converted to a hex string and passed to
1539 * LoadKeyboardLayout, see
1540 * http://msdn.microsoft.com/en-us/library/ms646305(VS.85).aspx
1541 * @param aNativeKeyCode a *platform-specific* keycode.
1542 * On Windows, this is the virtual key code.
1543 * @param aModifiers some combination of the above 'Modifiers' flags;
1544 * not all flags will apply to all platforms. Mac ignores the _R
1545 * modifiers. Windows ignores COMMAND, NUMERIC_KEY_PAD, HELP and
1547 * @param aCharacters characters that the OS would decide to generate
1548 * from the event. On Windows, this is the charCode passed by
1550 * @param aUnmodifiedCharacters characters that the OS would decide
1551 * to generate from the event if modifier keys (other than shift)
1552 * were assumed inactive. Needed on Mac, ignored on Windows.
1553 * @param aObserver the observer that will get notified once the events
1554 * have been dispatched.
1555 * @return NS_ERROR_NOT_AVAILABLE to indicate that the keyboard
1556 * layout is not supported and the event was not fired
1558 virtual nsresult
SynthesizeNativeKeyEvent(
1559 int32_t aNativeKeyboardLayout
, int32_t aNativeKeyCode
,
1560 uint32_t aModifierFlags
, const nsAString
& aCharacters
,
1561 const nsAString
& aUnmodifiedCharacters
, nsIObserver
* aObserver
) = 0;
1564 * Utility method intended for testing. Dispatches native mouse events
1565 * may even move the mouse cursor. On Mac the events are guaranteed to
1566 * be sent to the window containing this widget, but on Windows they'll go
1567 * to whatever's topmost on the screen at that position, so for
1568 * cross-platform testing ensure that your window is at the top of the
1570 * @param aPoint screen location of the mouse, in device
1571 * pixels, with origin at the top left
1572 * @param aNativeMessage *platform-specific* event type (e.g. on Mac,
1573 * NSMouseMoved; on Windows, MOUSEEVENTF_MOVE, MOUSEEVENTF_LEFTDOWN etc)
1574 * @param aModifierFlags *platform-specific* modifier flags (ignored
1576 * @param aObserver the observer that will get notified once the events
1577 * have been dispatched.
1579 virtual nsresult
SynthesizeNativeMouseEvent(LayoutDeviceIntPoint aPoint
,
1580 uint32_t aNativeMessage
,
1581 uint32_t aModifierFlags
,
1582 nsIObserver
* aObserver
) = 0;
1585 * A shortcut to SynthesizeNativeMouseEvent, abstracting away the native
1586 * message. aPoint is location in device pixels to which the mouse pointer
1588 * @param aObserver the observer that will get notified once the events
1589 * have been dispatched.
1591 virtual nsresult
SynthesizeNativeMouseMove(LayoutDeviceIntPoint aPoint
,
1592 nsIObserver
* aObserver
) = 0;
1595 * Utility method intended for testing. Dispatching native mouse scroll
1596 * events may move the mouse cursor.
1598 * @param aPoint Mouse cursor position in screen coordinates.
1599 * In device pixels, the origin at the top left of
1600 * the primary display.
1601 * @param aNativeMessage Platform native message.
1602 * @param aDeltaX The delta value for X direction. If the native
1603 * message doesn't indicate X direction scrolling,
1604 * this may be ignored.
1605 * @param aDeltaY The delta value for Y direction. If the native
1606 * message doesn't indicate Y direction scrolling,
1607 * this may be ignored.
1608 * @param aDeltaZ The delta value for Z direction. If the native
1609 * message doesn't indicate Z direction scrolling,
1610 * this may be ignored.
1611 * @param aModifierFlags Must be values of Modifiers, or zero.
1612 * @param aAdditionalFlags See nsIDOMWidnowUtils' consts and their
1614 * @param aObserver The observer that will get notified once the
1615 * events have been dispatched.
1617 virtual nsresult
SynthesizeNativeMouseScrollEvent(
1618 LayoutDeviceIntPoint aPoint
, uint32_t aNativeMessage
, double aDeltaX
,
1619 double aDeltaY
, double aDeltaZ
, uint32_t aModifierFlags
,
1620 uint32_t aAdditionalFlags
, nsIObserver
* aObserver
) = 0;
1623 * TouchPointerState states for SynthesizeNativeTouchPoint. Match
1624 * touch states in nsIDOMWindowUtils.idl.
1626 enum TouchPointerState
{
1627 // The pointer is in a hover state above the digitizer
1628 TOUCH_HOVER
= (1 << 0),
1629 // The pointer is in contact with the digitizer
1630 TOUCH_CONTACT
= (1 << 1),
1631 // The pointer has been removed from the digitizer detection area
1632 TOUCH_REMOVE
= (1 << 2),
1633 // The pointer has been canceled. Will cancel any pending os level
1634 // gestures that would triggered as a result of completion of the
1635 // input sequence. This may not cancel moz platform related events
1636 // that might get tirggered by input already delivered.
1637 TOUCH_CANCEL
= (1 << 3),
1639 // ALL_BITS used for validity checking during IPC serialization
1640 ALL_BITS
= (1 << 4) - 1
1644 * Create a new or update an existing touch pointer on the digitizer.
1645 * To trigger os level gestures, individual touch points should
1646 * transition through a complete set of touch states which should be
1647 * sent as individual messages.
1649 * @param aPointerId The touch point id to create or update.
1650 * @param aPointerState one or more of the touch states listed above
1651 * @param aPoint coords of this event
1652 * @param aPressure 0.0 -> 1.0 float val indicating pressure
1653 * @param aOrientation 0 -> 359 degree value indicating the
1654 * orientation of the pointer. Use 90 for normal taps.
1655 * @param aObserver The observer that will get notified once the events
1656 * have been dispatched.
1658 virtual nsresult
SynthesizeNativeTouchPoint(uint32_t aPointerId
,
1659 TouchPointerState aPointerState
,
1660 LayoutDeviceIntPoint aPoint
,
1661 double aPointerPressure
,
1662 uint32_t aPointerOrientation
,
1663 nsIObserver
* aObserver
) = 0;
1666 * Helper for simulating a simple tap event with one touch point. When
1667 * aLongTap is true, simulates a native long tap with a duration equal to
1668 * ui.click_hold_context_menus.delay. This pref is compatible with the
1669 * apzc long tap duration. Defaults to 1.5 seconds.
1670 * @param aObserver The observer that will get notified once the events
1671 * have been dispatched.
1673 virtual nsresult
SynthesizeNativeTouchTap(LayoutDeviceIntPoint aPoint
,
1675 nsIObserver
* aObserver
);
1678 * Cancels all active simulated touch input points and pending long taps.
1679 * Native widgets should track existing points such that they can clear the
1680 * digitizer state when this call is made.
1681 * @param aObserver The observer that will get notified once the touch
1682 * sequence has been cleared.
1684 virtual nsresult
ClearNativeTouchSequence(nsIObserver
* aObserver
);
1686 virtual void StartAsyncScrollbarDrag(
1687 const AsyncDragMetrics
& aDragMetrics
) = 0;
1690 * Notify APZ to start autoscrolling.
1691 * @param aAnchorLocation the location of the autoscroll anchor
1692 * @param aGuid identifies the scroll frame to be autoscrolled
1693 * @return true if APZ has been successfully notified
1695 virtual bool StartAsyncAutoscroll(const ScreenPoint
& aAnchorLocation
,
1696 const ScrollableLayerGuid
& aGuid
) = 0;
1699 * Notify APZ to stop autoscrolling.
1700 * @param aGuid identifies the scroll frame which is being autoscrolled.
1702 virtual void StopAsyncAutoscroll(const ScrollableLayerGuid
& aGuid
) = 0;
1704 // If this widget supports out-of-process compositing, it can override
1705 // this method to provide additional information to the compositor.
1706 virtual void GetCompositorWidgetInitData(
1707 mozilla::widget::CompositorWidgetInitData
* aInitData
) {}
1710 * Setter/Getter of the system font setting for testing.
1712 virtual nsresult
SetSystemFont(const nsCString
& aFontName
) {
1713 return NS_ERROR_NOT_IMPLEMENTED
;
1715 virtual nsresult
GetSystemFont(nsCString
& aFontName
) {
1716 return NS_ERROR_NOT_IMPLEMENTED
;
1719 virtual nsresult
SetPrefersReducedMotionOverrideForTest(bool aValue
) {
1720 return NS_ERROR_NOT_IMPLEMENTED
;
1722 virtual nsresult
ResetPrefersReducedMotionOverrideForTest() {
1723 return NS_ERROR_NOT_IMPLEMENTED
;
1726 // Get rectangle of the screen where the window is placed.
1727 // It's used to detect popup overflow under Wayland because
1728 // Screenmanager does not work under it.
1730 virtual nsresult
GetScreenRect(LayoutDeviceIntRect
* aRect
) {
1731 return NS_ERROR_NOT_IMPLEMENTED
;
1736 * Get safe area insets except to cutout.
1737 * See https://drafts.csswg.org/css-env-1/#safe-area-insets.
1739 virtual mozilla::ScreenIntMargin
GetSafeAreaInsets() const {
1740 return mozilla::ScreenIntMargin();
1746 LongTapInfo(int32_t aPointerId
, LayoutDeviceIntPoint
& aPoint
,
1747 mozilla::TimeDuration aDuration
, nsIObserver
* aObserver
)
1748 : mPointerId(aPointerId
),
1750 mDuration(aDuration
),
1751 mObserver(aObserver
),
1752 mStamp(mozilla::TimeStamp::Now()) {}
1755 LayoutDeviceIntPoint mPosition
;
1756 mozilla::TimeDuration mDuration
;
1757 nsCOMPtr
<nsIObserver
> mObserver
;
1758 mozilla::TimeStamp mStamp
;
1761 static void OnLongTapTimerCallback(nsITimer
* aTimer
, void* aClosure
);
1763 static already_AddRefed
<nsIBidiKeyboard
> CreateBidiKeyboardContentProcess();
1764 static already_AddRefed
<nsIBidiKeyboard
> CreateBidiKeyboardInner();
1766 mozilla::UniquePtr
<LongTapInfo
> mLongTapTouchPoint
;
1767 nsCOMPtr
<nsITimer
> mLongTapTimer
;
1768 static int32_t sPointerIdCounter
;
1772 * If key events have not been handled by content or XBL handlers, they can
1773 * be offered to the system (for custom application shortcuts set in system
1774 * preferences, for example).
1776 virtual void PostHandleKeyEvent(mozilla::WidgetKeyboardEvent
* aEvent
);
1779 * Activates a native menu item at the position specified by the index
1780 * string. The index string is a string of positive integers separated
1781 * by the "|" (pipe) character. The last integer in the string represents
1782 * the item index in a submenu located using the integers preceding it.
1785 * In this string, the first integer represents the top-level submenu
1786 * in the native menu bar. Since the integer is 1, it is the second submeu
1787 * in the native menu bar. Within that, the first item (index 0) is a
1788 * submenu, and we want to activate the 5th item within that submenu.
1790 virtual nsresult
ActivateNativeMenuItemAt(const nsAString
& indexString
) = 0;
1793 * This is used for native menu system testing.
1795 * Updates a native menu at the position specified by the index string.
1796 * The index string is a string of positive integers separated by the "|"
1800 * In this string, the first integer represents the top-level submenu
1801 * in the native menu bar. Since the integer is 1, it is the second submeu
1802 * in the native menu bar. Within that, the first item (index 0) is a
1803 * submenu, and we want to update submenu at index 4 within that submenu.
1805 * If this is called with an empty string it forces a full reload of the
1808 virtual nsresult
ForceUpdateNativeMenuAt(const nsAString
& indexString
) = 0;
1811 * This is used for testing macOS service menu code.
1813 * @param aResult - the current text selection. Is empty if no selection.
1814 * @return nsresult - whether or not aResult was assigned the selected text.
1816 [[nodiscard
]] virtual nsresult
GetSelectionAsPlaintext(nsAString
& aResult
) {
1817 return NS_ERROR_NOT_IMPLEMENTED
;
1821 * Notify IME of the specified notification.
1823 * @return If the notification is mouse button event and it's consumed by
1824 * IME, this returns NS_SUCCESS_EVENT_CONSUMED.
1826 virtual nsresult
NotifyIME(const IMENotification
& aIMENotification
) = 0;
1829 * Start plugin IME. If this results in a string getting committed, the
1830 * result is in aCommitted (otherwise aCommitted is empty).
1832 * aKeyboardEvent The event with which plugin IME is to be started
1833 * panelX and panelY Location in screen coordinates of the IME input panel
1834 * (should be just under the plugin)
1835 * aCommitted The string committed during IME -- otherwise empty
1837 [[nodiscard
]] virtual nsresult
StartPluginIME(
1838 const mozilla::WidgetKeyboardEvent
& aKeyboardEvent
, int32_t aPanelX
,
1839 int32_t aPanelY
, nsString
& aCommitted
) = 0;
1842 * Tells the widget whether or not a plugin (inside the widget) has the
1843 * keyboard focus. Should be sent when the keyboard focus changes too or
1846 * aFocused Whether or not a plugin is focused
1848 virtual void SetPluginFocused(bool& aFocused
) = 0;
1851 * Tell the plugin has focus. It is unnecessary to use IPC
1853 bool PluginHasFocus() {
1854 return GetInputContext().mIMEState
.mEnabled
== IMEState::PLUGIN
;
1858 * Set IME candidate window position by windowless plugin.
1860 virtual void SetCandidateWindowForPlugin(
1861 const mozilla::widget::CandidateWindowPosition
& aPosition
) = 0;
1864 * Handle default action when PluginEvent isn't handled
1866 virtual void DefaultProcOfPluginEvent(
1867 const mozilla::WidgetPluginEvent
& aEvent
) = 0;
1870 * Enable or Disable IME by windowless plugin.
1872 virtual void EnableIMEForPlugin(bool aEnable
) {}
1875 * Notifies the input context changes.
1877 virtual void SetInputContext(const InputContext
& aContext
,
1878 const InputContextAction
& aAction
) = 0;
1881 * Get current input context.
1883 virtual InputContext
GetInputContext() = 0;
1886 * Get native IME context. This is different from GetNativeData() with
1887 * NS_RAW_NATIVE_IME_CONTEXT, the result is unique even if in a remote
1890 virtual NativeIMEContext
GetNativeIMEContext() = 0;
1893 * Given a WidgetKeyboardEvent, this method synthesizes a corresponding
1894 * native (OS-level) event for it. This method allows tests to simulate
1895 * keystrokes that trigger native key bindings (which require a native
1898 [[nodiscard
]] virtual nsresult
AttachNativeKeyEvent(
1899 mozilla::WidgetKeyboardEvent
& aEvent
) = 0;
1902 * Retrieve edit commands when the key combination of aEvent is used
1903 * in platform native applications.
1905 enum NativeKeyBindingsType
: uint8_t {
1906 NativeKeyBindingsForSingleLineEditor
,
1907 NativeKeyBindingsForMultiLineEditor
,
1908 NativeKeyBindingsForRichTextEditor
1910 virtual bool GetEditCommands(NativeKeyBindingsType aType
,
1911 const mozilla::WidgetKeyboardEvent
& aEvent
,
1912 nsTArray
<mozilla::CommandInt
>& aCommands
);
1915 * Retrieves a reference to notification requests of IME. Note that the
1916 * reference is valid while the nsIWidget instance is alive. So, if you
1917 * need to store the reference for a long time, you need to grab the widget
1920 const IMENotificationRequests
& IMENotificationRequestsRef();
1923 * Call this method when a dialog is opened which has a default button.
1924 * The button's rectangle should be supplied in aButtonRect.
1926 [[nodiscard
]] virtual nsresult
OnDefaultButtonLoaded(
1927 const LayoutDeviceIntRect
& aButtonRect
) = 0;
1930 * Return true if this process shouldn't use platform widgets, and
1931 * so should use PuppetWidgets instead. If this returns true, the
1932 * result of creating and using a platform widget is undefined,
1933 * and likely to end in crashes or other buggy behavior.
1935 static bool UsePuppetWidgets() { return XRE_IsContentProcess(); }
1937 static already_AddRefed
<nsIWidget
> CreateTopLevelWindow();
1939 static already_AddRefed
<nsIWidget
> CreateChildWindow();
1942 * Allocate and return a "puppet widget" that doesn't directly
1943 * correlate to a platform widget; platform events and data must
1944 * be fed to it. Currently used in content processes. NULL is
1945 * returned if puppet widgets aren't supported in this build
1946 * config, on this platform, or for this process type.
1948 * This function is called "Create" to match CreateInstance().
1949 * The returned widget must still be nsIWidget::Create()d.
1951 static already_AddRefed
<nsIWidget
> CreatePuppetWidget(
1952 BrowserChild
* aBrowserChild
);
1954 static already_AddRefed
<nsIWidget
> CreateHeadlessWidget();
1957 * Allocate and return a "plugin proxy widget", a subclass of PuppetWidget
1958 * used in wrapping a PPluginWidget connection for remote widgets. Note
1959 * this call creates the base object, it does not create the widget. Use
1960 * nsIWidget's Create to do this.
1962 static already_AddRefed
<nsIWidget
> CreatePluginProxyWidget(
1963 BrowserChild
* aBrowserChild
, mozilla::plugins::PluginWidgetChild
* aActor
);
1966 * Reparent this widget's native widget.
1967 * @param aNewParent the native widget of aNewParent is the new native
1970 virtual void ReparentNativeWidget(nsIWidget
* aNewParent
) = 0;
1973 * Return true if widget has it's own GL context
1975 virtual bool HasGLContext() { return false; }
1978 * Returns true to indicate that this widget paints an opaque background
1979 * that we want to be visible under the page, so layout should not force
1980 * a default background.
1982 virtual bool WidgetPaintsBackground() { return false; }
1984 virtual bool NeedsPaint() { return IsVisible() && !GetBounds().IsEmpty(); }
1987 * Get the natural bounds of this widget. This method is only
1988 * meaningful for widgets for which Gecko implements screen
1989 * rotation natively. When this is the case, GetBounds() returns
1990 * the widget bounds taking rotation into account, and
1991 * GetNaturalBounds() returns the bounds *not* taking rotation
1994 * No code outside of the composition pipeline should know or care
1995 * about this. If you're not an agent of the compositor, you
1996 * probably shouldn't call this method.
1998 virtual LayoutDeviceIntRect
GetNaturalBounds() { return GetBounds(); }
2001 * Set size constraints on the window size such that it is never less than
2002 * the specified minimum size and never larger than the specified maximum
2003 * size. The size constraints are sizes of the outer rectangle including
2004 * the window frame and title bar. Use 0 for an unconstrained minimum size
2005 * and NS_MAXSIZE for an unconstrained maximum size. Note that this method
2006 * does not necessarily change the size of a window to conform to this size,
2007 * thus Resize should be called afterwards.
2009 * @param aConstraints: the size constraints in device pixels
2011 virtual void SetSizeConstraints(const SizeConstraints
& aConstraints
) = 0;
2014 * Return the size constraints currently observed by the widget.
2016 * @return the constraints in device pixels
2018 virtual const SizeConstraints
GetSizeConstraints() = 0;
2021 * If this is owned by a BrowserChild, return that. Otherwise return
2024 virtual BrowserChild
* GetOwningBrowserChild() { return nullptr; }
2027 * If this isn't directly compositing to its window surface,
2028 * return the compositor which is doing that on our behalf.
2030 virtual CompositorBridgeChild
* GetRemoteRenderer() { return nullptr; }
2033 * If this widget has its own vsync source, return it, otherwise return
2034 * nullptr. An example of such local source would be Wayland frame callbacks.
2036 virtual RefPtr
<mozilla::gfx::VsyncSource
> GetVsyncSource() { return nullptr; }
2039 * Returns true if the widget requires synchronous repaints on resize,
2042 virtual bool SynchronouslyRepaintOnResize() { return true; }
2045 * Some platforms (only cocoa right now) round widget coordinates to the
2046 * nearest even pixels (see bug 892994), this function allows us to
2047 * determine how widget coordinates will be rounded.
2049 virtual int32_t RoundsWidgetCoordinatesTo() { return 1; }
2051 virtual void UpdateZoomConstraints(
2052 const uint32_t& aPresShellId
, const ScrollableLayerGuid::ViewID
& aViewId
,
2053 const mozilla::Maybe
<ZoomConstraints
>& aConstraints
){};
2056 * GetTextEventDispatcher() returns TextEventDispatcher belonging to the
2057 * widget. Note that this never returns nullptr.
2059 virtual TextEventDispatcher
* GetTextEventDispatcher() = 0;
2062 * GetNativeTextEventDispatcherListener() returns a
2063 * TextEventDispatcherListener instance which is used when the widget
2064 * instance handles native IME and/or keyboard events.
2066 virtual TextEventDispatcherListener
*
2067 GetNativeTextEventDispatcherListener() = 0;
2069 virtual void ZoomToRect(const uint32_t& aPresShellId
,
2070 const ScrollableLayerGuid::ViewID
& aViewId
,
2071 const CSSRect
& aRect
, const uint32_t& aFlags
) = 0;
2074 * OnWindowedPluginKeyEvent() is called when native key event is
2075 * received in the focused plugin process directly in PluginInstanceChild.
2077 * @param aKeyEventData The native key event data. The actual type
2078 * copied into NativeEventData depends on the
2079 * caller. Please check PluginInstanceChild.
2080 * @param aCallback Callback interface. When this returns
2081 * NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY,
2082 * the event handler has to call this callback.
2083 * Otherwise, the caller should do that instead.
2084 * @return NS_ERROR_* if this fails to handle the event.
2085 * NS_SUCCESS_EVENT_CONSUMED if the key event is
2087 * NS_OK if the key event isn't consumed.
2088 * NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY if the
2089 * key event will be handled asynchronously.
2091 virtual nsresult
OnWindowedPluginKeyEvent(
2092 const mozilla::NativeEventData
& aKeyEventData
,
2093 nsIKeyEventInPluginCallback
* aCallback
);
2096 * LookUpDictionary shows the dictionary for the word around current point.
2098 * @param aText the word to look up dictiorary.
2099 * @param aFontRangeArray text decoration of aText
2100 * @param aIsVertical true if the word is vertical layout
2101 * @param aPoint top-left point of aText
2103 virtual void LookUpDictionary(
2104 const nsAString
& aText
,
2105 const nsTArray
<mozilla::FontRange
>& aFontRangeArray
,
2106 const bool aIsVertical
, const LayoutDeviceIntPoint
& aPoint
) {}
2108 virtual void RequestFxrOutput() {
2109 MOZ_ASSERT(false, "This function should only execute in Windows");
2112 #if defined(MOZ_WIDGET_ANDROID)
2114 * RecvToolbarAnimatorMessageFromCompositor receive message from compositor
2117 * @param aMessage message being sent to Android UI thread.
2119 virtual void RecvToolbarAnimatorMessageFromCompositor(int32_t aMessage
) = 0;
2122 * UpdateRootFrameMetrics steady state frame metrics send from compositor
2125 * @param aScrollOffset page scroll offset value in screen pixels.
2126 * @param aZoom current page zoom.
2128 virtual void UpdateRootFrameMetrics(const ScreenPoint
& aScrollOffset
,
2129 const CSSToScreenScale
& aZoom
) = 0;
2132 * RecvScreenPixels Buffer containing the pixel from the frame buffer. Used
2133 * for android robocop tests.
2135 * @param aMem shared memory containing the frame buffer pixels.
2136 * @param aSize size of the buffer in screen pixels.
2138 virtual void RecvScreenPixels(mozilla::ipc::Shmem
&& aMem
,
2139 const ScreenIntSize
& aSize
) = 0;
2141 virtual void UpdateDynamicToolbarMaxHeight(mozilla::ScreenIntCoord aHeight
) {}
2142 virtual mozilla::ScreenIntCoord
GetDynamicToolbarMaxHeight() const {
2147 static already_AddRefed
<nsIBidiKeyboard
> CreateBidiKeyboard();
2151 * Like GetDefaultScale, but taking into account only the system settings
2152 * and ignoring Gecko preferences.
2154 virtual double GetDefaultScaleInternal() { return 1.0; }
2156 // keep the list of children. We also keep track of our siblings.
2157 // The ownership model is as follows: parent holds a strong ref to
2158 // the first element of the list, and each element holds a strong
2159 // ref to the next element in the list. The prevsibling and
2160 // lastchild pointers are weak, which is fine as long as they are
2161 // maintained properly.
2162 nsCOMPtr
<nsIWidget
> mFirstChild
;
2163 nsIWidget
* MOZ_NON_OWNING_REF mLastChild
;
2164 nsCOMPtr
<nsIWidget
> mNextSibling
;
2165 nsIWidget
* MOZ_NON_OWNING_REF mPrevSibling
;
2166 // When Destroy() is called, the sub class should set this true.
2167 bool mOnDestroyCalled
;
2168 nsWindowType mWindowType
;
2172 NS_DEFINE_STATIC_IID_ACCESSOR(nsIWidget
, NS_IWIDGET_IID
)
2174 #endif // nsIWidget_h__