| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> |
| 4 * Copyright (C) 2007 Rob Buis <buis@kde.org> | 4 * Copyright (C) 2007 Rob Buis <buis@kde.org> |
| 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 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 #include "XLinkNames.h" | 25 #include "XLinkNames.h" |
| 26 #include "core/dom/Document.h" | 26 #include "core/dom/Document.h" |
| 27 #include "core/rendering/RenderView.h" | 27 #include "core/rendering/RenderView.h" |
| 28 #include "core/rendering/svg/SVGResourcesCache.h" | 28 #include "core/rendering/svg/SVGResourcesCache.h" |
| 29 #include "core/svg/SVGFontFaceElement.h" | 29 #include "core/svg/SVGFontFaceElement.h" |
| 30 #include "core/svg/SVGSVGElement.h" | 30 #include "core/svg/SVGSVGElement.h" |
| 31 #include "core/svg/SVGViewSpec.h" | 31 #include "core/svg/SVGViewSpec.h" |
| 32 #include "core/svg/SVGZoomAndPan.h" | 32 #include "core/svg/SVGZoomAndPan.h" |
| 33 #include "core/svg/animation/SMILTimeContainer.h" | 33 #include "core/svg/animation/SMILTimeContainer.h" |
| 34 #include "core/svg/animation/SVGSMILElement.h" |
| 34 #include "wtf/TemporaryChange.h" | 35 #include "wtf/TemporaryChange.h" |
| 35 #include "wtf/text/AtomicString.h" | 36 #include "wtf/text/AtomicString.h" |
| 36 | 37 |
| 37 namespace WebCore { | 38 namespace WebCore { |
| 38 | 39 |
| 39 SVGDocumentExtensions::SVGDocumentExtensions(Document* document) | 40 SVGDocumentExtensions::SVGDocumentExtensions(Document* document) |
| 40 : m_document(document) | 41 : m_document(document) |
| 41 , m_resourcesCache(adoptPtr(new SVGResourcesCache)) | 42 , m_resourcesCache(adoptPtr(new SVGResourcesCache)) |
| 42 #if !ASSERT_DISABLED | 43 #if !ASSERT_DISABLED |
| 43 , m_inRelativeLengthSVGRootsInvalidation(false) | 44 , m_inRelativeLengthSVGRootsInvalidation(false) |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 continue; | 345 continue; |
| 345 | 346 |
| 346 referencingElements->remove(setIt); | 347 referencingElements->remove(setIt); |
| 347 if (referencingElements->isEmpty()) | 348 if (referencingElements->isEmpty()) |
| 348 toBeRemoved.append(referencedElement); | 349 toBeRemoved.append(referencedElement); |
| 349 } | 350 } |
| 350 | 351 |
| 351 m_elementDependencies.removeAll(toBeRemoved); | 352 m_elementDependencies.removeAll(toBeRemoved); |
| 352 } | 353 } |
| 353 | 354 |
| 354 void SVGDocumentExtensions::rebuildAllElementReferencesForTarget(SVGElement* ref
erencedElement) | 355 void SVGDocumentExtensions::rebuildAllElementReferencesForTarget(SVGElement* ref
erencedElement, RebuildTargetFilter filter) |
| 355 { | 356 { |
| 356 ASSERT(referencedElement); | 357 ASSERT(referencedElement); |
| 357 HashMap<SVGElement*, OwnPtr<HashSet<SVGElement*> > >::iterator it = m_elemen
tDependencies.find(referencedElement); | 358 HashMap<SVGElement*, OwnPtr<HashSet<SVGElement*> > >::iterator it = m_elemen
tDependencies.find(referencedElement); |
| 358 if (it == m_elementDependencies.end()) | 359 if (it == m_elementDependencies.end()) |
| 359 return; | 360 return; |
| 360 ASSERT(it->key == referencedElement); | 361 ASSERT(it->key == referencedElement); |
| 361 Vector<SVGElement*> toBeNotified; | 362 Vector<SVGElement*> toBeNotified; |
| 362 | 363 |
| 363 HashSet<SVGElement*>* referencingElements = it->value.get(); | 364 HashSet<SVGElement*>* referencingElements = it->value.get(); |
| 364 HashSet<SVGElement*>::iterator setEnd = referencingElements->end(); | 365 HashSet<SVGElement*>::iterator setEnd = referencingElements->end(); |
| 365 for (HashSet<SVGElement*>::iterator setIt = referencingElements->begin(); se
tIt != setEnd; ++setIt) | 366 for (HashSet<SVGElement*>::iterator setIt = referencingElements->begin(); se
tIt != setEnd; ++setIt) |
| 366 toBeNotified.append(*setIt); | 367 toBeNotified.append(*setIt); |
| 367 | 368 |
| 368 // Force rebuilding the referencingElement so it knows about this change. | 369 // Force rebuilding the referencingElement so it knows about this change. |
| 369 Vector<SVGElement*>::iterator vectorEnd = toBeNotified.end(); | 370 Vector<SVGElement*>::iterator vectorEnd = toBeNotified.end(); |
| 370 for (Vector<SVGElement*>::iterator vectorIt = toBeNotified.begin(); vectorIt
!= vectorEnd; ++vectorIt) { | 371 for (Vector<SVGElement*>::iterator vectorIt = toBeNotified.begin(); vectorIt
!= vectorEnd; ++vectorIt) { |
| 371 // Before rebuilding referencingElement ensure it was not removed from u
nder us. | 372 // Before rebuilding referencingElement ensure it was not removed from u
nder us. |
| 372 if (HashSet<SVGElement*>* referencingElements = setOfElementsReferencing
Target(referencedElement)) { | 373 HashSet<SVGElement*>* referencingElements = setOfElementsReferencingTarg
et(referencedElement); |
| 373 if (referencingElements->contains(*vectorIt)) | 374 if (!referencingElements || !referencingElements->contains(*vectorIt)) |
| 374 (*vectorIt)->svgAttributeChanged(XLinkNames::hrefAttr); | 375 continue; |
| 375 } | 376 |
| 377 if (filter == ExcludeUseElements && isSVGUseElement(**vectorIt)) |
| 378 continue; |
| 379 |
| 380 (*vectorIt)->svgAttributeChanged(XLinkNames::hrefAttr); |
| 376 } | 381 } |
| 377 } | 382 } |
| 378 | 383 |
| 379 void SVGDocumentExtensions::removeAllElementReferencesForTarget(SVGElement* refe
rencedElement) | 384 void SVGDocumentExtensions::removeAllElementReferencesForTarget(SVGElement* refe
rencedElement) |
| 380 { | 385 { |
| 381 ASSERT(referencedElement); | 386 ASSERT(referencedElement); |
| 382 HashMap<SVGElement*, OwnPtr<HashSet<SVGElement*> > >::iterator it = m_elemen
tDependencies.find(referencedElement); | 387 HashMap<SVGElement*, OwnPtr<HashSet<SVGElement*> > >::iterator it = m_elemen
tDependencies.find(referencedElement); |
| 383 if (it == m_elementDependencies.end()) | 388 if (it == m_elementDependencies.end()) |
| 384 return; | 389 return; |
| 385 ASSERT(it->key == referencedElement); | 390 ASSERT(it->key == referencedElement); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 } | 484 } |
| 480 | 485 |
| 481 void SVGDocumentExtensions::trace(Visitor* visitor) | 486 void SVGDocumentExtensions::trace(Visitor* visitor) |
| 482 { | 487 { |
| 483 visitor->trace(m_timeContainers); | 488 visitor->trace(m_timeContainers); |
| 484 visitor->trace(m_svgFontFaceElements); | 489 visitor->trace(m_svgFontFaceElements); |
| 485 visitor->trace(m_pendingSVGFontFaceElementsForRemoval); | 490 visitor->trace(m_pendingSVGFontFaceElementsForRemoval); |
| 486 } | 491 } |
| 487 | 492 |
| 488 } | 493 } |
| OLD | NEW |