diff --git a/layout/forms/nsGfxCheckboxControlFrame.cpp b/layout/forms/nsGfxCheckboxControlFrame.cpp index 43cd75daa27..36772129a92 100644 --- a/layout/forms/nsGfxCheckboxControlFrame.cpp +++ b/layout/forms/nsGfxCheckboxControlFrame.cpp @@ -49,20 +49,25 @@ #include "nsIDOMNSHTMLInputElement.h" static void -PaintCheckMark(nsIRenderingContext& aRenderingContext, - const nsRect& aRect) +PaintCheckMark(nsIFrame* aFrame, + nsIRenderingContext* aCtx, + const nsRect& aDirtyRect, + nsPoint aPt) { + nsRect rect(aPt, aFrame->GetSize()); + rect.Deflate(aFrame->GetUsedBorderAndPadding()); + // Points come from the coordinates on a 7X7 unit box centered at 0,0 const PRInt32 checkPolygonX[] = { -3, -1, 3, 3, -1, -3 }; const PRInt32 checkPolygonY[] = { -1, 1, -3, -1, 3, 1 }; const PRInt32 checkNumPoints = sizeof(checkPolygonX) / sizeof(PRInt32); - const PRInt32 checkSize = 9; // This is value is determined by adding 2 - // units to pad the 7x7 unit checkmark + const PRInt32 checkSize = 9; // 2 units of padding on either side + // of the 7x7 unit checkmark // Scale the checkmark based on the smallest dimension - nscoord paintScale = PR_MIN(aRect.width, aRect.height) / checkSize; - nsPoint paintCenter(aRect.x + aRect.width / 2, - aRect.y + aRect.height / 2); + nscoord paintScale = PR_MIN(rect.width, rect.height) / checkSize; + nsPoint paintCenter(rect.x + rect.width / 2, + rect.y + rect.height / 2); nsPoint paintPolygon[checkNumPoints]; // Convert checkmark for screen rendering @@ -72,24 +77,30 @@ PaintCheckMark(nsIRenderingContext& aRenderingContext, checkPolygonY[polyIndex] * paintScale); } - aRenderingContext.FillPolygon(paintPolygon, checkNumPoints); + aCtx->SetColor(aFrame->GetStyleColor()->mColor); + aCtx->FillPolygon(paintPolygon, checkNumPoints); } static void -PaintIndeterminateMark(nsIRenderingContext& aRenderingContext, - const nsRect& aRect) +PaintIndeterminateMark(nsIFrame* aFrame, + nsIRenderingContext* aCtx, + const nsRect& aDirtyRect, + nsPoint aPt) { - // Drawing a thin horizontal line in the middle of the rect. - nsRect fillRect = aRect; - fillRect.height /= 4; - fillRect.y += (aRect.height - fillRect.height) / 2; + nsRect rect(aPt, aFrame->GetSize()); + rect.Deflate(aFrame->GetUsedBorderAndPadding()); - aRenderingContext.FillRect(fillRect); + rect.y += (rect.height - rect.height/4) / 2; + rect.height /= 4; + + aCtx->SetColor(aFrame->GetStyleColor()->mColor); + aCtx->FillRect(rect); } //------------------------------------------------------------ nsIFrame* -NS_NewGfxCheckboxControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) +NS_NewGfxCheckboxControlFrame(nsIPresShell* aPresShell, + nsStyleContext* aContext) { return new (aPresShell) nsGfxCheckboxControlFrame(aContext); } @@ -111,63 +122,22 @@ NS_QUERYFRAME_HEAD(nsGfxCheckboxControlFrame) NS_QUERYFRAME_ENTRY(nsICheckboxControlFrame) NS_QUERYFRAME_TAIL_INHERITING(nsFormControlFrame) -NS_IMETHODIMP -nsGfxCheckboxControlFrame::Init(nsIContent* aContent, - nsIFrame* aParent, - nsIFrame* aPrevInFlow) -{ - nsresult rv = nsFormControlFrame::Init(aContent, aParent, aPrevInFlow); - if (NS_SUCCEEDED(rv)) { - mCheckButtonFaceStyle = - PresContext()->PresShell()->StyleSet()-> - ResolvePseudoStyleFor(aContent, nsCSSAnonBoxes::check, - GetStyleContext()); - } - - return rv; -} - #ifdef ACCESSIBILITY -NS_IMETHODIMP nsGfxCheckboxControlFrame::GetAccessible(nsIAccessible** aAccessible) +NS_IMETHODIMP +nsGfxCheckboxControlFrame::GetAccessible(nsIAccessible** aAccessible) { - nsCOMPtr accService = do_GetService("@mozilla.org/accessibilityService;1"); + nsCOMPtr accService + = do_GetService("@mozilla.org/accessibilityService;1"); if (accService) { - return accService->CreateHTMLCheckboxAccessible(static_cast(this), aAccessible); + return accService->CreateHTMLCheckboxAccessible( + static_cast(this), aAccessible); } return NS_ERROR_FAILURE; } #endif -//-------------------------------------------------------------- -nsStyleContext* -nsGfxCheckboxControlFrame::GetAdditionalStyleContext(PRInt32 aIndex) const -{ - switch (aIndex) { - case NS_GFX_CHECKBOX_CONTROL_FRAME_FACE_CONTEXT_INDEX: - return mCheckButtonFaceStyle; - break; - default: - return nsnull; - } -} - - - -//-------------------------------------------------------------- -void -nsGfxCheckboxControlFrame::SetAdditionalStyleContext(PRInt32 aIndex, - nsStyleContext* aStyleContext) -{ - switch (aIndex) { - case NS_GFX_CHECKBOX_CONTROL_FRAME_FACE_CONTEXT_INDEX: - mCheckButtonFaceStyle = aStyleContext; - break; - } -} - - //------------------------------------------------------------ NS_IMETHODIMP nsGfxCheckboxControlFrame::OnChecked(nsPresContext* aPresContext, @@ -177,64 +147,14 @@ nsGfxCheckboxControlFrame::OnChecked(nsPresContext* aPresContext, return NS_OK; } -static void PaintCheckMarkFromStyle(nsIFrame* aFrame, - nsIRenderingContext* aCtx, const nsRect& aDirtyRect, nsPoint aPt) { - static_cast(aFrame) - ->PaintCheckBoxFromStyle(*aCtx, aPt, aDirtyRect); -} - -class nsDisplayCheckMark : public nsDisplayItem { -public: - nsDisplayCheckMark(nsGfxCheckboxControlFrame* aFrame) - : nsDisplayItem(aFrame) { - MOZ_COUNT_CTOR(nsDisplayCheckMark); - } -#ifdef NS_BUILD_REFCNT_LOGGING - virtual ~nsDisplayCheckMark() { - MOZ_COUNT_DTOR(nsDisplayCheckMark); - } -#endif - - virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx, - const nsRect& aDirtyRect); - NS_DISPLAY_DECL_NAME("CheckMark") -}; - -void -nsDisplayCheckMark::Paint(nsDisplayListBuilder* aBuilder, - nsIRenderingContext* aCtx, const nsRect& aDirtyRect) { - static_cast(mFrame)-> - PaintCheckBox(*aCtx, aBuilder->ToReferenceFrame(mFrame), aDirtyRect); -} - - -//------------------------------------------------------------ -void -nsGfxCheckboxControlFrame::PaintCheckBox(nsIRenderingContext& aRenderingContext, - nsPoint aPt, - const nsRect& aDirtyRect) -{ - // REVIEW: moved the mAppearance test out so we avoid constructing - // a display item if it's not needed - nsRect checkRect(aPt, mRect.Size()); - checkRect.Deflate(GetUsedBorderAndPadding()); - - const nsStyleColor* color = GetStyleColor(); - aRenderingContext.SetColor(color->mColor); - - if (IsIndeterminate()) - PaintIndeterminateMark(aRenderingContext, checkRect); - else - PaintCheckMark(aRenderingContext, checkRect); -} - //------------------------------------------------------------ NS_IMETHODIMP nsGfxCheckboxControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { - nsresult rv = nsFormControlFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists); + nsresult rv = nsFormControlFrame::BuildDisplayList(aBuilder, aDirtyRect, + aLists); NS_ENSURE_SUCCESS(rv, rv); // Get current checked state through content model. @@ -244,45 +164,11 @@ nsGfxCheckboxControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, if (IsThemed()) return NS_OK; // No need to paint the checkmark. The theme will do it. - // Paint the checkmark - if (mCheckButtonFaceStyle) { - // This code actually works now; not sure how useful it'll be - // (The purpose is to allow the UA stylesheet to substitute its own - // checkmark for the default one) - // XXXbz maybe we should just remove this, together with the - // attendant complexity - const nsStyleBackground* myBackground = mCheckButtonFaceStyle->GetStyleBackground(); - if (!myBackground->IsTransparent()) - return aLists.Content()->AppendNewToTop(new (aBuilder) - nsDisplayGeneric(this, PaintCheckMarkFromStyle, "CheckMarkFromStyle")); - } - - return aLists.Content()->AppendNewToTop(new (aBuilder) nsDisplayCheckMark(this)); -} - -void -nsGfxCheckboxControlFrame::PaintCheckBoxFromStyle( - nsIRenderingContext& aRenderingContext, nsPoint aPt, const nsRect& aDirtyRect) { - const nsStylePosition* myPosition = mCheckButtonFaceStyle->GetStylePosition(); - const nsStyleBorder* myBorder = mCheckButtonFaceStyle->GetStyleBorder(); - const nsStyleBackground* myBackground = mCheckButtonFaceStyle->GetStyleBackground(); - - NS_ASSERTION(myPosition->mWidth.GetUnit() == eStyleUnit_Coord && - myPosition->mHeight.GetUnit() == eStyleUnit_Coord, - "styles for :-moz-checkbox are incorrect or author-accessible"); - nscoord width = myPosition->mWidth.GetCoordValue(); - nscoord height = myPosition->mHeight.GetCoordValue(); - // Position the button centered within the control's rectangle. - nscoord x = (mRect.width - width) / 2; - nscoord y = (mRect.height - height) / 2; - nsRect rect(aPt.x + x, aPt.y + y, width, height); - - nsCSSRendering::PaintBackgroundWithSC(PresContext(), aRenderingContext, - this, aDirtyRect, rect, *myBackground, - *myBorder, PR_FALSE); - nsCSSRendering::PaintBorder(PresContext(), aRenderingContext, this, - aDirtyRect, rect, *myBorder, - mCheckButtonFaceStyle); + return aLists.Content()->AppendNewToTop(new (aBuilder) + nsDisplayGeneric(this, + IsIndeterminate() + ? PaintIndeterminateMark : PaintCheckMark, + "CheckedCheckbox")); } //------------------------------------------------------------ diff --git a/layout/forms/nsGfxCheckboxControlFrame.h b/layout/forms/nsGfxCheckboxControlFrame.h index fc89d04df94..400ded6d41c 100644 --- a/layout/forms/nsGfxCheckboxControlFrame.h +++ b/layout/forms/nsGfxCheckboxControlFrame.h @@ -44,10 +44,6 @@ class nsIAccessible; #endif - -#define NS_GFX_CHECKBOX_CONTROL_FRAME_FACE_CONTEXT_INDEX 0 // for additional style contexts -#define NS_GFX_CHECKBOX_CONTROL_FRAME_LAST_CONTEXT_INDEX 0 - class nsGfxCheckboxControlFrame : public nsFormControlFrame, public nsICheckboxControlFrame { @@ -69,32 +65,15 @@ public: NS_IMETHOD GetAccessible(nsIAccessible** aAccessible); #endif - //nsICheckboxControlFrame methods NS_IMETHOD OnChecked(nsPresContext* aPresContext, PRBool aChecked); - virtual nsStyleContext* GetAdditionalStyleContext(PRInt32 aIndex) const; - virtual void SetAdditionalStyleContext(PRInt32 aIndex, - nsStyleContext* aStyleContext); - NS_DECL_QUERYFRAME - NS_IMETHOD Init(nsIContent* aContent, - nsIFrame* aParent, - nsIFrame* asPrevInFlow); - - void PaintCheckBox(nsIRenderingContext& aRenderingContext, - nsPoint aPt, const nsRect& aDirtyRect); - - void PaintCheckBoxFromStyle(nsIRenderingContext& aRenderingContext, - nsPoint aPt, const nsRect& aDirtyRect); - protected: PRBool IsChecked(); PRBool IsIndeterminate(); - - nsRefPtr mCheckButtonFaceStyle; }; #endif diff --git a/layout/forms/nsGfxRadioControlFrame.cpp b/layout/forms/nsGfxRadioControlFrame.cpp index b6320dfbe1f..b2e8c00592f 100644 --- a/layout/forms/nsGfxRadioControlFrame.cpp +++ b/layout/forms/nsGfxRadioControlFrame.cpp @@ -66,29 +66,16 @@ NS_QUERYFRAME_HEAD(nsGfxRadioControlFrame) NS_QUERYFRAME_ENTRY(nsIRadioControlFrame) NS_QUERYFRAME_TAIL_INHERITING(nsFormControlFrame) -NS_IMETHODIMP -nsGfxRadioControlFrame::Init(nsIContent* aContent, - nsIFrame* aParent, - nsIFrame* aPrevInFlow) -{ - nsresult rv = nsFormControlFrame::Init(aContent, aParent, aPrevInFlow); - if (NS_SUCCEEDED(rv)) { - mRadioButtonFaceStyle = - PresContext()->PresShell()->StyleSet()-> - ResolvePseudoStyleFor(aContent, nsCSSAnonBoxes::radio, - GetStyleContext()); - } - - return rv; -} - #ifdef ACCESSIBILITY -NS_IMETHODIMP nsGfxRadioControlFrame::GetAccessible(nsIAccessible** aAccessible) +NS_IMETHODIMP +nsGfxRadioControlFrame::GetAccessible(nsIAccessible** aAccessible) { - nsCOMPtr accService = do_GetService("@mozilla.org/accessibilityService;1"); + nsCOMPtr accService + = do_GetService("@mozilla.org/accessibilityService;1"); if (accService) { - return accService->CreateHTMLRadioButtonAccessible(static_cast(this), aAccessible); + return accService->CreateHTMLRadioButtonAccessible( + static_cast(this), aAccessible); } return NS_ERROR_FAILURE; @@ -96,120 +83,48 @@ NS_IMETHODIMP nsGfxRadioControlFrame::GetAccessible(nsIAccessible** aAccessible) #endif //-------------------------------------------------------------- -nsStyleContext* -nsGfxRadioControlFrame::GetAdditionalStyleContext(PRInt32 aIndex) const +// Draw the dot for a non-native radio button in the checked state. +static void +PaintCheckedRadioButton(nsIFrame* aFrame, + nsIRenderingContext* aCtx, + const nsRect& aDirtyRect, + nsPoint aPt) { - switch (aIndex) { - case NS_GFX_RADIO_CONTROL_FRAME_FACE_CONTEXT_INDEX: - return mRadioButtonFaceStyle; - break; - default: - return nsnull; - } + // The dot is an ellipse 2px on all sides smaller than the content-box, + // drawn in the foreground color. + nsRect rect(aPt, aFrame->GetSize()); + rect.Deflate(aFrame->GetUsedBorderAndPadding()); + rect.Deflate(nsPresContext::CSSPixelsToAppUnits(2), + nsPresContext::CSSPixelsToAppUnits(2)); + + aCtx->SetColor(aFrame->GetStyleColor()->mColor); + aCtx->FillEllipse(rect); } -//-------------------------------------------------------------- -void -nsGfxRadioControlFrame::SetAdditionalStyleContext(PRInt32 aIndex, - nsStyleContext* aStyleContext) -{ - switch (aIndex) { - case NS_GFX_RADIO_CONTROL_FRAME_FACE_CONTEXT_INDEX: - mRadioButtonFaceStyle = aStyleContext; - break; - } -} - -//-------------------------------------------------------------- -void -nsGfxRadioControlFrame::PaintRadioButtonFromStyle( - nsIRenderingContext& aRenderingContext, nsPoint aPt, const nsRect& aDirtyRect) -{ - const nsStyleBorder* myBorder = mRadioButtonFaceStyle->GetStyleBorder(); - // Paint the button for the radio button using CSS background rendering code - const nsStyleBackground* myColor = mRadioButtonFaceStyle->GetStyleBackground(); - const nsStyleColor* color = mRadioButtonFaceStyle->GetStyleColor(); - const nsStylePosition* myPosition = mRadioButtonFaceStyle->GetStylePosition(); - - NS_ASSERTION(myPosition->mWidth.GetUnit() == eStyleUnit_Coord && - myPosition->mHeight.GetUnit() == eStyleUnit_Coord, - "styles for :-moz-radio are incorrect or author-accessible"); - nscoord width = myPosition->mWidth.GetCoordValue(); - nscoord height = myPosition->mHeight.GetCoordValue(); - // Position the button centered within the radio control's rectangle. - nscoord x = (mRect.width - width) / 2; - nscoord y = (mRect.height - height) / 2; - nsRect rect = nsRect(x, y, width, height) + aPt; - - // So we will use PaintBackgroundWithSC to paint the dot, - // but it uses the mBackgroundColor for painting and we need to use the mColor - // so create a temporary style color struct and set it up appropriately - // XXXldb It would make more sense to use - // |aRenderingContext.FillEllipse| here, but on at least GTK that - // doesn't draw a round enough circle. - nsStyleBackground tmpColor = *myColor; - tmpColor.mBackgroundColor = color->mColor; - nsPresContext* pc = PresContext(); - nsCSSRendering::PaintBackgroundWithSC(pc, aRenderingContext, - this, aDirtyRect, rect, - tmpColor, *myBorder, PR_FALSE); - nsCSSRendering::PaintBorder(pc, aRenderingContext, this, - aDirtyRect, rect, *myBorder, mRadioButtonFaceStyle, 0); -} - -class nsDisplayRadioButtonFromStyle : public nsDisplayItem { -public: - nsDisplayRadioButtonFromStyle(nsGfxRadioControlFrame* aFrame) - : nsDisplayItem(aFrame) { - MOZ_COUNT_CTOR(nsDisplayRadioButtonFromStyle); - } -#ifdef NS_BUILD_REFCNT_LOGGING - virtual ~nsDisplayRadioButtonFromStyle() { - MOZ_COUNT_DTOR(nsDisplayRadioButtonFromStyle); - } -#endif - - virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx, - const nsRect& aDirtyRect); - NS_DISPLAY_DECL_NAME("RadioButton") -}; - -void -nsDisplayRadioButtonFromStyle::Paint(nsDisplayListBuilder* aBuilder, - nsIRenderingContext* aCtx, const nsRect& aDirtyRect) { - static_cast(mFrame)-> - PaintRadioButtonFromStyle(*aCtx, aBuilder->ToReferenceFrame(mFrame), aDirtyRect); -} - -//-------------------------------------------------------------- NS_IMETHODIMP nsGfxRadioControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { - nsresult rv = nsFormControlFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists); + nsresult rv = nsFormControlFrame::BuildDisplayList(aBuilder, aDirtyRect, + aLists); NS_ENSURE_SUCCESS(rv, rv); if (!IsVisibleForPainting(aBuilder)) return NS_OK; if (IsThemed()) - return NS_OK; // No need to paint the radio button. The theme will do it. + return NS_OK; // The theme will paint the check, if any. - if (!mRadioButtonFaceStyle) - return NS_OK; - PRBool checked = PR_TRUE; GetCurrentCheckState(&checked); // Get check state from the content model if (!checked) return NS_OK; return aLists.Content()->AppendNewToTop(new (aBuilder) - nsDisplayRadioButtonFromStyle(this)); + nsDisplayGeneric(this, PaintCheckedRadioButton, "CheckedRadioButton")); } - -//-------------------------------------------------------------- NS_IMETHODIMP nsGfxRadioControlFrame::OnChecked(nsPresContext* aPresContext, PRBool aChecked) @@ -217,4 +132,3 @@ nsGfxRadioControlFrame::OnChecked(nsPresContext* aPresContext, InvalidateOverflowRect(); return NS_OK; } - diff --git a/layout/forms/nsGfxRadioControlFrame.h b/layout/forms/nsGfxRadioControlFrame.h index 49f32919283..e2bfc31a2fc 100644 --- a/layout/forms/nsGfxRadioControlFrame.h +++ b/layout/forms/nsGfxRadioControlFrame.h @@ -47,45 +47,24 @@ class nsIAccessible; // nsGfxRadioControlFrame -#define NS_GFX_RADIO_CONTROL_FRAME_FACE_CONTEXT_INDEX 0 // for additional style contexts -#define NS_GFX_RADIO_CONTROL_FRAME_LAST_CONTEXT_INDEX 0 - class nsGfxRadioControlFrame : public nsFormControlFrame, public nsIRadioControlFrame { -private: - public: nsGfxRadioControlFrame(nsStyleContext* aContext); ~nsGfxRadioControlFrame(); NS_DECL_QUERYFRAME - //nsIRadioControlFrame methods - NS_IMETHOD Init(nsIContent* aContent, - nsIFrame* aParent, - nsIFrame* asPrevInFlow); - #ifdef ACCESSIBILITY NS_IMETHOD GetAccessible(nsIAccessible** aAccessible); #endif NS_IMETHOD OnChecked(nsPresContext* aPresContext, PRBool aChecked); - virtual nsStyleContext* GetAdditionalStyleContext(PRInt32 aIndex) const; - virtual void SetAdditionalStyleContext(PRInt32 aIndex, - nsStyleContext* aStyleContext); - NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, const nsDisplayListSet& aLists); - - void PaintRadioButtonFromStyle(nsIRenderingContext& aRenderingContext, nsPoint aPt, - const nsRect& aDirtyRect); - -protected: - nsRefPtr mRadioButtonFaceStyle; }; #endif - diff --git a/layout/reftests/bugs/373381-1-ref.html b/layout/reftests/bugs/373381-1-ref.html index 75b3b5bd876..37ea5077ceb 100644 --- a/layout/reftests/bugs/373381-1-ref.html +++ b/layout/reftests/bugs/373381-1-ref.html @@ -1,4 +1,3 @@ - - - - + + + diff --git a/layout/reftests/bugs/373381-1.html b/layout/reftests/bugs/373381-1.html index 19d4c860cbe..597de6d1f00 100644 --- a/layout/reftests/bugs/373381-1.html +++ b/layout/reftests/bugs/373381-1.html @@ -1,4 +1,3 @@ - - - - + + + diff --git a/layout/reftests/bugs/373381-2-ref.html b/layout/reftests/bugs/373381-2-ref.html new file mode 100644 index 00000000000..d3051d4697f --- /dev/null +++ b/layout/reftests/bugs/373381-2-ref.html @@ -0,0 +1,3 @@ + + + diff --git a/layout/reftests/bugs/373381-2.html b/layout/reftests/bugs/373381-2.html new file mode 100644 index 00000000000..356578ae503 --- /dev/null +++ b/layout/reftests/bugs/373381-2.html @@ -0,0 +1,3 @@ + + + diff --git a/layout/reftests/bugs/373381-3-ref.html b/layout/reftests/bugs/373381-3-ref.html new file mode 100644 index 00000000000..a844c81b51b --- /dev/null +++ b/layout/reftests/bugs/373381-3-ref.html @@ -0,0 +1,3 @@ + + + diff --git a/layout/reftests/bugs/373381-3.html b/layout/reftests/bugs/373381-3.html new file mode 100644 index 00000000000..0f8326b2db0 --- /dev/null +++ b/layout/reftests/bugs/373381-3.html @@ -0,0 +1,3 @@ + + + diff --git a/layout/reftests/bugs/373381-4-ref.html b/layout/reftests/bugs/373381-4-ref.html new file mode 100644 index 00000000000..1fee977b80f --- /dev/null +++ b/layout/reftests/bugs/373381-4-ref.html @@ -0,0 +1,3 @@ + + + diff --git a/layout/reftests/bugs/373381-4.html b/layout/reftests/bugs/373381-4.html new file mode 100644 index 00000000000..20a84245fb3 --- /dev/null +++ b/layout/reftests/bugs/373381-4.html @@ -0,0 +1,3 @@ + + + diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 87151802639..e6ccd2117b5 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -578,6 +578,9 @@ random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 368020-5.html 368020-5-ref.html # bug 3 == 373295-1.html 373295-1-ref.html == 373298-1.html 373298-1-ref.html == 373381-1.html 373381-1-ref.html +== 373381-2.html 373381-2-ref.html +== 373381-3.html 373381-3-ref.html +== 373381-4.html 373381-4-ref.html == 375508-1.html 375508-1-ref.html == 373433-1.html 373433-1-ref.html == 372062-1.html 372062-1-ref.html diff --git a/layout/reftests/forms/checkbox-checked-native-notref.html b/layout/reftests/forms/checkbox-checked-native-notref.html new file mode 100644 index 00000000000..921482afcdf --- /dev/null +++ b/layout/reftests/forms/checkbox-checked-native-notref.html @@ -0,0 +1,2 @@ + + diff --git a/layout/reftests/forms/checkbox-checked-native.html b/layout/reftests/forms/checkbox-checked-native.html new file mode 100644 index 00000000000..50faa46d2d7 --- /dev/null +++ b/layout/reftests/forms/checkbox-checked-native.html @@ -0,0 +1,2 @@ + + diff --git a/layout/reftests/forms/checkbox-checked-notref.html b/layout/reftests/forms/checkbox-checked-notref.html new file mode 100644 index 00000000000..8e5b55cfb7d --- /dev/null +++ b/layout/reftests/forms/checkbox-checked-notref.html @@ -0,0 +1,2 @@ + + diff --git a/layout/reftests/forms/checkbox-checked.html b/layout/reftests/forms/checkbox-checked.html new file mode 100644 index 00000000000..b7d6511358b --- /dev/null +++ b/layout/reftests/forms/checkbox-checked.html @@ -0,0 +1,2 @@ + + diff --git a/layout/reftests/forms/radio-checked-native-notref.html b/layout/reftests/forms/radio-checked-native-notref.html new file mode 100644 index 00000000000..c9483ac056f --- /dev/null +++ b/layout/reftests/forms/radio-checked-native-notref.html @@ -0,0 +1,2 @@ + + diff --git a/layout/reftests/forms/radio-checked-native.html b/layout/reftests/forms/radio-checked-native.html new file mode 100644 index 00000000000..7e7673afd0a --- /dev/null +++ b/layout/reftests/forms/radio-checked-native.html @@ -0,0 +1,2 @@ + + diff --git a/layout/reftests/forms/radio-checked-notref.html b/layout/reftests/forms/radio-checked-notref.html new file mode 100644 index 00000000000..e30a1ef3961 --- /dev/null +++ b/layout/reftests/forms/radio-checked-notref.html @@ -0,0 +1,2 @@ + + diff --git a/layout/reftests/forms/radio-checked.html b/layout/reftests/forms/radio-checked.html new file mode 100644 index 00000000000..37aed5826ea --- /dev/null +++ b/layout/reftests/forms/radio-checked.html @@ -0,0 +1,2 @@ + + diff --git a/layout/reftests/forms/reftest.list b/layout/reftests/forms/reftest.list index 77f8f731a6c..4a2c05ea531 100644 --- a/layout/reftests/forms/reftest.list +++ b/layout/reftests/forms/reftest.list @@ -1,3 +1,4 @@ + == checkbox-label-dynamic.html checkbox-label-dynamic-ref.html == checkbox-radio-stretched.html checkbox-radio-stretched-ref.html # bug 464589 == input-file-width-clip-1.html input-file-width-clip-ref.html # bug 409587 @@ -10,3 +11,17 @@ != indeterminate-native-checked.html indeterminate-native-checked-notref.html != indeterminate-native-unchecked.html indeterminate-native-unchecked-notref.html == indeterminate-selector.html indeterminate-selector-ref.html + +!= checkbox-checked.html checkbox-checked-notref.html +!= checkbox-checked-native.html checkbox-checked-native-notref.html +!= radio-checked.html radio-checked-notref.html +!= radio-checked-native.html radio-checked-native-notref.html + +!= checkbox-checked.html about:blank +!= checkbox-checked-notref.html about:blank +!= radio-checked.html about:blank +!= radio-checked-notref.html about:blank +!= checkbox-checked-native.html about:blank +!= checkbox-checked-native-notref.html about:blank +!= radio-checked-native.html about:blank +!= radio-checked-native-notref.html about:blank diff --git a/layout/style/forms.css b/layout/style/forms.css index c96a310c8bb..9e5b398dd45 100644 --- a/layout/style/forms.css +++ b/layout/style/forms.css @@ -405,35 +405,33 @@ input[type="file"] > input[type="button"] { /* radio buttons */ input[type="radio"] { -moz-appearance: radio; - width: 13px; - height: 13px; margin: 3px 3px 0px 5px; - padding: 0 !important; - cursor: default; - -moz-binding: none; - -moz-border-radius: 100% !important; } /* check boxes */ input[type="checkbox"] { -moz-appearance: checkbox; - width: 13px; - height: 13px; margin: 3px 3px 3px 4px; - padding: 0 !important; - cursor: default; - -moz-binding: none; - -moz-border-radius: 0 !important; } /* common features of radio buttons and check boxes */ +/* NOTE: The width, height, border-width, and padding here must all + add up the way nsFormControlFrame::GetIntrinsic(Width|Height) + expects them to, or they will not come out with total width equal + to total height on sites that set their 'width' or 'height' to 'auto'. + (Should we maybe set !important on width and height, then?) */ input[type="radio"], input[type="checkbox"] { - /* same colors as |input| rule, but |!important| this time. */ -moz-box-sizing: border-box; + width: 13px; + height: 13px; + cursor: default; + padding: 0 !important; + -moz-binding: none; + /* same colors as |input| rule, but |!important| this time. */ background-color: -moz-Field ! important; color: -moz-FieldText ! important; border: 2px inset ThreeDFace ! important; @@ -466,13 +464,6 @@ input[type="radio"]:hover:active { border-style: inset !important; } -*|*::-moz-radio { - width: 4px; - height: 4px; - background-color: -moz-FieldText ! important; - -moz-border-radius: 3px; -} - /* buttons */ /* Note: Values in nsNativeTheme IsWidgetStyled function diff --git a/layout/style/nsCSSAnonBoxList.h b/layout/style/nsCSSAnonBoxList.h index 947d813696d..2dc9b44df4f 100644 --- a/layout/style/nsCSSAnonBoxList.h +++ b/layout/style/nsCSSAnonBoxList.h @@ -67,8 +67,6 @@ CSS_ANON_BOX(cellContent, ":-moz-cell-content") CSS_ANON_BOX(dropDownList, ":-moz-dropdown-list") CSS_ANON_BOX(fieldsetContent, ":-moz-fieldset-content") CSS_ANON_BOX(framesetBlank, ":-moz-frameset-blank") -CSS_ANON_BOX(radio, ":-moz-radio") -CSS_ANON_BOX(check, ":-moz-checkbox") CSS_ANON_BOX(mozDisplayComboboxControlFrame, ":-moz-display-comboboxcontrol-frame") CSS_ANON_BOX(inlineTable, ":-moz-inline-table")