widget/xpwidgets/nsXPLookAndFeel.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 /* -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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 #include "mozilla/ArrayUtils.h"
michael@0 7
michael@0 8 #include "nscore.h"
michael@0 9
michael@0 10 #include "nsXPLookAndFeel.h"
michael@0 11 #include "nsLookAndFeel.h"
michael@0 12 #include "nsCRT.h"
michael@0 13 #include "nsFont.h"
michael@0 14 #include "nsThemeConstants.h"
michael@0 15 #include "mozilla/Preferences.h"
michael@0 16 #include "mozilla/gfx/2D.h"
michael@0 17
michael@0 18 #include "gfxPlatform.h"
michael@0 19 #include "qcms.h"
michael@0 20
michael@0 21 #ifdef DEBUG
michael@0 22 #include "nsSize.h"
michael@0 23 #endif
michael@0 24
michael@0 25 using namespace mozilla;
michael@0 26
michael@0 27 nsLookAndFeelIntPref nsXPLookAndFeel::sIntPrefs[] =
michael@0 28 {
michael@0 29 { "ui.caretBlinkTime",
michael@0 30 eIntID_CaretBlinkTime,
michael@0 31 false, 0 },
michael@0 32 { "ui.caretWidth",
michael@0 33 eIntID_CaretWidth,
michael@0 34 false, 0 },
michael@0 35 { "ui.caretVisibleWithSelection",
michael@0 36 eIntID_ShowCaretDuringSelection,
michael@0 37 false, 0 },
michael@0 38 { "ui.submenuDelay",
michael@0 39 eIntID_SubmenuDelay,
michael@0 40 false, 0 },
michael@0 41 { "ui.dragThresholdX",
michael@0 42 eIntID_DragThresholdX,
michael@0 43 false, 0 },
michael@0 44 { "ui.dragThresholdY",
michael@0 45 eIntID_DragThresholdY,
michael@0 46 false, 0 },
michael@0 47 { "ui.useAccessibilityTheme",
michael@0 48 eIntID_UseAccessibilityTheme,
michael@0 49 false, 0 },
michael@0 50 { "ui.menusCanOverlapOSBar",
michael@0 51 eIntID_MenusCanOverlapOSBar,
michael@0 52 false, 0 },
michael@0 53 { "ui.useOverlayScrollbars",
michael@0 54 eIntID_UseOverlayScrollbars,
michael@0 55 false, 0 },
michael@0 56 { "ui.scrollbarDisplayOnMouseMove",
michael@0 57 eIntID_ScrollbarDisplayOnMouseMove,
michael@0 58 false, 0 },
michael@0 59 { "ui.scrollbarFadeBeginDelay",
michael@0 60 eIntID_ScrollbarFadeBeginDelay,
michael@0 61 false, 0 },
michael@0 62 { "ui.scrollbarFadeDuration",
michael@0 63 eIntID_ScrollbarFadeDuration,
michael@0 64 false, 0 },
michael@0 65 { "ui.showHideScrollbars",
michael@0 66 eIntID_ShowHideScrollbars,
michael@0 67 false, 0 },
michael@0 68 { "ui.skipNavigatingDisabledMenuItem",
michael@0 69 eIntID_SkipNavigatingDisabledMenuItem,
michael@0 70 false, 0 },
michael@0 71 { "ui.treeOpenDelay",
michael@0 72 eIntID_TreeOpenDelay,
michael@0 73 false, 0 },
michael@0 74 { "ui.treeCloseDelay",
michael@0 75 eIntID_TreeCloseDelay,
michael@0 76 false, 0 },
michael@0 77 { "ui.treeLazyScrollDelay",
michael@0 78 eIntID_TreeLazyScrollDelay,
michael@0 79 false, 0 },
michael@0 80 { "ui.treeScrollDelay",
michael@0 81 eIntID_TreeScrollDelay,
michael@0 82 false, 0 },
michael@0 83 { "ui.treeScrollLinesMax",
michael@0 84 eIntID_TreeScrollLinesMax,
michael@0 85 false, 0 },
michael@0 86 { "accessibility.tabfocus",
michael@0 87 eIntID_TabFocusModel,
michael@0 88 false, 0 },
michael@0 89 { "ui.alertNotificationOrigin",
michael@0 90 eIntID_AlertNotificationOrigin,
michael@0 91 false, 0 },
michael@0 92 { "ui.scrollToClick",
michael@0 93 eIntID_ScrollToClick,
michael@0 94 false, 0 },
michael@0 95 { "ui.IMERawInputUnderlineStyle",
michael@0 96 eIntID_IMERawInputUnderlineStyle,
michael@0 97 false, 0 },
michael@0 98 { "ui.IMESelectedRawTextUnderlineStyle",
michael@0 99 eIntID_IMESelectedRawTextUnderlineStyle,
michael@0 100 false, 0 },
michael@0 101 { "ui.IMEConvertedTextUnderlineStyle",
michael@0 102 eIntID_IMEConvertedTextUnderlineStyle,
michael@0 103 false, 0 },
michael@0 104 { "ui.IMESelectedConvertedTextUnderlineStyle",
michael@0 105 eIntID_IMESelectedConvertedTextUnderline,
michael@0 106 false, 0 },
michael@0 107 { "ui.SpellCheckerUnderlineStyle",
michael@0 108 eIntID_SpellCheckerUnderlineStyle,
michael@0 109 false, 0 },
michael@0 110 { "ui.scrollbarButtonAutoRepeatBehavior",
michael@0 111 eIntID_ScrollbarButtonAutoRepeatBehavior,
michael@0 112 false, 0 },
michael@0 113 { "ui.tooltipDelay",
michael@0 114 eIntID_TooltipDelay,
michael@0 115 false, 0 },
michael@0 116 { "ui.physicalHomeButton",
michael@0 117 eIntID_PhysicalHomeButton,
michael@0 118 false, 0 },
michael@0 119 };
michael@0 120
michael@0 121 nsLookAndFeelFloatPref nsXPLookAndFeel::sFloatPrefs[] =
michael@0 122 {
michael@0 123 { "ui.IMEUnderlineRelativeSize",
michael@0 124 eFloatID_IMEUnderlineRelativeSize,
michael@0 125 false, 0 },
michael@0 126 { "ui.SpellCheckerUnderlineRelativeSize",
michael@0 127 eFloatID_SpellCheckerUnderlineRelativeSize,
michael@0 128 false, 0 },
michael@0 129 { "ui.caretAspectRatio",
michael@0 130 eFloatID_CaretAspectRatio,
michael@0 131 false, 0 },
michael@0 132 };
michael@0 133
michael@0 134
michael@0 135 // This array MUST be kept in the same order as the color list in LookAndFeel.h.
michael@0 136 /* XXX If you add any strings longer than
michael@0 137 * "ui.IMESelectedConvertedTextBackground"
michael@0 138 * to the following array then you MUST update the
michael@0 139 * sizes of the sColorPrefs array in nsXPLookAndFeel.h
michael@0 140 */
michael@0 141 const char nsXPLookAndFeel::sColorPrefs[][38] =
michael@0 142 {
michael@0 143 "ui.windowBackground",
michael@0 144 "ui.windowForeground",
michael@0 145 "ui.widgetBackground",
michael@0 146 "ui.widgetForeground",
michael@0 147 "ui.widgetSelectBackground",
michael@0 148 "ui.widgetSelectForeground",
michael@0 149 "ui.widget3DHighlight",
michael@0 150 "ui.widget3DShadow",
michael@0 151 "ui.textBackground",
michael@0 152 "ui.textForeground",
michael@0 153 "ui.textSelectBackground",
michael@0 154 "ui.textSelectForeground",
michael@0 155 "ui.textSelectBackgroundDisabled",
michael@0 156 "ui.textSelectBackgroundAttention",
michael@0 157 "ui.textHighlightBackground",
michael@0 158 "ui.textHighlightForeground",
michael@0 159 "ui.IMERawInputBackground",
michael@0 160 "ui.IMERawInputForeground",
michael@0 161 "ui.IMERawInputUnderline",
michael@0 162 "ui.IMESelectedRawTextBackground",
michael@0 163 "ui.IMESelectedRawTextForeground",
michael@0 164 "ui.IMESelectedRawTextUnderline",
michael@0 165 "ui.IMEConvertedTextBackground",
michael@0 166 "ui.IMEConvertedTextForeground",
michael@0 167 "ui.IMEConvertedTextUnderline",
michael@0 168 "ui.IMESelectedConvertedTextBackground",
michael@0 169 "ui.IMESelectedConvertedTextForeground",
michael@0 170 "ui.IMESelectedConvertedTextUnderline",
michael@0 171 "ui.SpellCheckerUnderline",
michael@0 172 "ui.activeborder",
michael@0 173 "ui.activecaption",
michael@0 174 "ui.appworkspace",
michael@0 175 "ui.background",
michael@0 176 "ui.buttonface",
michael@0 177 "ui.buttonhighlight",
michael@0 178 "ui.buttonshadow",
michael@0 179 "ui.buttontext",
michael@0 180 "ui.captiontext",
michael@0 181 "ui.graytext",
michael@0 182 "ui.highlight",
michael@0 183 "ui.highlighttext",
michael@0 184 "ui.inactiveborder",
michael@0 185 "ui.inactivecaption",
michael@0 186 "ui.inactivecaptiontext",
michael@0 187 "ui.infobackground",
michael@0 188 "ui.infotext",
michael@0 189 "ui.menu",
michael@0 190 "ui.menutext",
michael@0 191 "ui.scrollbar",
michael@0 192 "ui.threeddarkshadow",
michael@0 193 "ui.threedface",
michael@0 194 "ui.threedhighlight",
michael@0 195 "ui.threedlightshadow",
michael@0 196 "ui.threedshadow",
michael@0 197 "ui.window",
michael@0 198 "ui.windowframe",
michael@0 199 "ui.windowtext",
michael@0 200 "ui.-moz-buttondefault",
michael@0 201 "ui.-moz-field",
michael@0 202 "ui.-moz-fieldtext",
michael@0 203 "ui.-moz-dialog",
michael@0 204 "ui.-moz-dialogtext",
michael@0 205 "ui.-moz-dragtargetzone",
michael@0 206 "ui.-moz-cellhighlight",
michael@0 207 "ui.-moz_cellhighlighttext",
michael@0 208 "ui.-moz-html-cellhighlight",
michael@0 209 "ui.-moz-html-cellhighlighttext",
michael@0 210 "ui.-moz-buttonhoverface",
michael@0 211 "ui.-moz_buttonhovertext",
michael@0 212 "ui.-moz_menuhover",
michael@0 213 "ui.-moz_menuhovertext",
michael@0 214 "ui.-moz_menubartext",
michael@0 215 "ui.-moz_menubarhovertext",
michael@0 216 "ui.-moz_eventreerow",
michael@0 217 "ui.-moz_oddtreerow",
michael@0 218 "ui.-moz_mac_chrome_active",
michael@0 219 "ui.-moz_mac_chrome_inactive",
michael@0 220 "ui.-moz-mac-focusring",
michael@0 221 "ui.-moz-mac-menuselect",
michael@0 222 "ui.-moz-mac-menushadow",
michael@0 223 "ui.-moz-mac-menutextdisable",
michael@0 224 "ui.-moz-mac-menutextselect",
michael@0 225 "ui.-moz_mac_disabledtoolbartext",
michael@0 226 "ui.-moz-mac-secondaryhighlight",
michael@0 227 "ui.-moz-win-mediatext",
michael@0 228 "ui.-moz-win-communicationstext",
michael@0 229 "ui.-moz-nativehyperlinktext",
michael@0 230 "ui.-moz-comboboxtext",
michael@0 231 "ui.-moz-combobox"
michael@0 232 };
michael@0 233
michael@0 234 int32_t nsXPLookAndFeel::sCachedColors[LookAndFeel::eColorID_LAST_COLOR] = {0};
michael@0 235 int32_t nsXPLookAndFeel::sCachedColorBits[COLOR_CACHE_SIZE] = {0};
michael@0 236
michael@0 237 bool nsXPLookAndFeel::sInitialized = false;
michael@0 238 bool nsXPLookAndFeel::sUseNativeColors = true;
michael@0 239
michael@0 240 nsLookAndFeel* nsXPLookAndFeel::sInstance = nullptr;
michael@0 241 bool nsXPLookAndFeel::sShutdown = false;
michael@0 242
michael@0 243 // static
michael@0 244 nsLookAndFeel*
michael@0 245 nsXPLookAndFeel::GetInstance()
michael@0 246 {
michael@0 247 if (sInstance) {
michael@0 248 return sInstance;
michael@0 249 }
michael@0 250
michael@0 251 NS_ENSURE_TRUE(!sShutdown, nullptr);
michael@0 252
michael@0 253 sInstance = new nsLookAndFeel();
michael@0 254 return sInstance;
michael@0 255 }
michael@0 256
michael@0 257 // static
michael@0 258 void
michael@0 259 nsXPLookAndFeel::Shutdown()
michael@0 260 {
michael@0 261 if (sShutdown) {
michael@0 262 return;
michael@0 263 }
michael@0 264 sShutdown = true;
michael@0 265 delete sInstance;
michael@0 266 sInstance = nullptr;
michael@0 267 }
michael@0 268
michael@0 269 nsXPLookAndFeel::nsXPLookAndFeel() : LookAndFeel()
michael@0 270 {
michael@0 271 }
michael@0 272
michael@0 273 // static
michael@0 274 void
michael@0 275 nsXPLookAndFeel::IntPrefChanged(nsLookAndFeelIntPref *data)
michael@0 276 {
michael@0 277 if (!data) {
michael@0 278 return;
michael@0 279 }
michael@0 280
michael@0 281 int32_t intpref;
michael@0 282 nsresult rv = Preferences::GetInt(data->name, &intpref);
michael@0 283 if (NS_FAILED(rv)) {
michael@0 284 return;
michael@0 285 }
michael@0 286 data->intVar = intpref;
michael@0 287 data->isSet = true;
michael@0 288 #ifdef DEBUG_akkana
michael@0 289 printf("====== Changed int pref %s to %d\n", data->name, data->intVar);
michael@0 290 #endif
michael@0 291 }
michael@0 292
michael@0 293 // static
michael@0 294 void
michael@0 295 nsXPLookAndFeel::FloatPrefChanged(nsLookAndFeelFloatPref *data)
michael@0 296 {
michael@0 297 if (!data) {
michael@0 298 return;
michael@0 299 }
michael@0 300
michael@0 301 int32_t intpref;
michael@0 302 nsresult rv = Preferences::GetInt(data->name, &intpref);
michael@0 303 if (NS_FAILED(rv)) {
michael@0 304 return;
michael@0 305 }
michael@0 306 data->floatVar = (float)intpref / 100.0f;
michael@0 307 data->isSet = true;
michael@0 308 #ifdef DEBUG_akkana
michael@0 309 printf("====== Changed float pref %s to %f\n", data->name, data->floatVar);
michael@0 310 #endif
michael@0 311 }
michael@0 312
michael@0 313 // static
michael@0 314 void
michael@0 315 nsXPLookAndFeel::ColorPrefChanged (unsigned int index, const char *prefName)
michael@0 316 {
michael@0 317 nsAutoString colorStr;
michael@0 318 nsresult rv = Preferences::GetString(prefName, &colorStr);
michael@0 319 if (NS_FAILED(rv)) {
michael@0 320 return;
michael@0 321 }
michael@0 322 if (!colorStr.IsEmpty()) {
michael@0 323 nscolor thecolor;
michael@0 324 if (colorStr[0] == char16_t('#')) {
michael@0 325 if (NS_HexToRGB(nsDependentString(colorStr, 1), &thecolor)) {
michael@0 326 int32_t id = NS_PTR_TO_INT32(index);
michael@0 327 CACHE_COLOR(id, thecolor);
michael@0 328 }
michael@0 329 } else if (NS_ColorNameToRGB(colorStr, &thecolor)) {
michael@0 330 int32_t id = NS_PTR_TO_INT32(index);
michael@0 331 CACHE_COLOR(id, thecolor);
michael@0 332 #ifdef DEBUG_akkana
michael@0 333 printf("====== Changed color pref %s to 0x%lx\n",
michael@0 334 prefName, thecolor);
michael@0 335 #endif
michael@0 336 }
michael@0 337 } else {
michael@0 338 // Reset to the default color, by clearing the cache
michael@0 339 // to force lookup when the color is next used
michael@0 340 int32_t id = NS_PTR_TO_INT32(index);
michael@0 341 CLEAR_COLOR_CACHE(id);
michael@0 342 }
michael@0 343 }
michael@0 344
michael@0 345 void
michael@0 346 nsXPLookAndFeel::InitFromPref(nsLookAndFeelIntPref* aPref)
michael@0 347 {
michael@0 348 int32_t intpref;
michael@0 349 nsresult rv = Preferences::GetInt(aPref->name, &intpref);
michael@0 350 if (NS_SUCCEEDED(rv)) {
michael@0 351 aPref->isSet = true;
michael@0 352 aPref->intVar = intpref;
michael@0 353 }
michael@0 354 }
michael@0 355
michael@0 356 void
michael@0 357 nsXPLookAndFeel::InitFromPref(nsLookAndFeelFloatPref* aPref)
michael@0 358 {
michael@0 359 int32_t intpref;
michael@0 360 nsresult rv = Preferences::GetInt(aPref->name, &intpref);
michael@0 361 if (NS_SUCCEEDED(rv)) {
michael@0 362 aPref->isSet = true;
michael@0 363 aPref->floatVar = (float)intpref / 100.0f;
michael@0 364 }
michael@0 365 }
michael@0 366
michael@0 367 void
michael@0 368 nsXPLookAndFeel::InitColorFromPref(int32_t i)
michael@0 369 {
michael@0 370 nsAutoString colorStr;
michael@0 371 nsresult rv = Preferences::GetString(sColorPrefs[i], &colorStr);
michael@0 372 if (NS_FAILED(rv) || colorStr.IsEmpty()) {
michael@0 373 return;
michael@0 374 }
michael@0 375 nscolor thecolor;
michael@0 376 if (colorStr[0] == char16_t('#')) {
michael@0 377 nsAutoString hexString;
michael@0 378 colorStr.Right(hexString, colorStr.Length() - 1);
michael@0 379 if (NS_HexToRGB(hexString, &thecolor)) {
michael@0 380 CACHE_COLOR(i, thecolor);
michael@0 381 }
michael@0 382 } else if (NS_ColorNameToRGB(colorStr, &thecolor)) {
michael@0 383 CACHE_COLOR(i, thecolor);
michael@0 384 }
michael@0 385 }
michael@0 386
michael@0 387 // static
michael@0 388 void
michael@0 389 nsXPLookAndFeel::OnPrefChanged(const char* aPref, void* aClosure)
michael@0 390 {
michael@0 391
michael@0 392 // looping in the same order as in ::Init
michael@0 393
michael@0 394 nsDependentCString prefName(aPref);
michael@0 395 unsigned int i;
michael@0 396 for (i = 0; i < ArrayLength(sIntPrefs); ++i) {
michael@0 397 if (prefName.Equals(sIntPrefs[i].name)) {
michael@0 398 IntPrefChanged(&sIntPrefs[i]);
michael@0 399 return;
michael@0 400 }
michael@0 401 }
michael@0 402
michael@0 403 for (i = 0; i < ArrayLength(sFloatPrefs); ++i) {
michael@0 404 if (prefName.Equals(sFloatPrefs[i].name)) {
michael@0 405 FloatPrefChanged(&sFloatPrefs[i]);
michael@0 406 return;
michael@0 407 }
michael@0 408 }
michael@0 409
michael@0 410 for (i = 0; i < ArrayLength(sColorPrefs); ++i) {
michael@0 411 if (prefName.Equals(sColorPrefs[i])) {
michael@0 412 ColorPrefChanged(i, sColorPrefs[i]);
michael@0 413 return;
michael@0 414 }
michael@0 415 }
michael@0 416 }
michael@0 417
michael@0 418 //
michael@0 419 // Read values from the user's preferences.
michael@0 420 // This is done once at startup, but since the user's preferences
michael@0 421 // haven't actually been read yet at that time, we also have to
michael@0 422 // set a callback to inform us of changes to each pref.
michael@0 423 //
michael@0 424 void
michael@0 425 nsXPLookAndFeel::Init()
michael@0 426 {
michael@0 427 // Say we're already initialized, and take the chance that it might fail;
michael@0 428 // protects against some other process writing to our static variables.
michael@0 429 sInitialized = true;
michael@0 430
michael@0 431 // XXX If we could reorganize the pref names, we should separate the branch
michael@0 432 // for each types. Then, we could reduce the unnecessary loop from
michael@0 433 // nsXPLookAndFeel::OnPrefChanged().
michael@0 434 Preferences::RegisterCallback(OnPrefChanged, "ui.");
michael@0 435 Preferences::RegisterCallback(OnPrefChanged, "accessibility.tabfocus");
michael@0 436
michael@0 437 unsigned int i;
michael@0 438 for (i = 0; i < ArrayLength(sIntPrefs); ++i) {
michael@0 439 InitFromPref(&sIntPrefs[i]);
michael@0 440 }
michael@0 441
michael@0 442 for (i = 0; i < ArrayLength(sFloatPrefs); ++i) {
michael@0 443 InitFromPref(&sFloatPrefs[i]);
michael@0 444 }
michael@0 445
michael@0 446 for (i = 0; i < ArrayLength(sColorPrefs); ++i) {
michael@0 447 InitColorFromPref(i);
michael@0 448 }
michael@0 449
michael@0 450 bool val;
michael@0 451 if (NS_SUCCEEDED(Preferences::GetBool("ui.use_native_colors", &val))) {
michael@0 452 sUseNativeColors = val;
michael@0 453 }
michael@0 454 }
michael@0 455
michael@0 456 nsXPLookAndFeel::~nsXPLookAndFeel()
michael@0 457 {
michael@0 458 NS_ASSERTION(sInstance == this,
michael@0 459 "This destroying instance isn't the singleton instance");
michael@0 460 sInstance = nullptr;
michael@0 461 }
michael@0 462
michael@0 463 bool
michael@0 464 nsXPLookAndFeel::IsSpecialColor(ColorID aID, nscolor &aColor)
michael@0 465 {
michael@0 466 switch (aID) {
michael@0 467 case eColorID_TextSelectForeground:
michael@0 468 return (aColor == NS_DONT_CHANGE_COLOR);
michael@0 469 case eColorID_IMESelectedRawTextBackground:
michael@0 470 case eColorID_IMESelectedConvertedTextBackground:
michael@0 471 case eColorID_IMERawInputBackground:
michael@0 472 case eColorID_IMEConvertedTextBackground:
michael@0 473 case eColorID_IMESelectedRawTextForeground:
michael@0 474 case eColorID_IMESelectedConvertedTextForeground:
michael@0 475 case eColorID_IMERawInputForeground:
michael@0 476 case eColorID_IMEConvertedTextForeground:
michael@0 477 case eColorID_IMERawInputUnderline:
michael@0 478 case eColorID_IMEConvertedTextUnderline:
michael@0 479 case eColorID_IMESelectedRawTextUnderline:
michael@0 480 case eColorID_IMESelectedConvertedTextUnderline:
michael@0 481 case eColorID_SpellCheckerUnderline:
michael@0 482 return NS_IS_SELECTION_SPECIAL_COLOR(aColor);
michael@0 483 default:
michael@0 484 /*
michael@0 485 * In GetColor(), every color that is not a special color is color
michael@0 486 * corrected. Use false to make other colors color corrected.
michael@0 487 */
michael@0 488 return false;
michael@0 489 }
michael@0 490 return false;
michael@0 491 }
michael@0 492
michael@0 493 bool
michael@0 494 nsXPLookAndFeel::ColorIsNotCSSAccessible(ColorID aID)
michael@0 495 {
michael@0 496 bool result = false;
michael@0 497
michael@0 498 switch (aID) {
michael@0 499 case eColorID_WindowBackground:
michael@0 500 case eColorID_WindowForeground:
michael@0 501 case eColorID_WidgetBackground:
michael@0 502 case eColorID_WidgetForeground:
michael@0 503 case eColorID_WidgetSelectBackground:
michael@0 504 case eColorID_WidgetSelectForeground:
michael@0 505 case eColorID_Widget3DHighlight:
michael@0 506 case eColorID_Widget3DShadow:
michael@0 507 case eColorID_TextBackground:
michael@0 508 case eColorID_TextForeground:
michael@0 509 case eColorID_TextSelectBackground:
michael@0 510 case eColorID_TextSelectForeground:
michael@0 511 case eColorID_TextSelectBackgroundDisabled:
michael@0 512 case eColorID_TextSelectBackgroundAttention:
michael@0 513 case eColorID_TextHighlightBackground:
michael@0 514 case eColorID_TextHighlightForeground:
michael@0 515 case eColorID_IMERawInputBackground:
michael@0 516 case eColorID_IMERawInputForeground:
michael@0 517 case eColorID_IMERawInputUnderline:
michael@0 518 case eColorID_IMESelectedRawTextBackground:
michael@0 519 case eColorID_IMESelectedRawTextForeground:
michael@0 520 case eColorID_IMESelectedRawTextUnderline:
michael@0 521 case eColorID_IMEConvertedTextBackground:
michael@0 522 case eColorID_IMEConvertedTextForeground:
michael@0 523 case eColorID_IMEConvertedTextUnderline:
michael@0 524 case eColorID_IMESelectedConvertedTextBackground:
michael@0 525 case eColorID_IMESelectedConvertedTextForeground:
michael@0 526 case eColorID_IMESelectedConvertedTextUnderline:
michael@0 527 case eColorID_SpellCheckerUnderline:
michael@0 528 result = true;
michael@0 529 break;
michael@0 530 default:
michael@0 531 break;
michael@0 532 }
michael@0 533
michael@0 534 return result;
michael@0 535 }
michael@0 536
michael@0 537 nscolor
michael@0 538 nsXPLookAndFeel::GetStandinForNativeColor(ColorID aID)
michael@0 539 {
michael@0 540 nscolor result = NS_RGB(0xFF, 0xFF, 0xFF);
michael@0 541
michael@0 542 // The stand-in colors are taken from the Windows 7 Aero theme
michael@0 543 // except Mac-specific colors which are taken from Mac OS 10.7.
michael@0 544 switch (aID) {
michael@0 545 // CSS 2 colors:
michael@0 546 case eColorID_activeborder: result = NS_RGB(0xB4, 0xB4, 0xB4); break;
michael@0 547 case eColorID_activecaption: result = NS_RGB(0x99, 0xB4, 0xD1); break;
michael@0 548 case eColorID_appworkspace: result = NS_RGB(0xAB, 0xAB, 0xAB); break;
michael@0 549 case eColorID_background: result = NS_RGB(0x00, 0x00, 0x00); break;
michael@0 550 case eColorID_buttonface: result = NS_RGB(0xF0, 0xF0, 0xF0); break;
michael@0 551 case eColorID_buttonhighlight: result = NS_RGB(0xFF, 0xFF, 0xFF); break;
michael@0 552 case eColorID_buttonshadow: result = NS_RGB(0xA0, 0xA0, 0xA0); break;
michael@0 553 case eColorID_buttontext: result = NS_RGB(0x00, 0x00, 0x00); break;
michael@0 554 case eColorID_captiontext: result = NS_RGB(0x00, 0x00, 0x00); break;
michael@0 555 case eColorID_graytext: result = NS_RGB(0x6D, 0x6D, 0x6D); break;
michael@0 556 case eColorID_highlight: result = NS_RGB(0x33, 0x99, 0xFF); break;
michael@0 557 case eColorID_highlighttext: result = NS_RGB(0xFF, 0xFF, 0xFF); break;
michael@0 558 case eColorID_inactiveborder: result = NS_RGB(0xF4, 0xF7, 0xFC); break;
michael@0 559 case eColorID_inactivecaption: result = NS_RGB(0xBF, 0xCD, 0xDB); break;
michael@0 560 case eColorID_inactivecaptiontext:
michael@0 561 result = NS_RGB(0x43, 0x4E, 0x54); break;
michael@0 562 case eColorID_infobackground: result = NS_RGB(0xFF, 0xFF, 0xE1); break;
michael@0 563 case eColorID_infotext: result = NS_RGB(0x00, 0x00, 0x00); break;
michael@0 564 case eColorID_menu: result = NS_RGB(0xF0, 0xF0, 0xF0); break;
michael@0 565 case eColorID_menutext: result = NS_RGB(0x00, 0x00, 0x00); break;
michael@0 566 case eColorID_scrollbar: result = NS_RGB(0xC8, 0xC8, 0xC8); break;
michael@0 567 case eColorID_threeddarkshadow: result = NS_RGB(0x69, 0x69, 0x69); break;
michael@0 568 case eColorID_threedface: result = NS_RGB(0xF0, 0xF0, 0xF0); break;
michael@0 569 case eColorID_threedhighlight: result = NS_RGB(0xFF, 0xFF, 0xFF); break;
michael@0 570 case eColorID_threedlightshadow: result = NS_RGB(0xE3, 0xE3, 0xE3); break;
michael@0 571 case eColorID_threedshadow: result = NS_RGB(0xA0, 0xA0, 0xA0); break;
michael@0 572 case eColorID_window: result = NS_RGB(0xFF, 0xFF, 0xFF); break;
michael@0 573 case eColorID_windowframe: result = NS_RGB(0x64, 0x64, 0x64); break;
michael@0 574 case eColorID_windowtext: result = NS_RGB(0x00, 0x00, 0x00); break;
michael@0 575 case eColorID__moz_buttondefault:
michael@0 576 result = NS_RGB(0x69, 0x69, 0x69); break;
michael@0 577 case eColorID__moz_field: result = NS_RGB(0xFF, 0xFF, 0xFF); break;
michael@0 578 case eColorID__moz_fieldtext: result = NS_RGB(0x00, 0x00, 0x00); break;
michael@0 579 case eColorID__moz_dialog: result = NS_RGB(0xF0, 0xF0, 0xF0); break;
michael@0 580 case eColorID__moz_dialogtext: result = NS_RGB(0x00, 0x00, 0x00); break;
michael@0 581 case eColorID__moz_dragtargetzone:
michael@0 582 result = NS_RGB(0xFF, 0xFF, 0xFF); break;
michael@0 583 case eColorID__moz_cellhighlight:
michael@0 584 result = NS_RGB(0xF0, 0xF0, 0xF0); break;
michael@0 585 case eColorID__moz_cellhighlighttext:
michael@0 586 result = NS_RGB(0x00, 0x00, 0x00); break;
michael@0 587 case eColorID__moz_html_cellhighlight:
michael@0 588 result = NS_RGB(0x33, 0x99, 0xFF); break;
michael@0 589 case eColorID__moz_html_cellhighlighttext:
michael@0 590 result = NS_RGB(0xFF, 0xFF, 0xFF); break;
michael@0 591 case eColorID__moz_buttonhoverface:
michael@0 592 result = NS_RGB(0xF0, 0xF0, 0xF0); break;
michael@0 593 case eColorID__moz_buttonhovertext:
michael@0 594 result = NS_RGB(0x00, 0x00, 0x00); break;
michael@0 595 case eColorID__moz_menuhover:
michael@0 596 result = NS_RGB(0x33, 0x99, 0xFF); break;
michael@0 597 case eColorID__moz_menuhovertext:
michael@0 598 result = NS_RGB(0x00, 0x00, 0x00); break;
michael@0 599 case eColorID__moz_menubartext:
michael@0 600 result = NS_RGB(0x00, 0x00, 0x00); break;
michael@0 601 case eColorID__moz_menubarhovertext:
michael@0 602 result = NS_RGB(0x00, 0x00, 0x00); break;
michael@0 603 case eColorID__moz_oddtreerow:
michael@0 604 result = NS_RGB(0xFF, 0xFF, 0xFF); break;
michael@0 605 case eColorID__moz_mac_chrome_active:
michael@0 606 result = NS_RGB(0xB2, 0xB2, 0xB2); break;
michael@0 607 case eColorID__moz_mac_chrome_inactive:
michael@0 608 result = NS_RGB(0xE1, 0xE1, 0xE1); break;
michael@0 609 case eColorID__moz_mac_focusring:
michael@0 610 result = NS_RGB(0x60, 0x9D, 0xD7); break;
michael@0 611 case eColorID__moz_mac_menuselect:
michael@0 612 result = NS_RGB(0x38, 0x75, 0xD7); break;
michael@0 613 case eColorID__moz_mac_menushadow:
michael@0 614 result = NS_RGB(0xA3, 0xA3, 0xA3); break;
michael@0 615 case eColorID__moz_mac_menutextdisable:
michael@0 616 result = NS_RGB(0x88, 0x88, 0x88); break;
michael@0 617 case eColorID__moz_mac_menutextselect:
michael@0 618 result = NS_RGB(0xFF, 0xFF, 0xFF); break;
michael@0 619 case eColorID__moz_mac_disabledtoolbartext:
michael@0 620 result = NS_RGB(0x3F, 0x3F, 0x3F); break;
michael@0 621 case eColorID__moz_mac_secondaryhighlight:
michael@0 622 result = NS_RGB(0xD4, 0xD4, 0xD4); break;
michael@0 623 case eColorID__moz_win_mediatext:
michael@0 624 result = NS_RGB(0xFF, 0xFF, 0xFF); break;
michael@0 625 case eColorID__moz_win_communicationstext:
michael@0 626 result = NS_RGB(0xFF, 0xFF, 0xFF); break;
michael@0 627 case eColorID__moz_nativehyperlinktext:
michael@0 628 result = NS_RGB(0x00, 0x66, 0xCC); break;
michael@0 629 case eColorID__moz_comboboxtext:
michael@0 630 result = NS_RGB(0x00, 0x00, 0x00); break;
michael@0 631 case eColorID__moz_combobox:
michael@0 632 result = NS_RGB(0xFF, 0xFF, 0xFF); break;
michael@0 633 default:
michael@0 634 break;
michael@0 635 }
michael@0 636
michael@0 637 return result;
michael@0 638 }
michael@0 639
michael@0 640 //
michael@0 641 // All these routines will return NS_OK if they have a value,
michael@0 642 // in which case the nsLookAndFeel should use that value;
michael@0 643 // otherwise we'll return NS_ERROR_NOT_AVAILABLE, in which case, the
michael@0 644 // platform-specific nsLookAndFeel should use its own values instead.
michael@0 645 //
michael@0 646 nsresult
michael@0 647 nsXPLookAndFeel::GetColorImpl(ColorID aID, bool aUseStandinsForNativeColors,
michael@0 648 nscolor &aResult)
michael@0 649 {
michael@0 650 if (!sInitialized)
michael@0 651 Init();
michael@0 652
michael@0 653 // define DEBUG_SYSTEM_COLOR_USE if you want to debug system color
michael@0 654 // use in a skin that uses them. When set, it will make all system
michael@0 655 // color pairs that are appropriate for foreground/background
michael@0 656 // pairing the same. This means if the skin is using system colors
michael@0 657 // correctly you will not be able to see *any* text.
michael@0 658 #undef DEBUG_SYSTEM_COLOR_USE
michael@0 659
michael@0 660 #ifdef DEBUG_SYSTEM_COLOR_USE
michael@0 661 {
michael@0 662 nsresult rv = NS_OK;
michael@0 663 switch (aID) {
michael@0 664 // css2 http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
michael@0 665 case eColorID_activecaption:
michael@0 666 // active window caption background
michael@0 667 case eColorID_captiontext:
michael@0 668 // text in active window caption
michael@0 669 aResult = NS_RGB(0xff, 0x00, 0x00);
michael@0 670 break;
michael@0 671
michael@0 672 case eColorID_highlight:
michael@0 673 // background of selected item
michael@0 674 case eColorID_highlighttext:
michael@0 675 // text of selected item
michael@0 676 aResult = NS_RGB(0xff, 0xff, 0x00);
michael@0 677 break;
michael@0 678
michael@0 679 case eColorID_inactivecaption:
michael@0 680 // inactive window caption
michael@0 681 case eColorID_inactivecaptiontext:
michael@0 682 // text in inactive window caption
michael@0 683 aResult = NS_RGB(0x66, 0x66, 0x00);
michael@0 684 break;
michael@0 685
michael@0 686 case eColorID_infobackground:
michael@0 687 // tooltip background color
michael@0 688 case eColorID_infotext:
michael@0 689 // tooltip text color
michael@0 690 aResult = NS_RGB(0x00, 0xff, 0x00);
michael@0 691 break;
michael@0 692
michael@0 693 case eColorID_menu:
michael@0 694 // menu background
michael@0 695 case eColorID_menutext:
michael@0 696 // menu text
michael@0 697 aResult = NS_RGB(0x00, 0xff, 0xff);
michael@0 698 break;
michael@0 699
michael@0 700 case eColorID_threedface:
michael@0 701 case eColorID_buttonface:
michael@0 702 // 3-D face color
michael@0 703 case eColorID_buttontext:
michael@0 704 // text on push buttons
michael@0 705 aResult = NS_RGB(0x00, 0x66, 0x66);
michael@0 706 break;
michael@0 707
michael@0 708 case eColorID_window:
michael@0 709 case eColorID_windowtext:
michael@0 710 aResult = NS_RGB(0x00, 0x00, 0xff);
michael@0 711 break;
michael@0 712
michael@0 713 // from the CSS3 working draft (not yet finalized)
michael@0 714 // http://www.w3.org/tr/2000/wd-css3-userint-20000216.html#color
michael@0 715
michael@0 716 case eColorID__moz_field:
michael@0 717 case eColorID__moz_fieldtext:
michael@0 718 aResult = NS_RGB(0xff, 0x00, 0xff);
michael@0 719 break;
michael@0 720
michael@0 721 case eColorID__moz_dialog:
michael@0 722 case eColorID__moz_dialogtext:
michael@0 723 aResult = NS_RGB(0x66, 0x00, 0x66);
michael@0 724 break;
michael@0 725
michael@0 726 default:
michael@0 727 rv = NS_ERROR_NOT_AVAILABLE;
michael@0 728 }
michael@0 729 if (NS_SUCCEEDED(rv))
michael@0 730 return rv;
michael@0 731 }
michael@0 732 #endif // DEBUG_SYSTEM_COLOR_USE
michael@0 733
michael@0 734 if (aUseStandinsForNativeColors && ColorIsNotCSSAccessible(aID))
michael@0 735 aUseStandinsForNativeColors = false;
michael@0 736
michael@0 737 if (!aUseStandinsForNativeColors && IS_COLOR_CACHED(aID)) {
michael@0 738 aResult = sCachedColors[aID];
michael@0 739 return NS_OK;
michael@0 740 }
michael@0 741
michael@0 742 // There are no system color settings for these, so set them manually
michael@0 743 if (aID == eColorID_TextSelectBackgroundDisabled) {
michael@0 744 // This is used to gray out the selection when it's not focused
michael@0 745 // Used with nsISelectionController::SELECTION_DISABLED
michael@0 746 aResult = NS_RGB(0xb0, 0xb0, 0xb0);
michael@0 747 return NS_OK;
michael@0 748 }
michael@0 749
michael@0 750 if (aID == eColorID_TextSelectBackgroundAttention) {
michael@0 751 // This makes the selection stand out when typeaheadfind is on
michael@0 752 // Used with nsISelectionController::SELECTION_ATTENTION
michael@0 753 aResult = NS_RGB(0x38, 0xd8, 0x78);
michael@0 754 return NS_OK;
michael@0 755 }
michael@0 756
michael@0 757 if (aID == eColorID_TextHighlightBackground) {
michael@0 758 // This makes the matched text stand out when findbar highlighting is on
michael@0 759 // Used with nsISelectionController::SELECTION_FIND
michael@0 760 aResult = NS_RGB(0xef, 0x0f, 0xff);
michael@0 761 return NS_OK;
michael@0 762 }
michael@0 763
michael@0 764 if (aID == eColorID_TextHighlightForeground) {
michael@0 765 // The foreground color for the matched text in findbar highlighting
michael@0 766 // Used with nsISelectionController::SELECTION_FIND
michael@0 767 aResult = NS_RGB(0xff, 0xff, 0xff);
michael@0 768 return NS_OK;
michael@0 769 }
michael@0 770
michael@0 771 if (sUseNativeColors && aUseStandinsForNativeColors)
michael@0 772 {
michael@0 773 aResult = GetStandinForNativeColor(aID);
michael@0 774 return NS_OK;
michael@0 775 }
michael@0 776
michael@0 777 if (sUseNativeColors && NS_SUCCEEDED(NativeGetColor(aID, aResult))) {
michael@0 778 if ((gfxPlatform::GetCMSMode() == eCMSMode_All) &&
michael@0 779 !IsSpecialColor(aID, aResult)) {
michael@0 780 qcms_transform *transform = gfxPlatform::GetCMSInverseRGBTransform();
michael@0 781 if (transform) {
michael@0 782 uint8_t color[3];
michael@0 783 color[0] = NS_GET_R(aResult);
michael@0 784 color[1] = NS_GET_G(aResult);
michael@0 785 color[2] = NS_GET_B(aResult);
michael@0 786 qcms_transform_data(transform, color, color, 1);
michael@0 787 aResult = NS_RGB(color[0], color[1], color[2]);
michael@0 788 }
michael@0 789 }
michael@0 790
michael@0 791 CACHE_COLOR(aID, aResult);
michael@0 792 return NS_OK;
michael@0 793 }
michael@0 794
michael@0 795 return NS_ERROR_NOT_AVAILABLE;
michael@0 796 }
michael@0 797
michael@0 798 nsresult
michael@0 799 nsXPLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
michael@0 800 {
michael@0 801 if (!sInitialized)
michael@0 802 Init();
michael@0 803
michael@0 804 // Set the default values for these prefs. but allow different platforms
michael@0 805 // to override them in their nsLookAndFeel if desired.
michael@0 806 switch (aID) {
michael@0 807 case eIntID_ScrollButtonLeftMouseButtonAction:
michael@0 808 aResult = 0;
michael@0 809 return NS_OK;
michael@0 810 case eIntID_ScrollButtonMiddleMouseButtonAction:
michael@0 811 aResult = 3;
michael@0 812 return NS_OK;
michael@0 813 case eIntID_ScrollButtonRightMouseButtonAction:
michael@0 814 aResult = 3;
michael@0 815 return NS_OK;
michael@0 816 default:
michael@0 817 /*
michael@0 818 * The metrics above are hardcoded platform defaults. All the other
michael@0 819 * metrics are stored in sIntPrefs and can be changed at runtime.
michael@0 820 */
michael@0 821 break;
michael@0 822 }
michael@0 823
michael@0 824 for (unsigned int i = 0; i < ArrayLength(sIntPrefs); ++i) {
michael@0 825 if (sIntPrefs[i].isSet && (sIntPrefs[i].id == aID)) {
michael@0 826 aResult = sIntPrefs[i].intVar;
michael@0 827 return NS_OK;
michael@0 828 }
michael@0 829 }
michael@0 830
michael@0 831 return NS_ERROR_NOT_AVAILABLE;
michael@0 832 }
michael@0 833
michael@0 834 nsresult
michael@0 835 nsXPLookAndFeel::GetFloatImpl(FloatID aID, float &aResult)
michael@0 836 {
michael@0 837 if (!sInitialized)
michael@0 838 Init();
michael@0 839
michael@0 840 for (unsigned int i = 0; i < ArrayLength(sFloatPrefs); ++i) {
michael@0 841 if (sFloatPrefs[i].isSet && sFloatPrefs[i].id == aID) {
michael@0 842 aResult = sFloatPrefs[i].floatVar;
michael@0 843 return NS_OK;
michael@0 844 }
michael@0 845 }
michael@0 846
michael@0 847 return NS_ERROR_NOT_AVAILABLE;
michael@0 848 }
michael@0 849
michael@0 850 void
michael@0 851 nsXPLookAndFeel::RefreshImpl()
michael@0 852 {
michael@0 853 // Wipe out our color cache.
michael@0 854 uint32_t i;
michael@0 855 for (i = 0; i < eColorID_LAST_COLOR; i++)
michael@0 856 sCachedColors[i] = 0;
michael@0 857 for (i = 0; i < COLOR_CACHE_SIZE; i++)
michael@0 858 sCachedColorBits[i] = 0;
michael@0 859 }
michael@0 860
michael@0 861 namespace mozilla {
michael@0 862
michael@0 863 // static
michael@0 864 nsresult
michael@0 865 LookAndFeel::GetColor(ColorID aID, nscolor* aResult)
michael@0 866 {
michael@0 867 return nsLookAndFeel::GetInstance()->GetColorImpl(aID, false, *aResult);
michael@0 868 }
michael@0 869
michael@0 870 nsresult
michael@0 871 LookAndFeel::GetColor(ColorID aID, bool aUseStandinsForNativeColors,
michael@0 872 nscolor* aResult)
michael@0 873 {
michael@0 874 return nsLookAndFeel::GetInstance()->GetColorImpl(aID,
michael@0 875 aUseStandinsForNativeColors, *aResult);
michael@0 876 }
michael@0 877
michael@0 878 // static
michael@0 879 nsresult
michael@0 880 LookAndFeel::GetColorForNativeAppearance(uint8_t aWidgetType, bool aIsDisabled,
michael@0 881 nscolor* aResult)
michael@0 882 {
michael@0 883 NS_ENSURE_ARG_POINTER(aResult);
michael@0 884
michael@0 885 ColorID colorID = eColorID_LAST_COLOR;
michael@0 886 switch (aWidgetType) {
michael@0 887 case NS_THEME_TEXTFIELD:
michael@0 888 case NS_THEME_TEXTFIELD_MULTILINE:
michael@0 889 case NS_THEME_LISTBOX:
michael@0 890 case NS_THEME_DROPDOWN:
michael@0 891 case NS_THEME_DROPDOWN_TEXTFIELD:
michael@0 892 case NS_THEME_TREEVIEW:
michael@0 893 colorID = (aIsDisabled) ? eColorID_graytext : eColorID__moz_fieldtext;
michael@0 894 break;
michael@0 895
michael@0 896 case NS_THEME_TOOLTIP:
michael@0 897 colorID = eColorID_infotext;
michael@0 898 break;
michael@0 899
michael@0 900 case NS_THEME_BUTTON:
michael@0 901 case NS_THEME_GROUPBOX:
michael@0 902 case NS_THEME_PROGRESSBAR:
michael@0 903 case NS_THEME_PROGRESSBAR_VERTICAL:
michael@0 904 case NS_THEME_TAB_PANEL:
michael@0 905 case NS_THEME_STATUSBAR:
michael@0 906 case NS_THEME_STATUSBAR_RESIZER_PANEL:
michael@0 907 colorID = (aIsDisabled) ? eColorID_graytext : eColorID_buttontext;
michael@0 908 break;
michael@0 909 }
michael@0 910
michael@0 911 if (LookAndFeel::eColorID_LAST_COLOR == colorID)
michael@0 912 return NS_ERROR_FAILURE;
michael@0 913
michael@0 914 *aResult = NS_RGB(0, 0, 0);
michael@0 915 return nsLookAndFeel::GetInstance()->NativeGetColor(colorID, *aResult);
michael@0 916 }
michael@0 917
michael@0 918 // static
michael@0 919 nsresult
michael@0 920 LookAndFeel::GetInt(IntID aID, int32_t* aResult)
michael@0 921 {
michael@0 922 return nsLookAndFeel::GetInstance()->GetIntImpl(aID, *aResult);
michael@0 923 }
michael@0 924
michael@0 925 // static
michael@0 926 nsresult
michael@0 927 LookAndFeel::GetFloat(FloatID aID, float* aResult)
michael@0 928 {
michael@0 929 return nsLookAndFeel::GetInstance()->GetFloatImpl(aID, *aResult);
michael@0 930 }
michael@0 931
michael@0 932 // static
michael@0 933 bool
michael@0 934 LookAndFeel::GetFont(FontID aID, nsString& aName, gfxFontStyle& aStyle,
michael@0 935 float aDevPixPerCSSPixel)
michael@0 936 {
michael@0 937 return nsLookAndFeel::GetInstance()->GetFontImpl(aID, aName, aStyle,
michael@0 938 aDevPixPerCSSPixel);
michael@0 939 }
michael@0 940
michael@0 941 // static
michael@0 942 char16_t
michael@0 943 LookAndFeel::GetPasswordCharacter()
michael@0 944 {
michael@0 945 return nsLookAndFeel::GetInstance()->GetPasswordCharacterImpl();
michael@0 946 }
michael@0 947
michael@0 948 // static
michael@0 949 bool
michael@0 950 LookAndFeel::GetEchoPassword()
michael@0 951 {
michael@0 952 return nsLookAndFeel::GetInstance()->GetEchoPasswordImpl();
michael@0 953 }
michael@0 954
michael@0 955 // static
michael@0 956 uint32_t
michael@0 957 LookAndFeel::GetPasswordMaskDelay()
michael@0 958 {
michael@0 959 return nsLookAndFeel::GetInstance()->GetPasswordMaskDelayImpl();
michael@0 960 }
michael@0 961
michael@0 962 // static
michael@0 963 void
michael@0 964 LookAndFeel::Refresh()
michael@0 965 {
michael@0 966 nsLookAndFeel::GetInstance()->RefreshImpl();
michael@0 967 }
michael@0 968
michael@0 969 } // namespace mozilla

mercurial