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

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

Issue 2337193004: Setting the link title may change the preferred set. (Closed)
Patch Set: Rebased Created 4 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
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 6df1e57efa8b2eac01cd9512213de33ca81bca70..400f7c736f0e7b3488fe1b1dc2f8f5c9fd5ee3d1 100644
--- a/third_party/WebKit/Source/core/dom/StyleEngine.cpp
+++ b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
@@ -533,7 +533,7 @@ CSSStyleSheet* StyleEngine::createSheet(Element* e, const String& text, TextPosi
DCHECK(styleSheet);
if (!e->isInShadowTree()) {
styleSheet->setTitle(e->title());
- setPreferredStylesheetSetNameIfNotSet(e->title());
+ setPreferredStylesheetSetNameIfNotSet(e->title(), DontUpdateActiveSheets);
}
return styleSheet;
}
@@ -761,7 +761,7 @@ void StyleEngine::setStatsEnabled(bool enabled)
m_styleResolverStats->reset();
}
-void StyleEngine::setPreferredStylesheetSetNameIfNotSet(const String& name)
+void StyleEngine::setPreferredStylesheetSetNameIfNotSet(const String& name, ActiveSheetsUpdate activeSheetsUpdate)
{
if (!m_preferredStylesheetSetName.isEmpty())
return;
@@ -770,10 +770,16 @@ void StyleEngine::setPreferredStylesheetSetNameIfNotSet(const String& name)
// has been previously set by through Document.selectedStylesheetSet. Our
// current implementation ignores the effect of Document.selectedStylesheetSet
// and either only collects persistent style, or additionally preferred
- // style when present. We are currently not marking the document scope dirty
- // because preferred style is updated during active stylesheet update which
- // would make this method re-entrant. Will need to change for async update.
+ // style when present.
m_selectedStylesheetSetName = name;
+
+ // TODO(rune@opera.com): For async stylesheet update, we should always mark
+ // the TreeScope dirty here, and the synchronous active stylesheet update
+ // (resolverChanged) should go away.
+ if (activeSheetsUpdate == UpdateActiveSheets) {
+ markDocumentDirty();
+ resolverChanged(AnalyzedStyleUpdate);
+ }
}
void StyleEngine::setSelectedStylesheetSetName(const String& name)
@@ -788,9 +794,7 @@ void StyleEngine::setSelectedStylesheetSetName(const String& name)
void StyleEngine::setHttpDefaultStyle(const String& content)
{
- setPreferredStylesheetSetNameIfNotSet(content);
- markDocumentDirty();
- resolverChanged(FullStyleUpdate);
+ setPreferredStylesheetSetNameIfNotSet(content, UpdateActiveSheets);
}
void StyleEngine::ensureFullscreenUAStyle()
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.h ('k') | third_party/WebKit/Source/core/html/HTMLLinkElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698