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

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

Issue 862183003: Merge ShadowRootRareData into ShadowRoot. (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 | « no previous file | sky/engine/core/dom/shadow/ShadowRoot.h » ('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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 } 163 }
164 164
165 void InsertionPoint::insertedInto(ContainerNode* insertionPoint) 165 void InsertionPoint::insertedInto(ContainerNode* insertionPoint)
166 { 166 {
167 HTMLElement::insertedInto(insertionPoint); 167 HTMLElement::insertedInto(insertionPoint);
168 if (ShadowRoot* root = containingShadowRoot()) { 168 if (ShadowRoot* root = containingShadowRoot()) {
169 if (ElementShadow* rootOwner = root->owner()) { 169 if (ElementShadow* rootOwner = root->owner()) {
170 rootOwner->setNeedsDistributionRecalc(); 170 rootOwner->setNeedsDistributionRecalc();
171 if (canBeActive() && !m_registeredWithShadowRoot && insertionPoint-> treeScope().rootNode() == root) { 171 if (canBeActive() && !m_registeredWithShadowRoot && insertionPoint-> treeScope().rootNode() == root) {
172 m_registeredWithShadowRoot = true; 172 m_registeredWithShadowRoot = true;
173 root->didAddInsertionPoint(this); 173 root->didAddInsertionPoint();
174 if (canAffectSelector()) 174 if (canAffectSelector())
175 rootOwner->willAffectSelector(); 175 rootOwner->willAffectSelector();
176 } 176 }
177 } 177 }
178 } 178 }
179 } 179 }
180 180
181 void InsertionPoint::removedFrom(ContainerNode* insertionPoint) 181 void InsertionPoint::removedFrom(ContainerNode* insertionPoint)
182 { 182 {
183 ShadowRoot* root = containingShadowRoot(); 183 ShadowRoot* root = containingShadowRoot();
184 if (!root) 184 if (!root)
185 root = insertionPoint->containingShadowRoot(); 185 root = insertionPoint->containingShadowRoot();
186 186
187 if (root) { 187 if (root) {
188 if (ElementShadow* rootOwner = root->owner()) 188 if (ElementShadow* rootOwner = root->owner())
189 rootOwner->setNeedsDistributionRecalc(); 189 rootOwner->setNeedsDistributionRecalc();
190 } 190 }
191 191
192 // host can be null when removedFrom() is called from ElementShadow destruct or. 192 // host can be null when removedFrom() is called from ElementShadow destruct or.
193 ElementShadow* rootOwner = root ? root->owner() : 0; 193 ElementShadow* rootOwner = root ? root->owner() : 0;
194 194
195 // Since this insertion point is no longer visible from the shadow subtree, it need to clean itself up. 195 // Since this insertion point is no longer visible from the shadow subtree, it need to clean itself up.
196 clearDistribution(); 196 clearDistribution();
197 197
198 if (m_registeredWithShadowRoot && insertionPoint->treeScope().rootNode() == root) { 198 if (m_registeredWithShadowRoot && insertionPoint->treeScope().rootNode() == root) {
199 ASSERT(root); 199 ASSERT(root);
200 m_registeredWithShadowRoot = false; 200 m_registeredWithShadowRoot = false;
201 root->didRemoveInsertionPoint(this); 201 root->didRemoveInsertionPoint();
202 if (rootOwner) { 202 if (rootOwner) {
203 if (canAffectSelector()) 203 if (canAffectSelector())
204 rootOwner->willAffectSelector(); 204 rootOwner->willAffectSelector();
205 } 205 }
206 } 206 }
207 207
208 HTMLElement::removedFrom(insertionPoint); 208 HTMLElement::removedFrom(insertionPoint);
209 } 209 }
210 210
211 const InsertionPoint* resolveReprojection(const Node* projectedNode) 211 const InsertionPoint* resolveReprojection(const Node* projectedNode)
(...skipping 30 matching lines...) Expand all
242 if (!insertionPoints) 242 if (!insertionPoints)
243 return; 243 return;
244 for (size_t i = 0; i < insertionPoints->size(); ++i) 244 for (size_t i = 0; i < insertionPoints->size(); ++i)
245 results.append(insertionPoints->at(i).get()); 245 results.append(insertionPoints->at(i).get());
246 ASSERT(current != insertionPoints->last().get()); 246 ASSERT(current != insertionPoints->last().get());
247 current = insertionPoints->last().get(); 247 current = insertionPoints->last().get();
248 } 248 }
249 } 249 }
250 250
251 } // namespace blink 251 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/dom/shadow/ShadowRoot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698