2012-12-22 00:16:55 -08: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/. */
|
2009-09-03 21:49:18 -07:00
|
|
|
|
2014-04-02 21:18:37 -07:00
|
|
|
#ifndef mozilla_dom_PaintRequest_h_
|
|
|
|
#define mozilla_dom_PaintRequest_h_
|
2009-09-03 21:49:18 -07:00
|
|
|
|
|
|
|
#include "nsIDOMPaintRequest.h"
|
|
|
|
#include "nsPresContext.h"
|
2011-08-22 02:14:13 -07:00
|
|
|
#include "nsIDOMEvent.h"
|
2012-06-18 19:30:09 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-06-13 08:18:30 -07:00
|
|
|
#include "nsWrapperCache.h"
|
2009-09-03 21:49:18 -07:00
|
|
|
|
2013-09-20 03:21:03 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2014-04-02 21:18:37 -07:00
|
|
|
|
2013-09-20 03:21:03 -07:00
|
|
|
class DOMRect;
|
2013-08-29 14:18:25 -07:00
|
|
|
|
2014-04-02 21:18:37 -07:00
|
|
|
class PaintRequest MOZ_FINAL : public nsIDOMPaintRequest
|
|
|
|
, public nsWrapperCache
|
2009-09-03 21:49:18 -07:00
|
|
|
{
|
|
|
|
public:
|
2014-09-01 15:26:43 -07:00
|
|
|
explicit PaintRequest(nsIDOMEvent* aParent)
|
2012-12-22 00:16:55 -08:00
|
|
|
: mParent(aParent)
|
|
|
|
{
|
|
|
|
mRequest.mFlags = 0;
|
|
|
|
}
|
|
|
|
|
2012-12-22 00:04:33 -08:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2014-04-02 21:18:37 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PaintRequest)
|
2009-09-03 21:49:18 -07:00
|
|
|
NS_DECL_NSIDOMPAINTREQUEST
|
|
|
|
|
2014-04-08 15:27:18 -07:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
2012-12-22 00:04:33 -08:00
|
|
|
|
2012-12-22 00:16:55 -08:00
|
|
|
nsIDOMEvent* GetParentObject() const
|
|
|
|
{
|
|
|
|
return mParent;
|
|
|
|
}
|
|
|
|
|
2013-09-20 03:21:03 -07:00
|
|
|
already_AddRefed<DOMRect> ClientRect();
|
2012-12-22 00:16:55 -08:00
|
|
|
void GetReason(nsAString& aResult) const
|
|
|
|
{
|
|
|
|
aResult.AssignLiteral("repaint");
|
|
|
|
}
|
2009-09-03 21:49:18 -07:00
|
|
|
|
|
|
|
void SetRequest(const nsInvalidateRequestList::Request& aRequest)
|
|
|
|
{ mRequest = aRequest; }
|
|
|
|
|
|
|
|
private:
|
2014-04-02 21:18:37 -07:00
|
|
|
~PaintRequest() {}
|
2009-09-03 21:49:18 -07:00
|
|
|
|
2012-12-22 00:16:55 -08:00
|
|
|
nsCOMPtr<nsIDOMEvent> mParent;
|
2009-09-03 21:49:18 -07:00
|
|
|
nsInvalidateRequestList::Request mRequest;
|
|
|
|
};
|
|
|
|
|
2014-04-02 21:18:37 -07:00
|
|
|
class PaintRequestList MOZ_FINAL : public nsISupports,
|
|
|
|
public nsWrapperCache
|
2009-09-03 21:49:18 -07:00
|
|
|
{
|
|
|
|
public:
|
2014-09-01 15:26:43 -07:00
|
|
|
explicit PaintRequestList(nsIDOMEvent *aParent) : mParent(aParent)
|
2011-08-22 02:14:13 -07:00
|
|
|
{
|
|
|
|
}
|
2009-09-03 21:49:18 -07:00
|
|
|
|
2011-08-22 02:14:13 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2014-04-02 21:18:37 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(PaintRequestList)
|
2009-09-03 21:49:18 -07:00
|
|
|
|
2014-04-08 15:27:18 -07:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
2011-08-22 02:14:13 -07:00
|
|
|
nsISupports* GetParentObject()
|
2009-09-03 21:49:18 -07:00
|
|
|
{
|
2011-08-22 02:14:13 -07:00
|
|
|
return mParent;
|
2009-09-03 21:49:18 -07:00
|
|
|
}
|
|
|
|
|
2014-04-02 21:18:37 -07:00
|
|
|
void Append(PaintRequest* aElement)
|
2012-12-22 00:04:33 -08:00
|
|
|
{
|
|
|
|
mArray.AppendElement(aElement);
|
|
|
|
}
|
2011-08-22 02:14:13 -07:00
|
|
|
|
2012-09-05 13:49:53 -07:00
|
|
|
uint32_t Length()
|
|
|
|
{
|
2012-12-22 00:04:33 -08:00
|
|
|
return mArray.Length();
|
2012-09-05 13:49:53 -07:00
|
|
|
}
|
|
|
|
|
2014-04-02 21:18:37 -07:00
|
|
|
PaintRequest* Item(uint32_t aIndex)
|
2012-09-05 13:49:53 -07:00
|
|
|
{
|
2012-12-22 00:04:33 -08:00
|
|
|
return mArray.SafeElementAt(aIndex);
|
2012-09-05 13:49:53 -07:00
|
|
|
}
|
2014-04-02 21:18:37 -07:00
|
|
|
PaintRequest* IndexedGetter(uint32_t aIndex, bool& aFound)
|
2012-09-05 13:49:53 -07:00
|
|
|
{
|
2012-12-22 00:04:33 -08:00
|
|
|
aFound = aIndex < mArray.Length();
|
|
|
|
return aFound ? mArray.ElementAt(aIndex) : nullptr;
|
2012-09-05 13:49:53 -07:00
|
|
|
}
|
|
|
|
|
2009-09-03 21:49:18 -07:00
|
|
|
private:
|
2014-04-02 21:18:37 -07:00
|
|
|
~PaintRequestList() {}
|
2009-09-03 21:49:18 -07:00
|
|
|
|
2014-04-02 21:18:37 -07:00
|
|
|
nsTArray< nsRefPtr<PaintRequest> > mArray;
|
2011-08-22 02:14:13 -07:00
|
|
|
nsCOMPtr<nsIDOMEvent> mParent;
|
2009-09-03 21:49:18 -07:00
|
|
|
};
|
|
|
|
|
2014-04-02 21:18:37 -07:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_PaintRequest_h_
|