Bug 1239864 (part 3) - Use the new rect iterators in docshell/ and dom/. r=baku.

This commit is contained in:
Nicholas Nethercote 2016-01-18 17:20:44 -08:00
parent 930b809f01
commit 4cf55819dc
3 changed files with 11 additions and 14 deletions

View File

@ -23,13 +23,13 @@ public:
void AddLayerRectangles(dom::Sequence<dom::ProfileTimelineLayerRect>& aRectangles)
{
nsIntRegionRectIterator it(mRegion);
while (const nsIntRect* iterRect = it.Next()) {
for (auto iter = mRegion.RectIter(); !iter.Done(); iter.Next()) {
const nsIntRect& iterRect = iter.Get();
dom::ProfileTimelineLayerRect rect;
rect.mX = iterRect->X();
rect.mY = iterRect->Y();
rect.mWidth = iterRect->Width();
rect.mHeight = iterRect->Height();
rect.mX = iterRect.X();
rect.mY = iterRect.Y();
rect.mWidth = iterRect.Width();
rect.mHeight = iterRect.Height();
aRectangles.AppendElement(rect, fallible);
}
}

View File

@ -84,11 +84,9 @@ NotifyPaintEvent::ClientRects()
RefPtr<DOMRectList> rectList = new DOMRectList(parent);
nsRegion r = GetRegion();
nsRegionRectIterator iter(r);
for (const nsRect* rgnRect = iter.Next(); rgnRect; rgnRect = iter.Next()) {
for (auto iter = r.RectIter(); !iter.Done(); iter.Next()) {
RefPtr<DOMRect> rect = new DOMRect(parent);
rect->SetLayoutRect(*rgnRect);
rect->SetLayoutRect(iter.Get());
rectList->Append(rect);
}

View File

@ -3871,10 +3871,9 @@ PluginInstanceChild::ReadbackDifferenceRect(const nsIntRect& rect)
// Subtract from mSurfaceDifferenceRect area which is overlapping with rect
nsIntRegion result;
result.Sub(mSurfaceDifferenceRect, nsIntRegion(rect));
nsIntRegionRectIterator iter(result);
const nsIntRect* r;
while ((r = iter.Next()) != nullptr) {
dt->CopySurface(source, *r, r->TopLeft());
for (auto iter = result.RectIter(); !iter.Done(); iter.Next()) {
const nsIntRect& r = iter.Get();
dt->CopySurface(source, r, r.TopLeft());
}
return true;