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

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

Issue 1511523002: Align HTMLImageElement relevant mutations to spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix removal issue when a text node is between <source> and <img> Created 5 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 unified diff | Download patch
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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } 214 }
215 } 215 }
216 216
217 // We could have been distributed into in a detached subtree, make sure to 217 // We could have been distributed into in a detached subtree, make sure to
218 // clear the distribution when inserted again to avoid cycles. 218 // clear the distribution when inserted again to avoid cycles.
219 clearDistribution(); 219 clearDistribution();
220 220
221 return InsertionDone; 221 return InsertionDone;
222 } 222 }
223 223
224 void InsertionPoint::removedFrom(ContainerNode* insertionPoint) 224 void InsertionPoint::removedFrom(ContainerNode* insertionPoint, Node* next)
225 { 225 {
226 ShadowRoot* root = containingShadowRoot(); 226 ShadowRoot* root = containingShadowRoot();
227 if (!root) 227 if (!root)
228 root = insertionPoint->containingShadowRoot(); 228 root = insertionPoint->containingShadowRoot();
229 229
230 if (root) { 230 if (root) {
231 if (ElementShadow* rootOwner = root->owner()) 231 if (ElementShadow* rootOwner = root->owner())
232 rootOwner->setNeedsDistributionRecalc(); 232 rootOwner->setNeedsDistributionRecalc();
233 } 233 }
234 234
235 // host can be null when removedFrom() is called from ElementShadow destruct or. 235 // host can be null when removedFrom() is called from ElementShadow destruct or.
236 ElementShadow* rootOwner = root ? root->owner() : 0; 236 ElementShadow* rootOwner = root ? root->owner() : 0;
237 237
238 // Since this insertion point is no longer visible from the shadow subtree, it need to clean itself up. 238 // Since this insertion point is no longer visible from the shadow subtree, it need to clean itself up.
239 clearDistribution(); 239 clearDistribution();
240 240
241 if (m_registeredWithShadowRoot && insertionPoint->treeScope().rootNode() == root) { 241 if (m_registeredWithShadowRoot && insertionPoint->treeScope().rootNode() == root) {
242 ASSERT(root); 242 ASSERT(root);
243 m_registeredWithShadowRoot = false; 243 m_registeredWithShadowRoot = false;
244 root->didRemoveInsertionPoint(this); 244 root->didRemoveInsertionPoint(this);
245 if (rootOwner) { 245 if (rootOwner) {
246 if (canAffectSelector()) 246 if (canAffectSelector())
247 rootOwner->willAffectSelector(); 247 rootOwner->willAffectSelector();
248 } 248 }
249 } 249 }
250 250
251 HTMLElement::removedFrom(insertionPoint); 251 HTMLElement::removedFrom(insertionPoint, next);
252 } 252 }
253 253
254 DEFINE_TRACE(InsertionPoint) 254 DEFINE_TRACE(InsertionPoint)
255 { 255 {
256 visitor->trace(m_distributedNodes); 256 visitor->trace(m_distributedNodes);
257 HTMLElement::trace(visitor); 257 HTMLElement::trace(visitor);
258 } 258 }
259 259
260 const InsertionPoint* resolveReprojection(const Node* projectedNode) 260 const InsertionPoint* resolveReprojection(const Node* projectedNode)
261 { 261 {
(...skipping 29 matching lines...) Expand all
291 if (!insertionPoints) 291 if (!insertionPoints)
292 return; 292 return;
293 for (size_t i = 0; i < insertionPoints->size(); ++i) 293 for (size_t i = 0; i < insertionPoints->size(); ++i)
294 results.append(insertionPoints->at(i).get()); 294 results.append(insertionPoints->at(i).get());
295 ASSERT(current != insertionPoints->last().get()); 295 ASSERT(current != insertionPoints->last().get());
296 current = insertionPoints->last().get(); 296 current = insertionPoints->last().get();
297 } 297 }
298 } 298 }
299 299
300 } // namespace blink 300 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698