Bug 503814. iframe contents shifted slightly due to rounding issue. r+sr=roc

This commit is contained in:
Timothy Nikkel 2009-07-29 18:10:50 -04:00
parent 21d72e721f
commit 5fff4ee2f4
5 changed files with 25 additions and 6 deletions

View File

@ -365,6 +365,11 @@ inline PRInt32 NSToIntRound(float aValue)
return NS_lroundf(aValue);
}
inline PRInt32 NSToIntRoundUp(float aValue)
{
return PRInt32(NS_floorf(aValue + 0.5f));
}
/*
* App Unit/Pixel conversions
*/

View File

@ -324,12 +324,12 @@ inline nsIntRect
nsRect::ToNearestPixels(nscoord aAppUnitsPerPixel) const
{
nsIntRect rect;
rect.x = NSToIntRound(NSAppUnitsToFloatPixels(x, float(aAppUnitsPerPixel)));
rect.y = NSToIntRound(NSAppUnitsToFloatPixels(y, float(aAppUnitsPerPixel)));
rect.width = NSToIntRound(NSAppUnitsToFloatPixels(XMost(),
float(aAppUnitsPerPixel))) - rect.x;
rect.height = NSToIntRound(NSAppUnitsToFloatPixels(YMost(),
float(aAppUnitsPerPixel))) - rect.y;
rect.x = NSToIntRoundUp(NSAppUnitsToFloatPixels(x, float(aAppUnitsPerPixel)));
rect.y = NSToIntRoundUp(NSAppUnitsToFloatPixels(y, float(aAppUnitsPerPixel)));
rect.width = NSToIntRoundUp(NSAppUnitsToFloatPixels(XMost(),
float(aAppUnitsPerPixel))) - rect.x;
rect.height = NSToIntRoundUp(NSAppUnitsToFloatPixels(YMost(),
float(aAppUnitsPerPixel))) - rect.y;
return rect;
}

View File

@ -0,0 +1,6 @@
<html>
<body style="background-color: rgb(255,0,0)">
<iframe style="position: fixed; top: 11" src="data:text/html,<body style='background-color: rgba(0,0,255,0.5)'>">
</iframe>
</body>
</html>

View File

@ -0,0 +1,6 @@
<html>
<body style="background-color: rgb(255,0,0)">
<iframe style="position: fixed; top: 10.5" src="data:text/html,<body style='background-color: rgba(0,0,255,0.5)'>">
</iframe>
</body>
</html>

View File

@ -175,3 +175,5 @@ fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") == background-image-tiling.html background
!= border-image-width-0.html border-image-width-10.html
== border-image-width-4.html border-image-width-0.html
== border-image-width-9.html border-image-width-0.html
== iframe-1.html iframe-1-ref.html