From b2f32dc37e7a3cee8733cf7c282bc3f711d46f4a Mon Sep 17 00:00:00 2001 From: "masayuki%d-toybox.com" Date: Fri, 28 Apr 2006 23:21:01 +0000 Subject: [PATCH] Bug 335474 Crash in [@ nsCSSRendering::DrawDashedSides] r+sr=roc git-svn-id: svn://10.0.0.236/trunk@195696 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsCSSRendering.cpp | 4 +++- mozilla/layout/generic/nsHTMLFrame.cpp | 13 ++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/mozilla/layout/base/nsCSSRendering.cpp b/mozilla/layout/base/nsCSSRendering.cpp index 7e382e96f18..307751a5a07 100644 --- a/mozilla/layout/base/nsCSSRendering.cpp +++ b/mozilla/layout/base/nsCSSRendering.cpp @@ -920,7 +920,9 @@ PRBool bSolid = PR_TRUE; float over = 0.0f; PRBool skippedSide = PR_FALSE; - NS_ASSERTION((aDoOutline && aOutlineStyle) || (!aDoOutline && aBorderStyle), "null params not allowed"); + NS_ASSERTION(aColorStyle && + ((aDoOutline && aOutlineStyle) || (!aDoOutline && aBorderStyle)), + "null params not allowed"); PRUint8 style = aDoOutline ? aOutlineStyle->GetOutlineStyle() : aBorderStyle->GetBorderStyle(startSide); diff --git a/mozilla/layout/generic/nsHTMLFrame.cpp b/mozilla/layout/generic/nsHTMLFrame.cpp index f253052a27a..9f25469f6a1 100644 --- a/mozilla/layout/generic/nsHTMLFrame.cpp +++ b/mozilla/layout/generic/nsHTMLFrame.cpp @@ -502,6 +502,17 @@ CanvasFrame::PaintFocus(nsIRenderingContext& aRenderingContext, nsPoint aPt) outlineStyle.SetOutlineStyle(NS_STYLE_BORDER_STYLE_DOTTED); outlineStyle.SetOutlineInvert(); + // XXX use the root frame foreground color, but should we find BODY frame + // for HTML documents? + nsIFrame* root = mFrames.FirstChild(); + const nsStyleColor* color = + root ? root->GetStyleContext()->GetStyleColor() : + mStyleContext->GetStyleColor(); + if (!color) { + NS_ERROR("current color cannot be found"); + return; + } + float p2t = GetPresContext()->PixelsToTwips(); // XXX the CSS border for links is specified as 2px, but it // is only drawn as 1px. Match this here. @@ -513,7 +524,7 @@ CanvasFrame::PaintFocus(nsIRenderingContext& aRenderingContext, nsPoint aPt) focusRect.height - 2 * onePixel); nsCSSRendering::DrawDashedSides(0, aRenderingContext, - focusRect, nsnull, + focusRect, color, nsnull, &outlineStyle, PR_TRUE, focusRect, borderInside, 0,