Bug 936628: Add media query to check for whether we have a color picker backend available. r=jimm
authorDaniel Holbert <dholbert@cs.stanford.edu>
Sun, 10 Nov 2013 19:07:59 -0800
changeset 154392 2f7dec25e9d611e5b87cef1ffa7cf0967171a218
parent 154391 3fb151446ec5d0a496d8d6da0863c4acb8e75d0c
child 154393 372dddb6113d607865fba1a54a10c6343929a5a3
push id25640
push userryanvm@gmail.com
push dateMon, 11 Nov 2013 20:43:44 +0000
treeherdermozilla-central@68249b4929f2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs936628
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 936628: Add media query to check for whether we have a color picker backend available. r=jimm
content/base/src/nsGkAtomList.h
layout/style/nsCSSRuleProcessor.cpp
layout/style/nsMediaFeatures.cpp
widget/LookAndFeel.h
widget/cocoa/nsLookAndFeel.mm
widget/gtk/nsLookAndFeel.cpp
widget/windows/nsLookAndFeel.cpp
--- a/content/base/src/nsGkAtomList.h
+++ b/content/base/src/nsGkAtomList.h
@@ -1996,16 +1996,17 @@ GK_ATOM(DeleteTxnName, "Deleting")
 
 // IPC stuff
 GK_ATOM(Remote, "remote")
 GK_ATOM(RemoteId, "_remote_id")
 GK_ATOM(DisplayPort, "_displayport")
 GK_ATOM(CriticalDisplayPort, "_critical_displayport")
 
 // 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(images_in_menus, "images-in-menus")
 GK_ATOM(images_in_buttons, "images-in-buttons")
 GK_ATOM(overlay_scrollbars, "overlay-scrollbars")
@@ -2033,16 +2034,17 @@ GK_ATOM(windows_theme_generic, "windows-
 // windows version info selector metrics, helpful in removing ambiguity
 // in theme selectors.
 GK_ATOM(windows_version_xp, "windows-version-xp")
 GK_ATOM(windows_version_vista, "windows-version-vista")
 GK_ATOM(windows_version_win7, "windows-version-win7")
 GK_ATOM(windows_version_win8, "windows-version-win8")
 
 // 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_images_in_menus, "-moz-images-in-menus")
 GK_ATOM(_moz_images_in_buttons, "-moz-images-in-buttons")
 GK_ATOM(_moz_overlay_scrollbars, "-moz-overlay-scrollbars")
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -1163,16 +1163,21 @@ 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
@@ -491,16 +491,23 @@ nsMediaFeatures::features[] = {
     {
         &nsGkAtoms::_moz_is_resource_document,
         nsMediaFeature::eMinMaxNotAllowed,
         nsMediaFeature::eBoolInteger,
         { nullptr },
         GetIsResourceDocument
     },
     {
+        &nsGkAtoms::_moz_color_picker_available,
+        nsMediaFeature::eMinMaxNotAllowed,
+        nsMediaFeature::eBoolInteger,
+        { &nsGkAtoms::color_picker_available },
+        GetSystemMetric
+    },
+    {
         &nsGkAtoms::_moz_scrollbar_start_backward,
         nsMediaFeature::eMinMaxNotAllowed,
         nsMediaFeature::eBoolInteger,
         { &nsGkAtoms::scrollbar_start_backward },
         GetSystemMetric
     },
     {
         &nsGkAtoms::_moz_scrollbar_start_forward,
--- a/widget/LookAndFeel.h
+++ b/widget/LookAndFeel.h
@@ -352,16 +352,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/cocoa/nsLookAndFeel.mm
+++ b/widget/cocoa/nsLookAndFeel.mm
@@ -441,16 +441,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;
     default:
       aResult = 0;
       res = NS_ERROR_FAILURE;
   }
   return res;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
--- a/widget/gtk/nsLookAndFeel.cpp
+++ b/widget/gtk/nsLookAndFeel.cpp
@@ -658,16 +658,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;
     default:
         aResult = 0;
         res     = NS_ERROR_FAILURE;
     }
 
     return res;
 }
 
--- a/widget/windows/nsLookAndFeel.cpp
+++ b/widget/windows/nsLookAndFeel.cpp
@@ -477,16 +477,20 @@ 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:
+        // We don't have a color picker implemented on Metro yet (bug 895464)
+        aResult = (XRE_GetWindowsEnvironment() != WindowsEnvironmentType_Metro);
+        break;
     case eIntID_UseOverlayScrollbars:
         aResult = (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro);
         break;
     case eIntID_AllowOverlayScrollbarsOverlap:
         aResult = 0;
         break;
     case eIntID_ScrollbarDisplayOnMouseMove:
         aResult = 1;