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

Side by Side Diff: Source/core/dom/shadow/ShadowRoot.cpp

Issue 975933002: Return reference from styleEngine() accessor. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « Source/core/dom/StyleEngine.cpp ('k') | Source/core/frame/FrameView.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 ShadowRoot::~ShadowRoot() 65 ShadowRoot::~ShadowRoot()
66 { 66 {
67 #if !ENABLE(OILPAN) 67 #if !ENABLE(OILPAN)
68 ASSERT(!m_prev); 68 ASSERT(!m_prev);
69 ASSERT(!m_next); 69 ASSERT(!m_next);
70 70
71 if (m_shadowRootRareData && m_shadowRootRareData->styleSheets()) 71 if (m_shadowRootRareData && m_shadowRootRareData->styleSheets())
72 m_shadowRootRareData->styleSheets()->detachFromDocument(); 72 m_shadowRootRareData->styleSheets()->detachFromDocument();
73 73
74 document().styleEngine()->didRemoveShadowRoot(this); 74 document().styleEngine().didRemoveShadowRoot(this);
75 75
76 // We cannot let ContainerNode destructor call willBeDeletedFromDocument() 76 // We cannot let ContainerNode destructor call willBeDeletedFromDocument()
77 // for this ShadowRoot instance because TreeScope destructor 77 // for this ShadowRoot instance because TreeScope destructor
78 // clears Node::m_treeScope thus ContainerNode is no longer able 78 // clears Node::m_treeScope thus ContainerNode is no longer able
79 // to access it Document reference after that. 79 // to access it Document reference after that.
80 willBeDeletedFromDocument(); 80 willBeDeletedFromDocument();
81 81
82 // We must remove all of our children first before the TreeScope destructor 82 // We must remove all of our children first before the TreeScope destructor
83 // runs so we don't go through TreeScopeAdopter for each child with a 83 // runs so we don't go through TreeScopeAdopter for each child with a
84 // destructed tree scope in each descendant. 84 // destructed tree scope in each descendant.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 root->addChildShadowRoot(); 169 root->addChildShadowRoot();
170 m_registeredWithParentShadowRoot = true; 170 m_registeredWithParentShadowRoot = true;
171 } 171 }
172 172
173 return InsertionDone; 173 return InsertionDone;
174 } 174 }
175 175
176 void ShadowRoot::removedFrom(ContainerNode* insertionPoint) 176 void ShadowRoot::removedFrom(ContainerNode* insertionPoint)
177 { 177 {
178 if (insertionPoint->inDocument()) { 178 if (insertionPoint->inDocument()) {
179 document().styleEngine()->shadowRootRemovedFromDocument(this); 179 document().styleEngine().shadowRootRemovedFromDocument(this);
180 if (m_registeredWithParentShadowRoot) { 180 if (m_registeredWithParentShadowRoot) {
181 ShadowRoot* root = host()->containingShadowRoot(); 181 ShadowRoot* root = host()->containingShadowRoot();
182 if (!root) 182 if (!root)
183 root = insertionPoint->containingShadowRoot(); 183 root = insertionPoint->containingShadowRoot();
184 if (root) 184 if (root)
185 root->removeChildShadowRoot(); 185 root->removeChildShadowRoot();
186 m_registeredWithParentShadowRoot = false; 186 m_registeredWithParentShadowRoot = false;
187 } 187 }
188 } 188 }
189 189
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 DEFINE_TRACE(ShadowRoot) 322 DEFINE_TRACE(ShadowRoot)
323 { 323 {
324 visitor->trace(m_prev); 324 visitor->trace(m_prev);
325 visitor->trace(m_next); 325 visitor->trace(m_next);
326 visitor->trace(m_shadowRootRareData); 326 visitor->trace(m_shadowRootRareData);
327 TreeScope::trace(visitor); 327 TreeScope::trace(visitor);
328 DocumentFragment::trace(visitor); 328 DocumentFragment::trace(visitor);
329 } 329 }
330 330
331 } 331 }
OLDNEW
« no previous file with comments | « Source/core/dom/StyleEngine.cpp ('k') | Source/core/frame/FrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698