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..7c3d17c728997a443c63cf4af061c97fb8f28598 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(); |
@@ -118,38 +103,27 @@ RuleSet* CSSDefaultStyleSheets::defaultViewSourceStyle() { |
return m_defaultViewSourceStyle.get(); |
} |
-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.get(); |
} |
-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.get(); |
} |
-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.get(); |
} |
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); |