From 59b589b9643753392933bd1beebdfb44275cf7c3 Mon Sep 17 00:00:00 2001 From: "aaronleventhal%moonset.net" Date: Thu, 11 Nov 2004 15:07:22 +0000 Subject: [PATCH] Bug 250269. Outlines not getting painted on buttons, radios, checkboxes, tables and table cells. r+sr=roc git-svn-id: svn://10.0.0.236/trunk@165254 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/forms/nsFormControlFrame.cpp | 2 ++ mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp | 8 +++++++- mozilla/layout/forms/nsGfxRadioControlFrame.cpp | 8 +++++++- mozilla/layout/forms/nsHTMLButtonControlFrame.cpp | 9 +++++++++ mozilla/layout/html/forms/src/nsFormControlFrame.cpp | 2 ++ .../layout/html/forms/src/nsGfxCheckboxControlFrame.cpp | 8 +++++++- mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp | 8 +++++++- .../layout/html/forms/src/nsHTMLButtonControlFrame.cpp | 9 +++++++++ mozilla/layout/html/table/src/nsTableCellFrame.cpp | 7 +++++++ mozilla/layout/html/table/src/nsTableFrame.cpp | 7 +++++++ mozilla/layout/html/table/src/nsTableRowFrame.cpp | 8 ++++++++ mozilla/layout/tables/nsTableCellFrame.cpp | 7 +++++++ mozilla/layout/tables/nsTableFrame.cpp | 7 +++++++ mozilla/layout/tables/nsTableRowFrame.cpp | 8 ++++++++ 14 files changed, 94 insertions(+), 4 deletions(-) diff --git a/mozilla/layout/forms/nsFormControlFrame.cpp b/mozilla/layout/forms/nsFormControlFrame.cpp index c7ffea01a17..69c98c21742 100644 --- a/mozilla/layout/forms/nsFormControlFrame.cpp +++ b/mozilla/layout/forms/nsFormControlFrame.cpp @@ -550,6 +550,8 @@ nsFormControlFrame::Reflow(nsPresContext* aPresContext, aStatus = NS_FRAME_COMPLETE; SetupCachedSizes(mCacheSize, mCachedAscent, mCachedMaxElementWidth, aDesiredSize); NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize); + nsRect overflowStartRect(0, 0, aDesiredSize.width, aDesiredSize.height); + FinishAndStoreOverflow(&overflowStartRect, overflowStartRect.Size()); return rv; } diff --git a/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp b/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp index b561084bd20..a5183b0d874 100644 --- a/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp +++ b/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp @@ -227,11 +227,11 @@ nsGfxCheckboxControlFrame::Paint(nsPresContext* aPresContext, if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) { PRBool doDefaultPainting = PR_TRUE; // Paint the checkmark + const nsStyleBorder* myBorder = mCheckButtonFaceStyle->GetStyleBorder(); if (!mCheckButtonFaceStyle && GetCheckboxState()) { const nsStyleBackground* myColor = mCheckButtonFaceStyle->GetStyleBackground(); if (myColor->mBackgroundImage) { - const nsStyleBorder* myBorder = mCheckButtonFaceStyle->GetStyleBorder(); const nsStylePadding* myPadding = mCheckButtonFaceStyle->GetStylePadding(); const nsStylePosition* myPosition = mCheckButtonFaceStyle->GetStylePosition(); @@ -251,6 +251,12 @@ nsGfxCheckboxControlFrame::Paint(nsPresContext* aPresContext, } } + nsRect rect(0, 0, mRect.width, mRect.height); + const nsStyleOutline* myOutline = GetStyleOutline(); + nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *myBorder, *myOutline, + mStyleContext, 0); + if (doDefaultPainting) { PaintCheckBox(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); } diff --git a/mozilla/layout/forms/nsGfxRadioControlFrame.cpp b/mozilla/layout/forms/nsGfxRadioControlFrame.cpp index 70cae44e446..1362668aa1d 100644 --- a/mozilla/layout/forms/nsGfxRadioControlFrame.cpp +++ b/mozilla/layout/forms/nsGfxRadioControlFrame.cpp @@ -178,12 +178,12 @@ nsGfxRadioControlFrame::PaintRadioButton(nsPresContext* aPresContext, PRBool checked = PR_TRUE; GetCurrentCheckState(&checked); // Get check state from the content model + const nsStyleBorder* myBorder = mRadioButtonFaceStyle->GetStyleBorder(); if (checked) { // Paint the button for the radio button using CSS background rendering code if (nsnull != mRadioButtonFaceStyle) { const nsStyleBackground* myColor = mRadioButtonFaceStyle->GetStyleBackground(); const nsStyleColor* color = mRadioButtonFaceStyle->GetStyleColor(); - const nsStyleBorder* myBorder = mRadioButtonFaceStyle->GetStyleBorder(); const nsStylePadding* myPadding = mRadioButtonFaceStyle->GetStylePadding(); const nsStylePosition* myPosition = mRadioButtonFaceStyle->GetStylePosition(); @@ -229,6 +229,12 @@ nsGfxRadioControlFrame::Paint(nsPresContext* aPresContext, if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) { PaintRadioButton(aPresContext, aRenderingContext, aDirtyRect); } + nsRect rect(0, 0, mRect.width, mRect.height); + const nsStyleOutline* myOutline = GetStyleOutline(); + const nsStyleBorder* myBorder = GetStyleBorder(); + nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *myBorder, *myOutline, + mStyleContext, 0); return rv; } diff --git a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp index 422a8bf78a7..eeee92deaca 100644 --- a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp @@ -356,6 +356,12 @@ nsHTMLButtonControlFrame::Paint(nsPresContext* aPresContext, #endif + // Paint outline + const nsStyleOutline* outlineStyle = GetStyleOutline(); + nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *borderStyle, *outlineStyle, + mStyleContext, 0); + // to draw border when selected in editor return nsFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); } @@ -481,6 +487,9 @@ nsHTMLButtonControlFrame::Reflow(nsPresContext* aPresContext, aDesiredSize.ascent += aReflowState.mComputedBorderPadding.top + focusPadding.top; aDesiredSize.descent = aDesiredSize.height - aDesiredSize.ascent; + nsRect buttonRect(0, 0, aDesiredSize.width, aDesiredSize.height); + FinishAndStoreOverflow(&buttonRect, buttonRect.Size()); + aStatus = NS_FRAME_COMPLETE; nsFormControlFrame::SetupCachedSizes(mCacheSize, mCachedAscent, diff --git a/mozilla/layout/html/forms/src/nsFormControlFrame.cpp b/mozilla/layout/html/forms/src/nsFormControlFrame.cpp index c7ffea01a17..69c98c21742 100644 --- a/mozilla/layout/html/forms/src/nsFormControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFormControlFrame.cpp @@ -550,6 +550,8 @@ nsFormControlFrame::Reflow(nsPresContext* aPresContext, aStatus = NS_FRAME_COMPLETE; SetupCachedSizes(mCacheSize, mCachedAscent, mCachedMaxElementWidth, aDesiredSize); NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize); + nsRect overflowStartRect(0, 0, aDesiredSize.width, aDesiredSize.height); + FinishAndStoreOverflow(&overflowStartRect, overflowStartRect.Size()); return rv; } diff --git a/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp index b561084bd20..a5183b0d874 100644 --- a/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp @@ -227,11 +227,11 @@ nsGfxCheckboxControlFrame::Paint(nsPresContext* aPresContext, if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) { PRBool doDefaultPainting = PR_TRUE; // Paint the checkmark + const nsStyleBorder* myBorder = mCheckButtonFaceStyle->GetStyleBorder(); if (!mCheckButtonFaceStyle && GetCheckboxState()) { const nsStyleBackground* myColor = mCheckButtonFaceStyle->GetStyleBackground(); if (myColor->mBackgroundImage) { - const nsStyleBorder* myBorder = mCheckButtonFaceStyle->GetStyleBorder(); const nsStylePadding* myPadding = mCheckButtonFaceStyle->GetStylePadding(); const nsStylePosition* myPosition = mCheckButtonFaceStyle->GetStylePosition(); @@ -251,6 +251,12 @@ nsGfxCheckboxControlFrame::Paint(nsPresContext* aPresContext, } } + nsRect rect(0, 0, mRect.width, mRect.height); + const nsStyleOutline* myOutline = GetStyleOutline(); + nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *myBorder, *myOutline, + mStyleContext, 0); + if (doDefaultPainting) { PaintCheckBox(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); } diff --git a/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp index 70cae44e446..1362668aa1d 100644 --- a/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp @@ -178,12 +178,12 @@ nsGfxRadioControlFrame::PaintRadioButton(nsPresContext* aPresContext, PRBool checked = PR_TRUE; GetCurrentCheckState(&checked); // Get check state from the content model + const nsStyleBorder* myBorder = mRadioButtonFaceStyle->GetStyleBorder(); if (checked) { // Paint the button for the radio button using CSS background rendering code if (nsnull != mRadioButtonFaceStyle) { const nsStyleBackground* myColor = mRadioButtonFaceStyle->GetStyleBackground(); const nsStyleColor* color = mRadioButtonFaceStyle->GetStyleColor(); - const nsStyleBorder* myBorder = mRadioButtonFaceStyle->GetStyleBorder(); const nsStylePadding* myPadding = mRadioButtonFaceStyle->GetStylePadding(); const nsStylePosition* myPosition = mRadioButtonFaceStyle->GetStylePosition(); @@ -229,6 +229,12 @@ nsGfxRadioControlFrame::Paint(nsPresContext* aPresContext, if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) { PaintRadioButton(aPresContext, aRenderingContext, aDirtyRect); } + nsRect rect(0, 0, mRect.width, mRect.height); + const nsStyleOutline* myOutline = GetStyleOutline(); + const nsStyleBorder* myBorder = GetStyleBorder(); + nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *myBorder, *myOutline, + mStyleContext, 0); return rv; } diff --git a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp index 422a8bf78a7..eeee92deaca 100644 --- a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp @@ -356,6 +356,12 @@ nsHTMLButtonControlFrame::Paint(nsPresContext* aPresContext, #endif + // Paint outline + const nsStyleOutline* outlineStyle = GetStyleOutline(); + nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *borderStyle, *outlineStyle, + mStyleContext, 0); + // to draw border when selected in editor return nsFrame::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); } @@ -481,6 +487,9 @@ nsHTMLButtonControlFrame::Reflow(nsPresContext* aPresContext, aDesiredSize.ascent += aReflowState.mComputedBorderPadding.top + focusPadding.top; aDesiredSize.descent = aDesiredSize.height - aDesiredSize.ascent; + nsRect buttonRect(0, 0, aDesiredSize.width, aDesiredSize.height); + FinishAndStoreOverflow(&buttonRect, buttonRect.Size()); + aStatus = NS_FRAME_COMPLETE; nsFormControlFrame::SetupCachedSizes(mCacheSize, mCachedAscent, diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.cpp b/mozilla/layout/html/table/src/nsTableCellFrame.cpp index 0d47f8c8e5d..7449dd7a8b7 100644 --- a/mozilla/layout/html/table/src/nsTableCellFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableCellFrame.cpp @@ -397,6 +397,13 @@ nsTableCellFrame::Paint(nsPresContext* aPresContext, *myBorder, *myPadding, *cellTableStyle); } + // Paint outline + nsRect rect(0, 0, mRect.width, mRect.height); + const nsStyleOutline* myOutline = GetStyleOutline(); + nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *myBorder, *myOutline, + mStyleContext, 0); + const nsStyleBackground* myColor = GetStyleBackground(); DecorateForSelection(aPresContext, aRenderingContext,myColor); //ignore return value } diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index b39a4bd73f9..a4def1c753b 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -1434,6 +1434,13 @@ nsTableFrame::Paint(nsPresContext* aPresContext, PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aFlags); + // Paint outline + nsRect rect(0, 0, mRect.width, mRect.height); + const nsStyleOutline* outlineStyle = GetStyleOutline(); + const nsStyleBorder* borderStyle = GetStyleBorder(); + nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *borderStyle, *outlineStyle, + mStyleContext, 0); #ifdef DEBUG // for debug... if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { diff --git a/mozilla/layout/html/table/src/nsTableRowFrame.cpp b/mozilla/layout/html/table/src/nsTableRowFrame.cpp index 48c85ca68ec..e2681c3f027 100644 --- a/mozilla/layout/html/table/src/nsTableRowFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowFrame.cpp @@ -562,6 +562,14 @@ NS_METHOD nsTableRowFrame::Paint(nsPresContext* aPresContext, } PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aFlags); + + // Paint outline + nsRect rect(0, 0, mRect.width, mRect.height); + const nsStyleOutline* outlineStyle = GetStyleOutline(); + const nsStyleBorder* borderStyle = GetStyleBorder(); + nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *borderStyle, *outlineStyle, + mStyleContext, 0); if (clip) aRenderingContext.PopState(); return NS_OK; diff --git a/mozilla/layout/tables/nsTableCellFrame.cpp b/mozilla/layout/tables/nsTableCellFrame.cpp index 0d47f8c8e5d..7449dd7a8b7 100644 --- a/mozilla/layout/tables/nsTableCellFrame.cpp +++ b/mozilla/layout/tables/nsTableCellFrame.cpp @@ -397,6 +397,13 @@ nsTableCellFrame::Paint(nsPresContext* aPresContext, *myBorder, *myPadding, *cellTableStyle); } + // Paint outline + nsRect rect(0, 0, mRect.width, mRect.height); + const nsStyleOutline* myOutline = GetStyleOutline(); + nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *myBorder, *myOutline, + mStyleContext, 0); + const nsStyleBackground* myColor = GetStyleBackground(); DecorateForSelection(aPresContext, aRenderingContext,myColor); //ignore return value } diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index b39a4bd73f9..a4def1c753b 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -1434,6 +1434,13 @@ nsTableFrame::Paint(nsPresContext* aPresContext, PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aFlags); + // Paint outline + nsRect rect(0, 0, mRect.width, mRect.height); + const nsStyleOutline* outlineStyle = GetStyleOutline(); + const nsStyleBorder* borderStyle = GetStyleBorder(); + nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *borderStyle, *outlineStyle, + mStyleContext, 0); #ifdef DEBUG // for debug... if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { diff --git a/mozilla/layout/tables/nsTableRowFrame.cpp b/mozilla/layout/tables/nsTableRowFrame.cpp index 48c85ca68ec..e2681c3f027 100644 --- a/mozilla/layout/tables/nsTableRowFrame.cpp +++ b/mozilla/layout/tables/nsTableRowFrame.cpp @@ -562,6 +562,14 @@ NS_METHOD nsTableRowFrame::Paint(nsPresContext* aPresContext, } PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aFlags); + + // Paint outline + nsRect rect(0, 0, mRect.width, mRect.height); + const nsStyleOutline* outlineStyle = GetStyleOutline(); + const nsStyleBorder* borderStyle = GetStyleBorder(); + nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this, + aDirtyRect, rect, *borderStyle, *outlineStyle, + mStyleContext, 0); if (clip) aRenderingContext.PopState(); return NS_OK;