зеркало из https://github.com/mozilla/gecko-dev.git
changes for pixel scaling/printing.
This commit is contained in:
Родитель
5f6f52a7b2
Коммит
7a9e1a4bc1
|
@ -1462,7 +1462,8 @@ nsGenericHTMLElement::MapImageAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
if (nsnull != aAttributes) {
|
if (nsnull != aAttributes) {
|
||||||
nsHTMLValue value;
|
nsHTMLValue value;
|
||||||
|
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsStylePosition* pos = (nsStylePosition*)
|
nsStylePosition* pos = (nsStylePosition*)
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Position);
|
aContext->GetMutableStyleData(eStyleStruct_Position);
|
||||||
nsStyleSpacing* spacing = (nsStyleSpacing*)
|
nsStyleSpacing* spacing = (nsStyleSpacing*)
|
||||||
|
@ -1534,7 +1535,8 @@ nsGenericHTMLElement::MapImageAlignAttributeInto(nsIHTMLAttributes* aAttributes,
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Text);
|
aContext->GetMutableStyleData(eStyleStruct_Text);
|
||||||
nsStyleSpacing* spacing = (nsStyleSpacing*)
|
nsStyleSpacing* spacing = (nsStyleSpacing*)
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Spacing);
|
aContext->GetMutableStyleData(eStyleStruct_Spacing);
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsStyleCoord three(NSIntPixelsToTwips(3, p2t));
|
nsStyleCoord three(NSIntPixelsToTwips(3, p2t));
|
||||||
switch (align) {
|
switch (align) {
|
||||||
case NS_STYLE_TEXT_ALIGN_LEFT:
|
case NS_STYLE_TEXT_ALIGN_LEFT:
|
||||||
|
@ -1575,7 +1577,8 @@ nsGenericHTMLElement::MapImageBorderAttributesInto(nsIHTMLAttributes* aAttribute
|
||||||
value.SetPixelValue(2);
|
value.SetPixelValue(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t);
|
nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t);
|
||||||
|
|
||||||
// Fixup border-padding sums: subtract out the old size and then
|
// Fixup border-padding sums: subtract out the old size and then
|
||||||
|
|
|
@ -405,7 +405,7 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
// marginwidth/marginheight
|
// marginwidth/marginheight
|
||||||
// XXX: see ua.css for related code in the BODY rule
|
// XXX: see ua.css for related code in the BODY rule
|
||||||
float p2t;
|
float p2t;
|
||||||
p2t = aPresContext->GetPixelsToTwips();
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsStyleSpacing* spacing = (nsStyleSpacing*)
|
nsStyleSpacing* spacing = (nsStyleSpacing*)
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Spacing);
|
aContext->GetMutableStyleData(eStyleStruct_Spacing);
|
||||||
aAttributes->GetAttribute(nsHTMLAtoms::marginwidth, value);
|
aAttributes->GetAttribute(nsHTMLAtoms::marginwidth, value);
|
||||||
|
|
|
@ -222,7 +222,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
}
|
}
|
||||||
|
|
||||||
// width: pixel, percent
|
// width: pixel, percent
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsStylePosition* pos = (nsStylePosition*)
|
nsStylePosition* pos = (nsStylePosition*)
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Position);
|
aContext->GetMutableStyleData(eStyleStruct_Position);
|
||||||
aAttributes->GetAttribute(nsHTMLAtoms::width, value);
|
aAttributes->GetAttribute(nsHTMLAtoms::width, value);
|
||||||
|
|
|
@ -232,7 +232,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
|
|
||||||
nsHTMLValue value;
|
nsHTMLValue value;
|
||||||
|
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsStylePosition* pos = (nsStylePosition*)
|
nsStylePosition* pos = (nsStylePosition*)
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Position);
|
aContext->GetMutableStyleData(eStyleStruct_Position);
|
||||||
nsStyleSpacing* spacing = (nsStyleSpacing*)
|
nsStyleSpacing* spacing = (nsStyleSpacing*)
|
||||||
|
|
|
@ -245,7 +245,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
nsStyleSpacing* spacing = (nsStyleSpacing*)
|
nsStyleSpacing* spacing = (nsStyleSpacing*)
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Spacing);
|
aContext->GetMutableStyleData(eStyleStruct_Spacing);
|
||||||
|
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsStyleCoord three(NSIntPixelsToTwips(3, p2t));
|
nsStyleCoord three(NSIntPixelsToTwips(3, p2t));
|
||||||
switch (align) {
|
switch (align) {
|
||||||
case NS_STYLE_TEXT_ALIGN_LEFT:
|
case NS_STYLE_TEXT_ALIGN_LEFT:
|
||||||
|
|
|
@ -567,7 +567,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
case NS_FORM_INPUT_CHECKBOX:
|
case NS_FORM_INPUT_CHECKBOX:
|
||||||
case NS_FORM_INPUT_RADIO:
|
case NS_FORM_INPUT_RADIO:
|
||||||
{
|
{
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nscoord pad = NSIntPixelsToTwips(3, p2t);
|
nscoord pad = NSIntPixelsToTwips(3, p2t);
|
||||||
|
|
||||||
// add left and right padding around the radio button via css
|
// add left and right padding around the radio button via css
|
||||||
|
|
|
@ -350,7 +350,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
}
|
}
|
||||||
|
|
||||||
// width: pixel
|
// width: pixel
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsStylePosition* pos = (nsStylePosition*)
|
nsStylePosition* pos = (nsStylePosition*)
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Position);
|
aContext->GetMutableStyleData(eStyleStruct_Position);
|
||||||
aAttributes->GetAttribute(nsHTMLAtoms::width, widthValue);
|
aAttributes->GetAttribute(nsHTMLAtoms::width, widthValue);
|
||||||
|
|
|
@ -223,7 +223,6 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
NS_PRECONDITION(nsnull!=aPresContext, "bad presentation context arg");
|
NS_PRECONDITION(nsnull!=aPresContext, "bad presentation context arg");
|
||||||
if (nsnull != aAttributes) {
|
if (nsnull != aAttributes) {
|
||||||
|
|
||||||
float p2t;
|
|
||||||
nsHTMLValue value;
|
nsHTMLValue value;
|
||||||
nsStyleText* textStyle = nsnull;
|
nsStyleText* textStyle = nsnull;
|
||||||
|
|
||||||
|
@ -238,7 +237,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eHTMLUnit_Pixel:
|
case eHTMLUnit_Pixel:
|
||||||
p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
position->mWidth.SetCoordValue(NSIntPixelsToTwips(value.GetPixelValue(), p2t));
|
position->mWidth.SetCoordValue(NSIntPixelsToTwips(value.GetPixelValue(), p2t));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,7 +212,6 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
NS_PRECONDITION(nsnull!=aPresContext, "bad presentation context arg");
|
NS_PRECONDITION(nsnull!=aPresContext, "bad presentation context arg");
|
||||||
if (nsnull != aAttributes) {
|
if (nsnull != aAttributes) {
|
||||||
|
|
||||||
float p2t;
|
|
||||||
nsHTMLValue value;
|
nsHTMLValue value;
|
||||||
nsStyleText* textStyle = nsnull;
|
nsStyleText* textStyle = nsnull;
|
||||||
|
|
||||||
|
@ -227,7 +226,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eHTMLUnit_Pixel:
|
case eHTMLUnit_Pixel:
|
||||||
p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
position->mWidth.SetCoordValue(NSIntPixelsToTwips(value.GetPixelValue(), p2t));
|
position->mWidth.SetCoordValue(NSIntPixelsToTwips(value.GetPixelValue(), p2t));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -526,7 +526,8 @@ MapTableBorderInto(nsIHTMLAttributes* aAttributes,
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Spacing);
|
aContext->GetMutableStyleData(eStyleStruct_Spacing);
|
||||||
nsStyleTable *tableStyle = (nsStyleTable*)
|
nsStyleTable *tableStyle = (nsStyleTable*)
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Table);
|
aContext->GetMutableStyleData(eStyleStruct_Table);
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsStyleCoord twips;
|
nsStyleCoord twips;
|
||||||
if (borderValue.GetUnit() == eHTMLUnit_Empty) {
|
if (borderValue.GetUnit() == eHTMLUnit_Empty) {
|
||||||
tableStyle->mRules=NS_STYLE_TABLE_RULES_ALL; // non-0 values of border imply default rules=all
|
tableStyle->mRules=NS_STYLE_TABLE_RULES_ALL; // non-0 values of border imply default rules=all
|
||||||
|
@ -561,7 +562,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
|
|
||||||
if (nsnull!=aAttributes)
|
if (nsnull!=aAttributes)
|
||||||
{
|
{
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsHTMLValue value;
|
nsHTMLValue value;
|
||||||
|
|
||||||
// width
|
// width
|
||||||
|
|
|
@ -314,7 +314,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
// height: pixel
|
// height: pixel
|
||||||
aAttributes->GetAttribute(nsHTMLAtoms::height, value);
|
aAttributes->GetAttribute(nsHTMLAtoms::height, value);
|
||||||
if (value.GetUnit() == eHTMLUnit_Pixel) {
|
if (value.GetUnit() == eHTMLUnit_Pixel) {
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsStylePosition* pos = (nsStylePosition*)
|
nsStylePosition* pos = (nsStylePosition*)
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Position);
|
aContext->GetMutableStyleData(eStyleStruct_Position);
|
||||||
nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t);
|
nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t);
|
||||||
|
|
|
@ -265,7 +265,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
// height: pixel
|
// height: pixel
|
||||||
aAttributes->GetAttribute(nsHTMLAtoms::height, value);
|
aAttributes->GetAttribute(nsHTMLAtoms::height, value);
|
||||||
if (value.GetUnit() == eHTMLUnit_Pixel) {
|
if (value.GetUnit() == eHTMLUnit_Pixel) {
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsStylePosition* pos = (nsStylePosition*)
|
nsStylePosition* pos = (nsStylePosition*)
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Position);
|
aContext->GetMutableStyleData(eStyleStruct_Position);
|
||||||
nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t);
|
nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t);
|
||||||
|
|
|
@ -717,7 +717,9 @@ nscoord CalcLength(const nsCSSValue& aValue,
|
||||||
return NSToCoordRound(aValue.GetFloatValue() * (float)capHeight);
|
return NSToCoordRound(aValue.GetFloatValue() * (float)capHeight);
|
||||||
}
|
}
|
||||||
case eCSSUnit_Pixel:
|
case eCSSUnit_Pixel:
|
||||||
return NSFloatPixelsToTwips(aValue.GetFloatValue(), aPresContext->GetPixelsToTwips());
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
|
return NSFloatPixelsToTwips(aValue.GetFloatValue(), p2t);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -873,7 +873,8 @@ nsCSSRendering::PaintBackground(nsIPresContext& aPresContext,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Convert image dimensions into nscoord's
|
// Convert image dimensions into nscoord's
|
||||||
float p2t = aPresContext.GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext.GetScaledPixelsToTwips(p2t);
|
||||||
nscoord tileWidth = NSIntPixelsToTwips(imageSize.width, p2t);
|
nscoord tileWidth = NSIntPixelsToTwips(imageSize.width, p2t);
|
||||||
nscoord tileHeight = NSIntPixelsToTwips(imageSize.height, p2t);
|
nscoord tileHeight = NSIntPixelsToTwips(imageSize.height, p2t);
|
||||||
if ((tileWidth == 0) || (tileHeight == 0)) {
|
if ((tileWidth == 0) || (tileHeight == 0)) {
|
||||||
|
@ -937,7 +938,7 @@ nsCSSRendering::PaintBackground(nsIPresContext& aPresContext,
|
||||||
PRIntn x = xstart;
|
PRIntn x = xstart;
|
||||||
nscoord xpos = xpostart;
|
nscoord xpos = xpostart;
|
||||||
for (; x <= xCount; ++x, xpos += tileWidth) {
|
for (; x <= xCount; ++x, xpos += tileWidth) {
|
||||||
aRenderingContext.DrawImage(image, xpos, ypos);
|
aRenderingContext.DrawImage(image, xpos, ypos, tileWidth, tileHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aRenderingContext.PopState(clipState);
|
aRenderingContext.PopState(clipState);
|
||||||
|
|
|
@ -447,6 +447,21 @@ nsPresContext::GetTwipsToPixels() const
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP nsPresContext :: GetScaledPixelsToTwips(float &aScale) const
|
||||||
|
{
|
||||||
|
if (nsnull != mDeviceContext)
|
||||||
|
{
|
||||||
|
float p2t, scale;
|
||||||
|
mDeviceContext->GetDevUnitsToAppUnits(p2t);
|
||||||
|
mDeviceContext->GetCanonicalPixelScale(scale);
|
||||||
|
aScale = p2t * scale;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
aScale = 1.0f;
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
nsIDeviceContext*
|
nsIDeviceContext*
|
||||||
nsPresContext::GetDeviceContext() const
|
nsPresContext::GetDeviceContext() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -214,6 +214,13 @@ public:
|
||||||
virtual float GetPixelsToTwips() const = 0;
|
virtual float GetPixelsToTwips() const = 0;
|
||||||
virtual float GetTwipsToPixels() const = 0;
|
virtual float GetTwipsToPixels() const = 0;
|
||||||
|
|
||||||
|
//XXX this is probably not an ideal name. MMP
|
||||||
|
/**
|
||||||
|
* Do pixels to twips conversion taking into account
|
||||||
|
* differing size of a "pixel" from device to device.
|
||||||
|
*/
|
||||||
|
NS_IMETHOD GetScaledPixelsToTwips(float &aScale) const = 0;
|
||||||
|
|
||||||
//be sure to Relase() after you are done with the Get()
|
//be sure to Relase() after you are done with the Get()
|
||||||
virtual nsIDeviceContext * GetDeviceContext() const = 0;
|
virtual nsIDeviceContext * GetDeviceContext() const = 0;
|
||||||
|
|
||||||
|
|
|
@ -755,19 +755,16 @@ NS_IMETHODIMP PresShell :: CreateRenderingContext(nsIFrame *aFrame,
|
||||||
view->GetParent(view);
|
view->GetParent(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nsnull != view)
|
nsIDeviceContext *dx;
|
||||||
{
|
|
||||||
nsIDeviceContext *dx;
|
|
||||||
|
|
||||||
dx = mPresContext->GetDeviceContext();
|
dx = mPresContext->GetDeviceContext();
|
||||||
|
|
||||||
|
if (nsnull != view)
|
||||||
rv = dx->CreateRenderingContext(view, aContext);
|
rv = dx->CreateRenderingContext(view, aContext);
|
||||||
NS_RELEASE(dx);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
rv = dx->CreateRenderingContext(aContext);
|
||||||
rv = NS_ERROR_FAILURE;
|
|
||||||
aContext = nsnull;
|
NS_RELEASE(dx);
|
||||||
}
|
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,6 +214,13 @@ public:
|
||||||
virtual float GetPixelsToTwips() const = 0;
|
virtual float GetPixelsToTwips() const = 0;
|
||||||
virtual float GetTwipsToPixels() const = 0;
|
virtual float GetTwipsToPixels() const = 0;
|
||||||
|
|
||||||
|
//XXX this is probably not an ideal name. MMP
|
||||||
|
/**
|
||||||
|
* Do pixels to twips conversion taking into account
|
||||||
|
* differing size of a "pixel" from device to device.
|
||||||
|
*/
|
||||||
|
NS_IMETHOD GetScaledPixelsToTwips(float &aScale) const = 0;
|
||||||
|
|
||||||
//be sure to Relase() after you are done with the Get()
|
//be sure to Relase() after you are done with the Get()
|
||||||
virtual nsIDeviceContext * GetDeviceContext() const = 0;
|
virtual nsIDeviceContext * GetDeviceContext() const = 0;
|
||||||
|
|
||||||
|
|
|
@ -214,6 +214,13 @@ public:
|
||||||
virtual float GetPixelsToTwips() const = 0;
|
virtual float GetPixelsToTwips() const = 0;
|
||||||
virtual float GetTwipsToPixels() const = 0;
|
virtual float GetTwipsToPixels() const = 0;
|
||||||
|
|
||||||
|
//XXX this is probably not an ideal name. MMP
|
||||||
|
/**
|
||||||
|
* Do pixels to twips conversion taking into account
|
||||||
|
* differing size of a "pixel" from device to device.
|
||||||
|
*/
|
||||||
|
NS_IMETHOD GetScaledPixelsToTwips(float &aScale) const = 0;
|
||||||
|
|
||||||
//be sure to Relase() after you are done with the Get()
|
//be sure to Relase() after you are done with the Get()
|
||||||
virtual nsIDeviceContext * GetDeviceContext() const = 0;
|
virtual nsIDeviceContext * GetDeviceContext() const = 0;
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "prlog.h"
|
#include "prlog.h"
|
||||||
#include "nsISizeOfHandler.h"
|
#include "nsISizeOfHandler.h"
|
||||||
#include "nsIStyleContext.h"
|
#include "nsIStyleContext.h"
|
||||||
|
#include "nsIDeviceContext.h"
|
||||||
|
|
||||||
static NS_DEFINE_IID(kIFrameImageLoaderIID, NS_IFRAME_IMAGE_LOADER_IID);
|
static NS_DEFINE_IID(kIFrameImageLoaderIID, NS_IFRAME_IMAGE_LOADER_IID);
|
||||||
static NS_DEFINE_IID(kIImageRequestObserverIID, NS_IIMAGEREQUESTOBSERVER_IID);
|
static NS_DEFINE_IID(kIImageRequestObserverIID, NS_IIMAGEREQUESTOBSERVER_IID);
|
||||||
|
@ -206,7 +207,7 @@ nsFrameImageLoader::Notify(nsIImageRequest *aImageRequest,
|
||||||
mImageLoadStatus |= NS_IMAGE_LOAD_STATUS_IMAGE_READY;
|
mImageLoadStatus |= NS_IMAGE_LOAD_STATUS_IMAGE_READY;
|
||||||
|
|
||||||
// Convert the rect from pixels to twips
|
// Convert the rect from pixels to twips
|
||||||
p2t = mPresContext->GetPixelsToTwips();
|
mPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
changeRect = (const nsRect*)aParam3;
|
changeRect = (const nsRect*)aParam3;
|
||||||
damageRect.x = NSIntPixelsToTwips(changeRect->x, p2t);
|
damageRect.x = NSIntPixelsToTwips(changeRect->x, p2t);
|
||||||
damageRect.y = NSIntPixelsToTwips(changeRect->y, p2t);
|
damageRect.y = NSIntPixelsToTwips(changeRect->y, p2t);
|
||||||
|
@ -283,6 +284,8 @@ nsFrameImageLoader::DamageRepairFrame(const nsRect* aDamageRect)
|
||||||
("nsFrameImageLoader::DamageRepairFrame frame=%p status=%x",
|
("nsFrameImageLoader::DamageRepairFrame frame=%p status=%x",
|
||||||
mTargetFrame, mImageLoadStatus));
|
mTargetFrame, mImageLoadStatus));
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// XXX I #if 0'd this per troy's instruction... MMP
|
||||||
// XXX this should be done somewhere else, like when the window
|
// XXX this should be done somewhere else, like when the window
|
||||||
// is created or something???
|
// is created or something???
|
||||||
// XXX maybe there should be a seperate notification service for
|
// XXX maybe there should be a seperate notification service for
|
||||||
|
@ -297,6 +300,7 @@ nsFrameImageLoader::DamageRepairFrame(const nsRect* aDamageRect)
|
||||||
gXXXInstalledColorMap = PR_TRUE;
|
gXXXInstalledColorMap = PR_TRUE;
|
||||||
}
|
}
|
||||||
NS_RELEASE(window);
|
NS_RELEASE(window);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Determine damaged area and tell view manager to redraw it
|
// Determine damaged area and tell view manager to redraw it
|
||||||
nsPoint offset;
|
nsPoint offset;
|
||||||
|
|
|
@ -447,6 +447,21 @@ nsPresContext::GetTwipsToPixels() const
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP nsPresContext :: GetScaledPixelsToTwips(float &aScale) const
|
||||||
|
{
|
||||||
|
if (nsnull != mDeviceContext)
|
||||||
|
{
|
||||||
|
float p2t, scale;
|
||||||
|
mDeviceContext->GetDevUnitsToAppUnits(p2t);
|
||||||
|
mDeviceContext->GetCanonicalPixelScale(scale);
|
||||||
|
aScale = p2t * scale;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
aScale = 1.0f;
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
nsIDeviceContext*
|
nsIDeviceContext*
|
||||||
nsPresContext::GetDeviceContext() const
|
nsPresContext::GetDeviceContext() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,6 +74,7 @@ public:
|
||||||
virtual void SetVisibleArea(const nsRect& r);
|
virtual void SetVisibleArea(const nsRect& r);
|
||||||
virtual float GetPixelsToTwips() const;
|
virtual float GetPixelsToTwips() const;
|
||||||
virtual float GetTwipsToPixels() const;
|
virtual float GetTwipsToPixels() const;
|
||||||
|
NS_IMETHOD GetScaledPixelsToTwips(float &aScale) const;
|
||||||
virtual nsIDeviceContext* GetDeviceContext() const;
|
virtual nsIDeviceContext* GetDeviceContext() const;
|
||||||
NS_IMETHOD GetEventStateManager(nsIEventStateManager** aManager);
|
NS_IMETHOD GetEventStateManager(nsIEventStateManager** aManager);
|
||||||
|
|
||||||
|
|
|
@ -241,7 +241,8 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext,
|
||||||
nsReflowStatus& aStatus)
|
nsReflowStatus& aStatus)
|
||||||
{
|
{
|
||||||
nsSize availSize(aReflowState.maxSize);
|
nsSize availSize(aReflowState.maxSize);
|
||||||
float p2t = aPresContext.GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext.GetScaledPixelsToTwips(p2t);
|
||||||
const PRInt32 minTopBorder = NSIntPixelsToTwips(MIN_TOP_BORDER, p2t);
|
const PRInt32 minTopBorder = NSIntPixelsToTwips(MIN_TOP_BORDER, p2t);
|
||||||
|
|
||||||
const nsStyleSpacing* spacing =
|
const nsStyleSpacing* spacing =
|
||||||
|
|
|
@ -798,7 +798,8 @@ nsFormControlFrame::CalculateSize (nsIPresContext* aPresContext, nsFormControlFr
|
||||||
if (nsnull != aSpec.mColSizeAttr) {
|
if (nsnull != aSpec.mColSizeAttr) {
|
||||||
colStatus = hContent->GetAttribute(aSpec.mColSizeAttr, colAttr);
|
colStatus = hContent->GetAttribute(aSpec.mColSizeAttr, colAttr);
|
||||||
}
|
}
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
|
|
||||||
// determine the width
|
// determine the width
|
||||||
nscoord adjSize;
|
nscoord adjSize;
|
||||||
|
|
|
@ -387,7 +387,8 @@ nsHTMLButtonControlFrame::ShiftContents(nsIPresContext& aPresContext, PRBool aDo
|
||||||
nsStyleSpacing* spacing =
|
nsStyleSpacing* spacing =
|
||||||
(nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); // cast deliberate
|
(nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); // cast deliberate
|
||||||
|
|
||||||
float p2t = aPresContext.GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext.GetScaledPixelsToTwips(p2t);
|
||||||
nscoord shift = (aDown) ? NSIntPixelsToTwips(1, p2t) : -NSIntPixelsToTwips(1, p2t);
|
nscoord shift = (aDown) ? NSIntPixelsToTwips(1, p2t) : -NSIntPixelsToTwips(1, p2t);
|
||||||
nsStyleCoord styleCoord;
|
nsStyleCoord styleCoord;
|
||||||
|
|
||||||
|
@ -573,7 +574,8 @@ nsHTMLButtonControlFrame::Paint(nsIPresContext& aPresContext,
|
||||||
nsMargin border;
|
nsMargin border;
|
||||||
spacing->CalcBorderFor(this, border);
|
spacing->CalcBorderFor(this, border);
|
||||||
|
|
||||||
float p2t = aPresContext.GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext.GetScaledPixelsToTwips(p2t);
|
||||||
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
|
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
|
||||||
|
|
||||||
nsRect outside(0, 0, mRect.width, mRect.height);
|
nsRect outside(0, 0, mRect.width, mRect.height);
|
||||||
|
|
|
@ -237,7 +237,8 @@ nsHTMLFrameOuterFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||||
nsHTMLReflowMetrics& aDesiredSize)
|
nsHTMLReflowMetrics& aDesiredSize)
|
||||||
{
|
{
|
||||||
// <frame> processing does not use this routine, only <iframe>
|
// <frame> processing does not use this routine, only <iframe>
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
|
|
||||||
// XXX this needs to be changed from (200,200) to a better default for inline frames
|
// XXX this needs to be changed from (200,200) to a better default for inline frames
|
||||||
if (aReflowState.HaveFixedContentWidth()) {
|
if (aReflowState.HaveFixedContentWidth()) {
|
||||||
|
@ -532,7 +533,8 @@ PRInt32 nsHTMLFrameInnerFrame::GetMarginWidth(nsIPresContext* aPresContext, nsIC
|
||||||
nsIHTMLContent* content = nsnull;
|
nsIHTMLContent* content = nsnull;
|
||||||
mContent->QueryInterface(kIHTMLContentIID, (void**) &content);
|
mContent->QueryInterface(kIHTMLContentIID, (void**) &content);
|
||||||
if (nsnull != content) {
|
if (nsnull != content) {
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsHTMLValue value;
|
nsHTMLValue value;
|
||||||
content->GetAttribute(nsHTMLAtoms::marginwidth, value);
|
content->GetAttribute(nsHTMLAtoms::marginwidth, value);
|
||||||
if (eHTMLUnit_Pixel == value.GetUnit()) {
|
if (eHTMLUnit_Pixel == value.GetUnit()) {
|
||||||
|
@ -552,7 +554,8 @@ PRInt32 nsHTMLFrameInnerFrame::GetMarginHeight(nsIPresContext* aPresContext, nsI
|
||||||
nsIHTMLContent* content = nsnull;
|
nsIHTMLContent* content = nsnull;
|
||||||
mContent->QueryInterface(kIHTMLContentIID, (void**) &content);
|
mContent->QueryInterface(kIHTMLContentIID, (void**) &content);
|
||||||
if (nsnull != content) {
|
if (nsnull != content) {
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsHTMLValue value;
|
nsHTMLValue value;
|
||||||
content->GetAttribute(nsHTMLAtoms::marginheight, value);
|
content->GetAttribute(nsHTMLAtoms::marginheight, value);
|
||||||
if (eHTMLUnit_Pixel == value.GetUnit()) {
|
if (eHTMLUnit_Pixel == value.GetUnit()) {
|
||||||
|
|
|
@ -190,7 +190,8 @@ void nsHTMLFramesetFrame::CalculateRowCol(nsIPresContext* aPresContext, nscoord
|
||||||
PRInt32 free = 0;
|
PRInt32 free = 0;
|
||||||
PRInt32 percent = 0;
|
PRInt32 percent = 0;
|
||||||
PRInt32 pixel = 0;
|
PRInt32 pixel = 0;
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
|
|
||||||
int i; // feeble compiler
|
int i; // feeble compiler
|
||||||
for (i = 0; i < aNumSpecs; i++) {
|
for (i = 0; i < aNumSpecs; i++) {
|
||||||
|
@ -323,7 +324,8 @@ void nsHTMLFramesetFrame::CalculateRowCol(nsIPresContext* aPresContext, nscoord
|
||||||
|
|
||||||
PRInt32 nsHTMLFramesetFrame::GetBorderWidth(nsIPresContext* aPresContext)
|
PRInt32 nsHTMLFramesetFrame::GetBorderWidth(nsIPresContext* aPresContext)
|
||||||
{
|
{
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsHTMLValue htmlVal;
|
nsHTMLValue htmlVal;
|
||||||
PRInt32 intVal;
|
PRInt32 intVal;
|
||||||
nsIHTMLContent* content = nsnull;
|
nsIHTMLContent* content = nsnull;
|
||||||
|
|
|
@ -245,7 +245,8 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext,
|
||||||
aDesiredSize.height = 1;
|
aDesiredSize.height = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsSize imageSize;
|
nsSize imageSize;
|
||||||
mImageLoader->GetSize(imageSize);
|
mImageLoader->GetSize(imageSize);
|
||||||
float imageWidth = imageSize.width * p2t;
|
float imageWidth = imageSize.width * p2t;
|
||||||
|
@ -283,7 +284,8 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext,
|
||||||
aDesiredSize.width = 1;
|
aDesiredSize.width = 1;
|
||||||
aDesiredSize.height = 1;
|
aDesiredSize.height = 1;
|
||||||
} else {
|
} else {
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsSize imageSize;
|
nsSize imageSize;
|
||||||
mImageLoader->GetSize(imageSize);
|
mImageLoader->GetSize(imageSize);
|
||||||
aDesiredSize.width = NSIntPixelsToTwips(imageSize.width, p2t);
|
aDesiredSize.width = NSIntPixelsToTwips(imageSize.width, p2t);
|
||||||
|
@ -570,7 +572,8 @@ ImageFrame::DisplayAltFeedback(nsIPresContext& aPresContext,
|
||||||
nsRect inner;
|
nsRect inner;
|
||||||
GetInnerArea(&aPresContext, inner);
|
GetInnerArea(&aPresContext, inner);
|
||||||
|
|
||||||
float p2t = aPresContext.GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext.GetScaledPixelsToTwips(p2t);
|
||||||
nsRecessedBorder recessedBorder(NSIntPixelsToTwips(1, p2t));
|
nsRecessedBorder recessedBorder(NSIntPixelsToTwips(1, p2t));
|
||||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, inner,
|
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, inner,
|
||||||
inner, recessedBorder, 0);
|
inner, recessedBorder, 0);
|
||||||
|
@ -652,7 +655,8 @@ ImageFrame::Paint(nsIPresContext& aPresContext,
|
||||||
nsRect inner;
|
nsRect inner;
|
||||||
GetInnerArea(&aPresContext, inner);
|
GetInnerArea(&aPresContext, inner);
|
||||||
if (mImageLoader.GetLoadImageFailed()) {
|
if (mImageLoader.GetLoadImageFailed()) {
|
||||||
float p2t = aPresContext.GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext.GetScaledPixelsToTwips(p2t);
|
||||||
inner.width = NSIntPixelsToTwips(image->GetWidth(), p2t);
|
inner.width = NSIntPixelsToTwips(image->GetWidth(), p2t);
|
||||||
inner.height = NSIntPixelsToTwips(image->GetHeight(), p2t);
|
inner.height = NSIntPixelsToTwips(image->GetHeight(), p2t);
|
||||||
}
|
}
|
||||||
|
|
|
@ -324,7 +324,8 @@ nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||||
aMetrics.width = aMetrics.height;
|
aMetrics.width = aMetrics.height;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
aMetrics.width = NSIntPixelsToTwips(EMBED_DEF_DIM, p2t);
|
aMetrics.width = NSIntPixelsToTwips(EMBED_DEF_DIM, p2t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -333,7 +334,8 @@ nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||||
aMetrics.height = aMetrics.width;
|
aMetrics.height = aMetrics.width;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
aMetrics.height = NSIntPixelsToTwips(EMBED_DEF_DIM, p2t);
|
aMetrics.height = NSIntPixelsToTwips(EMBED_DEF_DIM, p2t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,8 @@ SpacerFrame::Reflow(nsIPresContext& aPresContext,
|
||||||
NS_RELEASE(hc);
|
NS_RELEASE(hc);
|
||||||
}
|
}
|
||||||
|
|
||||||
float p2t = aPresContext.GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext.GetScaledPixelsToTwips(p2t);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TYPE_WORD:
|
case TYPE_WORD:
|
||||||
if (0 != width) {
|
if (0 != width) {
|
||||||
|
|
|
@ -556,7 +556,8 @@ nsBodyFrame::DidSetStyleContext(nsIPresContext* aPresContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsHTMLValue value;
|
nsHTMLValue value;
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsIHTMLContent* hc;
|
nsIHTMLContent* hc;
|
||||||
if (NS_OK == mContent->QueryInterface(kIHTMLContentIID, (void**) &hc)) {
|
if (NS_OK == mContent->QueryInterface(kIHTMLContentIID, (void**) &hc)) {
|
||||||
hc->GetAttribute(nsHTMLAtoms::marginwidth, value);
|
hc->GetAttribute(nsHTMLAtoms::marginwidth, value);
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "nsStyleConsts.h"
|
#include "nsStyleConsts.h"
|
||||||
#include "nsCSSRendering.h"
|
#include "nsCSSRendering.h"
|
||||||
#include "nsIDOMHTMLHRElement.h"
|
#include "nsIDOMHTMLHRElement.h"
|
||||||
|
#include "nsIDeviceContext.h"
|
||||||
|
|
||||||
static NS_DEFINE_IID(kIDOMHTMLHRElementIID, NS_IDOMHTMLHRELEMENT_IID);
|
static NS_DEFINE_IID(kIDOMHTMLHRElementIID, NS_IDOMHTMLHRELEMENT_IID);
|
||||||
|
|
||||||
|
@ -96,7 +97,8 @@ HRuleFrame::Paint(nsIPresContext& aPresContext,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
float p2t = aPresContext.GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext.GetScaledPixelsToTwips(p2t);
|
||||||
nscoord thickness = NSIntPixelsToTwips(GetThickness(), p2t);
|
nscoord thickness = NSIntPixelsToTwips(GetThickness(), p2t);
|
||||||
|
|
||||||
// Get style data
|
// Get style data
|
||||||
|
@ -222,7 +224,9 @@ HRuleFrame::Reflow(nsIPresContext& aPresContext,
|
||||||
// HR's do not impact the max-element-size, unless a width is specified
|
// HR's do not impact the max-element-size, unless a width is specified
|
||||||
// otherwise tables behave badly. This makes sense they are springy.
|
// otherwise tables behave badly. This makes sense they are springy.
|
||||||
if (nsnull != aDesiredSize.maxElementSize) {
|
if (nsnull != aDesiredSize.maxElementSize) {
|
||||||
nscoord onePixel = NSIntPixelsToTwips(1, aPresContext.GetPixelsToTwips());
|
float p2t;
|
||||||
|
aPresContext.GetScaledPixelsToTwips(p2t);
|
||||||
|
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
|
||||||
if (aReflowState.HaveFixedContentWidth()) {
|
if (aReflowState.HaveFixedContentWidth()) {
|
||||||
aDesiredSize.maxElementSize->width = aReflowState.minWidth;
|
aDesiredSize.maxElementSize->width = aReflowState.minWidth;
|
||||||
aDesiredSize.maxElementSize->height = onePixel;
|
aDesiredSize.maxElementSize->height = onePixel;
|
||||||
|
@ -242,12 +246,15 @@ HRuleFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||||
const nsHTMLReflowState& aReflowState,
|
const nsHTMLReflowState& aReflowState,
|
||||||
nsHTMLReflowMetrics& aDesiredSize)
|
nsHTMLReflowMetrics& aDesiredSize)
|
||||||
{
|
{
|
||||||
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
|
|
||||||
if (aReflowState.HaveFixedContentWidth()) {
|
if (aReflowState.HaveFixedContentWidth()) {
|
||||||
aDesiredSize.width = aReflowState.minWidth;
|
aDesiredSize.width = aReflowState.minWidth;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (NS_UNCONSTRAINEDSIZE == aReflowState.maxSize.width) {
|
if (NS_UNCONSTRAINEDSIZE == aReflowState.maxSize.width) {
|
||||||
aDesiredSize.width = nscoord(aPresContext->GetPixelsToTwips());
|
aDesiredSize.width = nscoord(p2t);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
aDesiredSize.width = aReflowState.maxSize.width;
|
aDesiredSize.width = aReflowState.maxSize.width;
|
||||||
|
@ -265,7 +272,6 @@ HRuleFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||||
nscoord lineHeight;
|
nscoord lineHeight;
|
||||||
|
|
||||||
// Get the thickness of the rule (this is not css's height property)
|
// Get the thickness of the rule (this is not css's height property)
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
|
||||||
nscoord thickness = NSIntPixelsToTwips(GetThickness(), p2t);
|
nscoord thickness = NSIntPixelsToTwips(GetThickness(), p2t);
|
||||||
|
|
||||||
// Compute height of "line" that hrule will layout within. Use the
|
// Compute height of "line" that hrule will layout within. Use the
|
||||||
|
|
|
@ -319,7 +319,8 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext,
|
||||||
aDesiredSize.height = 1;
|
aDesiredSize.height = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsSize imageSize;
|
nsSize imageSize;
|
||||||
mImageLoader->GetSize(imageSize);
|
mImageLoader->GetSize(imageSize);
|
||||||
float imageWidth = imageSize.width * p2t;
|
float imageWidth = imageSize.width * p2t;
|
||||||
|
@ -358,7 +359,8 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext,
|
||||||
aDesiredSize.height = 1;
|
aDesiredSize.height = 1;
|
||||||
// printf ("in image loader, dummy size of 1 returned\n");
|
// printf ("in image loader, dummy size of 1 returned\n");
|
||||||
} else {
|
} else {
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsSize imageSize;
|
nsSize imageSize;
|
||||||
mImageLoader->GetSize(imageSize);
|
mImageLoader->GetSize(imageSize);
|
||||||
aDesiredSize.width = NSIntPixelsToTwips(imageSize.width, p2t);
|
aDesiredSize.width = NSIntPixelsToTwips(imageSize.width, p2t);
|
||||||
|
@ -627,7 +629,8 @@ ImageFrame::Paint(nsIPresContext& aPresContext,
|
||||||
nsRect inner;
|
nsRect inner;
|
||||||
GetInnerArea(&aPresContext, inner);
|
GetInnerArea(&aPresContext, inner);
|
||||||
|
|
||||||
float p2t = aPresContext.GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext.GetScaledPixelsToTwips(p2t);
|
||||||
nsRecessedBorder recessedBorder(NSIntPixelsToTwips(1, p2t));
|
nsRecessedBorder recessedBorder(NSIntPixelsToTwips(1, p2t));
|
||||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, inner,
|
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, inner,
|
||||||
inner, recessedBorder, 0);
|
inner, recessedBorder, 0);
|
||||||
|
@ -649,7 +652,8 @@ ImageFrame::Paint(nsIPresContext& aPresContext,
|
||||||
nsRect inner;
|
nsRect inner;
|
||||||
GetInnerArea(&aPresContext, inner);
|
GetInnerArea(&aPresContext, inner);
|
||||||
if (mImageLoader.GetLoadImageFailed()) {
|
if (mImageLoader.GetLoadImageFailed()) {
|
||||||
float p2t = aPresContext.GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext.GetScaledPixelsToTwips(p2t);
|
||||||
inner.width = NSIntPixelsToTwips(image->GetWidth(), p2t);
|
inner.width = NSIntPixelsToTwips(image->GetWidth(), p2t);
|
||||||
inner.height = NSIntPixelsToTwips(image->GetHeight(), p2t);
|
inner.height = NSIntPixelsToTwips(image->GetHeight(), p2t);
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,7 +245,8 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext,
|
||||||
aDesiredSize.height = 1;
|
aDesiredSize.height = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsSize imageSize;
|
nsSize imageSize;
|
||||||
mImageLoader->GetSize(imageSize);
|
mImageLoader->GetSize(imageSize);
|
||||||
float imageWidth = imageSize.width * p2t;
|
float imageWidth = imageSize.width * p2t;
|
||||||
|
@ -283,7 +284,8 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext,
|
||||||
aDesiredSize.width = 1;
|
aDesiredSize.width = 1;
|
||||||
aDesiredSize.height = 1;
|
aDesiredSize.height = 1;
|
||||||
} else {
|
} else {
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsSize imageSize;
|
nsSize imageSize;
|
||||||
mImageLoader->GetSize(imageSize);
|
mImageLoader->GetSize(imageSize);
|
||||||
aDesiredSize.width = NSIntPixelsToTwips(imageSize.width, p2t);
|
aDesiredSize.width = NSIntPixelsToTwips(imageSize.width, p2t);
|
||||||
|
@ -570,7 +572,8 @@ ImageFrame::DisplayAltFeedback(nsIPresContext& aPresContext,
|
||||||
nsRect inner;
|
nsRect inner;
|
||||||
GetInnerArea(&aPresContext, inner);
|
GetInnerArea(&aPresContext, inner);
|
||||||
|
|
||||||
float p2t = aPresContext.GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext.GetScaledPixelsToTwips(p2t);
|
||||||
nsRecessedBorder recessedBorder(NSIntPixelsToTwips(1, p2t));
|
nsRecessedBorder recessedBorder(NSIntPixelsToTwips(1, p2t));
|
||||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, inner,
|
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, inner,
|
||||||
inner, recessedBorder, 0);
|
inner, recessedBorder, 0);
|
||||||
|
@ -652,7 +655,8 @@ ImageFrame::Paint(nsIPresContext& aPresContext,
|
||||||
nsRect inner;
|
nsRect inner;
|
||||||
GetInnerArea(&aPresContext, inner);
|
GetInnerArea(&aPresContext, inner);
|
||||||
if (mImageLoader.GetLoadImageFailed()) {
|
if (mImageLoader.GetLoadImageFailed()) {
|
||||||
float p2t = aPresContext.GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext.GetScaledPixelsToTwips(p2t);
|
||||||
inner.width = NSIntPixelsToTwips(image->GetWidth(), p2t);
|
inner.width = NSIntPixelsToTwips(image->GetWidth(), p2t);
|
||||||
inner.height = NSIntPixelsToTwips(image->GetHeight(), p2t);
|
inner.height = NSIntPixelsToTwips(image->GetHeight(), p2t);
|
||||||
}
|
}
|
||||||
|
|
|
@ -324,7 +324,8 @@ nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||||
aMetrics.width = aMetrics.height;
|
aMetrics.width = aMetrics.height;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
aMetrics.width = NSIntPixelsToTwips(EMBED_DEF_DIM, p2t);
|
aMetrics.width = NSIntPixelsToTwips(EMBED_DEF_DIM, p2t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -333,7 +334,8 @@ nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||||
aMetrics.height = aMetrics.width;
|
aMetrics.height = aMetrics.width;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
aMetrics.height = NSIntPixelsToTwips(EMBED_DEF_DIM, p2t);
|
aMetrics.height = NSIntPixelsToTwips(EMBED_DEF_DIM, p2t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -755,19 +755,16 @@ NS_IMETHODIMP PresShell :: CreateRenderingContext(nsIFrame *aFrame,
|
||||||
view->GetParent(view);
|
view->GetParent(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nsnull != view)
|
nsIDeviceContext *dx;
|
||||||
{
|
|
||||||
nsIDeviceContext *dx;
|
|
||||||
|
|
||||||
dx = mPresContext->GetDeviceContext();
|
dx = mPresContext->GetDeviceContext();
|
||||||
|
|
||||||
|
if (nsnull != view)
|
||||||
rv = dx->CreateRenderingContext(view, aContext);
|
rv = dx->CreateRenderingContext(view, aContext);
|
||||||
NS_RELEASE(dx);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
rv = dx->CreateRenderingContext(aContext);
|
||||||
rv = NS_ERROR_FAILURE;
|
|
||||||
aContext = nsnull;
|
NS_RELEASE(dx);
|
||||||
}
|
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,8 @@ SpacerFrame::Reflow(nsIPresContext& aPresContext,
|
||||||
NS_RELEASE(hc);
|
NS_RELEASE(hc);
|
||||||
}
|
}
|
||||||
|
|
||||||
float p2t = aPresContext.GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext.GetScaledPixelsToTwips(p2t);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TYPE_WORD:
|
case TYPE_WORD:
|
||||||
if (0 != width) {
|
if (0 != width) {
|
||||||
|
|
|
@ -1462,7 +1462,8 @@ nsGenericHTMLElement::MapImageAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
if (nsnull != aAttributes) {
|
if (nsnull != aAttributes) {
|
||||||
nsHTMLValue value;
|
nsHTMLValue value;
|
||||||
|
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsStylePosition* pos = (nsStylePosition*)
|
nsStylePosition* pos = (nsStylePosition*)
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Position);
|
aContext->GetMutableStyleData(eStyleStruct_Position);
|
||||||
nsStyleSpacing* spacing = (nsStyleSpacing*)
|
nsStyleSpacing* spacing = (nsStyleSpacing*)
|
||||||
|
@ -1534,7 +1535,8 @@ nsGenericHTMLElement::MapImageAlignAttributeInto(nsIHTMLAttributes* aAttributes,
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Text);
|
aContext->GetMutableStyleData(eStyleStruct_Text);
|
||||||
nsStyleSpacing* spacing = (nsStyleSpacing*)
|
nsStyleSpacing* spacing = (nsStyleSpacing*)
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Spacing);
|
aContext->GetMutableStyleData(eStyleStruct_Spacing);
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsStyleCoord three(NSIntPixelsToTwips(3, p2t));
|
nsStyleCoord three(NSIntPixelsToTwips(3, p2t));
|
||||||
switch (align) {
|
switch (align) {
|
||||||
case NS_STYLE_TEXT_ALIGN_LEFT:
|
case NS_STYLE_TEXT_ALIGN_LEFT:
|
||||||
|
@ -1575,7 +1577,8 @@ nsGenericHTMLElement::MapImageBorderAttributesInto(nsIHTMLAttributes* aAttribute
|
||||||
value.SetPixelValue(2);
|
value.SetPixelValue(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t);
|
nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t);
|
||||||
|
|
||||||
// Fixup border-padding sums: subtract out the old size and then
|
// Fixup border-padding sums: subtract out the old size and then
|
||||||
|
|
|
@ -405,7 +405,7 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
// marginwidth/marginheight
|
// marginwidth/marginheight
|
||||||
// XXX: see ua.css for related code in the BODY rule
|
// XXX: see ua.css for related code in the BODY rule
|
||||||
float p2t;
|
float p2t;
|
||||||
p2t = aPresContext->GetPixelsToTwips();
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsStyleSpacing* spacing = (nsStyleSpacing*)
|
nsStyleSpacing* spacing = (nsStyleSpacing*)
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Spacing);
|
aContext->GetMutableStyleData(eStyleStruct_Spacing);
|
||||||
aAttributes->GetAttribute(nsHTMLAtoms::marginwidth, value);
|
aAttributes->GetAttribute(nsHTMLAtoms::marginwidth, value);
|
||||||
|
|
|
@ -222,7 +222,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
}
|
}
|
||||||
|
|
||||||
// width: pixel, percent
|
// width: pixel, percent
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsStylePosition* pos = (nsStylePosition*)
|
nsStylePosition* pos = (nsStylePosition*)
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Position);
|
aContext->GetMutableStyleData(eStyleStruct_Position);
|
||||||
aAttributes->GetAttribute(nsHTMLAtoms::width, value);
|
aAttributes->GetAttribute(nsHTMLAtoms::width, value);
|
||||||
|
|
|
@ -232,7 +232,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
|
|
||||||
nsHTMLValue value;
|
nsHTMLValue value;
|
||||||
|
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsStylePosition* pos = (nsStylePosition*)
|
nsStylePosition* pos = (nsStylePosition*)
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Position);
|
aContext->GetMutableStyleData(eStyleStruct_Position);
|
||||||
nsStyleSpacing* spacing = (nsStyleSpacing*)
|
nsStyleSpacing* spacing = (nsStyleSpacing*)
|
||||||
|
|
|
@ -245,7 +245,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
nsStyleSpacing* spacing = (nsStyleSpacing*)
|
nsStyleSpacing* spacing = (nsStyleSpacing*)
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Spacing);
|
aContext->GetMutableStyleData(eStyleStruct_Spacing);
|
||||||
|
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsStyleCoord three(NSIntPixelsToTwips(3, p2t));
|
nsStyleCoord three(NSIntPixelsToTwips(3, p2t));
|
||||||
switch (align) {
|
switch (align) {
|
||||||
case NS_STYLE_TEXT_ALIGN_LEFT:
|
case NS_STYLE_TEXT_ALIGN_LEFT:
|
||||||
|
|
|
@ -567,7 +567,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
case NS_FORM_INPUT_CHECKBOX:
|
case NS_FORM_INPUT_CHECKBOX:
|
||||||
case NS_FORM_INPUT_RADIO:
|
case NS_FORM_INPUT_RADIO:
|
||||||
{
|
{
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nscoord pad = NSIntPixelsToTwips(3, p2t);
|
nscoord pad = NSIntPixelsToTwips(3, p2t);
|
||||||
|
|
||||||
// add left and right padding around the radio button via css
|
// add left and right padding around the radio button via css
|
||||||
|
|
|
@ -207,7 +207,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
// Note: ua.css specifies that the 'position' is absolute
|
// Note: ua.css specifies that the 'position' is absolute
|
||||||
if (nsnull != aAttributes) {
|
if (nsnull != aAttributes) {
|
||||||
nsHTMLValue value;
|
nsHTMLValue value;
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsStylePosition* position = (nsStylePosition*)
|
nsStylePosition* position = (nsStylePosition*)
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Position);
|
aContext->GetMutableStyleData(eStyleStruct_Position);
|
||||||
|
|
||||||
|
|
|
@ -350,7 +350,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
}
|
}
|
||||||
|
|
||||||
// width: pixel
|
// width: pixel
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsStylePosition* pos = (nsStylePosition*)
|
nsStylePosition* pos = (nsStylePosition*)
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Position);
|
aContext->GetMutableStyleData(eStyleStruct_Position);
|
||||||
aAttributes->GetAttribute(nsHTMLAtoms::width, widthValue);
|
aAttributes->GetAttribute(nsHTMLAtoms::width, widthValue);
|
||||||
|
|
|
@ -223,7 +223,6 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
NS_PRECONDITION(nsnull!=aPresContext, "bad presentation context arg");
|
NS_PRECONDITION(nsnull!=aPresContext, "bad presentation context arg");
|
||||||
if (nsnull != aAttributes) {
|
if (nsnull != aAttributes) {
|
||||||
|
|
||||||
float p2t;
|
|
||||||
nsHTMLValue value;
|
nsHTMLValue value;
|
||||||
nsStyleText* textStyle = nsnull;
|
nsStyleText* textStyle = nsnull;
|
||||||
|
|
||||||
|
@ -238,7 +237,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eHTMLUnit_Pixel:
|
case eHTMLUnit_Pixel:
|
||||||
p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
position->mWidth.SetCoordValue(NSIntPixelsToTwips(value.GetPixelValue(), p2t));
|
position->mWidth.SetCoordValue(NSIntPixelsToTwips(value.GetPixelValue(), p2t));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,7 +212,6 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
NS_PRECONDITION(nsnull!=aPresContext, "bad presentation context arg");
|
NS_PRECONDITION(nsnull!=aPresContext, "bad presentation context arg");
|
||||||
if (nsnull != aAttributes) {
|
if (nsnull != aAttributes) {
|
||||||
|
|
||||||
float p2t;
|
|
||||||
nsHTMLValue value;
|
nsHTMLValue value;
|
||||||
nsStyleText* textStyle = nsnull;
|
nsStyleText* textStyle = nsnull;
|
||||||
|
|
||||||
|
@ -227,7 +226,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eHTMLUnit_Pixel:
|
case eHTMLUnit_Pixel:
|
||||||
p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
position->mWidth.SetCoordValue(NSIntPixelsToTwips(value.GetPixelValue(), p2t));
|
position->mWidth.SetCoordValue(NSIntPixelsToTwips(value.GetPixelValue(), p2t));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -526,7 +526,8 @@ MapTableBorderInto(nsIHTMLAttributes* aAttributes,
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Spacing);
|
aContext->GetMutableStyleData(eStyleStruct_Spacing);
|
||||||
nsStyleTable *tableStyle = (nsStyleTable*)
|
nsStyleTable *tableStyle = (nsStyleTable*)
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Table);
|
aContext->GetMutableStyleData(eStyleStruct_Table);
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsStyleCoord twips;
|
nsStyleCoord twips;
|
||||||
if (borderValue.GetUnit() == eHTMLUnit_Empty) {
|
if (borderValue.GetUnit() == eHTMLUnit_Empty) {
|
||||||
tableStyle->mRules=NS_STYLE_TABLE_RULES_ALL; // non-0 values of border imply default rules=all
|
tableStyle->mRules=NS_STYLE_TABLE_RULES_ALL; // non-0 values of border imply default rules=all
|
||||||
|
@ -561,7 +562,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
|
|
||||||
if (nsnull!=aAttributes)
|
if (nsnull!=aAttributes)
|
||||||
{
|
{
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsHTMLValue value;
|
nsHTMLValue value;
|
||||||
|
|
||||||
// width
|
// width
|
||||||
|
|
|
@ -314,7 +314,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
// height: pixel
|
// height: pixel
|
||||||
aAttributes->GetAttribute(nsHTMLAtoms::height, value);
|
aAttributes->GetAttribute(nsHTMLAtoms::height, value);
|
||||||
if (value.GetUnit() == eHTMLUnit_Pixel) {
|
if (value.GetUnit() == eHTMLUnit_Pixel) {
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsStylePosition* pos = (nsStylePosition*)
|
nsStylePosition* pos = (nsStylePosition*)
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Position);
|
aContext->GetMutableStyleData(eStyleStruct_Position);
|
||||||
nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t);
|
nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t);
|
||||||
|
|
|
@ -265,7 +265,8 @@ MapAttributesInto(nsIHTMLAttributes* aAttributes,
|
||||||
// height: pixel
|
// height: pixel
|
||||||
aAttributes->GetAttribute(nsHTMLAtoms::height, value);
|
aAttributes->GetAttribute(nsHTMLAtoms::height, value);
|
||||||
if (value.GetUnit() == eHTMLUnit_Pixel) {
|
if (value.GetUnit() == eHTMLUnit_Pixel) {
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsStylePosition* pos = (nsStylePosition*)
|
nsStylePosition* pos = (nsStylePosition*)
|
||||||
aContext->GetMutableStyleData(eStyleStruct_Position);
|
aContext->GetMutableStyleData(eStyleStruct_Position);
|
||||||
nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t);
|
nscoord twips = NSIntPixelsToTwips(value.GetPixelValue(), p2t);
|
||||||
|
|
|
@ -237,7 +237,8 @@ nsHTMLFrameOuterFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||||
nsHTMLReflowMetrics& aDesiredSize)
|
nsHTMLReflowMetrics& aDesiredSize)
|
||||||
{
|
{
|
||||||
// <frame> processing does not use this routine, only <iframe>
|
// <frame> processing does not use this routine, only <iframe>
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
|
|
||||||
// XXX this needs to be changed from (200,200) to a better default for inline frames
|
// XXX this needs to be changed from (200,200) to a better default for inline frames
|
||||||
if (aReflowState.HaveFixedContentWidth()) {
|
if (aReflowState.HaveFixedContentWidth()) {
|
||||||
|
@ -532,7 +533,8 @@ PRInt32 nsHTMLFrameInnerFrame::GetMarginWidth(nsIPresContext* aPresContext, nsIC
|
||||||
nsIHTMLContent* content = nsnull;
|
nsIHTMLContent* content = nsnull;
|
||||||
mContent->QueryInterface(kIHTMLContentIID, (void**) &content);
|
mContent->QueryInterface(kIHTMLContentIID, (void**) &content);
|
||||||
if (nsnull != content) {
|
if (nsnull != content) {
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsHTMLValue value;
|
nsHTMLValue value;
|
||||||
content->GetAttribute(nsHTMLAtoms::marginwidth, value);
|
content->GetAttribute(nsHTMLAtoms::marginwidth, value);
|
||||||
if (eHTMLUnit_Pixel == value.GetUnit()) {
|
if (eHTMLUnit_Pixel == value.GetUnit()) {
|
||||||
|
@ -552,7 +554,8 @@ PRInt32 nsHTMLFrameInnerFrame::GetMarginHeight(nsIPresContext* aPresContext, nsI
|
||||||
nsIHTMLContent* content = nsnull;
|
nsIHTMLContent* content = nsnull;
|
||||||
mContent->QueryInterface(kIHTMLContentIID, (void**) &content);
|
mContent->QueryInterface(kIHTMLContentIID, (void**) &content);
|
||||||
if (nsnull != content) {
|
if (nsnull != content) {
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsHTMLValue value;
|
nsHTMLValue value;
|
||||||
content->GetAttribute(nsHTMLAtoms::marginheight, value);
|
content->GetAttribute(nsHTMLAtoms::marginheight, value);
|
||||||
if (eHTMLUnit_Pixel == value.GetUnit()) {
|
if (eHTMLUnit_Pixel == value.GetUnit()) {
|
||||||
|
|
|
@ -190,7 +190,8 @@ void nsHTMLFramesetFrame::CalculateRowCol(nsIPresContext* aPresContext, nscoord
|
||||||
PRInt32 free = 0;
|
PRInt32 free = 0;
|
||||||
PRInt32 percent = 0;
|
PRInt32 percent = 0;
|
||||||
PRInt32 pixel = 0;
|
PRInt32 pixel = 0;
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
|
|
||||||
int i; // feeble compiler
|
int i; // feeble compiler
|
||||||
for (i = 0; i < aNumSpecs; i++) {
|
for (i = 0; i < aNumSpecs; i++) {
|
||||||
|
@ -323,7 +324,8 @@ void nsHTMLFramesetFrame::CalculateRowCol(nsIPresContext* aPresContext, nscoord
|
||||||
|
|
||||||
PRInt32 nsHTMLFramesetFrame::GetBorderWidth(nsIPresContext* aPresContext)
|
PRInt32 nsHTMLFramesetFrame::GetBorderWidth(nsIPresContext* aPresContext)
|
||||||
{
|
{
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
nsHTMLValue htmlVal;
|
nsHTMLValue htmlVal;
|
||||||
PRInt32 intVal;
|
PRInt32 intVal;
|
||||||
nsIHTMLContent* content = nsnull;
|
nsIHTMLContent* content = nsnull;
|
||||||
|
|
|
@ -113,7 +113,8 @@ nsCheckboxControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||||
nsHTMLReflowMetrics& aDesiredLayoutSize,
|
nsHTMLReflowMetrics& aDesiredLayoutSize,
|
||||||
nsSize& aDesiredWidgetSize)
|
nsSize& aDesiredWidgetSize)
|
||||||
{
|
{
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
#ifdef XP_PC
|
#ifdef XP_PC
|
||||||
aDesiredWidgetSize.width = NSIntPixelsToTwips(12, p2t);
|
aDesiredWidgetSize.width = NSIntPixelsToTwips(12, p2t);
|
||||||
aDesiredWidgetSize.height = NSIntPixelsToTwips(12, p2t);
|
aDesiredWidgetSize.height = NSIntPixelsToTwips(12, p2t);
|
||||||
|
|
|
@ -241,7 +241,8 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext,
|
||||||
nsReflowStatus& aStatus)
|
nsReflowStatus& aStatus)
|
||||||
{
|
{
|
||||||
nsSize availSize(aReflowState.maxSize);
|
nsSize availSize(aReflowState.maxSize);
|
||||||
float p2t = aPresContext.GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext.GetScaledPixelsToTwips(p2t);
|
||||||
const PRInt32 minTopBorder = NSIntPixelsToTwips(MIN_TOP_BORDER, p2t);
|
const PRInt32 minTopBorder = NSIntPixelsToTwips(MIN_TOP_BORDER, p2t);
|
||||||
|
|
||||||
const nsStyleSpacing* spacing =
|
const nsStyleSpacing* spacing =
|
||||||
|
|
|
@ -798,7 +798,8 @@ nsFormControlFrame::CalculateSize (nsIPresContext* aPresContext, nsFormControlFr
|
||||||
if (nsnull != aSpec.mColSizeAttr) {
|
if (nsnull != aSpec.mColSizeAttr) {
|
||||||
colStatus = hContent->GetAttribute(aSpec.mColSizeAttr, colAttr);
|
colStatus = hContent->GetAttribute(aSpec.mColSizeAttr, colAttr);
|
||||||
}
|
}
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
|
|
||||||
// determine the width
|
// determine the width
|
||||||
nscoord adjSize;
|
nscoord adjSize;
|
||||||
|
|
|
@ -387,7 +387,8 @@ nsHTMLButtonControlFrame::ShiftContents(nsIPresContext& aPresContext, PRBool aDo
|
||||||
nsStyleSpacing* spacing =
|
nsStyleSpacing* spacing =
|
||||||
(nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); // cast deliberate
|
(nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing); // cast deliberate
|
||||||
|
|
||||||
float p2t = aPresContext.GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext.GetScaledPixelsToTwips(p2t);
|
||||||
nscoord shift = (aDown) ? NSIntPixelsToTwips(1, p2t) : -NSIntPixelsToTwips(1, p2t);
|
nscoord shift = (aDown) ? NSIntPixelsToTwips(1, p2t) : -NSIntPixelsToTwips(1, p2t);
|
||||||
nsStyleCoord styleCoord;
|
nsStyleCoord styleCoord;
|
||||||
|
|
||||||
|
@ -573,7 +574,8 @@ nsHTMLButtonControlFrame::Paint(nsIPresContext& aPresContext,
|
||||||
nsMargin border;
|
nsMargin border;
|
||||||
spacing->CalcBorderFor(this, border);
|
spacing->CalcBorderFor(this, border);
|
||||||
|
|
||||||
float p2t = aPresContext.GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext.GetScaledPixelsToTwips(p2t);
|
||||||
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
|
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
|
||||||
|
|
||||||
nsRect outside(0, 0, mRect.width, mRect.height);
|
nsRect outside(0, 0, mRect.width, mRect.height);
|
||||||
|
|
|
@ -82,7 +82,8 @@ nsRadioControlFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||||
nsHTMLReflowMetrics& aDesiredLayoutSize,
|
nsHTMLReflowMetrics& aDesiredLayoutSize,
|
||||||
nsSize& aDesiredWidgetSize)
|
nsSize& aDesiredWidgetSize)
|
||||||
{
|
{
|
||||||
float p2t = aPresContext->GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
aDesiredWidgetSize.width = NSIntPixelsToTwips(12, p2t);
|
aDesiredWidgetSize.width = NSIntPixelsToTwips(12, p2t);
|
||||||
aDesiredWidgetSize.height = NSIntPixelsToTwips(12, p2t);
|
aDesiredWidgetSize.height = NSIntPixelsToTwips(12, p2t);
|
||||||
aDesiredLayoutSize.width = aDesiredWidgetSize.width;
|
aDesiredLayoutSize.width = aDesiredWidgetSize.width;
|
||||||
|
|
|
@ -873,7 +873,8 @@ nsCSSRendering::PaintBackground(nsIPresContext& aPresContext,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Convert image dimensions into nscoord's
|
// Convert image dimensions into nscoord's
|
||||||
float p2t = aPresContext.GetPixelsToTwips();
|
float p2t;
|
||||||
|
aPresContext.GetScaledPixelsToTwips(p2t);
|
||||||
nscoord tileWidth = NSIntPixelsToTwips(imageSize.width, p2t);
|
nscoord tileWidth = NSIntPixelsToTwips(imageSize.width, p2t);
|
||||||
nscoord tileHeight = NSIntPixelsToTwips(imageSize.height, p2t);
|
nscoord tileHeight = NSIntPixelsToTwips(imageSize.height, p2t);
|
||||||
if ((tileWidth == 0) || (tileHeight == 0)) {
|
if ((tileWidth == 0) || (tileHeight == 0)) {
|
||||||
|
@ -937,7 +938,7 @@ nsCSSRendering::PaintBackground(nsIPresContext& aPresContext,
|
||||||
PRIntn x = xstart;
|
PRIntn x = xstart;
|
||||||
nscoord xpos = xpostart;
|
nscoord xpos = xpostart;
|
||||||
for (; x <= xCount; ++x, xpos += tileWidth) {
|
for (; x <= xCount; ++x, xpos += tileWidth) {
|
||||||
aRenderingContext.DrawImage(image, xpos, ypos);
|
aRenderingContext.DrawImage(image, xpos, ypos, tileWidth, tileHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aRenderingContext.PopState(clipState);
|
aRenderingContext.PopState(clipState);
|
||||||
|
|
|
@ -717,7 +717,9 @@ nscoord CalcLength(const nsCSSValue& aValue,
|
||||||
return NSToCoordRound(aValue.GetFloatValue() * (float)capHeight);
|
return NSToCoordRound(aValue.GetFloatValue() * (float)capHeight);
|
||||||
}
|
}
|
||||||
case eCSSUnit_Pixel:
|
case eCSSUnit_Pixel:
|
||||||
return NSFloatPixelsToTwips(aValue.GetFloatValue(), aPresContext->GetPixelsToTwips());
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
|
return NSFloatPixelsToTwips(aValue.GetFloatValue(), p2t);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -399,7 +399,9 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
|
||||||
grandChild->ChildCount(childCount);
|
grandChild->ChildCount(childCount);
|
||||||
if (0!=childCount)
|
if (0!=childCount)
|
||||||
{
|
{
|
||||||
nscoord one = ((nscoord)(NSIntPixelsToTwips(1, aPresContext.GetPixelsToTwips())));
|
float p2t;
|
||||||
|
aPresContext.GetScaledPixelsToTwips(p2t);
|
||||||
|
nscoord one = ((nscoord)(NSIntPixelsToTwips(1, p2t)));
|
||||||
cellWidth = 1;
|
cellWidth = 1;
|
||||||
if (gsDebug)
|
if (gsDebug)
|
||||||
printf ("setting cellWidth=1 because it was 0 but there's some content\n");
|
printf ("setting cellWidth=1 because it was 0 but there's some content\n");
|
||||||
|
@ -645,7 +647,9 @@ void nsTableCellFrame::MapBorderMarginPadding(nsIPresContext* aPresContext)
|
||||||
{
|
{
|
||||||
// XXX: need to get border width here
|
// XXX: need to get border width here
|
||||||
// in HTML, cell borders are always 1 pixel by default
|
// in HTML, cell borders are always 1 pixel by default
|
||||||
border = NSIntPixelsToTwips(1, aPresContext->GetPixelsToTwips());
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
|
border = NSIntPixelsToTwips(1, p2t);
|
||||||
MapHTMLBorderStyle(aPresContext, *spacingData, border, tableFrame);
|
MapHTMLBorderStyle(aPresContext, *spacingData, border, tableFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3347,7 +3347,7 @@ void nsTableFrame::MapBorderMarginPadding(nsIPresContext& aPresContext)
|
||||||
{
|
{
|
||||||
PRInt32 intValue = 0;
|
PRInt32 intValue = 0;
|
||||||
|
|
||||||
if (ConvertToPixelValue(border_value,1,intValue))
|
if (ConvertToPixelValue(border_value,1,intValue)) //XXX this is busted if this code is ever used again. MMP
|
||||||
border = NSIntPixelsToTwips(intValue, p2t);
|
border = NSIntPixelsToTwips(intValue, p2t);
|
||||||
}
|
}
|
||||||
MapHTMLBorderStyle(*spacingData,border);
|
MapHTMLBorderStyle(*spacingData,border);
|
||||||
|
|
|
@ -717,7 +717,9 @@ nscoord CalcLength(const nsCSSValue& aValue,
|
||||||
return NSToCoordRound(aValue.GetFloatValue() * (float)capHeight);
|
return NSToCoordRound(aValue.GetFloatValue() * (float)capHeight);
|
||||||
}
|
}
|
||||||
case eCSSUnit_Pixel:
|
case eCSSUnit_Pixel:
|
||||||
return NSFloatPixelsToTwips(aValue.GetFloatValue(), aPresContext->GetPixelsToTwips());
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
|
return NSFloatPixelsToTwips(aValue.GetFloatValue(), p2t);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -399,7 +399,9 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext& aPresContext,
|
||||||
grandChild->ChildCount(childCount);
|
grandChild->ChildCount(childCount);
|
||||||
if (0!=childCount)
|
if (0!=childCount)
|
||||||
{
|
{
|
||||||
nscoord one = ((nscoord)(NSIntPixelsToTwips(1, aPresContext.GetPixelsToTwips())));
|
float p2t;
|
||||||
|
aPresContext.GetScaledPixelsToTwips(p2t);
|
||||||
|
nscoord one = ((nscoord)(NSIntPixelsToTwips(1, p2t)));
|
||||||
cellWidth = 1;
|
cellWidth = 1;
|
||||||
if (gsDebug)
|
if (gsDebug)
|
||||||
printf ("setting cellWidth=1 because it was 0 but there's some content\n");
|
printf ("setting cellWidth=1 because it was 0 but there's some content\n");
|
||||||
|
@ -645,7 +647,9 @@ void nsTableCellFrame::MapBorderMarginPadding(nsIPresContext* aPresContext)
|
||||||
{
|
{
|
||||||
// XXX: need to get border width here
|
// XXX: need to get border width here
|
||||||
// in HTML, cell borders are always 1 pixel by default
|
// in HTML, cell borders are always 1 pixel by default
|
||||||
border = NSIntPixelsToTwips(1, aPresContext->GetPixelsToTwips());
|
float p2t;
|
||||||
|
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||||
|
border = NSIntPixelsToTwips(1, p2t);
|
||||||
MapHTMLBorderStyle(aPresContext, *spacingData, border, tableFrame);
|
MapHTMLBorderStyle(aPresContext, *spacingData, border, tableFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3347,7 +3347,7 @@ void nsTableFrame::MapBorderMarginPadding(nsIPresContext& aPresContext)
|
||||||
{
|
{
|
||||||
PRInt32 intValue = 0;
|
PRInt32 intValue = 0;
|
||||||
|
|
||||||
if (ConvertToPixelValue(border_value,1,intValue))
|
if (ConvertToPixelValue(border_value,1,intValue)) //XXX this is busted if this code is ever used again. MMP
|
||||||
border = NSIntPixelsToTwips(intValue, p2t);
|
border = NSIntPixelsToTwips(intValue, p2t);
|
||||||
}
|
}
|
||||||
MapHTMLBorderStyle(*spacingData,border);
|
MapHTMLBorderStyle(*spacingData,border);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче