dom/base/nsDOMWindowUtils.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/base/nsDOMWindowUtils.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,109 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef nsDOMWindowUtils_h_
    1.10 +#define nsDOMWindowUtils_h_
    1.11 +
    1.12 +#include "nsWeakReference.h"
    1.13 +
    1.14 +#include "nsIDOMWindowUtils.h"
    1.15 +#include "mozilla/Attributes.h"
    1.16 +#include "mozilla/BasicEvents.h"
    1.17 +
    1.18 +class nsGlobalWindow;
    1.19 +class nsIPresShell;
    1.20 +class nsIWidget;
    1.21 +class nsPresContext;
    1.22 +class nsPoint;
    1.23 +class nsIDocument;
    1.24 +
    1.25 +namespace mozilla {
    1.26 +  namespace layers {
    1.27 +    class LayerTransactionChild;
    1.28 +  }
    1.29 +}
    1.30 +
    1.31 +class nsTranslationNodeList MOZ_FINAL : public nsITranslationNodeList
    1.32 +{
    1.33 +public:
    1.34 +  nsTranslationNodeList()
    1.35 +  {
    1.36 +    mNodes.SetCapacity(1000);
    1.37 +    mNodeIsRoot.SetCapacity(1000);
    1.38 +    mLength = 0;
    1.39 +  }
    1.40 +
    1.41 +  NS_DECL_ISUPPORTS
    1.42 +  NS_DECL_NSITRANSLATIONNODELIST
    1.43 +
    1.44 +  void AppendElement(nsIDOMNode* aElement, bool aIsRoot)
    1.45 +  {
    1.46 +    mNodes.AppendElement(aElement);
    1.47 +    mNodeIsRoot.AppendElement(aIsRoot);
    1.48 +    mLength++;
    1.49 +  }
    1.50 +
    1.51 +private:
    1.52 +  nsTArray<nsCOMPtr<nsIDOMNode> > mNodes;
    1.53 +  nsTArray<bool> mNodeIsRoot;
    1.54 +  uint32_t mLength;
    1.55 +};
    1.56 +
    1.57 +class nsDOMWindowUtils MOZ_FINAL : public nsIDOMWindowUtils,
    1.58 +                                   public nsSupportsWeakReference
    1.59 +{
    1.60 +public:
    1.61 +  nsDOMWindowUtils(nsGlobalWindow *aWindow);
    1.62 +  ~nsDOMWindowUtils();
    1.63 +  NS_DECL_ISUPPORTS
    1.64 +  NS_DECL_NSIDOMWINDOWUTILS
    1.65 +
    1.66 +protected:
    1.67 +  nsWeakPtr mWindow;
    1.68 +
    1.69 +  // If aOffset is non-null, it gets filled in with the offset of the root
    1.70 +  // frame of our window to the nearest widget in the app units of our window.
    1.71 +  // Add this offset to any event offset we're given to make it relative to the
    1.72 +  // widget returned by GetWidget.
    1.73 +  nsIWidget* GetWidget(nsPoint* aOffset = nullptr);
    1.74 +  nsIWidget* GetWidgetForElement(nsIDOMElement* aElement);
    1.75 +
    1.76 +  nsIPresShell* GetPresShell();
    1.77 +  nsPresContext* GetPresContext();
    1.78 +  nsIDocument* GetDocument();
    1.79 +  mozilla::layers::LayerTransactionChild* GetLayerTransaction();
    1.80 +
    1.81 +  NS_IMETHOD SendMouseEventCommon(const nsAString& aType,
    1.82 +                                  float aX,
    1.83 +                                  float aY,
    1.84 +                                  int32_t aButton,
    1.85 +                                  int32_t aClickCount,
    1.86 +                                  int32_t aModifiers,
    1.87 +                                  bool aIgnoreRootScrollFrame,
    1.88 +                                  float aPressure,
    1.89 +                                  unsigned short aInputSourceArg,
    1.90 +                                  bool aToWindow,
    1.91 +                                  bool *aPreventDefault,
    1.92 +                                  bool aIsSynthesized);
    1.93 +
    1.94 +  NS_IMETHOD SendTouchEventCommon(const nsAString& aType,
    1.95 +                                  uint32_t* aIdentifiers,
    1.96 +                                  int32_t* aXs,
    1.97 +                                  int32_t* aYs,
    1.98 +                                  uint32_t* aRxs,
    1.99 +                                  uint32_t* aRys,
   1.100 +                                  float* aRotationAngles,
   1.101 +                                  float* aForces,
   1.102 +                                  uint32_t aCount,
   1.103 +                                  int32_t aModifiers,
   1.104 +                                  bool aIgnoreRootScrollFrame,
   1.105 +                                  bool aToWindow,
   1.106 +                                  bool* aPreventDefault);
   1.107 +
   1.108 +
   1.109 +  static mozilla::Modifiers GetWidgetModifiers(int32_t aModifiers);
   1.110 +};
   1.111 +
   1.112 +#endif

mercurial