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

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

Issue 1913833002: Current work-in-progress crbug.com/567021 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More assert fixes Created 4 years, 7 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 3d30b471961b3827f1c031edab3f0c40e6c73532..51dbf5f34a8f91915adfff8c5641d85314ec7456 100644
--- a/third_party/WebKit/Source/core/css/CSSDefaultStyleSheets.cpp
+++ b/third_party/WebKit/Source/core/css/CSSDefaultStyleSheets.cpp
@@ -72,21 +72,6 @@ static StyleSheetContents* parseUASheet(const String& str)
}
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)
{
m_defaultStyle = RuleSet::create();
m_defaultPrintStyle = RuleSet::create();
@@ -115,39 +100,31 @@ RuleSet* CSSDefaultStyleSheets::defaultViewSourceStyle()
return m_defaultViewSourceStyle.get();
}
-RuleSet* CSSDefaultStyleSheets::defaultXHTMLMobileProfileStyle()
+StyleSheetContents* CSSDefaultStyleSheets::ensureXHTMLMobileProfileStyleSheet()
{
- if (!m_defaultXHTMLMobileProfileStyle) {
- m_defaultXHTMLMobileProfileStyle = RuleSet::create();
- // Loaded stylesheet is leaked on purpose.
- StyleSheetContents* stylesheet = parseUASheet(loadResourceAsASCIIString("xhtmlmp.css"));
- m_defaultXHTMLMobileProfileStyle->addRulesFromSheet(stylesheet, screenEval());
- }
- return m_defaultXHTMLMobileProfileStyle.get();
+ if (!m_xhtmlMobileProfileStyleSheet)
+ m_xhtmlMobileProfileStyleSheet = parseUASheet(loadResourceAsASCIIString("xhtmlmp.css"));
+ return m_xhtmlMobileProfileStyleSheet.get();
}
-RuleSet* CSSDefaultStyleSheets::defaultMobileViewportStyle()
+StyleSheetContents* CSSDefaultStyleSheets::ensureMobileViewportStyleSheet()
{
- if (!m_defaultMobileViewportStyle) {
- m_defaultMobileViewportStyle = RuleSet::create();
+ 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()
+StyleSheetContents* CSSDefaultStyleSheets::ensureTelevisionViewportStyleSheet()
{
- if (!m_defaultTelevisionViewportStyle) {
- m_defaultTelevisionViewportStyle = RuleSet::create();
+ 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(const Element& element, bool& changedDefaultStyle)
+bool CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(const Element& element)
{
+ bool changedDefaultStyle = false;
+
// FIXME: We should assert that the sheet only styles SVG elements.
if (element.isSVGElement() && !m_svgStyleSheet) {
m_svgStyleSheet = parseUASheet(loadResourceAsASCIIString("svg.css"));
@@ -179,31 +156,32 @@ void CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(const Element& el
ASSERT(!m_defaultStyle->features().hasIdsInSelectors());
ASSERT(m_defaultStyle->features().siblingRules.isEmpty());
+
+ return changedDefaultStyle;
}
-void CSSDefaultStyleSheets::ensureDefaultStyleSheetForFullscreen()
+bool CSSDefaultStyleSheets::ensureDefaultStyleSheetForFullscreen()
{
if (m_fullscreenStyleSheet)
- return;
+ return false;
String fullscreenRules = loadResourceAsASCIIString("fullscreen.css") + LayoutTheme::theme().extraFullScreenStyleSheet();
m_fullscreenStyleSheet = parseUASheet(fullscreenRules);
m_defaultStyle->addRulesFromSheet(fullscreenStyleSheet(), screenEval());
m_defaultQuirksStyle->addRulesFromSheet(fullscreenStyleSheet(), screenEval());
+ return true;
}
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);
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSDefaultStyleSheets.h ('k') | third_party/WebKit/Source/core/css/CSSGlobalRuleSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698