Bug 1857915 - Remove about:PreferenceStyleSheet. r=morgan,devtools-reviewers,nchevobbe
These days, after bug 1853323, about:PreferenceStyleSheet is basically just an empty sheet for most users. For the ones that isn't, it's either slightly or completely broken (see below). If we were to implement this today, we'd do it with privileged env() variables or media queries, and add a bunch of tests for different combinations, but I don't think it's worth the effort: * There's no UI for any of these prefs. * There are no tests for any of these prefs. * browser.display.focus_ring_or_anything is not great, it's better replaced by browser.display.show_focus_rings, which actually makes the :focus-visible pseudo-class work. Otherwise the native controls may show no rings even though this pref is set. * for browser.display.focus_ring_style = 0, the color used (-moz-mac-focusring) is not implemented in any non-macOS platform. * The ::-moz-focus-inner rules are completely useless nowadays, because ::-moz-focus-inner only works on the windows native theme (which isn't used on content). * The focus colors are not color-scheme aware. So given those, and that if you want the specific current behavior, these are trivially implementable as a web extension (by using a user stylesheet), I think we should just remove this code altogether. Differential Revision: https://phabricator.services.mozilla.com/D190464
This commit is contained in:
@@ -897,9 +897,6 @@ void PresShell::Init(nsPresContext* aPresContext, nsViewManager* aViewManager) {
|
||||
// needed otherwise.
|
||||
EnsureStyleFlush();
|
||||
|
||||
// Add the preference style sheet.
|
||||
UpdatePreferenceStyles();
|
||||
|
||||
const bool accessibleCaretEnabled =
|
||||
AccessibleCaretEnabled(mDocument->GetDocShell());
|
||||
if (accessibleCaretEnabled) {
|
||||
@@ -1268,11 +1265,6 @@ void PresShell::Destroy() {
|
||||
frameSelection->DisconnectFromPresShell();
|
||||
}
|
||||
|
||||
// release our pref style sheet, if we have one still
|
||||
//
|
||||
// TODO(emilio): Should we move the preference sheet tracking to the Document?
|
||||
RemovePreferenceStyles();
|
||||
|
||||
mIsDestroying = true;
|
||||
|
||||
// We can't release all the event content in
|
||||
@@ -1421,53 +1413,6 @@ bool PresShell::GetAuthorStyleDisabled() const {
|
||||
return StyleSet()->GetAuthorStyleDisabled();
|
||||
}
|
||||
|
||||
void PresShell::UpdatePreferenceStyles() {
|
||||
if (!mDocument) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the document doesn't have a window there's no need to notify
|
||||
// its presshell about changes to preferences since the document is
|
||||
// in a state where it doesn't matter any more (see
|
||||
// nsDocumentViewer::Close()).
|
||||
if (!mDocument->GetWindow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Documents in chrome shells do not have any preference style rules applied.
|
||||
if (mDocument->IsInChromeDocShell()) {
|
||||
return;
|
||||
}
|
||||
|
||||
PreferenceSheet::EnsureInitialized();
|
||||
auto* cache = GlobalStyleSheetCache::Singleton();
|
||||
|
||||
RefPtr<StyleSheet> newPrefSheet =
|
||||
PreferenceSheet::ShouldUseChromePrefs(*mDocument)
|
||||
? cache->ChromePreferenceSheet()
|
||||
: cache->ContentPreferenceSheet();
|
||||
|
||||
if (mPrefStyleSheet == newPrefSheet) {
|
||||
return;
|
||||
}
|
||||
|
||||
RemovePreferenceStyles();
|
||||
|
||||
// NOTE(emilio): This sheet is added as an agent sheet, because we don't want
|
||||
// it to be modifiable from devtools and similar, see bugs 1239336 and
|
||||
// 1436782. I think it conceptually should be a user sheet, and could be
|
||||
// without too much trouble I'd think.
|
||||
StyleSet()->AppendStyleSheet(*newPrefSheet);
|
||||
mPrefStyleSheet = newPrefSheet;
|
||||
}
|
||||
|
||||
void PresShell::RemovePreferenceStyles() {
|
||||
if (mPrefStyleSheet) {
|
||||
StyleSet()->RemoveStyleSheet(*mPrefStyleSheet);
|
||||
mPrefStyleSheet = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void PresShell::AddUserSheet(StyleSheet* aSheet) {
|
||||
// Make sure this does what nsDocumentViewer::CreateStyleSet does wrt
|
||||
// ordering. We want this new sheet to come after all the existing stylesheet
|
||||
@@ -4293,9 +4238,6 @@ void PresShell::DoFlushPendingNotifications(mozilla::ChangesToFlush aFlush) {
|
||||
|
||||
mDocument->UpdateSVGUseElementShadowTrees();
|
||||
|
||||
// Ensure our preference sheets are up-to-date.
|
||||
UpdatePreferenceStyles();
|
||||
|
||||
// Process pending restyles, since any flush of the presshell wants
|
||||
// up-to-date style data.
|
||||
if (MOZ_LIKELY(!mIsDestroying)) {
|
||||
|
||||
Reference in New Issue
Block a user