Bug 1166867 - Support -moz-os-version: windows-win10. r=jimm, a=sledru
authorTim Nguyen <ntim.bugs@gmail.com>
Thu, 21 May 2015 12:16:00 +0200
changeset 266161 e712de047451
parent 266160 4b0c26bdab21
child 266162 9463b7173dd9
push id4770
push userryanvm@gmail.com
push date2015-06-02 17:21 +0000
treeherdermozilla-beta@9463b7173dd9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm, sledru
bugs1166867
milestone39.0
Bug 1166867 - Support -moz-os-version: windows-win10. r=jimm, a=sledru
layout/style/nsMediaFeatures.cpp
widget/LookAndFeel.h
widget/windows/nsLookAndFeel.cpp
--- a/layout/style/nsMediaFeatures.cpp
+++ b/layout/style/nsMediaFeatures.cpp
@@ -56,16 +56,17 @@ struct OperatingSystemVersionInfo {
 };
 
 // Os version identities used in the -moz-os-version media query.
 const OperatingSystemVersionInfo osVersionStrings[] = {
     { LookAndFeel::eOperatingSystemVersion_WindowsXP,     L"windows-xp" },
     { LookAndFeel::eOperatingSystemVersion_WindowsVista,  L"windows-vista" },
     { LookAndFeel::eOperatingSystemVersion_Windows7,      L"windows-win7" },
     { LookAndFeel::eOperatingSystemVersion_Windows8,      L"windows-win8" },
+    { LookAndFeel::eOperatingSystemVersion_Windows10,     L"windows-win10" }
 };
 #endif
 
 // A helper for four features below
 static nsSize
 GetSize(nsPresContext* aPresContext)
 {
     nsSize size;
--- a/widget/LookAndFeel.h
+++ b/widget/LookAndFeel.h
@@ -153,17 +153,17 @@ public:
 
     // media rebar text
     eColorID__moz_win_mediatext,
     // communications rebar text
     eColorID__moz_win_communicationstext,
 
     // Hyperlink color extracted from the system, not affected by the
     // browser.anchor_color user pref.
-    // There is no OS-specified safe background color for this text, 
+    // There is no OS-specified safe background color for this text,
     // but it is used regularly within Windows and the Gnome DE on Dialog and
     // Window colors.
     eColorID__moz_nativehyperlinktext,
 
     // Combo box widgets
     eColorID__moz_comboboxtext,
     eColorID__moz_combobox,
 
@@ -381,23 +381,23 @@ public:
     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
       * the mouse in a scrollable frame.
       */
      eIntID_ScrollbarDisplayOnMouseMove,
- 
+
      /*
       * Overlay scrollbar animation constants.
       */
      eIntID_ScrollbarFadeBeginDelay,
      eIntID_ScrollbarFadeDuration
   };
 
   /**
@@ -418,31 +418,32 @@ public:
   /**
    * Operating system versions.
    */
   enum OperatingSystemVersion {
     eOperatingSystemVersion_WindowsXP = 0,
     eOperatingSystemVersion_WindowsVista,
     eOperatingSystemVersion_Windows7,
     eOperatingSystemVersion_Windows8,
+    eOperatingSystemVersion_Windows10,
     eOperatingSystemVersion_Unknown
   };
 
   enum {
     eScrollArrow_None = 0,
     eScrollArrow_StartBackward = 0x1000,
     eScrollArrow_StartForward = 0x0100,
     eScrollArrow_EndBackward = 0x0010,
     eScrollArrow_EndForward = 0x0001
   };
 
   enum {
     // single arrow at each end
     eScrollArrowStyle_Single =
-      eScrollArrow_StartBackward | eScrollArrow_EndForward, 
+      eScrollArrow_StartBackward | eScrollArrow_EndForward,
     // both arrows at bottom/right, none at top/left
     eScrollArrowStyle_BothAtBottom =
       eScrollArrow_EndBackward | eScrollArrow_EndForward,
     // both arrows at both ends
     eScrollArrowStyle_BothAtEachEnd =
       eScrollArrow_EndBackward | eScrollArrow_EndForward |
       eScrollArrow_StartBackward | eScrollArrow_StartForward,
     // both arrows at top/left, none at bottom/right
--- a/widget/windows/nsLookAndFeel.cpp
+++ b/widget/windows/nsLookAndFeel.cpp
@@ -23,17 +23,19 @@ LookAndFeel::OperatingSystemVersion
 nsLookAndFeel::GetOperatingSystemVersion()
 {
   static OperatingSystemVersion version = eOperatingSystemVersion_Unknown;
 
   if (version != eOperatingSystemVersion_Unknown) {
     return version;
   }
 
-  if (IsWin8OrLater()) {
+  if (IsWin10OrLater()) {
+    version = eOperatingSystemVersion_Windows10;
+  } else if (IsWin8OrLater()) {
     version = eOperatingSystemVersion_Windows8;
   } else if (IsWin7OrLater()) {
     version = eOperatingSystemVersion_Windows7;
   } else if (IsVistaOrLater()) {
     version = eOperatingSystemVersion_WindowsVista;
   } else {
     version = eOperatingSystemVersion_WindowsXP;
   }
@@ -54,17 +56,17 @@ static nsresult GetColorFromTheme(nsUXTh
     aColor = COLOREF_2_NSRGB(color);
     return NS_OK;
   }
   return NS_ERROR_FAILURE;
 }
 
 static int32_t GetSystemParam(long flag, int32_t def)
 {
-    DWORD value; 
+    DWORD value;
     return ::SystemParametersInfo(flag, 0, &value, 0) ? value : def;
 }
 
 namespace mozilla {
 namespace widget {
 // This is in use here and in dom/events/TouchEvent.cpp
 int32_t IsTouchDeviceSupportPresent()
 {
@@ -361,17 +363,17 @@ nsLookAndFeel::GetIntImpl(IntID aID, int
         // move before starting a drag, so subtract 1.
 
         aResult = ::GetSystemMetrics(SM_CXDRAG) - 1;
         break;
     case eIntID_DragThresholdY:
         aResult = ::GetSystemMetrics(SM_CYDRAG) - 1;
         break;
     case eIntID_UseAccessibilityTheme:
-        // High contrast is a misnomer under Win32 -- any theme can be used with it, 
+        // High contrast is a misnomer under Win32 -- any theme can be used with it,
         // e.g. normal contrast with large fonts, low contrast, etc.
         // The high contrast flag really means -- use this theme and don't override it.
         aResult = nsUXThemeData::IsHighContrastOn();
         break;
     case eIntID_ScrollArrowStyle:
         aResult = eScrollArrowStyle_Single;
         break;
     case eIntID_ScrollSliderStyle: