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

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

Issue 1087653004: [svg] Update the <use> shadowtree if a referenced element is removed. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: alternative Created 5 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
« no previous file with comments | « LayoutTests/svg/custom/use-remove-referenced-expected.html ('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) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org> 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org>
3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
4 * Copyright (C) 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2008 Apple Inc. All rights reserved.
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 } 959 }
960 960
961 void SVGElement::markForLayoutAndParentResourceInvalidation(LayoutObject* render er) 961 void SVGElement::markForLayoutAndParentResourceInvalidation(LayoutObject* render er)
962 { 962 {
963 ASSERT(renderer); 963 ASSERT(renderer);
964 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(rende rer, true); 964 LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(rende rer, true);
965 } 965 }
966 966
967 void SVGElement::invalidateInstances() 967 void SVGElement::invalidateInstances()
968 { 968 {
969 if (!inDocument())
970 return;
971
972 if (instanceUpdatesBlocked()) 969 if (instanceUpdatesBlocked())
973 return; 970 return;
974 971
975 const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement>>& set = instances ForElement(); 972 const WillBeHeapHashSet<RawPtrWillBeWeakMember<SVGElement>>& set = instances ForElement();
976 if (set.isEmpty()) 973 if (set.isEmpty())
977 return; 974 return;
978 975
979 // Mark all use elements referencing 'element' for rebuilding 976 // Mark all use elements referencing 'element' for rebuilding
980 for (SVGElement* instance : set) { 977 for (SVGElement* instance : set) {
981 instance->setCorrespondingElement(0); 978 instance->setCorrespondingElement(0);
982 979
983 if (SVGUseElement* element = instance->correspondingUseElement()) { 980 if (SVGUseElement* element = instance->correspondingUseElement()) {
984 ASSERT(element->inDocument()); 981 if (element->inDocument())
985 element->invalidateShadowTree(); 982 element->invalidateShadowTree();
986 } 983 }
987 } 984 }
988 985
989 svgRareData()->elementInstances().clear(); 986 svgRareData()->elementInstances().clear();
990 987
991 document().updateRenderTreeIfNeeded(); 988 if (inDocument())
989 document().updateRenderTreeIfNeeded();
992 } 990 }
993 991
994 SVGElement::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* targetEleme nt) 992 SVGElement::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* targetEleme nt)
995 : m_targetElement(targetElement) 993 : m_targetElement(targetElement)
996 { 994 {
997 if (m_targetElement) 995 if (m_targetElement)
998 m_targetElement->setInstanceUpdatesBlocked(true); 996 m_targetElement->setInstanceUpdatesBlocked(true);
999 } 997 }
1000 998
1001 SVGElement::InstanceUpdateBlocker::~InstanceUpdateBlocker() 999 SVGElement::InstanceUpdateBlocker::~InstanceUpdateBlocker()
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 Element::trace(visitor); 1184 Element::trace(visitor);
1187 } 1185 }
1188 1186
1189 const AtomicString& SVGElement::eventParameterName() 1187 const AtomicString& SVGElement::eventParameterName()
1190 { 1188 {
1191 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt", AtomicString::Con structFromLiteral)); 1189 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt", AtomicString::Con structFromLiteral));
1192 return evtString; 1190 return evtString;
1193 } 1191 }
1194 1192
1195 } // namespace blink 1193 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/svg/custom/use-remove-referenced-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698