Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef nsDOMWindowUtils_h_ |
michael@0 | 7 | #define nsDOMWindowUtils_h_ |
michael@0 | 8 | |
michael@0 | 9 | #include "nsWeakReference.h" |
michael@0 | 10 | |
michael@0 | 11 | #include "nsIDOMWindowUtils.h" |
michael@0 | 12 | #include "mozilla/Attributes.h" |
michael@0 | 13 | #include "mozilla/BasicEvents.h" |
michael@0 | 14 | |
michael@0 | 15 | class nsGlobalWindow; |
michael@0 | 16 | class nsIPresShell; |
michael@0 | 17 | class nsIWidget; |
michael@0 | 18 | class nsPresContext; |
michael@0 | 19 | class nsPoint; |
michael@0 | 20 | class nsIDocument; |
michael@0 | 21 | |
michael@0 | 22 | namespace mozilla { |
michael@0 | 23 | namespace layers { |
michael@0 | 24 | class LayerTransactionChild; |
michael@0 | 25 | } |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | class nsTranslationNodeList MOZ_FINAL : public nsITranslationNodeList |
michael@0 | 29 | { |
michael@0 | 30 | public: |
michael@0 | 31 | nsTranslationNodeList() |
michael@0 | 32 | { |
michael@0 | 33 | mNodes.SetCapacity(1000); |
michael@0 | 34 | mNodeIsRoot.SetCapacity(1000); |
michael@0 | 35 | mLength = 0; |
michael@0 | 36 | } |
michael@0 | 37 | |
michael@0 | 38 | NS_DECL_ISUPPORTS |
michael@0 | 39 | NS_DECL_NSITRANSLATIONNODELIST |
michael@0 | 40 | |
michael@0 | 41 | void AppendElement(nsIDOMNode* aElement, bool aIsRoot) |
michael@0 | 42 | { |
michael@0 | 43 | mNodes.AppendElement(aElement); |
michael@0 | 44 | mNodeIsRoot.AppendElement(aIsRoot); |
michael@0 | 45 | mLength++; |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | private: |
michael@0 | 49 | nsTArray<nsCOMPtr<nsIDOMNode> > mNodes; |
michael@0 | 50 | nsTArray<bool> mNodeIsRoot; |
michael@0 | 51 | uint32_t mLength; |
michael@0 | 52 | }; |
michael@0 | 53 | |
michael@0 | 54 | class nsDOMWindowUtils MOZ_FINAL : public nsIDOMWindowUtils, |
michael@0 | 55 | public nsSupportsWeakReference |
michael@0 | 56 | { |
michael@0 | 57 | public: |
michael@0 | 58 | nsDOMWindowUtils(nsGlobalWindow *aWindow); |
michael@0 | 59 | ~nsDOMWindowUtils(); |
michael@0 | 60 | NS_DECL_ISUPPORTS |
michael@0 | 61 | NS_DECL_NSIDOMWINDOWUTILS |
michael@0 | 62 | |
michael@0 | 63 | protected: |
michael@0 | 64 | nsWeakPtr mWindow; |
michael@0 | 65 | |
michael@0 | 66 | // If aOffset is non-null, it gets filled in with the offset of the root |
michael@0 | 67 | // frame of our window to the nearest widget in the app units of our window. |
michael@0 | 68 | // Add this offset to any event offset we're given to make it relative to the |
michael@0 | 69 | // widget returned by GetWidget. |
michael@0 | 70 | nsIWidget* GetWidget(nsPoint* aOffset = nullptr); |
michael@0 | 71 | nsIWidget* GetWidgetForElement(nsIDOMElement* aElement); |
michael@0 | 72 | |
michael@0 | 73 | nsIPresShell* GetPresShell(); |
michael@0 | 74 | nsPresContext* GetPresContext(); |
michael@0 | 75 | nsIDocument* GetDocument(); |
michael@0 | 76 | mozilla::layers::LayerTransactionChild* GetLayerTransaction(); |
michael@0 | 77 | |
michael@0 | 78 | NS_IMETHOD SendMouseEventCommon(const nsAString& aType, |
michael@0 | 79 | float aX, |
michael@0 | 80 | float aY, |
michael@0 | 81 | int32_t aButton, |
michael@0 | 82 | int32_t aClickCount, |
michael@0 | 83 | int32_t aModifiers, |
michael@0 | 84 | bool aIgnoreRootScrollFrame, |
michael@0 | 85 | float aPressure, |
michael@0 | 86 | unsigned short aInputSourceArg, |
michael@0 | 87 | bool aToWindow, |
michael@0 | 88 | bool *aPreventDefault, |
michael@0 | 89 | bool aIsSynthesized); |
michael@0 | 90 | |
michael@0 | 91 | NS_IMETHOD SendTouchEventCommon(const nsAString& aType, |
michael@0 | 92 | uint32_t* aIdentifiers, |
michael@0 | 93 | int32_t* aXs, |
michael@0 | 94 | int32_t* aYs, |
michael@0 | 95 | uint32_t* aRxs, |
michael@0 | 96 | uint32_t* aRys, |
michael@0 | 97 | float* aRotationAngles, |
michael@0 | 98 | float* aForces, |
michael@0 | 99 | uint32_t aCount, |
michael@0 | 100 | int32_t aModifiers, |
michael@0 | 101 | bool aIgnoreRootScrollFrame, |
michael@0 | 102 | bool aToWindow, |
michael@0 | 103 | bool* aPreventDefault); |
michael@0 | 104 | |
michael@0 | 105 | |
michael@0 | 106 | static mozilla::Modifiers GetWidgetModifiers(int32_t aModifiers); |
michael@0 | 107 | }; |
michael@0 | 108 | |
michael@0 | 109 | #endif |