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 "nsPresContext.h"
|
2012-06-19 06:30:09 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2018-04-20 19:55:30 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
|
|
|
#include "mozilla/dom/Event.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
|
|
|
|
2018-02-08 19:24:03 +03:00
|
|
|
class PaintRequest final : public nsISupports, public nsWrapperCache {
|
2009-09-04 08:49:18 +04:00
|
|
|
public:
|
2018-04-20 19:55:30 +03:00
|
|
|
explicit PaintRequest(Event* aParent) : mParent(aParent) {}
|
2012-12-22 12:16:55 +04:00
|
|
|
|
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
|
|
|
|
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
|
|
|
|
2018-04-20 19:55:30 +03:00
|
|
|
Event* GetParentObject() const { return mParent; }
|
2012-12-22 12:16:55 +04:00
|
|
|
|
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) { mRequest = aRequest; }
|
2009-09-04 08:49:18 +04:00
|
|
|
|
|
|
|
private:
|
2020-02-20 18:56:28 +03:00
|
|
|
~PaintRequest() = default;
|
2009-09-04 08:49:18 +04:00
|
|
|
|
2018-04-20 19:55:30 +03:00
|
|
|
RefPtr<Event> 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, public nsWrapperCache {
|
2009-09-04 08:49:18 +04:00
|
|
|
public:
|
2018-04-20 19:55:30 +03:00
|
|
|
explicit PaintRequestList(Event* aParent) : mParent(aParent) {}
|
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() { return mParent; }
|
2009-09-04 08:49:18 +04:00
|
|
|
|
2014-04-03 08:18:37 +04:00
|
|
|
void Append(PaintRequest* aElement) { mArray.AppendElement(aElement); }
|
2011-08-22 13:14:13 +04:00
|
|
|
|
2012-12-22 12:04:33 +04:00
|
|
|
uint32_t Length() { return mArray.Length(); }
|
2012-09-06 00:49:53 +04:00
|
|
|
|
2012-12-22 12:04:33 +04:00
|
|
|
PaintRequest* Item(uint32_t aIndex) { return mArray.SafeElementAt(aIndex); }
|
2014-04-03 08:18:37 +04:00
|
|
|
PaintRequest* IndexedGetter(uint32_t aIndex, bool& aFound) {
|
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:
|
2020-02-20 18:56:28 +03:00
|
|
|
~PaintRequestList() = default;
|
2009-09-04 08:49:18 +04:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
nsTArray<RefPtr<PaintRequest> > mArray;
|
2018-04-20 19:55:30 +03:00
|
|
|
RefPtr<Event> 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_
|