Bug 177805: Fix the use of units in Gecko. r+sr=roc

git-svn-id: svn://10.0.0.236/trunk@219640 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
sharparrow1%yahoo.com
2007-02-07 07:46:44 +00:00
parent d70c26f70c
commit dd459d0a71
164 changed files with 1364 additions and 2226 deletions

View File

@@ -125,9 +125,6 @@ public:
virtual void Destroy();
virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
NS_IMETHOD Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
@@ -322,13 +319,13 @@ nsSubDocumentFrame::GetIntrinsicWidth()
return 0; // <frame> has no useful intrinsic width
}
if (!mContent->IsNodeOfType(nsINode::eXUL)) {
if (mContent->IsNodeOfType(nsINode::eXUL)) {
return 0; // <xul:iframe> also has no useful intrinsic width
}
// We must be an HTML <iframe>. Default to a width of 300, for IE
// compat (and per CSS2.1 draft).
return NSIntPixelsToTwips(300, GetPresContext()->ScaledPixelsToTwips());
return nsPresContext::CSSPixelsToAppUnits(300);
}
nscoord
@@ -342,8 +339,7 @@ nsSubDocumentFrame::GetIntrinsicHeight()
}
// Use 150px, for compatibility with IE, and per CSS2.1 draft.
return NSIntPixelsToTwips(150,
GetPresContext()->ScaledPixelsToTwips());
return nsPresContext::CSSPixelsToAppUnits(150);
}
#ifdef DEBUG
@@ -365,25 +361,6 @@ nsSubDocumentFrame::IsFrameOfType(PRUint32 aFlags) const
return !(aFlags & ~(eReplaced | eReplacedContainsBlock));
}
/* virtual */ nscoord
nsSubDocumentFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
{
return nsSubDocumentFrame::GetPrefWidth(aRenderingContext);
}
/* virtual */ nscoord
nsSubDocumentFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
{
// XUL frames don't have a default 300px width
nscoord result;
DISPLAY_PREF_WIDTH(this, result);
if (mContent->IsNodeOfType(nsINode::eXUL))
result = 0;
else
result = NSIntPixelsToTwips(300, GetPresContext()->ScaledPixelsToTwips());
return result;
}
NS_IMETHODIMP
nsSubDocumentFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
@@ -441,14 +418,12 @@ nsSubDocumentFrame::Reflow(nsPresContext* aPresContext,
// resize the sub document
if (baseWindow) {
float t2p;
t2p = aPresContext->TwipsToPixels();
PRInt32 x = 0;
PRInt32 y = 0;
baseWindow->GetPositionAndSize(&x, &y, nsnull, nsnull);
PRInt32 cx = NSToCoordRound(innerSize.width * t2p);
PRInt32 cy = NSToCoordRound(innerSize.height * t2p);
PRInt32 cx = aPresContext->AppUnitsToDevPixels(innerSize.width);
PRInt32 cy = aPresContext->AppUnitsToDevPixels(innerSize.height);
baseWindow->SetPositionAndSize(x, y, cx, cy, PR_FALSE);
}
}