Bug 1635702 [wpt PR 23413] - Move some internal scroll anchoring tests to wpt, a...
[gecko.git] / layout / style / PreferenceSheet.h
blob5ae16c50e4fe3de92417d82f1ddec00f33676346
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 /* Some prefable colors for style system use */
9 #ifndef mozilla_ColorPreferences_h
10 #define mozilla_ColorPreferences_h
12 #include "nsColor.h"
14 namespace mozilla {
16 namespace dom {
17 class Document;
20 struct PreferenceSheet {
21 struct Prefs {
22 nscolor mLinkColor = NS_RGB(0x00, 0x00, 0xEE);
23 nscolor mActiveLinkColor = NS_RGB(0xEE, 0x00, 0x00);
24 nscolor mVisitedLinkColor = NS_RGB(0x55, 0x1A, 0x8B);
26 nscolor mDefaultColor = NS_RGB(0, 0, 0);
27 nscolor mDefaultBackgroundColor = NS_RGB(0xFF, 0xFF, 0xFF);
29 nscolor mLinkBackgroundColor = mDefaultBackgroundColor;
31 nscolor mFocusTextColor = mDefaultColor;
32 nscolor mFocusBackgroundColor = mDefaultBackgroundColor;
34 bool mIsChrome = false;
35 bool mUseAccessibilityTheme = false;
37 bool mUnderlineLinks = true;
38 bool mUseFocusColors = false;
39 bool mUseDocumentColors = true;
40 uint8_t mFocusRingWidth = 1;
41 uint8_t mFocusRingStyle = 1;
42 bool mFocusRingOnAnything = false;
44 void Load(bool aIsChrome);
47 static void EnsureInitialized() {
48 if (sInitialized) {
49 return;
51 Initialize();
54 static void Refresh() {
55 sInitialized = false;
56 EnsureInitialized();
59 static Prefs& ContentPrefs() {
60 MOZ_ASSERT(sInitialized);
61 return sContentPrefs;
64 static Prefs& ChromePrefs() {
65 MOZ_ASSERT(sInitialized);
66 return sChromePrefs;
69 static bool ShouldUseChromePrefs(const dom::Document&);
70 static const Prefs& PrefsFor(const dom::Document& aDocument) {
71 return ShouldUseChromePrefs(aDocument) ? ChromePrefs() : ContentPrefs();
74 private:
75 static bool sInitialized;
76 static Prefs sContentPrefs;
77 static Prefs sChromePrefs;
79 static void Initialize();
82 } // namespace mozilla
84 #endif