diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 0f03edcbe0c..b12d2b256d7 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -729,7 +729,7 @@ nsPresContext::Init(nsIDeviceContext* aDeviceContext) mInitialized = PR_TRUE; #endif - float pixelsToTwips = PixelsToTwips(); + float pixelsToTwips = ScaledPixelsToTwips(); mBorderWidthTable[NS_STYLE_BORDER_WIDTH_THIN] = NSIntPixelsToTwips(1, pixelsToTwips); mBorderWidthTable[NS_STYLE_BORDER_WIDTH_MEDIUM] = NSIntPixelsToTwips(3, pixelsToTwips); mBorderWidthTable[NS_STYLE_BORDER_WIDTH_THICK] = NSIntPixelsToTwips(5, pixelsToTwips); diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h index ef91b34f23c..53e770a0706 100644 --- a/layout/base/nsPresContext.h +++ b/layout/base/nsPresContext.h @@ -388,6 +388,11 @@ public: */ NS_HIDDEN_(void) SetPageDim(const nsRect& aRect); + /** + * Conversion from device pixels to twips. + * WARNING: The misuse of this function to convert CSS pixels to twips + * will cause problems during printing + */ float PixelsToTwips() const { return mDeviceContext->DevUnitsToAppUnits(); } float TwipsToPixels() const { return mDeviceContext->AppUnitsToDevUnits(); } @@ -396,7 +401,7 @@ public: //XXX this is probably not an ideal name. MMP /** - * Do pixels to twips conversion taking into account + * Do CSS pixels to twips conversion taking into account * differing size of a "pixel" from device to device. */ NS_HIDDEN_(float) ScaledPixelsToTwips() const;