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
|
|
|
|
|
|
|
#ifndef NSPAINTREQUEST_H_
|
|
|
|
#define NSPAINTREQUEST_H_
|
|
|
|
|
|
|
|
#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-12-22 00:16:55 -08:00
|
|
|
#include "nsClientRect.h"
|
2012-06-13 08:18:30 -07:00
|
|
|
#include "nsWrapperCache.h"
|
2009-09-03 21:49:18 -07:00
|
|
|
|
2012-06-18 19:30:09 -07:00
|
|
|
class nsPaintRequest MOZ_FINAL : public nsIDOMPaintRequest
|
2012-12-22 00:04:33 -08:00
|
|
|
, public nsWrapperCache
|
2009-09-03 21:49:18 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-12-22 00:16:55 -08:00
|
|
|
nsPaintRequest(nsIDOMEvent* aParent)
|
|
|
|
: mParent(aParent)
|
|
|
|
{
|
|
|
|
mRequest.mFlags = 0;
|
|
|
|
SetIsDOMBinding();
|
|
|
|
}
|
|
|
|
|
2012-12-22 00:04:33 -08:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsPaintRequest)
|
2009-09-03 21:49:18 -07:00
|
|
|
NS_DECL_NSIDOMPAINTREQUEST
|
|
|
|
|
2013-04-25 09:29:54 -07:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
|
2012-12-22 00:04:33 -08:00
|
|
|
|
2012-12-22 00:16:55 -08:00
|
|
|
nsIDOMEvent* GetParentObject() const
|
|
|
|
{
|
|
|
|
return mParent;
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<nsClientRect> ClientRect();
|
|
|
|
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:
|
|
|
|
~nsPaintRequest() {}
|
|
|
|
|
2012-12-22 00:16:55 -08:00
|
|
|
nsCOMPtr<nsIDOMEvent> mParent;
|
2009-09-03 21:49:18 -07:00
|
|
|
nsInvalidateRequestList::Request mRequest;
|
|
|
|
};
|
|
|
|
|
2013-07-10 03:01:29 -07:00
|
|
|
class nsPaintRequestList MOZ_FINAL : public nsISupports,
|
2011-08-22 02:14:13 -07:00
|
|
|
public nsWrapperCache
|
2009-09-03 21:49:18 -07:00
|
|
|
{
|
|
|
|
public:
|
2011-08-22 02:14:13 -07:00
|
|
|
nsPaintRequestList(nsIDOMEvent *aParent) : mParent(aParent)
|
|
|
|
{
|
2012-03-16 08:44:09 -07:00
|
|
|
SetIsDOMBinding();
|
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
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsPaintRequestList)
|
2009-09-03 21:49:18 -07:00
|
|
|
|
2013-07-10 03:01:29 -07:00
|
|
|
virtual JSObject* WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aScope) 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
|
|
|
}
|
|
|
|
|
2012-12-22 00:04:33 -08:00
|
|
|
void Append(nsPaintRequest* aElement)
|
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2012-12-22 00:04:33 -08:00
|
|
|
nsPaintRequest* 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
|
|
|
}
|
2012-12-22 00:04:33 -08:00
|
|
|
nsPaintRequest* 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:
|
|
|
|
~nsPaintRequestList() {}
|
|
|
|
|
2012-12-22 00:04:33 -08:00
|
|
|
nsTArray< nsRefPtr<nsPaintRequest> > mArray;
|
2011-08-22 02:14:13 -07:00
|
|
|
nsCOMPtr<nsIDOMEvent> mParent;
|
2009-09-03 21:49:18 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /*NSPAINTREQUEST_H_*/
|