Bug 1334957 part 3. Remove the use of IsCallerChrome() in NotifyPaintEvent. r=smaug

This commit is contained in:
Boris Zbarsky 2017-02-01 18:26:31 -05:00
Родитель 48f43b7f91
Коммит 9516d2d41d
3 изменённых файлов: 24 добавлений и 28 удалений

Просмотреть файл

@ -43,12 +43,9 @@ NS_IMPL_ADDREF_INHERITED(NotifyPaintEvent, Event)
NS_IMPL_RELEASE_INHERITED(NotifyPaintEvent, Event)
nsRegion
NotifyPaintEvent::GetRegion()
NotifyPaintEvent::GetRegion(SystemCallerGuarantee)
{
nsRegion r;
if (!nsContentUtils::IsCallerChrome()) {
return r;
}
for (uint32_t i = 0; i < mInvalidateRequests.Length(); ++i) {
r.Or(r, mInvalidateRequests[i].mRect);
r.SimplifyOutward(10);
@ -57,24 +54,24 @@ NotifyPaintEvent::GetRegion()
}
already_AddRefed<DOMRect>
NotifyPaintEvent::BoundingClientRect()
NotifyPaintEvent::BoundingClientRect(SystemCallerGuarantee aGuarantee)
{
RefPtr<DOMRect> rect = new DOMRect(ToSupports(this));
if (mPresContext) {
rect->SetLayoutRect(GetRegion().GetBounds());
rect->SetLayoutRect(GetRegion(aGuarantee).GetBounds());
}
return rect.forget();
}
already_AddRefed<DOMRectList>
NotifyPaintEvent::ClientRects()
NotifyPaintEvent::ClientRects(SystemCallerGuarantee aGuarantee)
{
nsISupports* parent = ToSupports(this);
RefPtr<DOMRectList> rectList = new DOMRectList(parent);
nsRegion r = GetRegion();
nsRegion r = GetRegion(aGuarantee);
for (auto iter = r.RectIter(); !iter.Done(); iter.Next()) {
RefPtr<DOMRect> rect = new DOMRect(parent);
rect->SetLayoutRect(iter.Get());
@ -85,17 +82,15 @@ NotifyPaintEvent::ClientRects()
}
already_AddRefed<PaintRequestList>
NotifyPaintEvent::PaintRequests()
NotifyPaintEvent::PaintRequests(SystemCallerGuarantee)
{
Event* parent = this;
RefPtr<PaintRequestList> requests = new PaintRequestList(parent);
if (nsContentUtils::IsCallerChrome()) {
for (uint32_t i = 0; i < mInvalidateRequests.Length(); ++i) {
RefPtr<PaintRequest> r = new PaintRequest(parent);
r->SetRequest(mInvalidateRequests[i]);
requests->Append(r);
}
for (uint32_t i = 0; i < mInvalidateRequests.Length(); ++i) {
RefPtr<PaintRequest> r = new PaintRequest(parent);
r->SetRequest(mInvalidateRequests[i]);
requests->Append(r);
}
return requests.forget();
@ -138,13 +133,13 @@ NotifyPaintEvent::Deserialize(const IPC::Message* aMsg, PickleIterator* aIter)
}
uint64_t
NotifyPaintEvent::TransactionId()
NotifyPaintEvent::TransactionId(SystemCallerGuarantee)
{
return mTransactionId;
}
DOMHighResTimeStamp
NotifyPaintEvent::PaintTimeStamp()
NotifyPaintEvent::PaintTimeStamp(SystemCallerGuarantee)
{
return mTimeStamp;
}

Просмотреть файл

@ -9,6 +9,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/NotifyPaintEventBinding.h"
#include "nsIDOMNotifyPaintEvent.h"
#include "nsPresContext.h"
@ -51,21 +52,21 @@ public:
return NotifyPaintEventBinding::Wrap(aCx, this, aGivenProto);
}
already_AddRefed<DOMRectList> ClientRects();
already_AddRefed<DOMRectList> ClientRects(SystemCallerGuarantee aGuarantee);
already_AddRefed<DOMRect> BoundingClientRect();
already_AddRefed<DOMRect> BoundingClientRect(SystemCallerGuarantee aGuarantee);
already_AddRefed<PaintRequestList> PaintRequests();
already_AddRefed<PaintRequestList> PaintRequests(SystemCallerGuarantee);
uint64_t TransactionId();
uint64_t TransactionId(SystemCallerGuarantee);
DOMHighResTimeStamp PaintTimeStamp();
DOMHighResTimeStamp PaintTimeStamp(SystemCallerGuarantee);
protected:
~NotifyPaintEvent() {}
private:
nsRegion GetRegion();
nsRegion GetRegion(SystemCallerGuarantee);
nsTArray<nsInvalidateRequestList::Request> mInvalidateRequests;
uint64_t mTransactionId;

Просмотреть файл

@ -16,22 +16,22 @@ interface NotifyPaintEvent : Event
* Get a list of rectangles which are affected. The rectangles are
* in CSS pixels relative to the viewport origin.
*/
[ChromeOnly]
[ChromeOnly, NeedsCallerType]
readonly attribute DOMRectList clientRects;
/**
* Get the bounding box of the rectangles which are affected. The rectangle
* is in CSS pixels relative to the viewport origin.
*/
[ChromeOnly]
[ChromeOnly, NeedsCallerType]
readonly attribute DOMRect boundingClientRect;
[ChromeOnly]
[ChromeOnly, NeedsCallerType]
readonly attribute PaintRequestList paintRequests;
[ChromeOnly]
[ChromeOnly, NeedsCallerType]
readonly attribute unsigned long long transactionId;
[ChromeOnly]
[ChromeOnly, NeedsCallerType]
readonly attribute DOMHighResTimeStamp paintTimeStamp;
};