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

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

Issue 28553005: Avoid parsing css text if there are identical inline style blocks. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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: Source/core/css/CSSStyleSheet.cpp
diff --git a/Source/core/css/CSSStyleSheet.cpp b/Source/core/css/CSSStyleSheet.cpp
index bc9337ec5398bab38e514ec28152e47a0ef05bbf..1dc1b388f19119557b1c3f46d4bc1a746edd039f 100644
--- a/Source/core/css/CSSStyleSheet.cpp
+++ b/Source/core/css/CSSStyleSheet.cpp
@@ -80,6 +80,12 @@ PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(PassRefPtr<StyleSheetContents> s
return adoptRef(new CSSStyleSheet(sheet, ownerNode, false, TextPosition::minimumPosition()));
}
+PassRefPtr<CSSStyleSheet> CSSStyleSheet::createInline(PassRefPtr<StyleSheetContents> sheet, Node* ownerNode, const TextPosition& startPosition)
+{
+ ASSERT(sheet);
+ return adoptRef(new CSSStyleSheet(sheet, ownerNode, true, startPosition));
+}
+
PassRefPtr<CSSStyleSheet> CSSStyleSheet::createInline(Node* ownerNode, const KURL& baseURL, const TextPosition& startPosition, const String& encoding)
{
CSSParserContext parserContext(ownerNode->document(), baseURL, encoding);
@@ -94,6 +100,7 @@ CSSStyleSheet::CSSStyleSheet(PassRefPtr<StyleSheetContents> contents, CSSImportR
, m_ownerNode(0)
, m_ownerRule(ownerRule)
, m_startPosition(TextPosition::minimumPosition())
+ , m_loadCompleted(false)
{
m_contents->registerClient(this);
}
@@ -105,6 +112,7 @@ CSSStyleSheet::CSSStyleSheet(PassRefPtr<StyleSheetContents> contents, Node* owne
, m_ownerNode(ownerNode)
, m_ownerRule(0)
, m_startPosition(startPosition)
+ , m_loadCompleted(false)
{
ASSERT(isAcceptableCSSStyleSheetParent(ownerNode));
m_contents->registerClient(this);
@@ -132,6 +140,8 @@ void CSSStyleSheet::willMutateRules()
// If we are the only client it is safe to mutate.
if (m_contents->hasOneClient() && !m_contents->isInMemoryCache()) {
m_contents->clearRuleSet();
+ if (m_contents->maybeCacheable())
+ StyleEngine::removeSheet(m_contents.get());
m_contents->setMutable();
return;
}
@@ -381,4 +391,10 @@ void CSSStyleSheet::clearChildRuleCSSOMWrappers()
m_childRuleCSSOMWrappers.clear();
}
+void CSSStyleSheet::startLoadingDynamicSheet()
+{
+ m_loadCompleted = false;
+ m_ownerNode->startLoadingDynamicSheet();
+}
+
}

Powered by Google App Engine
This is Rietveld 408576698