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

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

Issue 1961173003: Corrected assert for cacheable stylesheets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 bf0ea0dc6fa95c8863be8c13b3be1fc163ad84f6..e68b424767d778f476eb9bd4c48b36ced163e570 100644
--- a/third_party/WebKit/Source/core/dom/StyleEngine.cpp
+++ b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
@@ -493,21 +493,6 @@ void StyleEngine::markDocumentDirty()
document().importsController()->master()->styleEngine().markDocumentDirty();
}
-static bool isCacheableForStyleElement(const StyleSheetContents& contents)
-{
- // FIXME: Support copying import rules.
- if (!contents.importRules().isEmpty())
- return false;
- // Until import rules are supported in cached sheets it's not possible for loading to fail.
- DCHECK(!contents.didLoadErrorOccur());
- // It is not the original sheet anymore.
- if (contents.isMutable())
- return false;
- if (!contents.hasSyntacticallyValidCSSHeader())
- return false;
- return true;
-}
-
CSSStyleSheet* StyleEngine::createSheet(Element* e, const String& text, TextPosition startPosition)
{
CSSStyleSheet* styleSheet = nullptr;
@@ -519,14 +504,14 @@ CSSStyleSheet* StyleEngine::createSheet(Element* e, const String& text, TextPosi
HeapHashMap<AtomicString, Member<StyleSheetContents>>::AddResult result = m_textToSheetCache.add(textContent, nullptr);
if (result.isNewEntry || !result.storedValue->value) {
styleSheet = StyleEngine::parseSheet(e, text, startPosition);
- if (result.isNewEntry && isCacheableForStyleElement(*styleSheet->contents())) {
+ if (result.isNewEntry && styleSheet->contents()->isCacheableForStyleElement()) {
result.storedValue->value = styleSheet->contents();
m_sheetToTextCache.add(styleSheet->contents(), textContent);
}
} else {
StyleSheetContents* contents = result.storedValue->value;
DCHECK(contents);
- DCHECK(isCacheableForStyleElement(*contents));
+ DCHECK(contents->isCacheableForStyleElement());
DCHECK_EQ(contents->singleOwnerDocument(), e->document());
styleSheet = CSSStyleSheet::createInline(contents, e, startPosition);
}

Powered by Google App Engine
This is Rietveld 408576698