mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-25 01:01:52 +00:00
b=893523 clamp CSS pixel to nscoord conversion to nscoord_MIN,MAX r=roc
--HG-- extra : transplant_source : P%87%C2l%86%9AWu%CD%06%E5%22%D3%88/%80a%CE%80p
This commit is contained in:
parent
6ae7b0b28c
commit
bd89481631
@ -106,20 +106,20 @@ struct CSSPixel {
|
||||
// Conversions to app units
|
||||
|
||||
static nsPoint ToAppUnits(const CSSPoint& aPoint) {
|
||||
return nsPoint(NSFloatPixelsToAppUnits(aPoint.x, float(nsDeviceContext::AppUnitsPerCSSPixel())),
|
||||
NSFloatPixelsToAppUnits(aPoint.y, float(nsDeviceContext::AppUnitsPerCSSPixel())));
|
||||
return nsPoint(NSToCoordRoundWithClamp(aPoint.x * float(nsDeviceContext::AppUnitsPerCSSPixel())),
|
||||
NSToCoordRoundWithClamp(aPoint.y * float(nsDeviceContext::AppUnitsPerCSSPixel())));
|
||||
}
|
||||
|
||||
static nsPoint ToAppUnits(const CSSIntPoint& aPoint) {
|
||||
return nsPoint(NSIntPixelsToAppUnits(aPoint.x, nsDeviceContext::AppUnitsPerCSSPixel()),
|
||||
NSIntPixelsToAppUnits(aPoint.y, nsDeviceContext::AppUnitsPerCSSPixel()));
|
||||
return nsPoint(NSToCoordRoundWithClamp(float(aPoint.x) * float(nsDeviceContext::AppUnitsPerCSSPixel())),
|
||||
NSToCoordRoundWithClamp(float(aPoint.y) * float(nsDeviceContext::AppUnitsPerCSSPixel())));
|
||||
}
|
||||
|
||||
static nsRect ToAppUnits(const CSSRect& aRect) {
|
||||
return nsRect(NSFloatPixelsToAppUnits(aRect.x, float(nsDeviceContext::AppUnitsPerCSSPixel())),
|
||||
NSFloatPixelsToAppUnits(aRect.y, float(nsDeviceContext::AppUnitsPerCSSPixel())),
|
||||
NSFloatPixelsToAppUnits(aRect.width, float(nsDeviceContext::AppUnitsPerCSSPixel())),
|
||||
NSFloatPixelsToAppUnits(aRect.height, float(nsDeviceContext::AppUnitsPerCSSPixel())));
|
||||
return nsRect(NSToCoordRoundWithClamp(aRect.x * float(nsDeviceContext::AppUnitsPerCSSPixel())),
|
||||
NSToCoordRoundWithClamp(aRect.y * float(nsDeviceContext::AppUnitsPerCSSPixel())),
|
||||
NSToCoordRoundWithClamp(aRect.width * float(nsDeviceContext::AppUnitsPerCSSPixel())),
|
||||
NSToCoordRoundWithClamp(aRect.height * float(nsDeviceContext::AppUnitsPerCSSPixel())));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -580,11 +580,11 @@ public:
|
||||
static int32_t AppUnitsPerCSSInch() { return nsDeviceContext::AppUnitsPerCSSInch(); }
|
||||
|
||||
static nscoord CSSPixelsToAppUnits(int32_t aPixels)
|
||||
{ return NSIntPixelsToAppUnits(aPixels,
|
||||
nsDeviceContext::AppUnitsPerCSSPixel()); }
|
||||
{ return NSToCoordRoundWithClamp(float(aPixels) *
|
||||
float(nsDeviceContext::AppUnitsPerCSSPixel())); }
|
||||
|
||||
static nscoord CSSPixelsToAppUnits(float aPixels)
|
||||
{ return NSFloatPixelsToAppUnits(aPixels,
|
||||
{ return NSToCoordRoundWithClamp(aPixels *
|
||||
float(nsDeviceContext::AppUnitsPerCSSPixel())); }
|
||||
|
||||
static int32_t AppUnitsToIntCSSPixels(nscoord aAppUnits)
|
||||
|
Loading…
Reference in New Issue
Block a user