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

Side by Side Diff: sky/engine/core/dom/shadow/ShadowRoot.cpp

Issue 844133002: Simplify tree scope tracking in StyleEngine. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « sky/engine/core/dom/StyleSheetCollection.cpp ('k') | sky/engine/core/html/HTMLStyleElement.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 11 matching lines...) Expand all
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #include "sky/engine/config.h" 27 #include "sky/engine/config.h"
28 #include "sky/engine/core/dom/shadow/ShadowRoot.h" 28 #include "sky/engine/core/dom/shadow/ShadowRoot.h"
29 29
30 #include "sky/engine/bindings/core/v8/ExceptionState.h" 30 #include "sky/engine/bindings/core/v8/ExceptionState.h"
31 #include "sky/engine/core/css/resolver/StyleResolver.h" 31 #include "sky/engine/core/css/resolver/StyleResolver.h"
32 #include "sky/engine/core/dom/Document.h"
32 #include "sky/engine/core/dom/ElementTraversal.h" 33 #include "sky/engine/core/dom/ElementTraversal.h"
33 #include "sky/engine/core/dom/StyleEngine.h" 34 #include "sky/engine/core/dom/StyleEngine.h"
34 #include "sky/engine/core/dom/Text.h" 35 #include "sky/engine/core/dom/Text.h"
35 #include "sky/engine/core/dom/shadow/ElementShadow.h" 36 #include "sky/engine/core/dom/shadow/ElementShadow.h"
36 #include "sky/engine/core/dom/shadow/InsertionPoint.h" 37 #include "sky/engine/core/dom/shadow/InsertionPoint.h"
37 #include "sky/engine/core/dom/shadow/ShadowRootRareData.h" 38 #include "sky/engine/core/dom/shadow/ShadowRootRareData.h"
38 #include "sky/engine/public/platform/Platform.h" 39 #include "sky/engine/public/platform/Platform.h"
39 40
40 namespace blink { 41 namespace blink {
41 42
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 106 }
106 } 107 }
107 108
108 clearChildNeedsStyleRecalc(); 109 clearChildNeedsStyleRecalc();
109 } 110 }
110 111
111 void ShadowRoot::insertedInto(ContainerNode* insertionPoint) 112 void ShadowRoot::insertedInto(ContainerNode* insertionPoint)
112 { 113 {
113 DocumentFragment::insertedInto(insertionPoint); 114 DocumentFragment::insertedInto(insertionPoint);
114 115
116 if (inActiveDocument())
117 document().styleEngine()->addTreeScope(*this);
118
115 if (ShadowRoot* root = host()->containingShadowRoot()) 119 if (ShadowRoot* root = host()->containingShadowRoot())
116 root->addChildShadowRoot(); 120 root->addChildShadowRoot();
117 } 121 }
118 122
119 void ShadowRoot::removedFrom(ContainerNode* insertionPoint) 123 void ShadowRoot::removedFrom(ContainerNode* insertionPoint)
120 { 124 {
121 ShadowRoot* root = host()->containingShadowRoot(); 125 ShadowRoot* root = host()->containingShadowRoot();
122 if (!root) 126 if (!root)
123 root = insertionPoint->containingShadowRoot(); 127 root = insertionPoint->containingShadowRoot();
124 if (root) 128 if (root)
125 root->removeChildShadowRoot(); 129 root->removeChildShadowRoot();
126 130
131 if (inActiveDocument())
132 document().styleEngine()->removeTreeScope(*this);
133
127 DocumentFragment::removedFrom(insertionPoint); 134 DocumentFragment::removedFrom(insertionPoint);
128 } 135 }
129 136
130 ShadowRootRareData* ShadowRoot::ensureShadowRootRareData() 137 ShadowRootRareData* ShadowRoot::ensureShadowRootRareData()
131 { 138 {
132 if (m_shadowRootRareData) 139 if (m_shadowRootRareData)
133 return m_shadowRootRareData.get(); 140 return m_shadowRootRareData.get();
134 141
135 m_shadowRootRareData = adoptPtr(new ShadowRootRareData); 142 m_shadowRootRareData = adoptPtr(new ShadowRootRareData);
136 return m_shadowRootRareData.get(); 143 return m_shadowRootRareData.get();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 Vector<RefPtr<InsertionPoint> > insertionPoints; 203 Vector<RefPtr<InsertionPoint> > insertionPoints;
197 for (InsertionPoint* insertionPoint = Traversal<InsertionPoint>::firstWithin (*this); insertionPoint; insertionPoint = Traversal<InsertionPoint>::next(*inser tionPoint, this)) 204 for (InsertionPoint* insertionPoint = Traversal<InsertionPoint>::firstWithin (*this); insertionPoint; insertionPoint = Traversal<InsertionPoint>::next(*inser tionPoint, this))
198 insertionPoints.append(insertionPoint); 205 insertionPoints.append(insertionPoint);
199 206
200 ensureShadowRootRareData()->setDescendantInsertionPoints(insertionPoints); 207 ensureShadowRootRareData()->setDescendantInsertionPoints(insertionPoints);
201 208
202 return m_shadowRootRareData->descendantInsertionPoints(); 209 return m_shadowRootRareData->descendantInsertionPoints();
203 } 210 }
204 211
205 } 212 }
OLDNEW
« no previous file with comments | « sky/engine/core/dom/StyleSheetCollection.cpp ('k') | sky/engine/core/html/HTMLStyleElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698