Bug 1717873 - Remove some things that don't change per document from PreferenceSheet. r=morgan

It's just needless indirection.

Depends on D120677

Differential Revision: https://phabricator.services.mozilla.com/D120678
This commit is contained in:
Emilio Cobos Álvarez 2021-07-24 21:10:43 +00:00
Родитель 9747c247ae
Коммит febd7c37d5
3 изменённых файлов: 6 добавлений и 16 удалений

Просмотреть файл

@ -14,6 +14,7 @@
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/Telemetry.h"
#include "mozilla/css/Loader.h"
#include "mozilla/StaticPrefs_browser.h"
#include "mozilla/dom/SRIMetadata.h"
#include "mozilla/ipc/SharedMemory.h"
#include "MainThreadUtils.h"
@ -589,16 +590,16 @@ void GlobalStyleSheetCache::BuildPreferenceSheet(
"@namespace svg url(http://www.w3.org/2000/svg);\n");
// Rules for link styling.
bool underlineLinks = aPrefs.mUnderlineLinks;
const bool underlineLinks = StaticPrefs::browser_underline_anchors();
sheetText.AppendPrintf("*|*:any-link%s { text-decoration: %s; }\n",
underlineLinks ? ":not(svg|a)" : "",
underlineLinks ? "underline" : "none");
// Rules for focus styling.
bool focusRingOnAnything = aPrefs.mFocusRingOnAnything;
uint8_t focusRingWidth = aPrefs.mFocusRingWidth;
uint8_t focusRingStyle = aPrefs.mFocusRingStyle;
const bool focusRingOnAnything = StaticPrefs::browser_display_focus_ring_on_anything();
uint8_t focusRingWidth = StaticPrefs::browser_display_focus_ring_width();
uint8_t focusRingStyle = StaticPrefs::browser_display_focus_ring_style();
if ((focusRingWidth != 1 && focusRingWidth <= 4) || focusRingOnAnything) {
if (focusRingWidth != 1) {
@ -626,7 +627,7 @@ void GlobalStyleSheetCache::BuildPreferenceSheet(
focusRingStyle == 0 ? "solid -moz-mac-focusring" : "dotted WindowText");
}
if (aPrefs.mUseFocusColors) {
if (StaticPrefs::browser_display_use_focus_colors()) {
nscolor focusText = aPrefs.mFocusTextColor;
nscolor focusBG = aPrefs.mFocusBackgroundColor;
sheetText.AppendPrintf(

Просмотреть файл

@ -82,12 +82,6 @@ void PreferenceSheet::Prefs::Load(bool aIsChrome) {
mIsChrome = aIsChrome;
mUseAccessibilityTheme = UseAccessibilityTheme(aIsChrome);
mUnderlineLinks = StaticPrefs::browser_underline_anchors();
mUseFocusColors = StaticPrefs::browser_display_use_focus_colors();
mFocusRingWidth = StaticPrefs::browser_display_focus_ring_width();
mFocusRingStyle = StaticPrefs::browser_display_focus_ring_style();
mFocusRingOnAnything = StaticPrefs::browser_display_focus_ring_on_anything();
const bool useStandins = nsContentUtils::UseStandinsForNativeColors();
const bool usePrefColors = !useStandins && !aIsChrome &&

Просмотреть файл

@ -34,12 +34,7 @@ struct PreferenceSheet {
bool mIsChrome = false;
bool mUseAccessibilityTheme = false;
bool mUnderlineLinks = true;
bool mUseFocusColors = false;
bool mUseDocumentColors = true;
uint8_t mFocusRingWidth = 1;
uint8_t mFocusRingStyle = 1;
bool mFocusRingOnAnything = false;
// Whether the non-native theme should use system colors for widgets.
// We only do that if we have a high-contrast theme _and_ we are overriding