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.)

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

mercurial