Bug 1442190 - Part 1: Add nsDisplayOpacityGeometry r=mattwoodrow

MozReview-Commit-ID: K7WqIlib10v

--HG--
extra : rebase_source : ccc6a2f531541b0d6dfce79bf0d1685cb9298f01
This commit is contained in:
Miko Mynttinen 2018-03-21 12:13:05 +01:00
Родитель 4e68a27bb1
Коммит 03a15b8df1
3 изменённых файлов: 34 добавлений и 4 удалений

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

@ -6640,6 +6640,20 @@ nsDisplayOpacity::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsDisplayWrapList::ComputeVisibility(aBuilder, &visibleUnderChildren);
}
void
nsDisplayOpacity::ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
const nsDisplayItemGeometry* aGeometry,
nsRegion* aInvalidRegion) const
{
const nsDisplayOpacityGeometry* geometry =
static_cast<const nsDisplayOpacityGeometry*>(aGeometry);
bool snap;
if (mOpacity != geometry->mOpacity) {
aInvalidRegion->Or(GetBounds(aBuilder, &snap), geometry->mBounds);
}
}
void
nsDisplayOpacity::WriteDebugInfo(std::stringstream& aStream)
{

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

@ -5201,12 +5201,15 @@ public:
return HasSameTypeAndClip(aItem) && HasSameContent(aItem);
}
virtual nsDisplayItemGeometry* AllocateGeometry(nsDisplayListBuilder* aBuilder) override
{
return new nsDisplayOpacityGeometry(this, aBuilder, mOpacity);
}
virtual void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
const nsDisplayItemGeometry* aGeometry,
nsRegion* aInvalidRegion) const override
{
// We don't need to compute an invalidation region since we have LayerTreeInvalidation
}
nsRegion* aInvalidRegion) const override;
virtual bool IsInvalid(nsRect& aRect) const override
{
if (mForEventsAndPluginsOnly) {

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

@ -353,4 +353,17 @@ public:
nsPoint mFrameOffsetToViewport;
};
class nsDisplayOpacityGeometry : public nsDisplayItemGenericGeometry
{
public:
nsDisplayOpacityGeometry(nsDisplayItem* aItem,
nsDisplayListBuilder* aBuilder,
float aOpacity)
: nsDisplayItemGenericGeometry(aItem, aBuilder)
, mOpacity(aOpacity)
{}
float mOpacity;
};
#endif /*NSDISPLAYLISTINVALIDATION_H_*/