Bug 735898. Part 2: When nsOverflowClipWrapper is asked to clip a display item that is entirely inside the clip rect, don't bother wrapping the item. r=mattwoodrow

This commit is contained in:
Robert O'Callahan 2012-04-11 16:48:56 +12:00
Родитель 0ba0c95279
Коммит 20226ccafe
1 изменённых файлов: 11 добавлений и 0 удалений

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

@ -1550,6 +1550,12 @@ public:
return new (aBuilder) nsDisplayClipRoundedRect(aBuilder, nsnull, aList,
mRect, mRadii);
}
bool snap;
if (!aList->IsEmpty() && !aList->GetBottom()->GetAbove() &&
mRect.Contains(aList->GetBottom()->GetBounds(aBuilder, &snap))) {
// Single list element which fits in the clip rect. No need to wrap it.
return aList->RemoveBottom();
}
return new (aBuilder) nsDisplayClip(aBuilder, nsnull, aList, mRect);
}
virtual nsDisplayItem* WrapItem(nsDisplayListBuilder* aBuilder,
@ -1561,6 +1567,11 @@ public:
return new (aBuilder) nsDisplayClipRoundedRect(aBuilder, f, aItem,
mRect, mRadii);
}
bool snap;
if (mRect.Contains(aItem->GetBounds(aBuilder, &snap))) {
// Item fits in the clip rect. No need to wrap it.
return aItem;
}
return new (aBuilder) nsDisplayClip(aBuilder, f, aItem, mRect);
}
return aItem;