Bug 472769: Use snapToPixels when redrawing dirty background rectangles, to fix painting error in widgets at fractional positions. r+sr=roc

This commit is contained in:
Daniel Holbert 2009-02-05 17:39:25 -08:00
parent b068e39978
commit 0deabefc86
9 changed files with 193 additions and 5 deletions

View File

@ -1365,8 +1365,6 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
// Compute the Thebes equivalent of the dirtyRect.
gfxRect dirtyRectGfx(RectToGfxRect(dirtyRect, appUnitsPerPixel));
dirtyRectGfx.Round();
dirtyRectGfx.Condition();
if (dirtyRectGfx.IsEmpty()) {
NS_WARNING("converted dirty rect should not be empty");
return;
@ -1404,7 +1402,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
// this far.)
if (!drawBackgroundImage) {
ctx->NewPath();
ctx->Rectangle(dirtyRectGfx);
ctx->Rectangle(dirtyRectGfx, PR_TRUE);
ctx->Fill();
return;
}
@ -1423,7 +1421,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
!(status & imgIRequest::STATUS_SIZE_AVAILABLE)) {
if (drawBackgroundColor) {
ctx->NewPath();
ctx->Rectangle(dirtyRectGfx);
ctx->Rectangle(dirtyRectGfx, PR_TRUE);
ctx->Fill();
}
return;
@ -1531,7 +1529,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
// even if the image isn't.
if (drawBackgroundColor) {
ctx->NewPath();
ctx->Rectangle(dirtyRectGfx);
ctx->Rectangle(dirtyRectGfx, PR_TRUE);
ctx->Fill();
}

View File

@ -0,0 +1,15 @@
<html>
<head>
<style>
body { margin: 0px; }
div {
margin-top: 1px;
margin-left: 1px;
height: 100px;
width: 100px;
background: black;
}
</style>
</head>
<body><div></div></body>
</html>

View File

@ -0,0 +1,14 @@
<html>
<head>
<style>
body { margin: 0px; }
div {
-moz-transform: translate(0.5px, 0.5px);
height: 100px;
width: 100px;
background: black;
}
</style>
</head>
<body><div></div></body>
</html>

View File

@ -0,0 +1,15 @@
<html>
<head>
<style>
body { margin: 0px; }
div {
margin-top: 0.5px;
margin-left: 0.5px;
height: 100px;
width: 100px;
background: black;
}
</style>
</head>
<body><div></div></body>
</html>

View File

@ -0,0 +1,36 @@
<html>
<head>
<style>
body { margin: 0px }
div.pt0 { -moz-transform:translateY(0.0px); }
div.pt1 { -moz-transform:translateY(0.1px); }
div.pt2 { -moz-transform:translateY(0.2px); }
div.pt3 { -moz-transform:translateY(0.3px); }
div.pt4 { -moz-transform:translateY(0.4px); }
div.pt5 { -moz-transform:translateY(0.5px); }
div.pt6 { -moz-transform:translateY(0.6px); }
div.pt7 { -moz-transform:translateY(0.7px); }
div.pt8 { -moz-transform:translateY(0.8px); }
div.pt9 { -moz-transform:translateY(0.9px); }
div.test {
border: 20px solid black;
width: 0px;
height: 0px;
display: inline-block;
margin-right: 4px;
}
</style>
</head>
<body
><div class="test pt0" ></div
><div class="test pt1" ></div
><div class="test pt2" ></div
><div class="test pt3" ></div
><div class="test pt4" ></div
><div class="test pt5" ></div
><div class="test pt6" ></div
><div class="test pt7" ></div
><div class="test pt8" ></div
><div class="test pt9" ></div
></body>
</html>

View File

@ -0,0 +1,36 @@
<html>
<head>
<style>
body { margin: 0px }
div.pt0 { -moz-transform:translateY(0.0px); }
div.pt1 { -moz-transform:translateY(0.1px); }
div.pt2 { -moz-transform:translateY(0.2px); }
div.pt3 { -moz-transform:translateY(0.3px); }
div.pt4 { -moz-transform:translateY(0.4px); }
div.pt5 { -moz-transform:translateY(0.5px); }
div.pt6 { -moz-transform:translateY(0.6px); }
div.pt7 { -moz-transform:translateY(0.7px); }
div.pt8 { -moz-transform:translateY(0.8px); }
div.pt9 { -moz-transform:translateY(0.9px); }
div.test {
background: black;
width: 40px;
height: 40px;
display: inline-block;
margin-right: 4px;
}
</style>
</head>
<body
><div class="test pt0" ></div
><div class="test pt1" ></div
><div class="test pt2" ></div
><div class="test pt3" ></div
><div class="test pt4" ></div
><div class="test pt5" ></div
><div class="test pt6" ></div
><div class="test pt7" ></div
><div class="test pt8" ></div
><div class="test pt9" ></div
></body>
</html>

View File

@ -0,0 +1,35 @@
<html>
<head>
<style>
body { margin: 0px }
div.pt0 { -moz-transform:translateX(0.0px); }
div.pt1 { -moz-transform:translateX(0.1px); }
div.pt2 { -moz-transform:translateX(0.2px); }
div.pt3 { -moz-transform:translateX(0.3px); }
div.pt4 { -moz-transform:translateX(0.4px); }
div.pt5 { -moz-transform:translateX(0.5px); }
div.pt6 { -moz-transform:translateX(0.6px); }
div.pt7 { -moz-transform:translateX(0.7px); }
div.pt8 { -moz-transform:translateX(0.8px); }
div.pt9 { -moz-transform:translateX(0.9px); }
div.test {
border: 20px solid black;
width: 0px;
height: 0px;
margin-bottom: 4px;
}
</style>
</head>
<body
><div class="test pt0" ></div
><div class="test pt1" ></div
><div class="test pt2" ></div
><div class="test pt3" ></div
><div class="test pt4" ></div
><div class="test pt5" ></div
><div class="test pt6" ></div
><div class="test pt7" ></div
><div class="test pt8" ></div
><div class="test pt9" ></div
></body>
</html>

View File

@ -0,0 +1,35 @@
<html>
<head>
<style>
body { margin: 0px }
div.pt0 { -moz-transform:translateX(0.0px); }
div.pt1 { -moz-transform:translateX(0.1px); }
div.pt2 { -moz-transform:translateX(0.2px); }
div.pt3 { -moz-transform:translateX(0.3px); }
div.pt4 { -moz-transform:translateX(0.4px); }
div.pt5 { -moz-transform:translateX(0.5px); }
div.pt6 { -moz-transform:translateX(0.6px); }
div.pt7 { -moz-transform:translateX(0.7px); }
div.pt8 { -moz-transform:translateX(0.8px); }
div.pt9 { -moz-transform:translateX(0.9px); }
div.test {
background: black;
width: 40px;
height: 40px;
margin-bottom: 4px;
}
</style>
</head>
<body
><div class="test pt0" ></div
><div class="test pt1" ></div
><div class="test pt2" ></div
><div class="test pt3" ></div
><div class="test pt4" ></div
><div class="test pt5" ></div
><div class="test pt6" ></div
><div class="test pt7" ></div
><div class="test pt8" ></div
><div class="test pt9" ></div
></body>
</html>

View File

@ -1032,6 +1032,10 @@ fails == 461512-1.html 461512-1-ref.html # Bug 461512
== 471356-1.html 471356-1-ref.html
== 471594-1.xhtml 471594-1-ref.html
== 472500-1.xul 472500-1-ref.xul
== 472769-1a.html 472769-1-ref.html
== 472769-1b.html 472769-1-ref.html
== 472769-2.html 472769-2-ref.html
== 472769-3.html 472769-3-ref.html
== 473847-1.xul 473847-1-ref.xul
== 474336-1.xul 474336-1-ref.xul
== 474417-1.html 474417-1-ref.html