Bug 1399776 - Draw a default background-color: white for checkbox/radio on Android. r?mats draft
authorLouis Chang <lochang@mozilla.com>
Mon, 18 Sep 2017 15:35:40 +0800
changeset 666217 be88535e1f0955231e8656a2e8703d97f1fc44cd
parent 659350 bd7c2148cc8079691e1330be389cb184347ce7c2
child 732015 583b9a8f4daae9e6e850fe91a9d0b985d749f9f7
push id80315
push userlochang@mozilla.com
push dateMon, 18 Sep 2017 07:59:36 +0000
reviewersmats
bugs1399776
milestone57.0a1
Bug 1399776 - Draw a default background-color: white for checkbox/radio on Android. r?mats MozReview-Commit-ID: HXUjbHtxLDj
widget/android/AndroidColors.h
widget/android/nsNativeThemeAndroid.cpp
--- a/widget/android/AndroidColors.h
+++ b/widget/android/AndroidColors.h
@@ -6,16 +6,17 @@
 #ifndef mozilla_widget_AndroidColors_h
 #define mozilla_widget_AndroidColors_h
 
 #include "mozilla/gfx/2D.h"
 
 namespace mozilla {
 namespace widget {
 
+static const Color sAndroidBackgroundColor(Color(1.0f, 1.0f, 1.0f));
 static const Color sAndroidBorderColor(Color(0.73f, 0.73f, 0.73f));
 static const Color sAndroidCheckColor(Color(0.19f, 0.21f, 0.23f));
 static const Color sAndroidDisabledColor(Color(0.88f, 0.88f, 0.88f));
 static const Color sAndroidHoverColor(Color(0.94f, 0.94f, 0.94f));
 
 } // namespace widget
 } // namespace mozilla
 
--- a/widget/android/nsNativeThemeAndroid.cpp
+++ b/widget/android/nsNativeThemeAndroid.cpp
@@ -33,16 +33,18 @@ PaintCheckboxControl(nsIFrame* aFrame,
     nsCSSRendering::GetBoxShadowInnerPaddingRect(aFrame, rect);
   const nscoord twipsPerPixel = aFrame->PresContext()->DevPixelsToAppUnits(1);
   Rect shadowGfxRect = NSRectToRect(paddingRect, twipsPerPixel);
   shadowGfxRect.Round();
   RefPtr<Path> roundedRect =
     MakePathForRoundedRect(*aDrawTarget, shadowGfxRect, innerRadii);
   aDrawTarget->Stroke(roundedRect,
     ColorPattern(ToDeviceColor(mozilla::widget::sAndroidBorderColor)));
+  aDrawTarget->Fill(roundedRect,
+    ColorPattern(ToDeviceColor(mozilla::widget::sAndroidBackgroundColor)));
 
   if (aState.HasState(NS_EVENT_STATE_DISABLED)) {
     aDrawTarget->Fill(roundedRect,
       ColorPattern(ToDeviceColor(mozilla::widget::sAndroidDisabledColor)));
     return;
   }
 
   if (aState.HasState(NS_EVENT_STATE_HOVER)) {
@@ -120,16 +122,18 @@ PaintRadioControl(nsIFrame* aFrame,
   // theming.
   const nscoord twipsPerPixel = aFrame->PresContext()->DevPixelsToAppUnits(1);
   Rect devPxRect = NSRectToRect(rect, twipsPerPixel);
   RefPtr<PathBuilder> builder = aDrawTarget->CreatePathBuilder();
   AppendEllipseToPath(builder, devPxRect.Center(), devPxRect.Size());
   RefPtr<Path> ellipse = builder->Finish();
   aDrawTarget->Stroke(ellipse,
     ColorPattern(ToDeviceColor(mozilla::widget::sAndroidBorderColor)));
+  aDrawTarget->Fill(ellipse,
+    ColorPattern(ToDeviceColor(mozilla::widget::sAndroidBackgroundColor)));
 
   if (aState.HasState(NS_EVENT_STATE_DISABLED)) {
     aDrawTarget->Fill(ellipse,
       ColorPattern(ToDeviceColor(mozilla::widget::sAndroidDisabledColor)));
     return;
   }
 
   if (aState.HasState(NS_EVENT_STATE_HOVER)) {