Bug 1149215 - Remove nsLayoutUtils::GetWholeImageDestination that use unitless nsIntSize. r=dholbert

This commit is contained in:
Mats Palmgren 2015-04-03 19:48:12 +00:00
parent 8ed1fac872
commit b49cf5eed9
4 changed files with 12 additions and 21 deletions

View File

@ -208,6 +208,11 @@ struct CSSPixel {
NSToCoordRoundWithClamp(float(aPoint.y) * float(AppUnitsPerCSSPixel())));
}
static nsSize ToAppUnits(const CSSIntSize& aSize) {
return nsSize(NSToCoordRoundWithClamp(float(aSize.width) * float(AppUnitsPerCSSPixel())),
NSToCoordRoundWithClamp(float(aSize.height) * float(AppUnitsPerCSSPixel())));
}
static nsRect ToAppUnits(const CSSRect& aRect) {
return nsRect(NSToCoordRoundWithClamp(aRect.x * float(AppUnitsPerCSSPixel())),
NSToCoordRoundWithClamp(aRect.y * float(AppUnitsPerCSSPixel())),

View File

@ -6247,18 +6247,6 @@ nsLayoutUtils::GetWholeImageDestination(const nsSize& aWholeImageSize,
nsSize(wholeSizeX, wholeSizeY));
}
/* static */ nsRect
nsLayoutUtils::GetWholeImageDestination(const nsIntSize& aWholeImageSize,
const nsRect& aImageSourceArea,
const nsRect& aDestArea)
{
nscoord appUnitsPerCSSPixel = nsDeviceContext::AppUnitsPerCSSPixel();
return GetWholeImageDestination(nsSize(aWholeImageSize.width * appUnitsPerCSSPixel,
aWholeImageSize.height * appUnitsPerCSSPixel),
aImageSourceArea,
aDestArea);
}
/* static */ already_AddRefed<imgIContainer>
nsLayoutUtils::OrientImage(imgIContainer* aContainer,
const nsStyleImageOrientation& aOrientation)

View File

@ -135,6 +135,7 @@ public:
typedef FrameMetrics::ViewID ViewID;
typedef mozilla::CSSPoint CSSPoint;
typedef mozilla::CSSSize CSSSize;
typedef mozilla::CSSIntSize CSSIntSize;
typedef mozilla::ScreenMargin ScreenMargin;
typedef mozilla::LayoutDeviceIntSize LayoutDeviceIntSize;
@ -1802,7 +1803,7 @@ public:
* have less information about the frame tree.
*/
static void ComputeSizeForDrawing(imgIContainer* aImage,
mozilla::CSSIntSize& aImageSize,
CSSIntSize& aImageSize,
nsSize& aIntrinsicRatio,
bool& aGotWidth,
bool& aGotHeight);
@ -1815,7 +1816,7 @@ public:
* after trying all these methods, no value is available for one or both
* dimensions, the corresponding dimension of aFallbackSize is used instead.
*/
static mozilla::CSSIntSize
static CSSIntSize
ComputeSizeForDrawingWithFallback(imgIContainer* aImage,
const nsSize& aFallbackSize);
@ -1826,10 +1827,6 @@ public:
* the aDest parameter of DrawImage, when we want to draw a subimage
* of an overall image.
*/
static nsRect GetWholeImageDestination(const nsIntSize& aWholeImageSize,
const nsRect& aImageSourceArea,
const nsRect& aDestArea);
static nsRect GetWholeImageDestination(const nsSize& aWholeImageSize,
const nsRect& aImageSourceArea,
const nsRect& aDestArea);

View File

@ -3552,9 +3552,10 @@ nsTreeBodyFrame::PaintImage(int32_t aRowIndex,
// Essentially, we are scaling the image as dictated by the CSS destination
// height and width, and we are then clipping the scaled image by the cell
// width and height.
nsIntSize rawImageSize;
image->GetWidth(&rawImageSize.width);
image->GetHeight(&rawImageSize.height);
CSSIntSize rawImageCSSIntSize;
image->GetWidth(&rawImageCSSIntSize.width);
image->GetHeight(&rawImageCSSIntSize.height);
nsSize rawImageSize(CSSPixel::ToAppUnits(rawImageCSSIntSize));
nsRect wholeImageDest =
nsLayoutUtils::GetWholeImageDestination(rawImageSize, sourceRect,
nsRect(destRect.TopLeft(), imageDestSize));