Bug 726928 - UpdateCoveredRegion needs to convert 'extent' from CSS px now, not Dex px, otherwise painting invalidation is broken. r=dholbert.

This commit is contained in:
Jonathan Watt 2012-02-17 06:07:51 +00:00
parent 75f6c051a9
commit b39656ec06
7 changed files with 35 additions and 8 deletions

View File

@ -18,4 +18,5 @@ fails == xbl-grad-ref--grad-in-resources-02.svg pass.svg
== feImage-zoom-01a.svg feImage-zoom-01-ref.svg
== feImage-zoom-01b.svg feImage-zoom-01-ref.svg
== foreignObject-zoom-01.svg pass.svg
== zoom-invalidation-01.svg pass.svg
skip == zoomed-svg-with-viewBox-01.svg zoomed-svg-with-viewBox-01-ref.svg

View File

@ -0,0 +1,25 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg xmlns="http://www.w3.org/2000/svg"
reftest-zoom="1.5" class="reftest-wait">
<title>Test invalidation of zoomed SVG</title>
<!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=726928 -->
<script type="text/javascript">
document.addEventListener("MozReftestInvalidate", doTest, false);
function doTest() {
var redRect = document.getElementById('red-rect');
redRect.parentNode.removeChild(redRect);
document.documentElement.removeAttribute("class");
}
</script>
<rect width="100%" height="100%" fill="lime"/>
<rect id="red-rect" x="10" y="10" width="100" height="100" fill="red"/>
</svg>

After

Width:  |  Height:  |  Size: 740 B

View File

@ -364,7 +364,7 @@ nsSVGForeignObjectFrame::UpdateCoveredRegion()
// GetCanvasTM includes the x,y translation
mRect = nsLayoutUtils::RoundGfxRectToAppRect(
gfxRect(0.0, 0.0, w, h),
PresContext()->AppUnitsPerDevPixel());
PresContext()->AppUnitsPerCSSPixel());
mCoveredRegion = ToCanvasBounds(gfxRect(0.0, 0.0, w, h), GetCanvasTM(), PresContext());
return NS_OK;

View File

@ -491,7 +491,7 @@ nsSVGGlyphFrame::UpdateCoveredRegion()
if (!extent.IsEmpty()) {
mRect = nsLayoutUtils::RoundGfxRectToAppRect(extent,
PresContext()->AppUnitsPerDevPixel());
PresContext()->AppUnitsPerCSSPixel());
}
// See bug 614732 comment 32.

View File

@ -492,7 +492,7 @@ nsSVGImageFrame::UpdateCoveredRegion()
if (!extent.IsEmpty()) {
mRect = nsLayoutUtils::RoundGfxRectToAppRect(extent,
PresContext()->AppUnitsPerDevPixel());
PresContext()->AppUnitsPerCSSPixel());
}
// See bug 614732 comment 32.

View File

@ -217,7 +217,7 @@ nsSVGPathGeometryFrame::UpdateCoveredRegion()
nsSVGUtils::eBBoxIncludeStroke | nsSVGUtils::eBBoxIgnoreStrokeIfNone |
nsSVGUtils::eBBoxIncludeMarkers);
mRect = nsLayoutUtils::RoundGfxRectToAppRect(extent,
PresContext()->AppUnitsPerDevPixel());
PresContext()->AppUnitsPerCSSPixel());
// See bug 614732 comment 32.
mCoveredRegion = nsSVGUtils::TransformFrameRectToOuterSVG(

View File

@ -1185,12 +1185,13 @@ nsSVGUtils::TransformOuterSVGPointToChildFrame(nsPoint aPoint,
const gfxMatrix& aFrameToCanvasTM,
nsPresContext* aPresContext)
{
gfxMatrix devToUser = aFrameToCanvasTM;
devToUser.Invert();
NS_ABORT_IF_FALSE(!devToUser.IsSingular(), "should not get here");
NS_ABORT_IF_FALSE(!aFrameToCanvasTM.IsSingular(),
"Callers must not pass a singular matrix");
gfxMatrix canvasDevToFrameUserSpace = aFrameToCanvasTM;
canvasDevToFrameUserSpace.Invert();
gfxPoint devPt = gfxPoint(aPoint.x, aPoint.y) /
aPresContext->AppUnitsPerDevPixel();
gfxPoint userPt = devToUser.Transform(devPt).Round();
gfxPoint userPt = canvasDevToFrameUserSpace.Transform(devPt).Round();
gfxPoint appPt = userPt * aPresContext->AppUnitsPerCSSPixel();
userPt.x = clamped(appPt.x, gfxFloat(nscoord_MIN), gfxFloat(nscoord_MAX));
userPt.y = clamped(appPt.y, gfxFloat(nscoord_MIN), gfxFloat(nscoord_MAX));