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"
24 class LayerTransactionChild
;
28 class nsTranslationNodeList MOZ_FINAL
: public nsITranslationNodeList
31 nsTranslationNodeList()
33 mNodes
.SetCapacity(1000);
34 mNodeIsRoot
.SetCapacity(1000);
39 NS_DECL_NSITRANSLATIONNODELIST
41 void AppendElement(nsIDOMNode
* aElement
, bool aIsRoot
)
43 mNodes
.AppendElement(aElement
);
44 mNodeIsRoot
.AppendElement(aIsRoot
);
49 nsTArray
<nsCOMPtr
<nsIDOMNode
> > mNodes
;
50 nsTArray
<bool> mNodeIsRoot
;
54 class nsDOMWindowUtils MOZ_FINAL
: public nsIDOMWindowUtils
,
55 public nsSupportsWeakReference
58 nsDOMWindowUtils(nsGlobalWindow
*aWindow
);
61 NS_DECL_NSIDOMWINDOWUTILS
66 // If aOffset is non-null, it gets filled in with the offset of the root
67 // frame of our window to the nearest widget in the app units of our window.
68 // Add this offset to any event offset we're given to make it relative to the
69 // widget returned by GetWidget.
70 nsIWidget
* GetWidget(nsPoint
* aOffset
= nullptr);
71 nsIWidget
* GetWidgetForElement(nsIDOMElement
* aElement
);
73 nsIPresShell
* GetPresShell();
74 nsPresContext
* GetPresContext();
75 nsIDocument
* GetDocument();
76 mozilla::layers::LayerTransactionChild
* GetLayerTransaction();
78 NS_IMETHOD
SendMouseEventCommon(const nsAString
& aType
,
84 bool aIgnoreRootScrollFrame
,
86 unsigned short aInputSourceArg
,
88 bool *aPreventDefault
,
91 NS_IMETHOD
SendTouchEventCommon(const nsAString
& aType
,
92 uint32_t* aIdentifiers
,
97 float* aRotationAngles
,
101 bool aIgnoreRootScrollFrame
,
103 bool* aPreventDefault
);
106 static mozilla::Modifiers
GetWidgetModifiers(int32_t aModifiers
);