Backed out changeset f70d6fcdb760 (bug 1406631) for failing color related reftests like layout/reftests/writing-mode/ua-style-sheet-input-color-1.html on Android. r=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Sat, 07 Oct 2017 20:08:12 +0200
changeset 427640 2f7a21908e75071747d52a101abd970073f9a22a
parent 427639 40a199104c9ac52bdfdfe4e242b07352c7d2af06
child 427641 993b0c97459dd0336cced363dc5571947b319687
push id97
push userfmarier@mozilla.com
push dateSat, 14 Oct 2017 01:12:59 +0000
reviewersbackout
bugs1406631
milestone58.0a1
backs outf70d6fcdb760b1c0103c94e1019e821c0a3ce3e3
Backed out changeset f70d6fcdb760 (bug 1406631) for failing color related reftests like layout/reftests/writing-mode/ua-style-sheet-input-color-1.html on Android. r=backout
dom/base/nsGkAtomList.h
layout/reftests/writing-mode/ua-style-sheet-input-color-1-ref.html
layout/style/nsCSSRuleProcessor.cpp
layout/style/nsMediaFeatures.cpp
layout/style/res/forms.css
mobile/android/themes/geckoview/content.css
widget/LookAndFeel.h
widget/android/nsLookAndFeel.cpp
widget/cocoa/nsLookAndFeel.mm
widget/gtk/nsLookAndFeel.cpp
widget/headless/HeadlessLookAndFeelGTK.cpp
widget/windows/nsLookAndFeel.cpp
--- a/dom/base/nsGkAtomList.h
+++ b/dom/base/nsGkAtomList.h
@@ -2251,16 +2251,17 @@ GK_ATOM(RemoteType, "remoteType")
 GK_ATOM(DisplayPort, "_displayport")
 GK_ATOM(DisplayPortMargins, "_displayportmargins")
 GK_ATOM(DisplayPortBase, "_displayportbase")
 GK_ATOM(AsyncScrollLayerCreationFailed, "_asyncscrolllayercreationfailed")
 GK_ATOM(forcemessagemanager, "forcemessagemanager")
 GK_ATOM(isPreloadBrowser, "isPreloadBrowser")
 
 // Names for system metrics
+GK_ATOM(color_picker_available, "color-picker-available")
 GK_ATOM(scrollbar_start_backward, "scrollbar-start-backward")
 GK_ATOM(scrollbar_start_forward, "scrollbar-start-forward")
 GK_ATOM(scrollbar_end_backward, "scrollbar-end-backward")
 GK_ATOM(scrollbar_end_forward, "scrollbar-end-forward")
 GK_ATOM(scrollbar_thumb_proportional, "scrollbar-thumb-proportional")
 GK_ATOM(overlay_scrollbars, "overlay-scrollbars")
 GK_ATOM(windows_accent_color_in_titlebar, "windows-accent-color-in-titlebar")
 GK_ATOM(windows_default_theme, "windows-default-theme")
