layout/style/nsMediaFeatures.cpp

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 /* vim: set shiftwidth=4 tabstop=8 autoindent cindent expandtab: */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 /* the features that media queries can test */
     8 #include "nsMediaFeatures.h"
     9 #include "nsGkAtoms.h"
    10 #include "nsCSSKeywords.h"
    11 #include "nsStyleConsts.h"
    12 #include "nsPresContext.h"
    13 #include "nsCSSValue.h"
    14 #ifdef XP_WIN
    15 #include "mozilla/LookAndFeel.h"
    16 #endif
    17 #include "nsCSSRuleProcessor.h"
    18 #include "nsDeviceContext.h"
    19 #include "nsIDocument.h"
    21 using namespace mozilla;
    23 static const nsCSSProps::KTableValue kOrientationKeywords[] = {
    24   eCSSKeyword_portrait,                 NS_STYLE_ORIENTATION_PORTRAIT,
    25   eCSSKeyword_landscape,                NS_STYLE_ORIENTATION_LANDSCAPE,
    26   eCSSKeyword_UNKNOWN,                  -1
    27 };
    29 static const nsCSSProps::KTableValue kScanKeywords[] = {
    30   eCSSKeyword_progressive,              NS_STYLE_SCAN_PROGRESSIVE,
    31   eCSSKeyword_interlace,                NS_STYLE_SCAN_INTERLACE,
    32   eCSSKeyword_UNKNOWN,                  -1
    33 };
    35 #ifdef XP_WIN
    36 struct WindowsThemeName {
    37     LookAndFeel::WindowsTheme id;
    38     const wchar_t* name;
    39 };
    41 // Windows theme identities used in the -moz-windows-theme media query.
    42 const WindowsThemeName themeStrings[] = {
    43     { LookAndFeel::eWindowsTheme_Aero,       L"aero" },
    44     { LookAndFeel::eWindowsTheme_AeroLite,   L"aero-lite" },
    45     { LookAndFeel::eWindowsTheme_LunaBlue,   L"luna-blue" },
    46     { LookAndFeel::eWindowsTheme_LunaOlive,  L"luna-olive" },
    47     { LookAndFeel::eWindowsTheme_LunaSilver, L"luna-silver" },
    48     { LookAndFeel::eWindowsTheme_Royale,     L"royale" },
    49     { LookAndFeel::eWindowsTheme_Zune,       L"zune" },
    50     { LookAndFeel::eWindowsTheme_Generic,    L"generic" }
    51 };
    53 struct OperatingSystemVersionInfo {
    54     LookAndFeel::OperatingSystemVersion id;
    55     const wchar_t* name;
    56 };
    58 // Os version identities used in the -moz-os-version media query.
    59 const OperatingSystemVersionInfo osVersionStrings[] = {
    60     { LookAndFeel::eOperatingSystemVersion_WindowsXP,     L"windows-xp" },
    61     { LookAndFeel::eOperatingSystemVersion_WindowsVista,  L"windows-vista" },
    62     { LookAndFeel::eOperatingSystemVersion_Windows7,      L"windows-win7" },
    63     { LookAndFeel::eOperatingSystemVersion_Windows8,      L"windows-win8" },
    64 };
    65 #endif
    67 // A helper for four features below
    68 static nsSize
    69 GetSize(nsPresContext* aPresContext)
    70 {
    71     nsSize size;
    72     if (aPresContext->IsRootPaginatedDocument())
    73         // We want the page size, including unprintable areas and margins.
    74         size = aPresContext->GetPageSize();
    75     else
    76         size = aPresContext->GetVisibleArea().Size();
    77     return size;
    78 }
    80 static nsresult
    81 GetWidth(nsPresContext* aPresContext, const nsMediaFeature*,
    82          nsCSSValue& aResult)
    83 {
    84     nsSize size = GetSize(aPresContext);
    85     float pixelWidth = aPresContext->AppUnitsToFloatCSSPixels(size.width);
    86     aResult.SetFloatValue(pixelWidth, eCSSUnit_Pixel);
    87     return NS_OK;
    88 }
    90 static nsresult
    91 GetHeight(nsPresContext* aPresContext, const nsMediaFeature*,
    92           nsCSSValue& aResult)
    93 {
    94     nsSize size = GetSize(aPresContext);
    95     float pixelHeight = aPresContext->AppUnitsToFloatCSSPixels(size.height);
    96     aResult.SetFloatValue(pixelHeight, eCSSUnit_Pixel);
    97     return NS_OK;
    98 }
   100 inline static nsDeviceContext*
   101 GetDeviceContextFor(nsPresContext* aPresContext)
   102 {
   103   // It would be nice to call
   104   // nsLayoutUtils::GetDeviceContextForScreenInfo here, except for two
   105   // things:  (1) it can flush, and flushing is bad here, and (2) it
   106   // doesn't really get us consistency in multi-monitor situations
   107   // *anyway*.
   108   return aPresContext->DeviceContext();
   109 }
   111 // A helper for three features below.
   112 static nsSize
   113 GetDeviceSize(nsPresContext* aPresContext)
   114 {
   115     nsSize size;
   117     if (!aPresContext->IsChrome() || aPresContext->IsDeviceSizePageSize()) {
   118         size = GetSize(aPresContext);
   119     } else if (aPresContext->IsRootPaginatedDocument()) {
   120         // We want the page size, including unprintable areas and margins.
   121         // XXX The spec actually says we want the "page sheet size", but
   122         // how is that different?
   123         size = aPresContext->GetPageSize();
   124     } else {
   125         GetDeviceContextFor(aPresContext)->
   126             GetDeviceSurfaceDimensions(size.width, size.height);
   127     }
   128     return size;
   129 }
   131 static nsresult
   132 GetDeviceWidth(nsPresContext* aPresContext, const nsMediaFeature*,
   133                nsCSSValue& aResult)
   134 {
   135     nsSize size = GetDeviceSize(aPresContext);
   136     float pixelWidth = aPresContext->AppUnitsToFloatCSSPixels(size.width);
   137     aResult.SetFloatValue(pixelWidth, eCSSUnit_Pixel);
   138     return NS_OK;
   139 }
   141 static nsresult
   142 GetDeviceHeight(nsPresContext* aPresContext, const nsMediaFeature*,
   143                 nsCSSValue& aResult)
   144 {
   145     nsSize size = GetDeviceSize(aPresContext);
   146     float pixelHeight = aPresContext->AppUnitsToFloatCSSPixels(size.height);
   147     aResult.SetFloatValue(pixelHeight, eCSSUnit_Pixel);
   148     return NS_OK;
   149 }
   151 static nsresult
   152 GetOrientation(nsPresContext* aPresContext, const nsMediaFeature*,
   153                nsCSSValue& aResult)
   154 {
   155     nsSize size = GetSize(aPresContext);
   156     int32_t orientation;
   157     if (size.width > size.height) {
   158         orientation = NS_STYLE_ORIENTATION_LANDSCAPE;
   159     } else {
   160         // Per spec, square viewports should be 'portrait'
   161         orientation = NS_STYLE_ORIENTATION_PORTRAIT;
   162     }
   164     aResult.SetIntValue(orientation, eCSSUnit_Enumerated);
   165     return NS_OK;
   166 }
   168 static nsresult
   169 GetDeviceOrientation(nsPresContext* aPresContext, const nsMediaFeature*,
   170                      nsCSSValue& aResult)
   171 {
   172     nsSize size = GetDeviceSize(aPresContext);
   173     int32_t orientation;
   174     if (size.width > size.height) {
   175         orientation = NS_STYLE_ORIENTATION_LANDSCAPE;
   176     } else {
   177         // Per spec, square viewports should be 'portrait'
   178         orientation = NS_STYLE_ORIENTATION_PORTRAIT;
   179     }
   181     aResult.SetIntValue(orientation, eCSSUnit_Enumerated);
   182     return NS_OK;
   183 }
   185 static nsresult
   186 GetIsResourceDocument(nsPresContext* aPresContext, const nsMediaFeature*,
   187                       nsCSSValue& aResult)
   188 {
   189   nsIDocument* doc = aPresContext->Document();
   190   aResult.SetIntValue(doc && doc->IsResourceDoc() ? 1 : 0, eCSSUnit_Integer);
   191   return NS_OK;
   192 }
   194 // Helper for two features below
   195 static nsresult
   196 MakeArray(const nsSize& aSize, nsCSSValue& aResult)
   197 {
   198     nsRefPtr<nsCSSValue::Array> a = nsCSSValue::Array::Create(2);
   200     a->Item(0).SetIntValue(aSize.width, eCSSUnit_Integer);
   201     a->Item(1).SetIntValue(aSize.height, eCSSUnit_Integer);
   203     aResult.SetArrayValue(a, eCSSUnit_Array);
   204     return NS_OK;
   205 }
   207 static nsresult
   208 GetAspectRatio(nsPresContext* aPresContext, const nsMediaFeature*,
   209                nsCSSValue& aResult)
   210 {
   211     return MakeArray(GetSize(aPresContext), aResult);
   212 }
   214 static nsresult
   215 GetDeviceAspectRatio(nsPresContext* aPresContext, const nsMediaFeature*,
   216                      nsCSSValue& aResult)
   217 {
   218     return MakeArray(GetDeviceSize(aPresContext), aResult);
   219 }
   221 static nsresult
   222 GetColor(nsPresContext* aPresContext, const nsMediaFeature*,
   223          nsCSSValue& aResult)
   224 {
   225     uint32_t depth = 24; // Always assume 24-bit depth for non-chrome callers.
   227     if (aPresContext->IsChrome()) {
   228         // FIXME:  This implementation is bogus.  nsDeviceContext
   229         // doesn't provide reliable information (should be fixed in bug
   230         // 424386).
   231         // FIXME: On a monochrome device, return 0!
   232         nsDeviceContext *dx = GetDeviceContextFor(aPresContext);
   233         dx->GetDepth(depth);
   234     }
   236     // The spec says to use bits *per color component*, so divide by 3,
   237     // and round down, since the spec says to use the smallest when the
   238     // color components differ.
   239     depth /= 3;
   240     aResult.SetIntValue(int32_t(depth), eCSSUnit_Integer);
   241     return NS_OK;
   242 }
   244 static nsresult
   245 GetColorIndex(nsPresContext* aPresContext, const nsMediaFeature*,
   246               nsCSSValue& aResult)
   247 {
   248     // We should return zero if the device does not use a color lookup
   249     // table.  Stuart says that our handling of displays with 8-bit
   250     // color is bad enough that we never change the lookup table to
   251     // match what we're trying to display, so perhaps we should always
   252     // return zero.  Given that there isn't any better information
   253     // exposed, we don't have much other choice.
   254     aResult.SetIntValue(0, eCSSUnit_Integer);
   255     return NS_OK;
   256 }
   258 static nsresult
   259 GetMonochrome(nsPresContext* aPresContext, const nsMediaFeature*,
   260               nsCSSValue& aResult)
   261 {
   262     // For color devices we should return 0.
   263     // FIXME: On a monochrome device, return the actual color depth, not
   264     // 0!
   265     aResult.SetIntValue(0, eCSSUnit_Integer);
   266     return NS_OK;
   267 }
   269 static nsresult
   270 GetResolution(nsPresContext* aPresContext, const nsMediaFeature*,
   271               nsCSSValue& aResult)
   272 {
   273     float dpi = 96; // Always return 96 to non-chrome callers.
   275     if (aPresContext->IsChrome()) {
   276       // Resolution measures device pixels per CSS (inch/cm/pixel).  We
   277       // return it in device pixels per CSS inches.
   278       dpi = float(nsPresContext::AppUnitsPerCSSInch()) /
   279             float(aPresContext->AppUnitsPerDevPixel());
   280     }
   282     aResult.SetFloatValue(dpi, eCSSUnit_Inch);
   283     return NS_OK;
   284 }
   286 static nsresult
   287 GetScan(nsPresContext* aPresContext, const nsMediaFeature*,
   288         nsCSSValue& aResult)
   289 {
   290     // Since Gecko doesn't support the 'tv' media type, the 'scan'
   291     // feature is never present.
   292     aResult.Reset();
   293     return NS_OK;
   294 }
   296 static nsresult
   297 GetGrid(nsPresContext* aPresContext, const nsMediaFeature*,
   298         nsCSSValue& aResult)
   299 {
   300     // Gecko doesn't support grid devices (e.g., ttys), so the 'grid'
   301     // feature is always 0.
   302     aResult.SetIntValue(0, eCSSUnit_Integer);
   303     return NS_OK;
   304 }
   306 static nsresult
   307 GetDevicePixelRatio(nsPresContext* aPresContext, const nsMediaFeature*,
   308                     nsCSSValue& aResult)
   309 {
   310     if (aPresContext->IsChrome()) {
   311         float ratio = aPresContext->CSSPixelsToDevPixels(1.0f);
   312         aResult.SetFloatValue(ratio, eCSSUnit_Number);
   313     } else {
   314         aResult.SetFloatValue(1.0, eCSSUnit_Number);
   315     }
   316     return NS_OK;
   317 }
   319 static nsresult
   320 GetSystemMetric(nsPresContext* aPresContext, const nsMediaFeature* aFeature,
   321                 nsCSSValue& aResult)
   322 {
   323     aResult.Reset();
   324     if (aPresContext->IsChrome()) {
   325         NS_ABORT_IF_FALSE(aFeature->mValueType == nsMediaFeature::eBoolInteger,
   326                           "unexpected type");
   327         nsIAtom *metricAtom = *aFeature->mData.mMetric;
   328         bool hasMetric = nsCSSRuleProcessor::HasSystemMetric(metricAtom);
   329         aResult.SetIntValue(hasMetric ? 1 : 0, eCSSUnit_Integer);
   330     }
   331     return NS_OK;
   332 }
   334 static nsresult
   335 GetWindowsTheme(nsPresContext* aPresContext, const nsMediaFeature* aFeature,
   336                 nsCSSValue& aResult)
   337 {
   338     aResult.Reset();
   339 #ifdef XP_WIN
   340     if (aPresContext->IsChrome()) {
   341         uint8_t windowsThemeId =
   342             nsCSSRuleProcessor::GetWindowsThemeIdentifier();
   344         // Classic mode should fail to match.
   345         if (windowsThemeId == LookAndFeel::eWindowsTheme_Classic)
   346             return NS_OK;
   348         // Look up the appropriate theme string
   349         for (size_t i = 0; i < ArrayLength(themeStrings); ++i) {
   350             if (windowsThemeId == themeStrings[i].id) {
   351                 aResult.SetStringValue(nsDependentString(themeStrings[i].name),
   352                                        eCSSUnit_Ident);
   353                 break;
   354             }
   355         }
   356     }
   357 #endif
   358     return NS_OK;
   359 }
   361 static nsresult
   362 GetOperatinSystemVersion(nsPresContext* aPresContext, const nsMediaFeature* aFeature,
   363                          nsCSSValue& aResult)
   364 {
   365     aResult.Reset();
   366     if (!aPresContext->IsChrome()) return NS_OK;
   368 #ifdef XP_WIN
   369     int32_t metricResult;
   370     if (NS_SUCCEEDED(
   371           LookAndFeel::GetInt(LookAndFeel::eIntID_OperatingSystemVersionIdentifier,
   372                               &metricResult))) {
   373         for (size_t i = 0; i < ArrayLength(osVersionStrings); ++i) {
   374             if (metricResult == osVersionStrings[i].id) {
   375                 aResult.SetStringValue(nsDependentString(osVersionStrings[i].name),
   376                                        eCSSUnit_Ident);
   377                 break;
   378             }
   379         }
   380     }
   381 #endif
   382     return NS_OK;
   383 }
   385 static nsresult
   386 GetIsGlyph(nsPresContext* aPresContext, const nsMediaFeature* aFeature,
   387           nsCSSValue& aResult)
   388 {
   389     aResult.SetIntValue(aPresContext->IsGlyph() ? 1 : 0, eCSSUnit_Integer);
   390     return NS_OK;
   391 }
   393 /*
   394  * Adding new media features requires (1) adding the new feature to this
   395  * array, with appropriate entries (and potentially any new code needed
   396  * to support new types in these entries and (2) ensuring that either
   397  * nsPresContext::MediaFeatureValuesChanged or
   398  * nsPresContext::PostMediaFeatureValuesChangedEvent is called when the
   399  * value that would be returned by the entry's mGetter changes.
   400  */
   402 /* static */ const nsMediaFeature
   403 nsMediaFeatures::features[] = {
   404     {
   405         &nsGkAtoms::width,
   406         nsMediaFeature::eMinMaxAllowed,
   407         nsMediaFeature::eLength,
   408         { nullptr },
   409         GetWidth
   410     },
   411     {
   412         &nsGkAtoms::height,
   413         nsMediaFeature::eMinMaxAllowed,
   414         nsMediaFeature::eLength,
   415         { nullptr },
   416         GetHeight
   417     },
   418     {
   419         &nsGkAtoms::deviceWidth,
   420         nsMediaFeature::eMinMaxAllowed,
   421         nsMediaFeature::eLength,
   422         { nullptr },
   423         GetDeviceWidth
   424     },
   425     {
   426         &nsGkAtoms::deviceHeight,
   427         nsMediaFeature::eMinMaxAllowed,
   428         nsMediaFeature::eLength,
   429         { nullptr },
   430         GetDeviceHeight
   431     },
   432     {
   433         &nsGkAtoms::orientation,
   434         nsMediaFeature::eMinMaxNotAllowed,
   435         nsMediaFeature::eEnumerated,
   436         { kOrientationKeywords },
   437         GetOrientation
   438     },
   439     {
   440         &nsGkAtoms::aspectRatio,
   441         nsMediaFeature::eMinMaxAllowed,
   442         nsMediaFeature::eIntRatio,
   443         { nullptr },
   444         GetAspectRatio
   445     },
   446     {
   447         &nsGkAtoms::deviceAspectRatio,
   448         nsMediaFeature::eMinMaxAllowed,
   449         nsMediaFeature::eIntRatio,
   450         { nullptr },
   451         GetDeviceAspectRatio
   452     },
   453     {
   454         &nsGkAtoms::color,
   455         nsMediaFeature::eMinMaxAllowed,
   456         nsMediaFeature::eInteger,
   457         { nullptr },
   458         GetColor
   459     },
   460     {
   461         &nsGkAtoms::colorIndex,
   462         nsMediaFeature::eMinMaxAllowed,
   463         nsMediaFeature::eInteger,
   464         { nullptr },
   465         GetColorIndex
   466     },
   467     {
   468         &nsGkAtoms::monochrome,
   469         nsMediaFeature::eMinMaxAllowed,
   470         nsMediaFeature::eInteger,
   471         { nullptr },
   472         GetMonochrome
   473     },
   474     {
   475         &nsGkAtoms::resolution,
   476         nsMediaFeature::eMinMaxAllowed,
   477         nsMediaFeature::eResolution,
   478         { nullptr },
   479         GetResolution
   480     },
   481     {
   482         &nsGkAtoms::scan,
   483         nsMediaFeature::eMinMaxNotAllowed,
   484         nsMediaFeature::eEnumerated,
   485         { kScanKeywords },
   486         GetScan
   487     },
   488     {
   489         &nsGkAtoms::grid,
   490         nsMediaFeature::eMinMaxNotAllowed,
   491         nsMediaFeature::eBoolInteger,
   492         { nullptr },
   493         GetGrid
   494     },
   496     // Mozilla extensions
   497     {
   498         &nsGkAtoms::_moz_device_pixel_ratio,
   499         nsMediaFeature::eMinMaxAllowed,
   500         nsMediaFeature::eFloat,
   501         { nullptr },
   502         GetDevicePixelRatio
   503     },
   504     {
   505         &nsGkAtoms::_moz_device_orientation,
   506         nsMediaFeature::eMinMaxNotAllowed,
   507         nsMediaFeature::eEnumerated,
   508         { kOrientationKeywords },
   509         GetDeviceOrientation
   510     },
   511     {
   512         &nsGkAtoms::_moz_is_resource_document,
   513         nsMediaFeature::eMinMaxNotAllowed,
   514         nsMediaFeature::eBoolInteger,
   515         { nullptr },
   516         GetIsResourceDocument
   517     },
   518     {
   519         &nsGkAtoms::_moz_color_picker_available,
   520         nsMediaFeature::eMinMaxNotAllowed,
   521         nsMediaFeature::eBoolInteger,
   522         { &nsGkAtoms::color_picker_available },
   523         GetSystemMetric
   524     },
   525     {
   526         &nsGkAtoms::_moz_scrollbar_start_backward,
   527         nsMediaFeature::eMinMaxNotAllowed,
   528         nsMediaFeature::eBoolInteger,
   529         { &nsGkAtoms::scrollbar_start_backward },
   530         GetSystemMetric
   531     },
   532     {
   533         &nsGkAtoms::_moz_scrollbar_start_forward,
   534         nsMediaFeature::eMinMaxNotAllowed,
   535         nsMediaFeature::eBoolInteger,
   536         { &nsGkAtoms::scrollbar_start_forward },
   537         GetSystemMetric
   538     },
   539     {
   540         &nsGkAtoms::_moz_scrollbar_end_backward,
   541         nsMediaFeature::eMinMaxNotAllowed,
   542         nsMediaFeature::eBoolInteger,
   543         { &nsGkAtoms::scrollbar_end_backward },
   544         GetSystemMetric
   545     },
   546     {
   547         &nsGkAtoms::_moz_scrollbar_end_forward,
   548         nsMediaFeature::eMinMaxNotAllowed,
   549         nsMediaFeature::eBoolInteger,
   550         { &nsGkAtoms::scrollbar_end_forward },
   551         GetSystemMetric
   552     },
   553     {
   554         &nsGkAtoms::_moz_scrollbar_thumb_proportional,
   555         nsMediaFeature::eMinMaxNotAllowed,
   556         nsMediaFeature::eBoolInteger,
   557         { &nsGkAtoms::scrollbar_thumb_proportional },
   558         GetSystemMetric
   559     },
   560     {
   561         &nsGkAtoms::_moz_images_in_menus,
   562         nsMediaFeature::eMinMaxNotAllowed,
   563         nsMediaFeature::eBoolInteger,
   564         { &nsGkAtoms::images_in_menus },
   565         GetSystemMetric
   566     },
   567     {
   568         &nsGkAtoms::_moz_images_in_buttons,
   569         nsMediaFeature::eMinMaxNotAllowed,
   570         nsMediaFeature::eBoolInteger,
   571         { &nsGkAtoms::images_in_buttons },
   572         GetSystemMetric
   573     },
   574     {
   575         &nsGkAtoms::_moz_overlay_scrollbars,
   576         nsMediaFeature::eMinMaxNotAllowed,
   577         nsMediaFeature::eBoolInteger,
   578         { &nsGkAtoms::overlay_scrollbars },
   579         GetSystemMetric
   580     },
   581     {
   582         &nsGkAtoms::_moz_windows_default_theme,
   583         nsMediaFeature::eMinMaxNotAllowed,
   584         nsMediaFeature::eBoolInteger,
   585         { &nsGkAtoms::windows_default_theme },
   586         GetSystemMetric
   587     },
   588     {
   589         &nsGkAtoms::_moz_mac_graphite_theme,
   590         nsMediaFeature::eMinMaxNotAllowed,
   591         nsMediaFeature::eBoolInteger,
   592         { &nsGkAtoms::mac_graphite_theme },
   593         GetSystemMetric
   594     },
   595     {
   596         &nsGkAtoms::_moz_mac_lion_theme,
   597         nsMediaFeature::eMinMaxNotAllowed,
   598         nsMediaFeature::eBoolInteger,
   599         { &nsGkAtoms::mac_lion_theme },
   600         GetSystemMetric
   601     },
   602     {
   603         &nsGkAtoms::_moz_windows_compositor,
   604         nsMediaFeature::eMinMaxNotAllowed,
   605         nsMediaFeature::eBoolInteger,
   606         { &nsGkAtoms::windows_compositor },
   607         GetSystemMetric
   608     },
   609     {
   610         &nsGkAtoms::_moz_windows_classic,
   611         nsMediaFeature::eMinMaxNotAllowed,
   612         nsMediaFeature::eBoolInteger,
   613         { &nsGkAtoms::windows_classic },
   614         GetSystemMetric
   615     },
   616     {
   617         &nsGkAtoms::_moz_windows_glass,
   618         nsMediaFeature::eMinMaxNotAllowed,
   619         nsMediaFeature::eBoolInteger,
   620         { &nsGkAtoms::windows_glass },
   621         GetSystemMetric
   622     },
   623     {
   624         &nsGkAtoms::_moz_touch_enabled,
   625         nsMediaFeature::eMinMaxNotAllowed,
   626         nsMediaFeature::eBoolInteger,
   627         { &nsGkAtoms::touch_enabled },
   628         GetSystemMetric
   629     },
   630     {
   631         &nsGkAtoms::_moz_menubar_drag,
   632         nsMediaFeature::eMinMaxNotAllowed,
   633         nsMediaFeature::eBoolInteger,
   634         { &nsGkAtoms::menubar_drag },
   635         GetSystemMetric
   636     },
   637     {
   638         &nsGkAtoms::_moz_windows_theme,
   639         nsMediaFeature::eMinMaxNotAllowed,
   640         nsMediaFeature::eIdent,
   641         { nullptr },
   642         GetWindowsTheme
   643     },
   644     {
   645         &nsGkAtoms::_moz_os_version,
   646         nsMediaFeature::eMinMaxNotAllowed,
   647         nsMediaFeature::eIdent,
   648         { nullptr },
   649         GetOperatinSystemVersion
   650     },
   652     {
   653         &nsGkAtoms::_moz_swipe_animation_enabled,
   654         nsMediaFeature::eMinMaxNotAllowed,
   655         nsMediaFeature::eBoolInteger,
   656         { &nsGkAtoms::swipe_animation_enabled },
   657         GetSystemMetric
   658     },
   660     {
   661         &nsGkAtoms::_moz_physical_home_button,
   662         nsMediaFeature::eMinMaxNotAllowed,
   663         nsMediaFeature::eBoolInteger,
   664         { &nsGkAtoms::physical_home_button },
   665         GetSystemMetric
   666     },
   668     // Internal -moz-is-glyph media feature: applies only inside SVG glyphs.
   669     // Internal because it is really only useful in the user agent anyway
   670     //  and therefore not worth standardizing.
   671     {
   672         &nsGkAtoms::_moz_is_glyph,
   673         nsMediaFeature::eMinMaxNotAllowed,
   674         nsMediaFeature::eBoolInteger,
   675         { nullptr },
   676         GetIsGlyph
   677     },
   678     // Null-mName terminator:
   679     {
   680         nullptr,
   681         nsMediaFeature::eMinMaxAllowed,
   682         nsMediaFeature::eInteger,
   683         { nullptr },
   684         nullptr
   685     },
   686 };

mercurial