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

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

Issue 979033003: Move code from StyleResolver to ViewportStyleResolver. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 5 years, 9 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
« no previous file with comments | « Source/core/css/CSSDefaultStyleSheets.h ('k') | Source/core/css/resolver/ScopedStyleResolver.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSDefaultStyleSheets.cpp
diff --git a/Source/core/css/CSSDefaultStyleSheets.cpp b/Source/core/css/CSSDefaultStyleSheets.cpp
index 03883ec00d0f8cbeb918ff3d77191949bb60a228..0d5374811a0d8944ed5cad55b054db3b1d20ed3d 100644
--- a/Source/core/css/CSSDefaultStyleSheets.cpp
+++ b/Source/core/css/CSSDefaultStyleSheets.cpp
@@ -74,14 +74,14 @@ static PassRefPtrWillBeRawPtr<StyleSheetContents> parseUASheet(const String& str
CSSDefaultStyleSheets::CSSDefaultStyleSheets()
: m_defaultStyle(nullptr)
- , m_defaultViewportStyle(nullptr)
+ , m_defaultMobileViewportStyle(nullptr)
, m_defaultQuirksStyle(nullptr)
, m_defaultPrintStyle(nullptr)
, m_defaultViewSourceStyle(nullptr)
, m_defaultXHTMLMobileProfileStyle(nullptr)
, m_defaultTransitionStyle(nullptr)
, m_defaultStyleSheet(nullptr)
- , m_viewportStyleSheet(nullptr)
+ , m_mobileViewportStyleSheet(nullptr)
, m_quirksStyleSheet(nullptr)
, m_svgStyleSheet(nullptr)
, m_mathmlStyleSheet(nullptr)
@@ -89,7 +89,6 @@ CSSDefaultStyleSheets::CSSDefaultStyleSheets()
, m_fullscreenStyleSheet(nullptr)
{
m_defaultStyle = RuleSet::create();
- m_defaultViewportStyle = RuleSet::create();
m_defaultPrintStyle = RuleSet::create();
m_defaultQuirksStyle = RuleSet::create();
@@ -97,13 +96,6 @@ CSSDefaultStyleSheets::CSSDefaultStyleSheets()
String defaultRules = loadResourceAsASCIIString("html.css") + LayoutTheme::theme().extraDefaultStyleSheet();
m_defaultStyleSheet = parseUASheet(defaultRules);
m_defaultStyle->addRulesFromSheet(defaultStyleSheet(), screenEval());
-#if OS(ANDROID)
- String viewportRules = loadResourceAsASCIIString("viewportAndroid.css");
-#else
- String viewportRules;
-#endif
- m_viewportStyleSheet = parseUASheet(viewportRules);
- m_defaultViewportStyle->addRulesFromSheet(viewportStyleSheet(), screenEval());
m_defaultPrintStyle->addRulesFromSheet(defaultStyleSheet(), printEval());
// Quirks-mode rules.
@@ -145,6 +137,16 @@ RuleSet* CSSDefaultStyleSheets::defaultXHTMLMobileProfileStyle()
return m_defaultXHTMLMobileProfileStyle.get();
}
+RuleSet* CSSDefaultStyleSheets::defaultMobileViewportStyle()
+{
+ if (!m_defaultMobileViewportStyle) {
+ m_defaultMobileViewportStyle = RuleSet::create();
+ m_mobileViewportStyleSheet = parseUASheet(loadResourceAsASCIIString("viewportAndroid.css"));
+ m_defaultMobileViewportStyle->addRulesFromSheet(m_mobileViewportStyleSheet.get(), screenEval());
+ }
+ return m_defaultMobileViewportStyle.get();
+}
+
void CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(Element* element, bool& changedDefaultStyle)
{
// FIXME: We should assert that the sheet only styles SVG elements.
@@ -190,14 +192,13 @@ void CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(Element* element,
DEFINE_TRACE(CSSDefaultStyleSheets)
{
visitor->trace(m_defaultStyle);
- visitor->trace(m_defaultViewportStyle);
+ visitor->trace(m_defaultMobileViewportStyle);
visitor->trace(m_defaultQuirksStyle);
visitor->trace(m_defaultPrintStyle);
visitor->trace(m_defaultViewSourceStyle);
visitor->trace(m_defaultXHTMLMobileProfileStyle);
visitor->trace(m_defaultTransitionStyle);
visitor->trace(m_defaultStyleSheet);
- visitor->trace(m_viewportStyleSheet);
visitor->trace(m_quirksStyleSheet);
visitor->trace(m_svgStyleSheet);
visitor->trace(m_mathmlStyleSheet);
« no previous file with comments | « Source/core/css/CSSDefaultStyleSheets.h ('k') | Source/core/css/resolver/ScopedStyleResolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698