Bug 1456111 - Make sure an empty pixel rectangle gets converted to an empty app unit rectangle, regardless of scale factor. r=tnikkel

MozReview-Commit-ID: 1S59BARsMzZ

--HG--
extra : rebase_source : 76bf7f7809a267c0be74870217e2b9e2b0b43850
This commit is contained in:
Matt Woodrow 2018-06-21 15:34:25 +12:00
parent 4c17debbd5
commit f59c972b9c
3 changed files with 24 additions and 0 deletions

View File

@ -2315,6 +2315,10 @@ static void ConstrainToCoordValues(gfxFloat& aStart, gfxFloat& aSize)
nsRect
nsLayoutUtils::RoundGfxRectToAppRect(const Rect &aRect, float aFactor)
{
if (aRect.IsEmpty()) {
return nsRect();
}
/* Get a new Rect whose units are app units by scaling by the specified factor. */
Rect scaledRect = aRect;
scaledRect.ScaleRoundOut(aFactor);
@ -2331,6 +2335,10 @@ nsLayoutUtils::RoundGfxRectToAppRect(const Rect &aRect, float aFactor)
nsRect
nsLayoutUtils::RoundGfxRectToAppRect(const gfxRect &aRect, float aFactor)
{
if (aRect.IsEmpty()) {
return nsRect();
}
/* Get a new gfxRect whose units are app units by scaling by the specified factor. */
gfxRect scaledRect = aRect;
scaledRect.ScaleRoundOut(aFactor);
@ -3471,6 +3479,7 @@ nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame,
AUTO_PROFILER_LABEL("nsLayoutUtils::PaintFrame", GRAPHICS);
typedef RetainedDisplayListBuilder::PartialUpdateResult PartialUpdateResult;
#ifdef MOZ_DUMP_PAINTING
if (!gPaintCountStack) {
gPaintCountStack = new nsTArray<int>();

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html reftest-zoom="0.9" class="reftest-wait">
<meta charset="utf-8">
<body>
<div id="transformed" style="width:200px; height:200px; background-color:red; transform:scale(2)"></div>
</body>
<script>
function doTest() {
document.getElementById("transformed").style.transform = "scale(0)";
document.documentElement.removeAttribute("class");
}
window.addEventListener("MozReftestInvalidate", doTest);
</script>
</html>

View File

@ -2075,5 +2075,6 @@ fuzzy-if(Android,66,574) fuzzy-if(d2d,89,777) fuzzy-if(!Android&&!d2d,1,31219) =
pref(layout.css.moz-document.url-prefix-hack.enabled,true) == 1446470.html 1035091-ref.html
pref(layout.css.moz-document.url-prefix-hack.enabled,false) == 1446470-2.html 1035091-ref.html
test-pref(layout.css.prefixes.gradients,false) == 1451874.html 1451874-ref.html
== 1456111-1.html about:blank
fuzzy-if(!(webrender&&gtkWidget),1-2,17500-17500) == 1412375.html 1412375-ref.html
test-pref(layout.css.contain.enabled,false) == 1466008.html 1466008-ref.html