Bug 1025824 - Fix mHwcLayerMap handling r=sushil
[gecko.git] / dom / base / nsDOMWindowUtils.h
blobf104f0a4262690392d2e00e6690795d216f2b000
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"
15 class nsGlobalWindow;
16 class nsIPresShell;
17 class nsIWidget;
18 class nsPresContext;
19 class nsPoint;
20 class nsIDocument;
22 namespace mozilla {
23 namespace layers {
24 class LayerTransactionChild;
28 class nsTranslationNodeList MOZ_FINAL : public nsITranslationNodeList
30 public:
31 nsTranslationNodeList()
33 mNodes.SetCapacity(1000);
34 mNodeIsRoot.SetCapacity(1000);
35 mLength = 0;
38 NS_DECL_ISUPPORTS
39 NS_DECL_NSITRANSLATIONNODELIST
41 void AppendElement(nsIDOMNode* aElement, bool aIsRoot)
43 mNodes.AppendElement(aElement);
44 mNodeIsRoot.AppendElement(aIsRoot);
45 mLength++;
48 private:
49 nsTArray<nsCOMPtr<nsIDOMNode> > mNodes;
50 nsTArray<bool> mNodeIsRoot;
51 uint32_t mLength;
54 class nsDOMWindowUtils MOZ_FINAL : public nsIDOMWindowUtils,
55 public nsSupportsWeakReference
57 public:
58 nsDOMWindowUtils(nsGlobalWindow *aWindow);
59 ~nsDOMWindowUtils();
60 NS_DECL_ISUPPORTS
61 NS_DECL_NSIDOMWINDOWUTILS
63 protected:
64 nsWeakPtr mWindow;
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,
79 float aX,
80 float aY,
81 int32_t aButton,
82 int32_t aClickCount,
83 int32_t aModifiers,
84 bool aIgnoreRootScrollFrame,
85 float aPressure,
86 unsigned short aInputSourceArg,
87 bool aToWindow,
88 bool *aPreventDefault,
89 bool aIsSynthesized);
91 NS_IMETHOD SendTouchEventCommon(const nsAString& aType,
92 uint32_t* aIdentifiers,
93 int32_t* aXs,
94 int32_t* aYs,
95 uint32_t* aRxs,
96 uint32_t* aRys,
97 float* aRotationAngles,
98 float* aForces,
99 uint32_t aCount,
100 int32_t aModifiers,
101 bool aIgnoreRootScrollFrame,
102 bool aToWindow,
103 bool* aPreventDefault);
106 static mozilla::Modifiers GetWidgetModifiers(int32_t aModifiers);
109 #endif