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

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

Issue 849163003: Reland: Move the user agent styles sheets to blink_resources.grd (Part 3) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 11 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/core_generated.gyp ('k') | Source/core/inspector/InspectorPageAgent.cpp » ('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 163b47f5916ab1285c9c448f4a58e3a8436d8af4..4ad5a4da3ccc53ad4e82320b44a0b147959e672a 100644
--- a/Source/core/css/CSSDefaultStyleSheets.cpp
+++ b/Source/core/css/CSSDefaultStyleSheets.cpp
@@ -30,7 +30,6 @@
#include "core/css/CSSDefaultStyleSheets.h"
#include "core/MathMLNames.h"
-#include "core/UserAgentStyleSheets.h"
#include "core/css/MediaQueryEvaluator.h"
#include "core/css/RuleSet.h"
#include "core/css/StyleSheetContents.h"
@@ -38,6 +37,7 @@
#include "core/html/HTMLAnchorElement.h"
#include "core/html/HTMLHtmlElement.h"
#include "core/rendering/RenderTheme.h"
+#include "platform/PlatformResourceLoader.h"
#include "wtf/LeakAnnotations.h"
namespace blink {
@@ -72,11 +72,6 @@ static PassRefPtrWillBeRawPtr<StyleSheetContents> parseUASheet(const String& str
return sheet.release();
}
-static PassRefPtrWillBeRawPtr<StyleSheetContents> parseUASheet(const char* characters, unsigned size)
-{
- return parseUASheet(String(characters, size));
-}
-
CSSDefaultStyleSheets::CSSDefaultStyleSheets()
: m_defaultStyle(nullptr)
, m_defaultViewportStyle(nullptr)
@@ -99,11 +94,11 @@ CSSDefaultStyleSheets::CSSDefaultStyleSheets()
m_defaultQuirksStyle = RuleSet::create();
// Strict-mode rules.
- String defaultRules = String(htmlCss, sizeof(htmlCss)) + RenderTheme::theme().extraDefaultStyleSheet();
+ String defaultRules = loadResourceAsASCIIString("html.css") + RenderTheme::theme().extraDefaultStyleSheet();
m_defaultStyleSheet = parseUASheet(defaultRules);
m_defaultStyle->addRulesFromSheet(defaultStyleSheet(), screenEval());
#if OS(ANDROID)
- String viewportRules(viewportAndroidCss, sizeof(viewportAndroidCss));
+ String viewportRules = loadResourceAsASCIIString("viewportAndroid.css");
#else
String viewportRules;
#endif
@@ -112,7 +107,7 @@ CSSDefaultStyleSheets::CSSDefaultStyleSheets()
m_defaultPrintStyle->addRulesFromSheet(defaultStyleSheet(), printEval());
// Quirks-mode rules.
- String quirksRules = String(quirksCss, sizeof(quirksCss)) + RenderTheme::theme().extraQuirksStyleSheet();
+ String quirksRules = loadResourceAsASCIIString("quirks.css") + RenderTheme::theme().extraQuirksStyleSheet();
m_quirksStyleSheet = parseUASheet(quirksRules);
m_defaultQuirksStyle->addRulesFromSheet(quirksStyleSheet(), screenEval());
}
@@ -122,7 +117,7 @@ RuleSet* CSSDefaultStyleSheets::defaultViewSourceStyle()
if (!m_defaultViewSourceStyle) {
m_defaultViewSourceStyle = RuleSet::create();
// Loaded stylesheet is leaked on purpose.
- RefPtrWillBeRawPtr<StyleSheetContents> stylesheet = parseUASheet(viewSourceCss, sizeof(viewSourceCss));
+ RefPtrWillBeRawPtr<StyleSheetContents> stylesheet = parseUASheet(loadResourceAsASCIIString("view-source.css"));
m_defaultViewSourceStyle->addRulesFromSheet(stylesheet.release().leakRef(), screenEval());
}
return m_defaultViewSourceStyle.get();
@@ -133,7 +128,7 @@ RuleSet* CSSDefaultStyleSheets::defaultTransitionStyle()
if (!m_defaultTransitionStyle) {
m_defaultTransitionStyle = RuleSet::create();
// Loaded stylesheet is leaked on purpose.
- RefPtrWillBeRawPtr<StyleSheetContents> stylesheet = parseUASheet(navigationTransitionsCss, sizeof(navigationTransitionsCss));
+ RefPtrWillBeRawPtr<StyleSheetContents> stylesheet = parseUASheet(loadResourceAsASCIIString("navigationTransitions.css"));
m_defaultTransitionStyle->addRulesFromSheet(stylesheet.release().leakRef(), screenEval());
}
return m_defaultTransitionStyle.get();
@@ -144,7 +139,7 @@ RuleSet* CSSDefaultStyleSheets::defaultXHTMLMobileProfileStyle()
if (!m_defaultXHTMLMobileProfileStyle) {
m_defaultXHTMLMobileProfileStyle = RuleSet::create();
// Loaded stylesheet is leaked on purpose.
- RefPtrWillBeRawPtr<StyleSheetContents> stylesheet = parseUASheet(xhtmlmpCss, sizeof(xhtmlmpCss));
+ RefPtrWillBeRawPtr<StyleSheetContents> stylesheet = parseUASheet(loadResourceAsASCIIString("xhtmlmp.css"));
m_defaultXHTMLMobileProfileStyle->addRulesFromSheet(stylesheet.release().leakRef(), screenEval());
}
return m_defaultXHTMLMobileProfileStyle.get();
@@ -154,7 +149,7 @@ void CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(Element* element,
{
// FIXME: We should assert that the sheet only styles SVG elements.
if (element->isSVGElement() && !m_svgStyleSheet) {
- m_svgStyleSheet = parseUASheet(svgCss, sizeof(svgCss));
+ m_svgStyleSheet = parseUASheet(loadResourceAsASCIIString("svg.css"));
m_defaultStyle->addRulesFromSheet(svgStyleSheet(), screenEval());
m_defaultPrintStyle->addRulesFromSheet(svgStyleSheet(), printEval());
changedDefaultStyle = true;
@@ -163,7 +158,7 @@ void CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(Element* element,
// FIXME: We should assert that the sheet only styles MathML elements.
if (element->namespaceURI() == MathMLNames::mathmlNamespaceURI
&& !m_mathmlStyleSheet) {
- m_mathmlStyleSheet = parseUASheet(mathmlCss, sizeof(mathmlCss));
+ m_mathmlStyleSheet = parseUASheet(loadResourceAsASCIIString("mathml.css"));
m_defaultStyle->addRulesFromSheet(mathmlStyleSheet(), screenEval());
m_defaultPrintStyle->addRulesFromSheet(mathmlStyleSheet(), printEval());
changedDefaultStyle = true;
@@ -171,7 +166,7 @@ void CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(Element* element,
// FIXME: We should assert that this sheet only contains rules for <video> and <audio>.
if (!m_mediaControlsStyleSheet && (isHTMLVideoElement(*element) || isHTMLAudioElement(*element))) {
- String mediaRules = String(mediaControlsCss, sizeof(mediaControlsCss)) + RenderTheme::theme().extraMediaControlsStyleSheet();
+ String mediaRules = loadResourceAsASCIIString("mediaControls.css") + RenderTheme::theme().extraMediaControlsStyleSheet();
m_mediaControlsStyleSheet = parseUASheet(mediaRules);
m_defaultStyle->addRulesFromSheet(mediaControlsStyleSheet(), screenEval());
m_defaultPrintStyle->addRulesFromSheet(mediaControlsStyleSheet(), printEval());
@@ -181,7 +176,7 @@ void CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(Element* element,
// FIXME: This only works because we Force recalc the entire document so the new sheet
// is loaded for <html> and the correct styles apply to everyone.
if (!m_fullscreenStyleSheet && Fullscreen::isFullScreen(element->document())) {
- String fullscreenRules = String(fullscreenCss, sizeof(fullscreenCss)) + RenderTheme::theme().extraFullScreenStyleSheet();
+ String fullscreenRules = loadResourceAsASCIIString("fullscreen.css") + RenderTheme::theme().extraFullScreenStyleSheet();
m_fullscreenStyleSheet = parseUASheet(fullscreenRules);
m_defaultStyle->addRulesFromSheet(fullscreenStyleSheet(), screenEval());
m_defaultQuirksStyle->addRulesFromSheet(fullscreenStyleSheet(), screenEval());
« no previous file with comments | « Source/core/core_generated.gyp ('k') | Source/core/inspector/InspectorPageAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698