From 70f2d42c598b229c124da73a436f1fb38d861091 Mon Sep 17 00:00:00 2001 From: "kipp%netscape.com" Date: Wed, 29 Jul 1998 19:33:27 +0000 Subject: [PATCH] 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 --- mozilla/layout/generic/nsPlaceholderFrame.cpp | 19 ++++++++----------- mozilla/layout/html/base/src/nsBRPart.cpp | 12 ++---------- .../html/base/src/nsPlaceholderFrame.cpp | 19 ++++++++----------- 3 files changed, 18 insertions(+), 32 deletions(-) diff --git a/mozilla/layout/generic/nsPlaceholderFrame.cpp b/mozilla/layout/generic/nsPlaceholderFrame.cpp index 363c793f91a..a9e1dd65266 100644 --- a/mozilla/layout/generic/nsPlaceholderFrame.cpp +++ b/mozilla/layout/generic/nsPlaceholderFrame.cpp @@ -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; } diff --git a/mozilla/layout/html/base/src/nsBRPart.cpp b/mozilla/layout/html/base/src/nsBRPart.cpp index bcb8de30e21..e563a3df75d 100644 --- a/mozilla/layout/html/base/src/nsBRPart.cpp +++ b/mozilla/layout/html/base/src/nsBRPart.cpp @@ -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 diff --git a/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp b/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp index 363c793f91a..a9e1dd65266 100644 --- a/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp +++ b/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp @@ -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; }