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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLSlotElement.cpp

Issue 2241193004: Fix a crash: SlotAssignment is unintentionally created for v0 shadow trees (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | « third_party/WebKit/Source/core/dom/shadow/SlotAssignment.cpp ('k') | no next file » | 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) 2015 Google Inc. All rights reserved. 2 * Copyright (C) 2015 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 Node::InsertionNotificationRequest HTMLSlotElement::insertedInto(ContainerNode* insertionPoint) 227 Node::InsertionNotificationRequest HTMLSlotElement::insertedInto(ContainerNode* insertionPoint)
228 { 228 {
229 HTMLElement::insertedInto(insertionPoint); 229 HTMLElement::insertedInto(insertionPoint);
230 ShadowRoot* root = containingShadowRoot(); 230 ShadowRoot* root = containingShadowRoot();
231 if (root) { 231 if (root) {
232 DCHECK(root->owner()); 232 DCHECK(root->owner());
233 root->owner()->setNeedsDistributionRecalc(); 233 root->owner()->setNeedsDistributionRecalc();
234 // Relevant DOM Standard: https://dom.spec.whatwg.org/#concept-node-inse rt 234 // Relevant DOM Standard: https://dom.spec.whatwg.org/#concept-node-inse rt
235 // - 6.4: Run assign slotables for a tree with node's tree and a set co ntaining each inclusive descendant of node that is a slot. 235 // - 6.4: Run assign slotables for a tree with node's tree and a set co ntaining each inclusive descendant of node that is a slot.
236 if (!wasInShadowTreeBeforeInserted(*this, *insertionPoint)) 236 if (root->isV1() && !wasInShadowTreeBeforeInserted(*this, *insertionPoin t))
237 root->ensureSlotAssignment().slotAdded(*this); 237 root->ensureSlotAssignment().slotAdded(*this);
238 } 238 }
239 239
240 // We could have been distributed into in a detached subtree, make sure to 240 // We could have been distributed into in a detached subtree, make sure to
241 // clear the distribution when inserted again to avoid cycles. 241 // clear the distribution when inserted again to avoid cycles.
242 clearDistribution(); 242 clearDistribution();
243 243
244 return InsertionDone; 244 return InsertionDone;
245 } 245 }
246 246
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 DEFINE_TRACE(HTMLSlotElement) 356 DEFINE_TRACE(HTMLSlotElement)
357 { 357 {
358 visitor->trace(m_assignedNodes); 358 visitor->trace(m_assignedNodes);
359 visitor->trace(m_distributedNodes); 359 visitor->trace(m_distributedNodes);
360 visitor->trace(m_oldDistributedNodes); 360 visitor->trace(m_oldDistributedNodes);
361 visitor->trace(m_distributedIndices); 361 visitor->trace(m_distributedIndices);
362 HTMLElement::trace(visitor); 362 HTMLElement::trace(visitor);
363 } 363 }
364 364
365 } // namespace blink 365 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/shadow/SlotAssignment.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698