2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-11-19 17:05:34 -08:00
|
|
|
#ifndef nsDOMWindowUtils_h_
|
|
|
|
#define nsDOMWindowUtils_h_
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsWeakReference.h"
|
|
|
|
|
|
|
|
#include "nsIDOMWindowUtils.h"
|
2012-06-14 19:31:55 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-02-11 20:41:57 -08:00
|
|
|
#include "mozilla/BasicEvents.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsGlobalWindow;
|
2010-09-03 13:10:45 -07:00
|
|
|
class nsIPresShell;
|
2014-02-11 20:41:57 -08:00
|
|
|
class nsIWidget;
|
|
|
|
class nsPresContext;
|
2014-03-08 01:22:28 -08:00
|
|
|
class nsIDocument;
|
2014-06-18 17:57:51 -07:00
|
|
|
struct nsPoint;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-03-21 14:59:57 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
class LayerTransactionChild;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-04 20:21:08 -07:00
|
|
|
class nsTranslationNodeList MOZ_FINAL : public nsITranslationNodeList
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsTranslationNodeList()
|
|
|
|
{
|
|
|
|
mNodes.SetCapacity(1000);
|
|
|
|
mNodeIsRoot.SetCapacity(1000);
|
|
|
|
mLength = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSITRANSLATIONNODELIST
|
|
|
|
|
|
|
|
void AppendElement(nsIDOMNode* aElement, bool aIsRoot)
|
|
|
|
{
|
|
|
|
mNodes.AppendElement(aElement);
|
|
|
|
mNodeIsRoot.AppendElement(aIsRoot);
|
|
|
|
mLength++;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsTArray<nsCOMPtr<nsIDOMNode> > mNodes;
|
|
|
|
nsTArray<bool> mNodeIsRoot;
|
|
|
|
uint32_t mLength;
|
|
|
|
};
|
|
|
|
|
2012-06-14 19:31:55 -07:00
|
|
|
class nsDOMWindowUtils MOZ_FINAL : public nsIDOMWindowUtils,
|
|
|
|
public nsSupportsWeakReference
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsDOMWindowUtils(nsGlobalWindow *aWindow);
|
|
|
|
~nsDOMWindowUtils();
|
2012-04-01 19:23:51 -07:00
|
|
|
NS_DECL_ISUPPORTS
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECL_NSIDOMWINDOWUTILS
|
|
|
|
|
|
|
|
protected:
|
2012-04-01 19:23:51 -07:00
|
|
|
nsWeakPtr mWindow;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-07-18 19:23:48 -07:00
|
|
|
// If aOffset is non-null, it gets filled in with the offset of the root
|
|
|
|
// frame of our window to the nearest widget in the app units of our window.
|
|
|
|
// Add this offset to any event offset we're given to make it relative to the
|
|
|
|
// widget returned by GetWidget.
|
2012-07-30 07:20:58 -07:00
|
|
|
nsIWidget* GetWidget(nsPoint* aOffset = nullptr);
|
2009-09-22 19:31:37 -07:00
|
|
|
nsIWidget* GetWidgetForElement(nsIDOMElement* aElement);
|
2009-01-05 17:15:13 -08:00
|
|
|
|
2010-09-03 13:10:45 -07:00
|
|
|
nsIPresShell* GetPresShell();
|
2009-01-05 17:15:13 -08:00
|
|
|
nsPresContext* GetPresContext();
|
2014-03-08 01:22:28 -08:00
|
|
|
nsIDocument* GetDocument();
|
2014-03-21 14:59:57 -07:00
|
|
|
mozilla::layers::LayerTransactionChild* GetLayerTransaction();
|
2010-08-27 16:15:07 -07:00
|
|
|
|
|
|
|
NS_IMETHOD SendMouseEventCommon(const nsAString& aType,
|
|
|
|
float aX,
|
|
|
|
float aY,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aButton,
|
|
|
|
int32_t aClickCount,
|
|
|
|
int32_t aModifiers,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aIgnoreRootScrollFrame,
|
2012-08-14 07:27:39 -07:00
|
|
|
float aPressure,
|
|
|
|
unsigned short aInputSourceArg,
|
2013-02-05 13:40:34 -08:00
|
|
|
bool aToWindow,
|
2014-01-15 06:28:04 -08:00
|
|
|
bool *aPreventDefault,
|
|
|
|
bool aIsSynthesized);
|
2012-04-24 20:00:02 -07:00
|
|
|
|
2013-12-03 07:10:47 -08:00
|
|
|
NS_IMETHOD SendTouchEventCommon(const nsAString& aType,
|
|
|
|
uint32_t* aIdentifiers,
|
|
|
|
int32_t* aXs,
|
|
|
|
int32_t* aYs,
|
|
|
|
uint32_t* aRxs,
|
|
|
|
uint32_t* aRys,
|
|
|
|
float* aRotationAngles,
|
|
|
|
float* aForces,
|
|
|
|
uint32_t aCount,
|
|
|
|
int32_t aModifiers,
|
|
|
|
bool aIgnoreRootScrollFrame,
|
|
|
|
bool aToWindow,
|
|
|
|
bool* aPreventDefault);
|
|
|
|
|
|
|
|
|
2013-09-13 19:39:41 -07:00
|
|
|
static mozilla::Modifiers GetWidgetModifiers(int32_t aModifiers);
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
2012-11-19 17:05:34 -08:00
|
|
|
|
|
|
|
#endif
|