Chromium Code Reviews| 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, bool onlySMILElements) |
|
esprehn
2014/05/23 04:38:17
An enum would be nicer, then it's more clear. Smil
kouhei (in TOK)
2014/05/23 07:17:15
Done.
| |
| 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 (onlySMILElements && !isSVGSMILElement(**vectorIt)) | |
| 378 continue; | |
| 379 | |
| 380 (*vectorIt)->svgAttributeChanged(XLinkNames::hrefAttr); | |
| 376 } | 381 } |
| 377 } | 382 } |
| 378 | 383 |
| 384 void SVGDocumentExtensions::rebuildSMILElementReferencesForTarget(SVGElement* re ferencedElement) | |
| 385 { | |
| 386 rebuildAllElementReferencesForTarget(referencedElement, true); | |
| 387 } | |
| 388 | |
| 379 void SVGDocumentExtensions::removeAllElementReferencesForTarget(SVGElement* refe rencedElement) | 389 void SVGDocumentExtensions::removeAllElementReferencesForTarget(SVGElement* refe rencedElement) |
| 380 { | 390 { |
| 381 ASSERT(referencedElement); | 391 ASSERT(referencedElement); |
| 382 HashMap<SVGElement*, OwnPtr<HashSet<SVGElement*> > >::iterator it = m_elemen tDependencies.find(referencedElement); | 392 HashMap<SVGElement*, OwnPtr<HashSet<SVGElement*> > >::iterator it = m_elemen tDependencies.find(referencedElement); |
| 383 if (it == m_elementDependencies.end()) | 393 if (it == m_elementDependencies.end()) |
| 384 return; | 394 return; |
| 385 ASSERT(it->key == referencedElement); | 395 ASSERT(it->key == referencedElement); |
| 386 | 396 |
| 387 m_elementDependencies.remove(it); | 397 m_elementDependencies.remove(it); |
| 388 } | 398 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 479 } | 489 } |
| 480 | 490 |
| 481 void SVGDocumentExtensions::trace(Visitor* visitor) | 491 void SVGDocumentExtensions::trace(Visitor* visitor) |
| 482 { | 492 { |
| 483 visitor->trace(m_timeContainers); | 493 visitor->trace(m_timeContainers); |
| 484 visitor->trace(m_svgFontFaceElements); | 494 visitor->trace(m_svgFontFaceElements); |
| 485 visitor->trace(m_pendingSVGFontFaceElementsForRemoval); | 495 visitor->trace(m_pendingSVGFontFaceElementsForRemoval); |
| 486 } | 496 } |
| 487 | 497 |
| 488 } | 498 } |
| OLD | NEW |