2015-05-03 19:32:37 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 11:12:37 +00: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/. */
|
2004-06-20 16:42:13 +00:00
|
|
|
|
2012-11-20 01:05:34 +00:00
|
|
|
#ifndef nsDOMWindowUtils_h_
|
|
|
|
#define nsDOMWindowUtils_h_
|
|
|
|
|
2004-06-20 16:42:13 +00:00
|
|
|
#include "nsWeakReference.h"
|
|
|
|
|
|
|
|
#include "nsIDOMWindowUtils.h"
|
2012-06-15 02:31:55 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-02-12 04:41:57 +00:00
|
|
|
#include "mozilla/BasicEvents.h"
|
2004-06-20 16:42:13 +00:00
|
|
|
|
2004-12-10 19:48:22 +00:00
|
|
|
class nsGlobalWindow;
|
2010-09-03 20:10:45 +00:00
|
|
|
class nsIPresShell;
|
2014-02-12 04:41:57 +00:00
|
|
|
class nsIWidget;
|
|
|
|
class nsPresContext;
|
2014-03-08 09:22:28 +00:00
|
|
|
class nsIDocument;
|
2014-07-09 05:03:00 +00:00
|
|
|
class nsView;
|
2014-06-19 00:57:51 +00:00
|
|
|
struct nsPoint;
|
2004-06-20 16:42:13 +00:00
|
|
|
|
2014-03-21 21:59:57 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
class LayerTransactionChild;
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
2014-03-21 21:59:57 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class nsTranslationNodeList final : public nsITranslationNodeList
|
2014-04-05 03:21:08 +00:00
|
|
|
{
|
|
|
|
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:
|
2014-06-23 19:56:07 +00:00
|
|
|
~nsTranslationNodeList() {}
|
|
|
|
|
2014-04-05 03:21:08 +00:00
|
|
|
nsTArray<nsCOMPtr<nsIDOMNode> > mNodes;
|
|
|
|
nsTArray<bool> mNodeIsRoot;
|
|
|
|
uint32_t mLength;
|
|
|
|
};
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class nsDOMWindowUtils final : public nsIDOMWindowUtils,
|
2015-03-27 18:52:19 +00:00
|
|
|
public nsSupportsWeakReference
|
2004-06-20 16:42:13 +00:00
|
|
|
{
|
2015-01-28 06:27:31 +00:00
|
|
|
typedef mozilla::widget::TextEventDispatcher
|
|
|
|
TextEventDispatcher;
|
2004-06-20 16:42:13 +00:00
|
|
|
public:
|
2014-08-05 13:19:51 +00:00
|
|
|
explicit nsDOMWindowUtils(nsGlobalWindow *aWindow);
|
2012-04-02 02:23:51 +00:00
|
|
|
NS_DECL_ISUPPORTS
|
2004-06-20 16:42:13 +00:00
|
|
|
NS_DECL_NSIDOMWINDOWUTILS
|
|
|
|
|
|
|
|
protected:
|
2014-06-23 19:56:07 +00:00
|
|
|
~nsDOMWindowUtils();
|
|
|
|
|
2012-04-02 02:23:51 +00:00
|
|
|
nsWeakPtr mWindow;
|
2007-02-26 21:14:19 +00:00
|
|
|
|
2010-07-19 02:23:48 +00: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 14:20:58 +00:00
|
|
|
nsIWidget* GetWidget(nsPoint* aOffset = nullptr);
|
2009-09-23 02:31:37 +00:00
|
|
|
nsIWidget* GetWidgetForElement(nsIDOMElement* aElement);
|
2009-01-06 01:15:13 +00:00
|
|
|
|
2010-09-03 20:10:45 +00:00
|
|
|
nsIPresShell* GetPresShell();
|
2009-01-06 01:15:13 +00:00
|
|
|
nsPresContext* GetPresContext();
|
2014-03-08 09:22:28 +00:00
|
|
|
nsIDocument* GetDocument();
|
2014-03-21 21:59:57 +00:00
|
|
|
mozilla::layers::LayerTransactionChild* GetLayerTransaction();
|
2010-08-27 23:15:07 +00:00
|
|
|
|
|
|
|
NS_IMETHOD SendMouseEventCommon(const nsAString& aType,
|
|
|
|
float aX,
|
|
|
|
float aY,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aButton,
|
|
|
|
int32_t aClickCount,
|
|
|
|
int32_t aModifiers,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aIgnoreRootScrollFrame,
|
2012-08-14 14:27:39 +00:00
|
|
|
float aPressure,
|
|
|
|
unsigned short aInputSourceArg,
|
2013-02-05 21:40:34 +00:00
|
|
|
bool aToWindow,
|
2014-01-15 14:28:04 +00:00
|
|
|
bool *aPreventDefault,
|
|
|
|
bool aIsSynthesized);
|
2012-04-25 03:00:02 +00:00
|
|
|
|
2014-07-09 05:03:00 +00:00
|
|
|
NS_IMETHOD SendPointerEventCommon(const nsAString& aType,
|
|
|
|
float aX,
|
|
|
|
float aY,
|
|
|
|
int32_t aButton,
|
|
|
|
int32_t aClickCount,
|
|
|
|
int32_t aModifiers,
|
|
|
|
bool aIgnoreRootScrollFrame,
|
|
|
|
float aPressure,
|
|
|
|
unsigned short aInputSourceArg,
|
|
|
|
int32_t aPointerId,
|
|
|
|
int32_t aWidth,
|
|
|
|
int32_t aHeight,
|
|
|
|
int32_t aTiltX,
|
|
|
|
int32_t aTiltY,
|
|
|
|
bool aIsPrimary,
|
|
|
|
bool aIsSynthesized,
|
|
|
|
uint8_t aOptionalArgCount,
|
|
|
|
bool aToWindow,
|
|
|
|
bool* aPreventDefault);
|
|
|
|
|
2013-12-03 15:10:47 +00: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);
|
2004-06-20 16:42:13 +00:00
|
|
|
};
|
2012-11-20 01:05:34 +00:00
|
|
|
|
|
|
|
#endif
|