mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-18 14:56:07 +00:00
Bug 1321885 - Add CSSPixel::FromAppUnits(nscoord) and CSSPixel::ToAppUnits(CSSCoord). r=kats
MozReview-Commit-ID: 8V9gjVf35bC --HG-- extra : rebase_source : 7fc17e00fddbdbe4856c08a78729e8467a1f9571
This commit is contained in:
parent
71a6962e97
commit
6aa36c0f99
@ -194,6 +194,10 @@ struct CSSPixel {
|
||||
|
||||
// Conversions from app units
|
||||
|
||||
static CSSCoord FromAppUnits(nscoord aCoord) {
|
||||
return NSAppUnitsToFloatPixels(aCoord, float(AppUnitsPerCSSPixel()));
|
||||
}
|
||||
|
||||
static CSSPoint FromAppUnits(const nsPoint& aPoint) {
|
||||
return CSSPoint(NSAppUnitsToFloatPixels(aPoint.x, float(AppUnitsPerCSSPixel())),
|
||||
NSAppUnitsToFloatPixels(aPoint.y, float(AppUnitsPerCSSPixel())));
|
||||
@ -238,6 +242,10 @@ struct CSSPixel {
|
||||
|
||||
// Conversions to app units
|
||||
|
||||
static nscoord ToAppUnits(CSSCoord aCoord) {
|
||||
return NSToCoordRoundWithClamp(aCoord * float(AppUnitsPerCSSPixel()));
|
||||
}
|
||||
|
||||
static nsPoint ToAppUnits(const CSSPoint& aPoint) {
|
||||
return nsPoint(NSToCoordRoundWithClamp(aPoint.x * float(AppUnitsPerCSSPixel())),
|
||||
NSToCoordRoundWithClamp(aPoint.y * float(AppUnitsPerCSSPixel())));
|
||||
|
Loading…
x
Reference in New Issue
Block a user