Tidy up the rendering; don't take space when show-borders is on
git-svn-id: svn://10.0.0.236/trunk@6751 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -142,16 +142,9 @@ nsPlaceholderFrame::InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
container->AddFloater(&presContext, aReflowState, mAnchoredItem, this);
|
||||
}
|
||||
|
||||
if (nsIFrame::GetShowFrameBorders()) {
|
||||
float p2t = presContext.GetPixelsToTwips();
|
||||
aDesiredSize.width = nscoord(p2t * 5);
|
||||
aDesiredSize.height = aDesiredSize.width;
|
||||
}
|
||||
else {
|
||||
aDesiredSize.width = 0;
|
||||
aDesiredSize.height = 0;
|
||||
}
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.width = 0;
|
||||
aDesiredSize.height = 0;
|
||||
aDesiredSize.ascent = 0;
|
||||
aDesiredSize.descent = 0;
|
||||
if (nsnull != aDesiredSize.maxElementSize) {
|
||||
aDesiredSize.maxElementSize->width = aDesiredSize.width;
|
||||
@@ -166,8 +159,12 @@ nsPlaceholderFrame::Paint(nsIPresContext& aPresContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
if (nsIFrame::GetShowFrameBorders()) {
|
||||
float p2t = aPresContext.GetPixelsToTwips();
|
||||
aRenderingContext.SetColor(NS_RGB(0, 255, 255));
|
||||
aRenderingContext.FillRect(0, 0, mRect.width, mRect.height);
|
||||
nscoord x = nscoord(-5 * p2t);
|
||||
aRenderingContext.FillRect(x, 0, nscoord(13 * p2t), nscoord(3 * p2t));
|
||||
nscoord y = nscoord(-10 * p2t);
|
||||
aRenderingContext.FillRect(0, y, nscoord(3 * p2t), nscoord(10 * p2t));
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -81,10 +81,8 @@ BRFrame::Paint(nsIPresContext& aPresContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
if (nsIFrame::GetShowFrameBorders()) {
|
||||
const nsStyleColor* color = (const nsStyleColor*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Color);
|
||||
float p2t = aPresContext.GetPixelsToTwips();
|
||||
aRenderingContext.SetColor(color->mColor);
|
||||
aRenderingContext.SetColor(NS_RGB(0, 255, 255));
|
||||
aRenderingContext.FillRect(0, 0, nscoord(5 * p2t), mRect.height);
|
||||
}
|
||||
return NS_OK;
|
||||
@@ -113,16 +111,10 @@ BRFrame::InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
mStyleContext->GetStyleData(eStyleStruct_Font);
|
||||
nsIFontMetrics* fm = aLineLayout.mPresContext->GetMetricsFor(font->mFont);
|
||||
|
||||
aMetrics.width = 0;
|
||||
if (nsIFrame::GetShowFrameBorders()) {
|
||||
// Reserve a tiny bit of space so that our frame won't be zero
|
||||
// sized so we get a chance to paint.
|
||||
aMetrics.width = 1;
|
||||
}
|
||||
|
||||
aMetrics.ascent = fm->GetMaxAscent();
|
||||
aMetrics.descent = fm->GetMaxDescent();
|
||||
aMetrics.height = aMetrics.ascent + aMetrics.descent;
|
||||
aMetrics.width = 0;
|
||||
NS_RELEASE(fm);
|
||||
|
||||
// Return our inline reflow status
|
||||
|
||||
@@ -142,16 +142,9 @@ nsPlaceholderFrame::InlineReflow(nsCSSLineLayout& aLineLayout,
|
||||
container->AddFloater(&presContext, aReflowState, mAnchoredItem, this);
|
||||
}
|
||||
|
||||
if (nsIFrame::GetShowFrameBorders()) {
|
||||
float p2t = presContext.GetPixelsToTwips();
|
||||
aDesiredSize.width = nscoord(p2t * 5);
|
||||
aDesiredSize.height = aDesiredSize.width;
|
||||
}
|
||||
else {
|
||||
aDesiredSize.width = 0;
|
||||
aDesiredSize.height = 0;
|
||||
}
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.width = 0;
|
||||
aDesiredSize.height = 0;
|
||||
aDesiredSize.ascent = 0;
|
||||
aDesiredSize.descent = 0;
|
||||
if (nsnull != aDesiredSize.maxElementSize) {
|
||||
aDesiredSize.maxElementSize->width = aDesiredSize.width;
|
||||
@@ -166,8 +159,12 @@ nsPlaceholderFrame::Paint(nsIPresContext& aPresContext,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
if (nsIFrame::GetShowFrameBorders()) {
|
||||
float p2t = aPresContext.GetPixelsToTwips();
|
||||
aRenderingContext.SetColor(NS_RGB(0, 255, 255));
|
||||
aRenderingContext.FillRect(0, 0, mRect.width, mRect.height);
|
||||
nscoord x = nscoord(-5 * p2t);
|
||||
aRenderingContext.FillRect(x, 0, nscoord(13 * p2t), nscoord(3 * p2t));
|
||||
nscoord y = nscoord(-10 * p2t);
|
||||
aRenderingContext.FillRect(0, y, nscoord(3 * p2t), nscoord(10 * p2t));
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user