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

Unified Diff: sky/engine/core/html/HTMLStyleElement.cpp

Issue 813493003: Only the main document should have a StyleEngine. (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/StyleSheetCollection.cpp ('k') | sky/engine/core/page/Page.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/html/HTMLStyleElement.cpp
diff --git a/sky/engine/core/html/HTMLStyleElement.cpp b/sky/engine/core/html/HTMLStyleElement.cpp
index d7ce4d9f59580423597ba489eddf23c6cd39ae95..265fd750e53fc3e16a9d5e60b7fc121663bd1a35 100644
--- a/sky/engine/core/html/HTMLStyleElement.cpp
+++ b/sky/engine/core/html/HTMLStyleElement.cpp
@@ -51,7 +51,8 @@ HTMLStyleElement::~HTMLStyleElement()
if (inDocument()) {
ContainerNode* scopingNode = this->scopingNode();
TreeScope& scope = scopingNode ? scopingNode->treeScope() : treeScope();
- document().styleEngine()->removeStyleSheetCandidateNode(this, scopingNode, scope);
+ if (StyleEngine* styleEngine = document().styleEngine())
+ styleEngine->removeStyleSheetCandidateNode(this, scopingNode, scope);
}
if (m_sheet)
@@ -76,15 +77,17 @@ void HTMLStyleElement::parseAttribute(const QualifiedName& name, const AtomicStr
void HTMLStyleElement::insertedInto(ContainerNode* insertionPoint)
{
HTMLElement::insertedInto(insertionPoint);
- document().styleEngine()->addStyleSheetCandidateNode(this, false);
- process();
+ if (inActiveDocument()) {
+ document().styleEngine()->addStyleSheetCandidateNode(this, false);
+ process();
+ }
}
void HTMLStyleElement::removedFrom(ContainerNode* insertionPoint)
{
HTMLElement::removedFrom(insertionPoint);
- if (!insertionPoint->inDocument())
+ if (!insertionPoint->inActiveDocument())
return;
ShadowRoot* scopingNode = containingShadowRoot();
@@ -117,7 +120,7 @@ const AtomicString& HTMLStyleElement::media() const
ContainerNode* HTMLStyleElement::scopingNode()
{
- if (!inDocument())
+ if (!inActiveDocument())
return 0;
if (isInShadowTree())
@@ -134,7 +137,7 @@ void HTMLStyleElement::clearSheet()
void HTMLStyleElement::process()
{
- if (!inDocument())
+ if (!inActiveDocument())
return;
TRACE_EVENT0("blink", "StyleElement::process");
« no previous file with comments | « sky/engine/core/dom/StyleSheetCollection.cpp ('k') | sky/engine/core/page/Page.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698