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

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

Issue 567073004: Revert of 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: Created 6 years, 3 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 4ad5a4da3ccc53ad4e82320b44a0b147959e672a..163b47f5916ab1285c9c448f4a58e3a8436d8af4 100644
--- a/Source/core/css/CSSDefaultStyleSheets.cpp
+++ b/Source/core/css/CSSDefaultStyleSheets.cpp
@@ -30,6 +30,7 @@
#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"
@@ -37,7 +38,6 @@
#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 {
@@ -70,6 +70,11 @@
// and are intentionally leaked.
WTF_ANNOTATE_LEAKING_OBJECT_PTR(sheet.get());
return sheet.release();
+}
+
+static PassRefPtrWillBeRawPtr<StyleSheetContents> parseUASheet(const char* characters, unsigned size)
+{
+ return parseUASheet(String(characters, size));
}
CSSDefaultStyleSheets::CSSDefaultStyleSheets()
@@ -94,11 +99,11 @@
m_defaultQuirksStyle = RuleSet::create();
// Strict-mode rules.
- String defaultRules = loadResourceAsASCIIString("html.css") + RenderTheme::theme().extraDefaultStyleSheet();
+ String defaultRules = String(htmlCss, sizeof(htmlCss)) + RenderTheme::theme().extraDefaultStyleSheet();
m_defaultStyleSheet = parseUASheet(defaultRules);
m_defaultStyle->addRulesFromSheet(defaultStyleSheet(), screenEval());
#if OS(ANDROID)
- String viewportRules = loadResourceAsASCIIString("viewportAndroid.css");
+ String viewportRules(viewportAndroidCss, sizeof(viewportAndroidCss));
#else
String viewportRules;
#endif
@@ -107,7 +112,7 @@
m_defaultPrintStyle->addRulesFromSheet(defaultStyleSheet(), printEval());
// Quirks-mode rules.
- String quirksRules = loadResourceAsASCIIString("quirks.css") + RenderTheme::theme().extraQuirksStyleSheet();
+ String quirksRules = String(quirksCss, sizeof(quirksCss)) + RenderTheme::theme().extraQuirksStyleSheet();
m_quirksStyleSheet = parseUASheet(quirksRules);
m_defaultQuirksStyle->addRulesFromSheet(quirksStyleSheet(), screenEval());
}
@@ -117,7 +122,7 @@
if (!m_defaultViewSourceStyle) {
m_defaultViewSourceStyle = RuleSet::create();
// Loaded stylesheet is leaked on purpose.
- RefPtrWillBeRawPtr<StyleSheetContents> stylesheet = parseUASheet(loadResourceAsASCIIString("view-source.css"));
+ RefPtrWillBeRawPtr<StyleSheetContents> stylesheet = parseUASheet(viewSourceCss, sizeof(viewSourceCss));
m_defaultViewSourceStyle->addRulesFromSheet(stylesheet.release().leakRef(), screenEval());
}
return m_defaultViewSourceStyle.get();
@@ -128,7 +133,7 @@
if (!m_defaultTransitionStyle) {
m_defaultTransitionStyle = RuleSet::create();
// Loaded stylesheet is leaked on purpose.
- RefPtrWillBeRawPtr<StyleSheetContents> stylesheet = parseUASheet(loadResourceAsASCIIString("navigationTransitions.css"));
+ RefPtrWillBeRawPtr<StyleSheetContents> stylesheet = parseUASheet(navigationTransitionsCss, sizeof(navigationTransitionsCss));
m_defaultTransitionStyle->addRulesFromSheet(stylesheet.release().leakRef(), screenEval());
}
return m_defaultTransitionStyle.get();
@@ -139,7 +144,7 @@
if (!m_defaultXHTMLMobileProfileStyle) {
m_defaultXHTMLMobileProfileStyle = RuleSet::create();
// Loaded stylesheet is leaked on purpose.
- RefPtrWillBeRawPtr<StyleSheetContents> stylesheet = parseUASheet(loadResourceAsASCIIString("xhtmlmp.css"));
+ RefPtrWillBeRawPtr<StyleSheetContents> stylesheet = parseUASheet(xhtmlmpCss, sizeof(xhtmlmpCss));
m_defaultXHTMLMobileProfileStyle->addRulesFromSheet(stylesheet.release().leakRef(), screenEval());
}
return m_defaultXHTMLMobileProfileStyle.get();
@@ -149,7 +154,7 @@
{
// FIXME: We should assert that the sheet only styles SVG elements.
if (element->isSVGElement() && !m_svgStyleSheet) {
- m_svgStyleSheet = parseUASheet(loadResourceAsASCIIString("svg.css"));
+ m_svgStyleSheet = parseUASheet(svgCss, sizeof(svgCss));
m_defaultStyle->addRulesFromSheet(svgStyleSheet(), screenEval());
m_defaultPrintStyle->addRulesFromSheet(svgStyleSheet(), printEval());
changedDefaultStyle = true;
@@ -158,7 +163,7 @@
// FIXME: We should assert that the sheet only styles MathML elements.
if (element->namespaceURI() == MathMLNames::mathmlNamespaceURI
&& !m_mathmlStyleSheet) {
- m_mathmlStyleSheet = parseUASheet(loadResourceAsASCIIString("mathml.css"));
+ m_mathmlStyleSheet = parseUASheet(mathmlCss, sizeof(mathmlCss));
m_defaultStyle->addRulesFromSheet(mathmlStyleSheet(), screenEval());
m_defaultPrintStyle->addRulesFromSheet(mathmlStyleSheet(), printEval());
changedDefaultStyle = true;
@@ -166,7 +171,7 @@
// FIXME: We should assert that this sheet only contains rules for <video> and <audio>.
if (!m_mediaControlsStyleSheet && (isHTMLVideoElement(*element) || isHTMLAudioElement(*element))) {
- String mediaRules = loadResourceAsASCIIString("mediaControls.css") + RenderTheme::theme().extraMediaControlsStyleSheet();
+ String mediaRules = String(mediaControlsCss, sizeof(mediaControlsCss)) + RenderTheme::theme().extraMediaControlsStyleSheet();
m_mediaControlsStyleSheet = parseUASheet(mediaRules);
m_defaultStyle->addRulesFromSheet(mediaControlsStyleSheet(), screenEval());
m_defaultPrintStyle->addRulesFromSheet(mediaControlsStyleSheet(), printEval());
@@ -176,7 +181,7 @@
// 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 = loadResourceAsASCIIString("fullscreen.css") + RenderTheme::theme().extraFullScreenStyleSheet();
+ String fullscreenRules = String(fullscreenCss, sizeof(fullscreenCss)) + 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