Merge inbound to m-c on a CLOSED TREE.
[gecko.git] / dom / base / nsDOMWindowUtils.h
blob512b0837ef026b1251e066422c63d6243941301d
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"
14 class nsGlobalWindow;
15 class nsIPresShell;
17 class nsDOMWindowUtils MOZ_FINAL : public nsIDOMWindowUtils,
18 public nsSupportsWeakReference
20 public:
21 nsDOMWindowUtils(nsGlobalWindow *aWindow);
22 ~nsDOMWindowUtils();
23 NS_DECL_ISUPPORTS
24 NS_DECL_NSIDOMWINDOWUTILS
26 protected:
27 nsWeakPtr mWindow;
29 // If aOffset is non-null, it gets filled in with the offset of the root
30 // frame of our window to the nearest widget in the app units of our window.
31 // Add this offset to any event offset we're given to make it relative to the
32 // widget returned by GetWidget.
33 nsIWidget* GetWidget(nsPoint* aOffset = nullptr);
34 nsIWidget* GetWidgetForElement(nsIDOMElement* aElement);
36 nsIPresShell* GetPresShell();
37 nsPresContext* GetPresContext();
39 NS_IMETHOD SendMouseEventCommon(const nsAString& aType,
40 float aX,
41 float aY,
42 int32_t aButton,
43 int32_t aClickCount,
44 int32_t aModifiers,
45 bool aIgnoreRootScrollFrame,
46 float aPressure,
47 unsigned short aInputSourceArg,
48 bool aToWindow,
49 bool *aPreventDefault);
51 NS_IMETHOD SendTouchEventCommon(const nsAString& aType,
52 uint32_t* aIdentifiers,
53 int32_t* aXs,
54 int32_t* aYs,
55 uint32_t* aRxs,
56 uint32_t* aRys,
57 float* aRotationAngles,
58 float* aForces,
59 uint32_t aCount,
60 int32_t aModifiers,
61 bool aIgnoreRootScrollFrame,
62 bool aToWindow,
63 bool* aPreventDefault);
66 static mozilla::Modifiers GetWidgetModifiers(int32_t aModifiers);
69 #endif