Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1128)

Unified Diff: third_party/WebKit/Source/core/css/CSSDefaultStyleSheets.cpp

Issue 2410283005: Don't generate RuleSets for viewport UA sheets. (Closed)
Patch Set: Rebased Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/CSSDefaultStyleSheets.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSDefaultStyleSheets.cpp b/third_party/WebKit/Source/core/css/CSSDefaultStyleSheets.cpp
index 5283cbe51a31730635218269a6b172fc3f90209c..eaa330f1d687f37aaef134910de844c21f587dc9 100644
--- a/third_party/WebKit/Source/core/css/CSSDefaultStyleSheets.cpp
+++ b/third_party/WebKit/Source/core/css/CSSDefaultStyleSheets.cpp
@@ -73,22 +73,7 @@ static StyleSheetContents* parseUASheet(const String& str) {
return sheet;
}
-CSSDefaultStyleSheets::CSSDefaultStyleSheets()
- : m_defaultStyle(nullptr),
- m_defaultMobileViewportStyle(nullptr),
- m_defaultTelevisionViewportStyle(nullptr),
- m_defaultQuirksStyle(nullptr),
- m_defaultPrintStyle(nullptr),
- m_defaultViewSourceStyle(nullptr),
- m_defaultXHTMLMobileProfileStyle(nullptr),
- m_defaultStyleSheet(nullptr),
- m_mobileViewportStyleSheet(nullptr),
- m_televisionViewportStyleSheet(nullptr),
- m_quirksStyleSheet(nullptr),
- m_svgStyleSheet(nullptr),
- m_mathmlStyleSheet(nullptr),
- m_mediaControlsStyleSheet(nullptr),
- m_fullscreenStyleSheet(nullptr) {
+CSSDefaultStyleSheets::CSSDefaultStyleSheets() {
m_defaultStyle = RuleSet::create();
m_defaultPrintStyle = RuleSet::create();
m_defaultQuirksStyle = RuleSet::create();
@@ -115,41 +100,30 @@ RuleSet* CSSDefaultStyleSheets::defaultViewSourceStyle() {
parseUASheet(loadResourceAsASCIIString("view-source.css"));
m_defaultViewSourceStyle->addRulesFromSheet(stylesheet, screenEval());
}
- return m_defaultViewSourceStyle.get();
+ return m_defaultViewSourceStyle;
}
-RuleSet* CSSDefaultStyleSheets::defaultXHTMLMobileProfileStyle() {
- if (!m_defaultXHTMLMobileProfileStyle) {
- m_defaultXHTMLMobileProfileStyle = RuleSet::create();
- // Loaded stylesheet is leaked on purpose.
- StyleSheetContents* stylesheet =
+StyleSheetContents*
+CSSDefaultStyleSheets::ensureXHTMLMobileProfileStyleSheet() {
+ if (!m_xhtmlMobileProfileStyleSheet)
+ m_xhtmlMobileProfileStyleSheet =
parseUASheet(loadResourceAsASCIIString("xhtmlmp.css"));
- m_defaultXHTMLMobileProfileStyle->addRulesFromSheet(stylesheet,
- screenEval());
- }
- return m_defaultXHTMLMobileProfileStyle.get();
+ return m_xhtmlMobileProfileStyleSheet;
}
-RuleSet* CSSDefaultStyleSheets::defaultMobileViewportStyle() {
- if (!m_defaultMobileViewportStyle) {
- m_defaultMobileViewportStyle = RuleSet::create();
+StyleSheetContents* CSSDefaultStyleSheets::ensureMobileViewportStyleSheet() {
+ if (!m_mobileViewportStyleSheet)
m_mobileViewportStyleSheet =
parseUASheet(loadResourceAsASCIIString("viewportAndroid.css"));
- m_defaultMobileViewportStyle->addRulesFromSheet(
- m_mobileViewportStyleSheet.get(), screenEval());
- }
- return m_defaultMobileViewportStyle.get();
+ return m_mobileViewportStyleSheet;
}
-RuleSet* CSSDefaultStyleSheets::defaultTelevisionViewportStyle() {
- if (!m_defaultTelevisionViewportStyle) {
- m_defaultTelevisionViewportStyle = RuleSet::create();
+StyleSheetContents*
+CSSDefaultStyleSheets::ensureTelevisionViewportStyleSheet() {
+ if (!m_televisionViewportStyleSheet)
m_televisionViewportStyleSheet =
parseUASheet(loadResourceAsASCIIString("viewportTelevision.css"));
- m_defaultTelevisionViewportStyle->addRulesFromSheet(
- m_televisionViewportStyleSheet.get(), screenEval());
- }
- return m_defaultTelevisionViewportStyle.get();
+ return m_televisionViewportStyleSheet;
}
void CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(
@@ -205,15 +179,13 @@ void CSSDefaultStyleSheets::ensureDefaultStyleSheetForFullscreen() {
DEFINE_TRACE(CSSDefaultStyleSheets) {
visitor->trace(m_defaultStyle);
- visitor->trace(m_defaultMobileViewportStyle);
- visitor->trace(m_defaultTelevisionViewportStyle);
visitor->trace(m_defaultQuirksStyle);
visitor->trace(m_defaultPrintStyle);
visitor->trace(m_defaultViewSourceStyle);
- visitor->trace(m_defaultXHTMLMobileProfileStyle);
visitor->trace(m_defaultStyleSheet);
visitor->trace(m_mobileViewportStyleSheet);
visitor->trace(m_televisionViewportStyleSheet);
+ visitor->trace(m_xhtmlMobileProfileStyleSheet);
visitor->trace(m_quirksStyleSheet);
visitor->trace(m_svgStyleSheet);
visitor->trace(m_mathmlStyleSheet);

Powered by Google App Engine
This is Rietveld 408576698