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