@@ -2280,16 +2281,17 @@ GK_ATOM(windows_theme_aero_lite, "window
 GK_ATOM(windows_theme_luna_blue, "windows-theme-luna-blue")
 GK_ATOM(windows_theme_luna_olive, "windows-theme-luna-olive")
 GK_ATOM(windows_theme_luna_silver, "windows-theme-luna-silver")
 GK_ATOM(windows_theme_royale, "windows-theme-royale")
 GK_ATOM(windows_theme_zune, "windows-theme-zune")
 GK_ATOM(windows_theme_generic, "windows-theme-generic")
 
 // And the same again, as media query keywords.
+GK_ATOM(_moz_color_picker_available, "-moz-color-picker-available")
 GK_ATOM(_moz_scrollbar_start_backward, "-moz-scrollbar-start-backward")
 GK_ATOM(_moz_scrollbar_start_forward, "-moz-scrollbar-start-forward")
 GK_ATOM(_moz_scrollbar_end_backward, "-moz-scrollbar-end-backward")
 GK_ATOM(_moz_scrollbar_end_forward, "-moz-scrollbar-end-forward")
 GK_ATOM(_moz_scrollbar_thumb_proportional, "-moz-scrollbar-thumb-proportional")
 GK_ATOM(_moz_overlay_scrollbars, "-moz-overlay-scrollbars")
 GK_ATOM(_moz_windows_accent_color_in_titlebar, "-moz-windows-accent-color-in-titlebar")
 GK_ATOM(_moz_windows_default_theme, "-moz-windows-default-theme")
--- a/layout/reftests/writing-mode/ua-style-sheet-input-color-1-ref.html
+++ b/layout/reftests/writing-mode/ua-style-sheet-input-color-1-ref.html
@@ -1,24 +1,24 @@
 <!DOCTYPE html>
 <meta charset=utf-8>
 <title>Test for logical properties of input type=color in the UA stylesheet</title>
 <style>
 .v-rl { writing-mode: vertical-rl; }
 .ltr, .rtl, .v-rl { border: 1px solid blue; }
 .a { -moz-appearance: none; }
 
-.ltr input[type="color"],
-.rtl input[type="color"] {
+.ltr input[type="color"]:-moz-system-metric(color-picker-available),
+.rtl input[type="color"]:-moz-system-metric(color-picker-available) {
   width: 64px;
   height: 23px;
   padding: 0px 8px;
 }
 
-.v-rl input[type="color"] {
+.v-rl input[type="color"]:-moz-system-metric(color-picker-available) {
   height: 64px;
   width: 23px;
   padding: 8px 0px;
 }
 </style>
 <div class=ltr>
   <input type=color><br>
   <input type=color class=a><br>
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -1148,16 +1148,21 @@ nsCSSRuleProcessor::InitSystemMetrics()
     sSystemMetrics->AppendElement(nsGkAtoms::windows_compositor);
   }
 
   rv = LookAndFeel::GetInt(LookAndFeel::eIntID_WindowsGlass, &metricResult);
   if (NS_SUCCEEDED(rv) && metricResult) {
     sSystemMetrics->AppendElement(nsGkAtoms::windows_glass);
   }
 
+  rv = LookAndFeel::GetInt(LookAndFeel::eIntID_ColorPickerAvailable, &metricResult);
+  if (NS_SUCCEEDED(rv) && metricResult) {
+    sSystemMetrics->AppendElement(nsGkAtoms::color_picker_available);
+  }
+
   rv = LookAndFeel::GetInt(LookAndFeel::eIntID_WindowsClassic, &metricResult);
   if (NS_SUCCEEDED(rv) && metricResult) {
     sSystemMetrics->AppendElement(nsGkAtoms::windows_classic);
   }
 
   rv = LookAndFeel::GetInt(LookAndFeel::eIntID_TouchEnabled, &metricResult);
   if (NS_SUCCEEDED(rv) && metricResult) {
     sSystemMetrics->AppendElement(nsGkAtoms::touch_enabled);
--- a/layout/style/nsMediaFeatures.cpp
+++ b/layout/style/nsMediaFeatures.cpp
@@ -629,16 +629,24 @@ nsMediaFeatures::features[] = {
     &nsGkAtoms::_moz_is_resource_document,
     nsMediaFeature::eMinMaxNotAllowed,
     nsMediaFeature::eBoolInteger,
     nsMediaFeature::eNoRequirements,
     { nullptr },
     GetIsResourceDocument
   },
   {
+    &nsGkAtoms::_moz_color_picker_available,
+    nsMediaFeature::eMinMaxNotAllowed,
+    nsMediaFeature::eBoolInteger,
+    nsMediaFeature::eNoRequirements,
+    { &nsGkAtoms::color_picker_available },
+    GetSystemMetric
+  },
+  {
     &nsGkAtoms::_moz_scrollbar_start_backward,
     nsMediaFeature::eMinMaxNotAllowed,
     nsMediaFeature::eBoolInteger,
     nsMediaFeature::eNoRequirements,
     { &nsGkAtoms::scrollbar_start_backward },
     GetSystemMetric
   },
   {
--- a/layout/style/res/forms.css
+++ b/layout/style/res/forms.css
@@ -514,17 +514,17 @@ input[type="file"] > xul|label {
 input[type="file"] > button[type="button"] {
   block-size: inherit;
   font-size: inherit;
   letter-spacing: inherit;
   cursor: inherit;
 }
 
 /* colored part of the color selector button */
-input[type="color"]::-moz-color-swatch {
+input[type="color"]:-moz-system-metric(color-picker-available)::-moz-color-swatch {
   width: 100%;
   height: 100%;
   min-width: 3px;
   min-height: 3px;
   margin-inline-start: auto;
   margin-inline-end: auto;
   box-sizing: border-box;
   border: 1px solid grey;
@@ -601,17 +601,17 @@ input[type="search"] {
 /* buttons */
 
 /* Note: Values in nsNativeTheme IsWidgetStyled function
    need to match button background/border values here */
 
 /* Non text-related properties for buttons: these ones are shared with
    input[type="color"] */
 button,
-input[type="color"],
+input[type="color"]:-moz-system-metric(color-picker-available),
 input[type="reset"],
 input[type="button"],
 input[type="submit"] {
   -moz-appearance: button;
   /* The sum of border and padding on block-start and block-end
      must be the same here, for text inputs, and for <select>.
      Note -moz-focus-inner padding does not affect button size. */
   padding-block-start: 0px;
@@ -636,17 +636,17 @@ input[type="submit"] {
   font: -moz-button;
   line-height: normal;
   white-space: pre;
   text-align: center;
   text-shadow: none;
   overflow-clip-box: padding-box;
 }
 
-input[type="color"] {
+input[type="color"]:-moz-system-metric(color-picker-available) {
   inline-size: 64px;
   block-size: 23px;
 }
 
 button {
   /* Buttons should lay out like "normal" html, mostly */
   white-space: inherit;
   text-indent: 0;
@@ -684,32 +684,32 @@ button {
   /* CSS Align */
   align-content: inherit;
   align-items: inherit;
   justify-content: inherit;
   justify-items: inherit;
 }
 
 button:hover,
-input[type="color"]:hover,
+input[type="color"]:-moz-system-metric(color-picker-available):hover,
 input[type="reset"]:hover,
 input[type="button"]:hover,
 input[type="submit"]:hover {
   background-color: -moz-buttonhoverface;
 }
 
 button:hover,
 input[type="reset"]:hover,
 input[type="button"]:hover,
 input[type="submit"]:hover {
   color: -moz-buttonhovertext;
 }
 
 button:active:hover,
-input[type="color"]:active:hover,
+input[type="color"]:-moz-system-metric(color-picker-available):active:hover,
 input[type="reset"]:active:hover,
 input[type="button"]:active:hover,
 input[type="submit"]:active:hover {
 %ifndef XP_MACOSX
   padding-block-start: 0px;
   padding-inline-end: 7px;
   padding-block-end: 0px;
   padding-inline-start: 9px;
@@ -721,41 +721,41 @@ input[type="submit"]:active:hover {
 button:active:hover,
 input[type="reset"]:active:hover,
 input[type="button"]:active:hover,
 input[type="submit"]:active:hover {
   color: ButtonText;
 }
 
 button::-moz-focus-inner,
-input[type="color"]::-moz-focus-inner,
+input[type="color"]:-moz-system-metric(color-picker-available)::-moz-focus-inner,
 input[type="reset"]::-moz-focus-inner,
 input[type="button"]::-moz-focus-inner,
 input[type="submit"]::-moz-focus-inner,
 input[type="file"] > button[type="button"]::-moz-focus-inner {
   /* Note this padding only affects the -moz-focus-inner ring, not the button itself */
   padding-block-start: 0px;
   padding-inline-end: 2px;
   padding-block-end: 0px;
   padding-inline-start: 2px;
   border: 1px dotted transparent;
 }
 
 button:-moz-focusring::-moz-focus-inner,
-input[type="color"]:-moz-focusring::-moz-focus-inner,
+input[type="color"]:-moz-system-metric(color-picker-available):-moz-focusring::-moz-focus-inner,
 input[type="reset"]:-moz-focusring::-moz-focus-inner,
 input[type="button"]:-moz-focusring::-moz-focus-inner,
 input[type="submit"]:-moz-focusring::-moz-focus-inner,
 input[type="file"] > button[type="button"]:-moz-focusring::-moz-focus-inner {
   border-color: ButtonText;
 }
 
 button:disabled:active, button:disabled,
-input[type="color"]:disabled:active,
-input[type="color"]:disabled,
+input[type="color"]:-moz-system-metric(color-picker-available):disabled:active,
+input[type="color"]:-moz-system-metric(color-picker-available):disabled,
 input[type="reset"]:disabled:active,
 input[type="reset"]:disabled,
 input[type="button"]:disabled:active,
 input[type="button"]:disabled,
 select:disabled > button,
 select:disabled > button,
 input[type="submit"]:disabled:active,
 input[type="submit"]:disabled {
--- a/mobile/android/themes/geckoview/content.css
+++ b/mobile/android/themes/geckoview/content.css
@@ -283,17 +283,17 @@ select:not(:disabled):active,
 textarea:not(:focus):not(:disabled):active,
 option:active,
 label:active,
 xul|menulist:active {
   background-color: var(--color_background_highlight_overlay);
 }
 
 button:active:hover,
-input[type="color"]:active:hover,
+input[type="color"]:-moz-system-metric(color-picker-available):active:hover,
 input[type="reset"]:active:hover,
 input[type="button"]:active:hover,
 input[type="submit"]:active:hover {
   padding-inline-end: 7px;
   padding-inline-start: 7px;
 }
 
 input[type=number] > div > div, /* work around bug 946184 */
--- a/widget/LookAndFeel.h
+++ b/widget/LookAndFeel.h
@@ -384,16 +384,25 @@ public:
     eIntID_TooltipDelay,
     /*
      * A Boolean value to determine whether Mac OS X Lion style swipe animations
      * should be used.
      */
     eIntID_SwipeAnimationEnabled,
 
     /*
+     * A Boolean value to determine whether we have a color picker available
+     * for <input type="color"> to hook into.
+     *
+     * This lets us selectively enable the style for <input type="color">
+     * based on whether it's functional or not.
+     */
+    eIntID_ColorPickerAvailable,
+
+    /*
      * A boolean value indicating whether or not the device has a hardware
      * home button. Used on gaia to determine whether a home button
      * is shown.
      */
      eIntID_PhysicalHomeButton,
 
      /*
       * Controls whether overlay scrollbars display when the user moves
--- a/widget/android/nsLookAndFeel.cpp
+++ b/widget/android/nsLookAndFeel.cpp
@@ -392,16 +392,20 @@ nsLookAndFeel::GetIntImpl(IntID aID, int
         case eIntID_ScrollSliderStyle:
             aResult = eScrollThumbStyle_Proportional;
             break;
 
         case eIntID_TouchEnabled:
             aResult = 1;
             break;
 
+        case eIntID_ColorPickerAvailable:
+            aResult = 1;
+            break;
+
         case eIntID_WindowsDefaultTheme:
         case eIntID_WindowsThemeIdentifier:
         case eIntID_OperatingSystemVersionIdentifier:
             aResult = 0;
             rv = NS_ERROR_NOT_IMPLEMENTED;
             break;
 
         case eIntID_SpellCheckerUnderlineStyle:
--- a/widget/cocoa/nsLookAndFeel.mm
+++ b/widget/cocoa/nsLookAndFeel.mm
@@ -476,16 +476,19 @@ nsLookAndFeel::GetIntImpl(IntID aID, int
       break;
     case eIntID_SwipeAnimationEnabled:
       aResult = 0;
       if ([NSEvent respondsToSelector:@selector(
             isSwipeTrackingFromScrollEventsEnabled)]) {
         aResult = [NSEvent isSwipeTrackingFromScrollEventsEnabled] ? 1 : 0;
       }
       break;
+    case eIntID_ColorPickerAvailable:
+      aResult = 1;
+      break;
     case eIntID_ContextMenuOffsetVertical:
       aResult = -6;
       break;
     case eIntID_ContextMenuOffsetHorizontal:
       aResult = 1;
       break;
     default:
       aResult = 0;
--- a/widget/gtk/nsLookAndFeel.cpp
+++ b/widget/gtk/nsLookAndFeel.cpp
@@ -630,16 +630,19 @@ nsLookAndFeel::GetIntImpl(IntID aID, int
         aResult = sMenuSupportsDrag;
         break;
     case eIntID_ScrollbarButtonAutoRepeatBehavior:
         aResult = 1;
         break;
     case eIntID_SwipeAnimationEnabled:
         aResult = 0;
         break;
+    case eIntID_ColorPickerAvailable:
+        aResult = 1;
+        break;
     case eIntID_ContextMenuOffsetVertical:
     case eIntID_ContextMenuOffsetHorizontal:
         aResult = 2;
         break;
     default:
         aResult = 0;
         res     = NS_ERROR_FAILURE;
     }
--- a/widget/headless/HeadlessLookAndFeelGTK.cpp
+++ b/widget/headless/HeadlessLookAndFeelGTK.cpp
@@ -258,16 +258,19 @@ HeadlessLookAndFeel::GetIntImpl(IntID aI
       aResult = 0;
       break;
     case eIntID_TooltipDelay:
       aResult = 500;
       break;
     case eIntID_SwipeAnimationEnabled:
       aResult = 0;
       break;
+    case eIntID_ColorPickerAvailable:
+      aResult = 1;
+      break;
     case eIntID_PhysicalHomeButton:
       aResult = 0;
       break;
     case eIntID_ScrollbarDisplayOnMouseMove:
       aResult = 0;
       break;
     case eIntID_ScrollbarFadeBeginDelay:
       aResult = 0;
--- a/widget/windows/nsLookAndFeel.cpp
+++ b/widget/windows/nsLookAndFeel.cpp
@@ -526,16 +526,19 @@ nsLookAndFeel::GetIntImpl(IntID aID, int
         aResult = NS_STYLE_TEXT_DECORATION_STYLE_WAVY;
         break;
     case eIntID_ScrollbarButtonAutoRepeatBehavior:
         aResult = 0;
         break;
     case eIntID_SwipeAnimationEnabled:
         aResult = 0;
         break;
+    case eIntID_ColorPickerAvailable:
+        aResult = true;
+        break;
     case eIntID_UseOverlayScrollbars:
         aResult = false;
         break;
     case eIntID_AllowOverlayScrollbarsOverlap:
         aResult = 0;
         break;
     case eIntID_ScrollbarDisplayOnMouseMove:
         aResult = 1;