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

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

Issue 1151973009: Share duplicate inline stylesheets in quirks mode. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/StyleEngine.cpp
diff --git a/Source/core/dom/StyleEngine.cpp b/Source/core/dom/StyleEngine.cpp
index ac540ebdadbc4d517b723ac45d3f74ba5a61df43..8a3986c684b50a0cf1cb6e0313e7ffac11164cab 100644
--- a/Source/core/dom/StyleEngine.cpp
+++ b/Source/core/dom/StyleEngine.cpp
@@ -603,26 +603,21 @@ PassRefPtrWillBeRawPtr<CSSStyleSheet> StyleEngine::createSheet(Element* e, const
e->document().styleEngine().addPendingSheet();
- if (!e->document().inQuirksMode()) {
- AtomicString textContent(text);
-
- WillBeHeapHashMap<AtomicString, RawPtrWillBeMember<StyleSheetContents>>::AddResult result = m_textToSheetCache.add(textContent, nullptr);
- if (result.isNewEntry || !result.storedValue->value) {
- styleSheet = StyleEngine::parseSheet(e, text, startPosition, createdByParser);
- if (result.isNewEntry && isCacheableForStyleElement(*styleSheet->contents())) {
- result.storedValue->value = styleSheet->contents();
- m_sheetToTextCache.add(styleSheet->contents(), textContent);
- }
- } else {
- StyleSheetContents* contents = result.storedValue->value;
- ASSERT(contents);
- ASSERT(isCacheableForStyleElement(*contents));
- ASSERT(contents->singleOwnerDocument() == e->document());
- styleSheet = CSSStyleSheet::createInline(contents, e, startPosition);
+ AtomicString textContent(text);
+
+ WillBeHeapHashMap<AtomicString, RawPtrWillBeMember<StyleSheetContents>>::AddResult result = m_textToSheetCache.add(textContent, nullptr);
+ if (result.isNewEntry || !result.storedValue->value) {
+ styleSheet = StyleEngine::parseSheet(e, text, startPosition, createdByParser);
+ if (result.isNewEntry && isCacheableForStyleElement(*styleSheet->contents())) {
+ result.storedValue->value = styleSheet->contents();
+ m_sheetToTextCache.add(styleSheet->contents(), textContent);
}
} else {
- // FIXME: currently we don't cache StyleSheetContents inQuirksMode.
- styleSheet = StyleEngine::parseSheet(e, text, startPosition, createdByParser);
+ StyleSheetContents* contents = result.storedValue->value;
+ ASSERT(contents);
+ ASSERT(isCacheableForStyleElement(*contents));
+ ASSERT(contents->singleOwnerDocument() == e->document());
+ styleSheet = CSSStyleSheet::createInline(contents, e, startPosition);
}
ASSERT(styleSheet);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698