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

Unified Diff: sky/engine/core/dom/StyleEngine.cpp

Issue 788113002: Simplify HTMLStyleElement. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « sky/engine/core/dom/StyleEngine.h ('k') | sky/engine/core/html/HTMLStyleElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/dom/StyleEngine.cpp
diff --git a/sky/engine/core/dom/StyleEngine.cpp b/sky/engine/core/dom/StyleEngine.cpp
index 2cc2d8021b8c084d10e7568f9f27ebfedc9eaca2..ee38518b7963a002fa26bf4f053d639a7e632434 100644
--- a/sky/engine/core/dom/StyleEngine.cpp
+++ b/sky/engine/core/dom/StyleEngine.cpp
@@ -383,15 +383,15 @@ static bool isCacheableForStyleElement(const StyleSheetContents& contents)
return true;
}
-PassRefPtr<CSSStyleSheet> StyleEngine::createSheet(Element* e, const String& text, TextPosition startPosition, bool createdByParser)
+PassRefPtr<CSSStyleSheet> StyleEngine::createSheet(Element* e, const String& text)
{
- RefPtr<CSSStyleSheet> styleSheet = nullptr;
-
+ RefPtr<CSSStyleSheet> styleSheet;
AtomicString textContent(text);
HashMap<AtomicString, RawPtr<StyleSheetContents> >::AddResult result = m_textToSheetCache.add(textContent, nullptr);
if (result.isNewEntry || !result.storedValue->value) {
- styleSheet = StyleEngine::parseSheet(e, text, startPosition, createdByParser);
+ styleSheet = CSSStyleSheet::createInline(e, KURL());
+ styleSheet->contents()->parseString(text);
if (result.isNewEntry && isCacheableForStyleElement(*styleSheet->contents())) {
result.storedValue->value = styleSheet->contents();
m_sheetToTextCache.add(styleSheet->contents(), textContent);
@@ -401,21 +401,13 @@ PassRefPtr<CSSStyleSheet> StyleEngine::createSheet(Element* e, const String& tex
ASSERT(contents);
ASSERT(isCacheableForStyleElement(*contents));
ASSERT(contents->singleOwnerDocument() == e->document());
- styleSheet = CSSStyleSheet::createInline(contents, e, startPosition);
+ styleSheet = CSSStyleSheet::createInline(contents, e);
}
ASSERT(styleSheet);
return styleSheet;
}
-PassRefPtr<CSSStyleSheet> StyleEngine::parseSheet(Element* e, const String& text, TextPosition startPosition, bool createdByParser)
-{
- RefPtr<CSSStyleSheet> styleSheet = nullptr;
- styleSheet = CSSStyleSheet::createInline(e, KURL(), startPosition);
- styleSheet->contents()->parseStringAtPosition(text, startPosition, createdByParser);
- return styleSheet;
-}
-
void StyleEngine::removeSheet(StyleSheetContents* contents)
{
HashMap<RawPtr<StyleSheetContents>, AtomicString>::iterator it = m_sheetToTextCache.find(contents);
« no previous file with comments | « sky/engine/core/dom/StyleEngine.h ('k') | sky/engine/core/html/HTMLStyleElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698