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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGElement.cpp

Issue 2817913002: Add connected-paranoia in SVGElement::UpdateRelativeLengthsInformation (Closed)
Patch Set: Created 3 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann
3 * <zimmermann@kde.org> 3 * <zimmermann@kde.org>
4 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> 4 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
5 * Copyright (C) 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2008 Apple Inc. All rights reserved.
6 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 6 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
7 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 7 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 } 528 }
529 529
530 return property_name_to_id_map->at(attr_name.LocalName().Impl()); 530 return property_name_to_id_map->at(attr_name.LocalName().Impl());
531 } 531 }
532 532
533 void SVGElement::UpdateRelativeLengthsInformation( 533 void SVGElement::UpdateRelativeLengthsInformation(
534 bool client_has_relative_lengths, 534 bool client_has_relative_lengths,
535 SVGElement* client_element) { 535 SVGElement* client_element) {
536 DCHECK(client_element); 536 DCHECK(client_element);
537 537
538 // Through an unfortunate chain of events, we can end up calling this while a
fs 2017/04/13 13:11:10 My plan for a way to better address this is crbug.
539 // subtree is being removed, and before the subtree has been properly
540 // "disconnected". Hence check the entire ancestor chain to avoid propagating
541 // relative length clients up into ancestors that have already been
542 // disconnected.
538 // If we're not yet in a document, this function will be called again from 543 // If we're not yet in a document, this function will be called again from
539 // insertedInto(). Do nothing now. 544 // insertedInto(). Do nothing now.
540 if (!isConnected()) 545 for (Node& current_node : NodeTraversal::InclusiveAncestorsOf(*this)) {
541 return; 546 if (!current_node.isConnected())
547 return;
548 }
542 549
543 // An element wants to notify us that its own relative lengths state changed. 550 // An element wants to notify us that its own relative lengths state changed.
544 // Register it in the relative length map, and register us in the parent 551 // Register it in the relative length map, and register us in the parent
545 // relative length map. Register the parent in the grandparents map, etc. 552 // relative length map. Register the parent in the grandparents map, etc.
546 // Repeat procedure until the root of the SVG tree. 553 // Repeat procedure until the root of the SVG tree.
547 for (Node& current_node : NodeTraversal::InclusiveAncestorsOf(*this)) { 554 for (Node& current_node : NodeTraversal::InclusiveAncestorsOf(*this)) {
548 if (!current_node.IsSVGElement()) 555 if (!current_node.IsSVGElement())
549 break; 556 break;
550 SVGElement& current_element = ToSVGElement(current_node); 557 SVGElement& current_element = ToSVGElement(current_node);
551 #if DCHECK_IS_ON() 558 #if DCHECK_IS_ON()
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 visitor->Trace(class_name_); 1339 visitor->Trace(class_name_);
1333 Element::Trace(visitor); 1340 Element::Trace(visitor);
1334 } 1341 }
1335 1342
1336 const AtomicString& SVGElement::EventParameterName() { 1343 const AtomicString& SVGElement::EventParameterName() {
1337 DEFINE_STATIC_LOCAL(const AtomicString, evt_string, ("evt")); 1344 DEFINE_STATIC_LOCAL(const AtomicString, evt_string, ("evt"));
1338 return evt_string; 1345 return evt_string;
1339 } 1346 }
1340 1347
1341 } // namespace blink 1348 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/animations/target-move-relative-length-invalidation-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698