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

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

Issue 268223003: Move InvalidationGuard/InstanceUpdateBlocker out of SVGElementInstance (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Perform the renames Created 6 years, 7 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 | « Source/core/svg/SVGElementInstance.h ('k') | Source/core/svg/SVGEllipseElement.cpp » ('j') | 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // Register as instance for passed element. 156 // Register as instance for passed element.
157 m_element->mapInstanceToElement(this); 157 m_element->mapInstanceToElement(this);
158 158
159 } 159 }
160 160
161 void SVGElementInstance::appendChild(PassRefPtr<SVGElementInstance> child) 161 void SVGElementInstance::appendChild(PassRefPtr<SVGElementInstance> child)
162 { 162 {
163 appendChildToContainer<SVGElementInstance, SVGElementInstance>(*child, *this ); 163 appendChildToContainer<SVGElementInstance, SVGElementInstance>(*child, *this );
164 } 164 }
165 165
166 void SVGElementInstance::invalidateAllInstancesOfElement(SVGElement* element)
167 {
168 if (!element || !element->inDocument())
169 return;
170
171 if (element->instanceUpdatesBlocked())
172 return;
173
174 const HashSet<SVGElement*>& set = element->instancesForElement();
175 if (set.isEmpty())
176 return;
177
178 // Mark all use elements referencing 'element' for rebuilding
179 const HashSet<SVGElement*>::const_iterator end = set.end();
180 for (HashSet<SVGElement*>::const_iterator it = set.begin(); it != end; ++it) {
181 (*it)->setCorrespondingElement(0);
182
183 if (SVGUseElement* element = (*it)->correspondingUseElement()) {
184 ASSERT(element->inDocument());
185 element->invalidateShadowTree();
186 }
187 }
188
189 element->document().updateRenderTreeIfNeeded();
190 }
191
192 const AtomicString& SVGElementInstance::interfaceName() const 166 const AtomicString& SVGElementInstance::interfaceName() const
193 { 167 {
194 return EventTargetNames::SVGElementInstance; 168 return EventTargetNames::SVGElementInstance;
195 } 169 }
196 170
197 ExecutionContext* SVGElementInstance::executionContext() const 171 ExecutionContext* SVGElementInstance::executionContext() const
198 { 172 {
199 return &m_element->document(); 173 return &m_element->document();
200 } 174 }
201 175
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 } 214 }
241 215
242 EventTargetData& SVGElementInstance::ensureEventTargetData() 216 EventTargetData& SVGElementInstance::ensureEventTargetData()
243 { 217 {
244 // EventTarget would use these methods if we were actually using its add/rem oveEventListener logic. 218 // EventTarget would use these methods if we were actually using its add/rem oveEventListener logic.
245 // As we're forwarding those calls to the correspondingElement(), no one sho uld ever call this function. 219 // As we're forwarding those calls to the correspondingElement(), no one sho uld ever call this function.
246 ASSERT_NOT_REACHED(); 220 ASSERT_NOT_REACHED();
247 return *eventTargetData(); 221 return *eventTargetData();
248 } 222 }
249 223
250 SVGElementInstance::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* tar getElement)
251 : m_targetElement(targetElement)
252 {
253 if (m_targetElement)
254 m_targetElement->setInstanceUpdatesBlocked(true);
255 } 224 }
256
257 SVGElementInstance::InstanceUpdateBlocker::~InstanceUpdateBlocker()
258 {
259 if (m_targetElement)
260 m_targetElement->setInstanceUpdatesBlocked(false);
261 }
262
263 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGElementInstance.h ('k') | Source/core/svg/SVGEllipseElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698