Bug 1535585 - Make sure empty app unit rectangles get converted to empty pixel rectangles. r=jnicol

Differential Revision: https://phabricator.services.mozilla.com/D24800

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matt Woodrow 2019-03-29 14:44:55 +00:00
parent d443a85cfe
commit 2497edd2ee

View File

@ -1240,26 +1240,17 @@ class ContainerState {
return aRect.ScaleToNearestPixels(mParameters.mXScale, mParameters.mYScale,
mAppUnitsPerDevPixel);
}
nsIntRegion ScaleRegionToNearestPixels(const nsRegion& aRegion) const {
return aRegion.ScaleToNearestPixels(
mParameters.mXScale, mParameters.mYScale, mAppUnitsPerDevPixel);
}
nsIntRect ScaleToOutsidePixels(const nsRect& aRect,
bool aSnap = false) const {
if (aRect.IsEmpty()) {
return nsIntRect();
}
if (aSnap && mSnappingEnabled) {
return ScaleToNearestPixels(aRect);
}
return aRect.ScaleToOutsidePixels(mParameters.mXScale, mParameters.mYScale,
mAppUnitsPerDevPixel);
}
nsIntRegion ScaleToOutsidePixels(const nsRegion& aRegion,
bool aSnap = false) const {
if (aSnap && mSnappingEnabled) {
return ScaleRegionToNearestPixels(aRegion);
}
return aRegion.ScaleToOutsidePixels(
mParameters.mXScale, mParameters.mYScale, mAppUnitsPerDevPixel);
}
nsIntRect ScaleToInsidePixels(const nsRect& aRect, bool aSnap = false) const {
if (aSnap && mSnappingEnabled) {
return ScaleToNearestPixels(aRect);
@ -1267,7 +1258,10 @@ class ContainerState {
return aRect.ScaleToInsidePixels(mParameters.mXScale, mParameters.mYScale,
mAppUnitsPerDevPixel);
}
nsIntRegion ScaleRegionToNearestPixels(const nsRegion& aRegion) const {
return aRegion.ScaleToNearestPixels(
mParameters.mXScale, mParameters.mYScale, mAppUnitsPerDevPixel);
}
nsIntRegion ScaleRegionToInsidePixels(const nsRegion& aRegion,
bool aSnap = false) const {
if (aSnap && mSnappingEnabled) {
@ -1279,6 +1273,9 @@ class ContainerState {
nsIntRegion ScaleRegionToOutsidePixels(const nsRegion& aRegion,
bool aSnap = false) const {
if (aRegion.IsEmpty()) {
return nsIntRegion();
}
if (aSnap && mSnappingEnabled) {
return ScaleRegionToNearestPixels(aRegion);
}
@ -4877,7 +4874,7 @@ void ContainerState::ProcessDisplayItems(nsDisplayList* aList) {
nsIntRegion itemVisibleRegion = itemVisibleRect;
nsRegion tightBounds = item->GetTightBounds(mBuilder, &snap);
if (!tightBounds.IsEmpty()) {
itemVisibleRegion.AndWith(ScaleToOutsidePixels(tightBounds, snap));
itemVisibleRegion.AndWith(ScaleRegionToOutsidePixels(tightBounds, snap));
}
ContainerLayer* oldContainer = ownLayer->GetParent();