2015-05-03 22:32:37 +03: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 15:12:37 +04: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 20:42:13 +04:00
|
|
|
|
2012-11-20 05:05:34 +04:00
|
|
|
#ifndef nsDOMWindowUtils_h_
|
|
|
|
#define nsDOMWindowUtils_h_
|
|
|
|
|
2004-06-20 20:42:13 +04:00
|
|
|
#include "nsWeakReference.h"
|
|
|
|
|
|
|
|
#include "nsIDOMWindowUtils.h"
|
2012-06-15 06:31:55 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-02-12 08:41:57 +04:00
|
|
|
#include "mozilla/BasicEvents.h"
|
2004-06-20 20:42:13 +04:00
|
|
|
|
2017-11-04 01:25:38 +03:00
|
|
|
class nsGlobalWindowOuter;
|
2014-02-12 08:41:57 +04:00
|
|
|
class nsIWidget;
|
|
|
|
class nsPresContext;
|
2014-07-09 09:03:00 +04:00
|
|
|
class nsView;
|
2014-06-19 04:57:51 +04:00
|
|
|
struct nsPoint;
|
2004-06-20 20:42:13 +04:00
|
|
|
|
2014-03-22 01:59:57 +04:00
|
|
|
namespace mozilla {
|
2019-04-13 04:03:13 +03:00
|
|
|
class PresShell;
|
2018-04-27 06:35:19 +03:00
|
|
|
namespace dom {
|
2019-01-02 16:05:23 +03:00
|
|
|
class Document;
|
2018-04-27 06:35:19 +03:00
|
|
|
class Element;
|
|
|
|
} // namespace dom
|
2014-03-22 01:59:57 +04:00
|
|
|
namespace layers {
|
|
|
|
class LayerTransactionChild;
|
2017-06-28 03:29:06 +03:00
|
|
|
class WebRenderBridgeChild;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsTranslationNodeList final : public nsITranslationNodeList {
|
2014-04-05 07:21:08 +04:00
|
|
|
public:
|
|
|
|
nsTranslationNodeList() {
|
|
|
|
mNodes.SetCapacity(1000);
|
|
|
|
mNodeIsRoot.SetCapacity(1000);
|
|
|
|
mLength = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSITRANSLATIONNODELIST
|
|
|
|
|
2018-05-30 05:58:49 +03:00
|
|
|
void AppendElement(nsINode* aElement, bool aIsRoot) {
|
2014-04-05 07:21:08 +04:00
|
|
|
mNodes.AppendElement(aElement);
|
|
|
|
mNodeIsRoot.AppendElement(aIsRoot);
|
|
|
|
mLength++;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2014-06-23 23:56:07 +04:00
|
|
|
~nsTranslationNodeList() {}
|
|
|
|
|
2018-05-30 05:58:49 +03:00
|
|
|
nsTArray<nsCOMPtr<nsINode> > mNodes;
|
2014-04-05 07:21:08 +04:00
|
|
|
nsTArray<bool> mNodeIsRoot;
|
|
|
|
uint32_t mLength;
|
|
|
|
};
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsDOMWindowUtils final : public nsIDOMWindowUtils,
|
2015-03-27 21:52:19 +03:00
|
|
|
public nsSupportsWeakReference {
|
2015-01-28 09:27:31 +03:00
|
|
|
typedef mozilla::widget::TextEventDispatcher TextEventDispatcher;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2004-06-20 20:42:13 +04:00
|
|
|
public:
|
2017-11-04 01:25:38 +03:00
|
|
|
explicit nsDOMWindowUtils(nsGlobalWindowOuter* aWindow);
|
2012-04-02 06:23:51 +04:00
|
|
|
NS_DECL_ISUPPORTS
|
2004-06-20 20:42:13 +04:00
|
|
|
NS_DECL_NSIDOMWINDOWUTILS
|
|
|
|
|
|
|
|
protected:
|
2014-06-23 23:56:07 +04:00
|
|
|
~nsDOMWindowUtils();
|
|
|
|
|
2012-04-02 06:23:51 +04:00
|
|
|
nsWeakPtr mWindow;
|
2007-02-27 00:14:19 +03:00
|
|
|
|
2010-07-19 06:23:48 +04: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 18:20:58 +04:00
|
|
|
nsIWidget* GetWidget(nsPoint* aOffset = nullptr);
|
2018-04-27 06:35:19 +03:00
|
|
|
nsIWidget* GetWidgetForElement(mozilla::dom::Element* aElement);
|
2009-01-06 04:15:13 +03:00
|
|
|
|
2019-04-13 04:03:13 +03:00
|
|
|
mozilla::PresShell* GetPresShell();
|
2009-01-06 04:15:13 +03:00
|
|
|
nsPresContext* GetPresContext();
|
2019-01-02 16:05:23 +03:00
|
|
|
mozilla::dom::Document* GetDocument();
|
2014-03-22 01:59:57 +04:00
|
|
|
mozilla::layers::LayerTransactionChild* GetLayerTransaction();
|
2017-06-28 03:29:06 +03:00
|
|
|
mozilla::layers::WebRenderBridgeChild* GetWebRenderBridge();
|
2019-03-18 21:23:14 +03:00
|
|
|
mozilla::layers::CompositorBridgeChild* GetCompositorBridge();
|
2010-08-28 03:15:07 +04:00
|
|
|
|
2018-01-29 22:35:17 +03:00
|
|
|
// Until callers are annotated.
|
2019-03-11 17:20:29 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT
|
2010-08-28 03:15:07 +04:00
|
|
|
NS_IMETHOD SendMouseEventCommon(
|
|
|
|
const nsAString& aType, float aX, float aY, int32_t aButton,
|
2011-09-29 10:19:26 +04:00
|
|
|
int32_t aClickCount, int32_t aModifiers, bool aIgnoreRootScrollFrame,
|
2012-08-14 18:27:39 +04:00
|
|
|
float aPressure, unsigned short aInputSourceArg, uint32_t aIdentifier,
|
2016-07-07 10:28:11 +03:00
|
|
|
bool aToWindow, bool* aPreventDefault, bool aIsDOMEventSynthesized,
|
2016-08-18 06:58:48 +03:00
|
|
|
bool aIsWidgetEventSynthesized, int32_t aButtons);
|
2012-04-25 07:00:02 +04:00
|
|
|
|
2019-03-11 17:20:29 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT
|
2019-05-10 12:03:39 +03:00
|
|
|
nsresult SendTouchEventCommon(
|
|
|
|
const nsAString& aType, const nsTArray<uint32_t>& aIdentifiers,
|
|
|
|
const nsTArray<int32_t>& aXs, const nsTArray<int32_t>& aYs,
|
|
|
|
const nsTArray<uint32_t>& aRxs, const nsTArray<uint32_t>& aRys,
|
|
|
|
const nsTArray<float>& aRotationAngles, const nsTArray<float>& aForces,
|
|
|
|
int32_t aModifiers, bool aIgnoreRootScrollFrame, bool aToWindow,
|
|
|
|
bool* aPreventDefault);
|
2004-06-20 20:42:13 +04:00
|
|
|
};
|
2012-11-20 05:05:34 +04:00
|
|
|
|
|
|
|
#endif
|