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

Unified Diff: third_party/WebKit/Source/core/dom/StyleEngine.cpp

Issue 2879223002: Don't try to set the empty string as the preferred set. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/StyleEngineTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/StyleEngine.cpp
diff --git a/third_party/WebKit/Source/core/dom/StyleEngine.cpp b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
index 0634c6ef6687e915f7a688860400b3aca78550f3..f17d6d79966c5440359b8c9b4767ed96013f016c 100644
--- a/third_party/WebKit/Source/core/dom/StyleEngine.cpp
+++ b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
@@ -560,8 +560,11 @@ CSSStyleSheet* StyleEngine::CreateSheet(Element& element,
DCHECK(style_sheet);
if (!element.IsInShadowTree()) {
- style_sheet->SetTitle(element.title());
- SetPreferredStylesheetSetNameIfNotSet(element.title());
+ String title = element.title();
+ if (!title.IsEmpty()) {
+ style_sheet->SetTitle(title);
+ SetPreferredStylesheetSetNameIfNotSet(title);
+ }
}
return style_sheet;
}
@@ -924,6 +927,7 @@ void StyleEngine::SetStatsEnabled(bool enabled) {
}
void StyleEngine::SetPreferredStylesheetSetNameIfNotSet(const String& name) {
+ DCHECK(!name.IsEmpty());
if (!preferred_stylesheet_set_name_.IsEmpty())
return;
preferred_stylesheet_set_name_ = name;
@@ -946,7 +950,8 @@ void StyleEngine::SetSelectedStylesheetSetName(const String& name) {
}
void StyleEngine::SetHttpDefaultStyle(const String& content) {
- SetPreferredStylesheetSetNameIfNotSet(content);
+ if (!content.IsEmpty())
+ SetPreferredStylesheetSetNameIfNotSet(content);
}
void StyleEngine::EnsureUAStyleForFullscreen() {
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/StyleEngineTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698