From 8106cebcf9835768c0487c9f81be667a87e0f2ba Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Fri, 11 Jan 2019 03:12:05 +0000 Subject: [PATCH] Bug 1519001 - Rename some style sheet accessors on nsLayoutStylesheetCache to indicate they can return null r=xidorn Differential Revision: https://phabricator.services.mozilla.com/D16150 --HG-- extra : moz-landing-system : lando --- dom/ipc/ContentParent.cpp | 2 +- layout/base/nsDocumentViewer.cpp | 9 +++------ layout/style/nsLayoutStylesheetCache.cpp | 4 ++-- layout/style/nsLayoutStylesheetCache.h | 4 ++-- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 124069c268c1..1aba5618662e 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -2497,7 +2497,7 @@ void ContentParent::InitInternal(ProcessPriority aInitialPriority) { // Content processes have no permission to access profile directory, so we // send the file URL instead. - StyleSheet* ucs = nsLayoutStylesheetCache::Singleton()->UserContentSheet(); + StyleSheet* ucs = nsLayoutStylesheetCache::Singleton()->GetUserContentSheet(); if (ucs) { SerializeURI(ucs->GetSheetURI(), xpcomInit.userContentSheetURL()); } else { diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index e3158c553bfa..61e83ce0630d 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -2299,12 +2299,9 @@ UniquePtr nsDocumentViewer::CreateStyleSet(Document* aDocument) { auto cache = nsLayoutStylesheetCache::Singleton(); // Handle the user sheets. - StyleSheet* sheet = nullptr; - if (nsContentUtils::IsInChromeDocshell(aDocument)) { - sheet = cache->UserChromeSheet(); - } else { - sheet = cache->UserContentSheet(); - } + StyleSheet* sheet = nsContentUtils::IsInChromeDocshell(aDocument) + ? cache->GetUserChromeSheet() + : cache->GetUserContentSheet(); if (sheet) { styleSet->AppendStyleSheet(SheetType::User, sheet); diff --git a/layout/style/nsLayoutStylesheetCache.cpp b/layout/style/nsLayoutStylesheetCache.cpp index f705743db328..0fdbc1bf049d 100644 --- a/layout/style/nsLayoutStylesheetCache.cpp +++ b/layout/style/nsLayoutStylesheetCache.cpp @@ -59,11 +59,11 @@ nsresult nsLayoutStylesheetCache::Observe(nsISupports* aSubject, #include "mozilla/UserAgentStyleSheetList.h" #undef STYLE_SHEET -StyleSheet* nsLayoutStylesheetCache::UserContentSheet() { +StyleSheet* nsLayoutStylesheetCache::GetUserContentSheet() { return mUserContentSheet; } -StyleSheet* nsLayoutStylesheetCache::UserChromeSheet() { +StyleSheet* nsLayoutStylesheetCache::GetUserChromeSheet() { return mUserChromeSheet; } diff --git a/layout/style/nsLayoutStylesheetCache.h b/layout/style/nsLayoutStylesheetCache.h index 4a301e44960b..4855a75207a2 100644 --- a/layout/style/nsLayoutStylesheetCache.h +++ b/layout/style/nsLayoutStylesheetCache.h @@ -43,8 +43,8 @@ class nsLayoutStylesheetCache final : public nsIObserver, #include "mozilla/UserAgentStyleSheetList.h" #undef STYLE_SHEET - mozilla::StyleSheet* UserContentSheet(); - mozilla::StyleSheet* UserChromeSheet(); + mozilla::StyleSheet* GetUserContentSheet(); + mozilla::StyleSheet* GetUserChromeSheet(); mozilla::StyleSheet* ChromePreferenceSheet(nsPresContext* aPresContext); mozilla::StyleSheet* ContentPreferenceSheet(nsPresContext* aPresContext);