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

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

Issue 23890025: WIP (Introduce WTF::NonNullPtr<T>.) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/shadow/ElementShadow.cpp ('k') | Source/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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 } 168 }
169 } 169 }
170 170
171 Node::InsertionNotificationRequest InsertionPoint::insertedInto(ContainerNode* i nsertionPoint) 171 Node::InsertionNotificationRequest InsertionPoint::insertedInto(ContainerNode* i nsertionPoint)
172 { 172 {
173 HTMLElement::insertedInto(insertionPoint); 173 HTMLElement::insertedInto(insertionPoint);
174 174
175 if (ShadowRoot* root = containingShadowRoot()) { 175 if (ShadowRoot* root = containingShadowRoot()) {
176 if (ElementShadow* rootOwner = root->owner()) { 176 if (ElementShadow* rootOwner = root->owner()) {
177 rootOwner->setNeedsDistributionRecalc(); 177 rootOwner->setNeedsDistributionRecalc();
178 if (isActive() && !m_registeredWithShadowRoot && insertionPoint->tre eScope().rootNode() == root) { 178 if (isActive() && !m_registeredWithShadowRoot && insertionPoint->tre eScope()->rootNode() == root) {
179 m_registeredWithShadowRoot = true; 179 m_registeredWithShadowRoot = true;
180 root->addInsertionPoint(this); 180 root->addInsertionPoint(this);
181 rootOwner->didAffectApplyAuthorStyles(); 181 rootOwner->didAffectApplyAuthorStyles();
182 if (canAffectSelector()) 182 if (canAffectSelector())
183 rootOwner->willAffectSelector(); 183 rootOwner->willAffectSelector();
184 } 184 }
185 } 185 }
186 } 186 }
187 187
188 return InsertionDone; 188 return InsertionDone;
189 } 189 }
190 190
191 void InsertionPoint::removedFrom(ContainerNode* insertionPoint) 191 void InsertionPoint::removedFrom(ContainerNode* insertionPoint)
192 { 192 {
193 ShadowRoot* root = containingShadowRoot(); 193 ShadowRoot* root = containingShadowRoot();
194 if (!root) 194 if (!root)
195 root = insertionPoint->containingShadowRoot(); 195 root = insertionPoint->containingShadowRoot();
196 196
197 if (root) { 197 if (root) {
198 if (ElementShadow* rootOwner = root->owner()) 198 if (ElementShadow* rootOwner = root->owner())
199 rootOwner->setNeedsDistributionRecalc(); 199 rootOwner->setNeedsDistributionRecalc();
200 } 200 }
201 201
202 // host can be null when removedFrom() is called from ElementShadow destruct or. 202 // host can be null when removedFrom() is called from ElementShadow destruct or.
203 ElementShadow* rootOwner = root ? root->owner() : 0; 203 ElementShadow* rootOwner = root ? root->owner() : 0;
204 204
205 // Since this insertion point is no longer visible from the shadow subtree, it need to clean itself up. 205 // Since this insertion point is no longer visible from the shadow subtree, it need to clean itself up.
206 clearDistribution(); 206 clearDistribution();
207 207
208 if (m_registeredWithShadowRoot && insertionPoint->treeScope().rootNode() == root) { 208 if (m_registeredWithShadowRoot && insertionPoint->treeScope()->rootNode() == root) {
209 ASSERT(root); 209 ASSERT(root);
210 m_registeredWithShadowRoot = false; 210 m_registeredWithShadowRoot = false;
211 root->removeInsertionPoint(this); 211 root->removeInsertionPoint(this);
212 if (rootOwner) { 212 if (rootOwner) {
213 rootOwner->didAffectApplyAuthorStyles(); 213 rootOwner->didAffectApplyAuthorStyles();
214 if (canAffectSelector()) 214 if (canAffectSelector())
215 rootOwner->willAffectSelector(); 215 rootOwner->willAffectSelector();
216 } 216 }
217 } 217 }
218 218
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 current = insertedTo; 283 current = insertedTo;
284 results.append(insertedTo); 284 results.append(insertedTo);
285 continue; 285 continue;
286 } 286 }
287 } 287 }
288 return; 288 return;
289 } 289 }
290 } 290 }
291 291
292 } // namespace WebCore 292 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/shadow/ElementShadow.cpp ('k') | Source/core/dom/shadow/ShadowRoot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698