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/. */
|
2009-09-04 08:49:18 +04:00
|
|
|
|
2014-04-03 08:18:37 +04:00
|
|
|
#ifndef mozilla_dom_PaintRequest_h_
|
|
|
|
#define mozilla_dom_PaintRequest_h_
|
2009-09-04 08:49:18 +04:00
|
|
|
|
|
|
|
#include "nsIDOMPaintRequest.h"
|
|
|
|
#include "nsPresContext.h"
|
2011-08-22 13:14:13 +04:00
|
|
|
#include "nsIDOMEvent.h"
|
2012-06-19 06:30:09 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-06-13 19:18:30 +04:00
|
|
|
#include "nsWrapperCache.h"
|
2009-09-04 08:49:18 +04:00
|
|
|
|
2013-09-20 14:21:03 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2014-04-03 08:18:37 +04:00
|
|
|
|
2013-09-20 14:21:03 +04:00
|
|
|
class DOMRect;
|
2013-08-30 01:18:25 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class PaintRequest final : public nsIDOMPaintRequest
|
2015-03-27 21:52:19 +03:00
|
|
|
, public nsWrapperCache
|
2009-09-04 08:49:18 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-09-02 02:26:43 +04:00
|
|
|
explicit PaintRequest(nsIDOMEvent* aParent)
|
2012-12-22 12:16:55 +04:00
|
|
|
: mParent(aParent)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-12-22 12:04:33 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2014-04-03 08:18:37 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PaintRequest)
|
2009-09-04 08:49:18 +04:00
|
|
|
NS_DECL_NSIDOMPAINTREQUEST
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2012-12-22 12:04:33 +04:00
|
|
|
|
2012-12-22 12:16:55 +04:00
|
|
|
nsIDOMEvent* GetParentObject() const
|
|
|
|
{
|
|
|
|
return mParent;
|
|
|
|
}
|
|
|
|
|
2013-09-20 14:21:03 +04:00
|
|
|
already_AddRefed<DOMRect> ClientRect();
|
2012-12-22 12:16:55 +04:00
|
|
|
void GetReason(nsAString& aResult) const
|
|
|
|
{
|
|
|
|
aResult.AssignLiteral("repaint");
|
|
|
|
}
|
2009-09-04 08:49:18 +04:00
|
|
|
|
2017-02-17 01:50:58 +03:00
|
|
|
void SetRequest(const nsRect& aRequest)
|
2009-09-04 08:49:18 +04:00
|
|
|
{ mRequest = aRequest; }
|
|
|
|
|
|
|
|
private:
|
2014-04-03 08:18:37 +04:00
|
|
|
~PaintRequest() {}
|
2009-09-04 08:49:18 +04:00
|
|
|
|
2012-12-22 12:16:55 +04:00
|
|
|
nsCOMPtr<nsIDOMEvent> mParent;
|
2017-02-17 01:50:58 +03:00
|
|
|
nsRect mRequest;
|
2009-09-04 08:49:18 +04:00
|
|
|
};
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class PaintRequestList final : public nsISupports,
|
2015-03-27 21:52:19 +03:00
|
|
|
public nsWrapperCache
|
2009-09-04 08:49:18 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-09-02 02:26:43 +04:00
|
|
|
explicit PaintRequestList(nsIDOMEvent *aParent) : mParent(aParent)
|
2011-08-22 13:14:13 +04:00
|
|
|
{
|
|
|
|
}
|
2009-09-04 08:49:18 +04:00
|
|
|
|
2011-08-22 13:14:13 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2014-04-03 08:18:37 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PaintRequestList)
|
2017-07-06 15:00:35 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2011-08-22 13:14:13 +04:00
|
|
|
nsISupports* GetParentObject()
|
2009-09-04 08:49:18 +04:00
|
|
|
{
|
2011-08-22 13:14:13 +04:00
|
|
|
return mParent;
|
2009-09-04 08:49:18 +04:00
|
|
|
}
|
|
|
|
|
2014-04-03 08:18:37 +04:00
|
|
|
void Append(PaintRequest* aElement)
|
2012-12-22 12:04:33 +04:00
|
|
|
{
|
|
|
|
mArray.AppendElement(aElement);
|
|
|
|
}
|
2011-08-22 13:14:13 +04:00
|
|
|
|
2012-09-06 00:49:53 +04:00
|
|
|
uint32_t Length()
|
|
|
|
{
|
2012-12-22 12:04:33 +04:00
|
|
|
return mArray.Length();
|
2012-09-06 00:49:53 +04:00
|
|
|
}
|
|
|
|
|
2014-04-03 08:18:37 +04:00
|
|
|
PaintRequest* Item(uint32_t aIndex)
|
2012-09-06 00:49:53 +04:00
|
|
|
{
|
2012-12-22 12:04:33 +04:00
|
|
|
return mArray.SafeElementAt(aIndex);
|
2012-09-06 00:49:53 +04:00
|
|
|
}
|
2014-04-03 08:18:37 +04:00
|
|
|
PaintRequest* IndexedGetter(uint32_t aIndex, bool& aFound)
|
2012-09-06 00:49:53 +04:00
|
|
|
{
|
2012-12-22 12:04:33 +04:00
|
|
|
aFound = aIndex < mArray.Length();
|
2015-08-13 15:22:48 +03:00
|
|
|
if (!aFound) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return mArray.ElementAt(aIndex);
|
2012-09-06 00:49:53 +04:00
|
|
|
}
|
|
|
|
|
2009-09-04 08:49:18 +04:00
|
|
|
private:
|
2014-04-03 08:18:37 +04:00
|
|
|
~PaintRequestList() {}
|
2009-09-04 08:49:18 +04:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
nsTArray< RefPtr<PaintRequest> > mArray;
|
2011-08-22 13:14:13 +04:00
|
|
|
nsCOMPtr<nsIDOMEvent> mParent;
|
2009-09-04 08:49:18 +04:00
|
|
|
};
|
|
|
|
|
2014-04-03 08:18:37 +04:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_PaintRequest_h_
|