OLD | NEW |
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, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
6 * Copyright (C) 2012 University of Szeged | 6 * Copyright (C) 2012 University of Szeged |
7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> | 7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 targetInstance->setShadowTreeElement(element); | 767 targetInstance->setShadowTreeElement(element); |
768 element->setCorrespondingElement(originalElement); | 768 element->setCorrespondingElement(originalElement); |
769 | 769 |
770 SVGElement* child = Traversal<SVGElement>::firstChild(*target); | 770 SVGElement* child = Traversal<SVGElement>::firstChild(*target); |
771 for (SVGElementInstance* instance = targetInstance->firstChild(); child && i
nstance; instance = instance->nextSibling()) { | 771 for (SVGElementInstance* instance = targetInstance->firstChild(); child && i
nstance; instance = instance->nextSibling()) { |
772 associateInstancesWithShadowTreeElements(child, instance); | 772 associateInstancesWithShadowTreeElements(child, instance); |
773 child = Traversal<SVGElement>::nextSibling(*child); | 773 child = Traversal<SVGElement>::nextSibling(*child); |
774 } | 774 } |
775 } | 775 } |
776 | 776 |
777 SVGElementInstance* SVGUseElement::instanceForShadowTreeElement(Node* element) c
onst | |
778 { | |
779 if (!m_targetElementInstance) { | |
780 ASSERT(!inDocument()); | |
781 return 0; | |
782 } | |
783 | |
784 return instanceForShadowTreeElement(element, m_targetElementInstance.get()); | |
785 } | |
786 | |
787 SVGElementInstance* SVGUseElement::instanceForShadowTreeElement(Node* element, S
VGElementInstance* instance) const | |
788 { | |
789 ASSERT(element); | |
790 ASSERT(instance); | |
791 | |
792 // We're dispatching a mutation event during shadow tree construction | |
793 // this instance hasn't yet been associated to a shadowTree element. | |
794 if (!instance->shadowTreeElement()) | |
795 return 0; | |
796 | |
797 if (element == instance->shadowTreeElement()) | |
798 return instance; | |
799 | |
800 for (SVGElementInstance* current = instance->firstChild(); current; current
= current->nextSibling()) { | |
801 if (SVGElementInstance* search = instanceForShadowTreeElement(element, c
urrent)) | |
802 return search; | |
803 } | |
804 | |
805 return 0; | |
806 } | |
807 | |
808 void SVGUseElement::invalidateShadowTree() | 777 void SVGUseElement::invalidateShadowTree() |
809 { | 778 { |
810 if (!inActiveDocument() || m_needsShadowTreeRecreation) | 779 if (!inActiveDocument() || m_needsShadowTreeRecreation) |
811 return; | 780 return; |
812 scheduleShadowTreeRecreation(); | 781 scheduleShadowTreeRecreation(); |
813 invalidateDependentShadowTrees(); | 782 invalidateDependentShadowTrees(); |
814 } | 783 } |
815 | 784 |
816 void SVGUseElement::invalidateDependentShadowTrees() | 785 void SVGUseElement::invalidateDependentShadowTrees() |
817 { | 786 { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 m_resource->addClient(this); | 879 m_resource->addClient(this); |
911 } | 880 } |
912 | 881 |
913 void SVGUseElement::trace(Visitor* visitor) | 882 void SVGUseElement::trace(Visitor* visitor) |
914 { | 883 { |
915 visitor->trace(m_targetElementInstance); | 884 visitor->trace(m_targetElementInstance); |
916 SVGGraphicsElement::trace(visitor); | 885 SVGGraphicsElement::trace(visitor); |
917 } | 886 } |
918 | 887 |
919 } | 888 } |
OLD | NEW |