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

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

Issue 234633004: Update <use> trees when the referenced element is changed. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/svg/dynamic-updates/SVGUseElement-target-changed-expected.txt ('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) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 3 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
4 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 m_shadowTreeElement = element; 164 m_shadowTreeElement = element;
165 } 165 }
166 166
167 void SVGElementInstance::appendChild(PassRefPtr<SVGElementInstance> child) 167 void SVGElementInstance::appendChild(PassRefPtr<SVGElementInstance> child)
168 { 168 {
169 appendChildToContainer<SVGElementInstance, SVGElementInstance>(*child, *this ); 169 appendChildToContainer<SVGElementInstance, SVGElementInstance>(*child, *this );
170 } 170 }
171 171
172 void SVGElementInstance::invalidateAllInstancesOfElement(SVGElement* element) 172 void SVGElementInstance::invalidateAllInstancesOfElement(SVGElement* element)
173 { 173 {
174 if (!element || !element->inDocument()) 174 if (!element)
175 return; 175 return;
176 176
177 if (element->instanceUpdatesBlocked()) 177 if (element->instanceUpdatesBlocked())
178 return; 178 return;
179 179
180 const HashSet<SVGElementInstance*>& set = element->instancesForElement(); 180 const HashSet<SVGElementInstance*>& set = element->instancesForElement();
181 if (set.isEmpty()) 181 if (set.isEmpty())
182 return; 182 return;
183 183
184 // Mark all use elements referencing 'element' for rebuilding 184 // Mark all use elements referencing 'element' for rebuilding
185 const HashSet<SVGElementInstance*>::const_iterator end = set.end(); 185 const HashSet<SVGElementInstance*>::const_iterator end = set.end();
186 for (HashSet<SVGElementInstance*>::const_iterator it = set.begin(); it != en d; ++it) { 186 for (HashSet<SVGElementInstance*>::const_iterator it = set.begin(); it != en d; ++it) {
187 ASSERT((*it)->shadowTreeElement()); 187 ASSERT((*it)->shadowTreeElement());
188 ASSERT((*it)->shadowTreeElement()->correspondingElement()); 188 ASSERT((*it)->shadowTreeElement()->correspondingElement());
189 ASSERT((*it)->shadowTreeElement()->correspondingElement() == (*it)->corr espondingElement()); 189 ASSERT((*it)->shadowTreeElement()->correspondingElement() == (*it)->corr espondingElement());
190 ASSERT((*it)->correspondingElement() == element); 190 ASSERT((*it)->correspondingElement() == element);
191 (*it)->shadowTreeElement()->setCorrespondingElement(0); 191 (*it)->shadowTreeElement()->setCorrespondingElement(0);
192 192
193 if (SVGUseElement* element = (*it)->correspondingUseElement()) { 193 if (SVGUseElement* element = (*it)->correspondingUseElement()) {
194 ASSERT(element->inDocument()); 194 ASSERT(element->inDocument());
195 element->invalidateShadowTree(); 195 element->invalidateShadowTree();
196 } 196 }
197 } 197 }
198
199 element->document().updateRenderTreeIfNeeded();
200 } 198 }
201 199
202 const AtomicString& SVGElementInstance::interfaceName() const 200 const AtomicString& SVGElementInstance::interfaceName() const
203 { 201 {
204 return EventTargetNames::SVGElementInstance; 202 return EventTargetNames::SVGElementInstance;
205 } 203 }
206 204
207 ExecutionContext* SVGElementInstance::executionContext() const 205 ExecutionContext* SVGElementInstance::executionContext() const
208 { 206 {
209 return &m_element->document(); 207 return &m_element->document();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 m_targetElement->setInstanceUpdatesBlocked(true); 262 m_targetElement->setInstanceUpdatesBlocked(true);
265 } 263 }
266 264
267 SVGElementInstance::InstanceUpdateBlocker::~InstanceUpdateBlocker() 265 SVGElementInstance::InstanceUpdateBlocker::~InstanceUpdateBlocker()
268 { 266 {
269 if (m_targetElement) 267 if (m_targetElement)
270 m_targetElement->setInstanceUpdatesBlocked(false); 268 m_targetElement->setInstanceUpdatesBlocked(false);
271 } 269 }
272 270
273 } 271 }
OLDNEW
« no previous file with comments | « LayoutTests/svg/dynamic-updates/SVGUseElement-target-changed-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698