1 /* -*- Mode: C++; tab-width: 2; 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/. */
6 #ifndef nsDOMWindowUtils_h_
7 #define nsDOMWindowUtils_h_
9 #include "nsWeakReference.h"
11 #include "nsIDOMWindowUtils.h"
12 #include "mozilla/Attributes.h"
13 #include "mozilla/BasicEvents.h"
25 class LayerTransactionChild
;
29 class nsTranslationNodeList MOZ_FINAL
: public nsITranslationNodeList
32 nsTranslationNodeList()
34 mNodes
.SetCapacity(1000);
35 mNodeIsRoot
.SetCapacity(1000);
40 NS_DECL_NSITRANSLATIONNODELIST
42 void AppendElement(nsIDOMNode
* aElement
, bool aIsRoot
)
44 mNodes
.AppendElement(aElement
);
45 mNodeIsRoot
.AppendElement(aIsRoot
);
50 ~nsTranslationNodeList() {}
52 nsTArray
<nsCOMPtr
<nsIDOMNode
> > mNodes
;
53 nsTArray
<bool> mNodeIsRoot
;
57 class nsDOMWindowUtils MOZ_FINAL
: public nsIDOMWindowUtils
,
58 public nsSupportsWeakReference
61 explicit nsDOMWindowUtils(nsGlobalWindow
*aWindow
);
63 NS_DECL_NSIDOMWINDOWUTILS
70 // If aOffset is non-null, it gets filled in with the offset of the root
71 // frame of our window to the nearest widget in the app units of our window.
72 // Add this offset to any event offset we're given to make it relative to the
73 // widget returned by GetWidget.
74 nsIWidget
* GetWidget(nsPoint
* aOffset
= nullptr);
75 nsIWidget
* GetWidgetForElement(nsIDOMElement
* aElement
);
77 nsIPresShell
* GetPresShell();
78 nsPresContext
* GetPresContext();
79 nsIDocument
* GetDocument();
80 mozilla::layers::LayerTransactionChild
* GetLayerTransaction();
82 nsView
* GetViewToDispatchEvent(nsPresContext
* presContext
, nsIPresShell
** presShell
);
84 NS_IMETHOD
SendMouseEventCommon(const nsAString
& aType
,
90 bool aIgnoreRootScrollFrame
,
92 unsigned short aInputSourceArg
,
94 bool *aPreventDefault
,
97 NS_IMETHOD
SendPointerEventCommon(const nsAString
& aType
,
103 bool aIgnoreRootScrollFrame
,
105 unsigned short aInputSourceArg
,
113 uint8_t aOptionalArgCount
,
115 bool* aPreventDefault
);
117 NS_IMETHOD
SendTouchEventCommon(const nsAString
& aType
,
118 uint32_t* aIdentifiers
,
123 float* aRotationAngles
,
127 bool aIgnoreRootScrollFrame
,
129 bool* aPreventDefault
);
131 static mozilla::Modifiers
GetWidgetModifiers(int32_t aModifiers
);