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 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 return; | 573 return; |
574 } | 574 } |
575 | 575 |
576 // A general description from the SVG spec, describing what buildInstanceTre
e() actually does. | 576 // A general description from the SVG spec, describing what buildInstanceTre
e() actually does. |
577 // | 577 // |
578 // Spec: If the 'use' element references a 'g' which contains two 'rect' ele
ments, then the instance tree | 578 // Spec: If the 'use' element references a 'g' which contains two 'rect' ele
ments, then the instance tree |
579 // contains three SVGElementInstance objects, a root SVGElementInstance obje
ct whose correspondingElement | 579 // contains three SVGElementInstance objects, a root SVGElementInstance obje
ct whose correspondingElement |
580 // is the SVGGElement object for the 'g', and then two child SVGElementInsta
nce objects, each of which has | 580 // is the SVGGElement object for the 'g', and then two child SVGElementInsta
nce objects, each of which has |
581 // its correspondingElement that is an SVGRectElement object. | 581 // its correspondingElement that is an SVGRectElement object. |
582 | 582 |
583 for (Node* node = target->firstChild(); node; node = node->nextSibling()) { | 583 for (SVGElement* element = Traversal<SVGElement>::firstChild(*target); eleme
nt; element = Traversal<SVGElement>::nextSibling(*element)) { |
584 SVGElement* element = 0; | 584 // Skip any disallowed element. |
585 if (node->isSVGElement()) | 585 if (isDisallowedElement(element)) |
586 element = toSVGElement(node); | |
587 | |
588 // Skip any non-svg nodes or any disallowed element. | |
589 if (!element || isDisallowedElement(element)) | |
590 continue; | 586 continue; |
591 | 587 |
592 // Create SVGElementInstance object, for both container/non-container no
des. | 588 // Create SVGElementInstance object, for both container/non-container no
des. |
593 RefPtr<SVGElementInstance> instance = SVGElementInstance::create(this, 0
, element); | 589 RefPtr<SVGElementInstance> instance = SVGElementInstance::create(this, 0
, element); |
594 SVGElementInstance* instancePtr = instance.get(); | 590 SVGElementInstance* instancePtr = instance.get(); |
595 targetInstance->appendChild(instance.release()); | 591 targetInstance->appendChild(instance.release()); |
596 | 592 |
597 // Enter recursion, appending new instance tree nodes to the "instance"
object. | 593 // Enter recursion, appending new instance tree nodes to the "instance"
object. |
598 buildInstanceTree(element, instancePtr, foundProblem, foundUse); | 594 buildInstanceTree(element, instancePtr, foundProblem, foundUse); |
599 if (foundProblem) | 595 if (foundProblem) |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 } | 809 } |
814 | 810 |
815 SVGElement* element = 0; | 811 SVGElement* element = 0; |
816 if (target->isSVGElement()) | 812 if (target->isSVGElement()) |
817 element = toSVGElement(target); | 813 element = toSVGElement(target); |
818 | 814 |
819 ASSERT(!targetInstance->shadowTreeElement()); | 815 ASSERT(!targetInstance->shadowTreeElement()); |
820 targetInstance->setShadowTreeElement(element); | 816 targetInstance->setShadowTreeElement(element); |
821 element->setCorrespondingElement(originalElement); | 817 element->setCorrespondingElement(originalElement); |
822 | 818 |
823 Node* node = target->firstChild(); | 819 SVGElement* child = Traversal<SVGElement>::firstChild(*target); |
824 for (SVGElementInstance* instance = targetInstance->firstChild(); node && in
stance; instance = instance->nextSibling()) { | 820 for (SVGElementInstance* instance = targetInstance->firstChild(); child && i
nstance; instance = instance->nextSibling()) { |
825 // Skip any non-svg elements in shadow tree | 821 associateInstancesWithShadowTreeElements(child, instance); |
826 while (node && !node->isSVGElement()) | 822 child = Traversal<SVGElement>::nextSibling(*child); |
827 node = node->nextSibling(); | |
828 | |
829 if (!node) | |
830 break; | |
831 | |
832 associateInstancesWithShadowTreeElements(node, instance); | |
833 node = node->nextSibling(); | |
834 } | 823 } |
835 } | 824 } |
836 | 825 |
837 SVGElementInstance* SVGUseElement::instanceForShadowTreeElement(Node* element) c
onst | 826 SVGElementInstance* SVGUseElement::instanceForShadowTreeElement(Node* element) c
onst |
838 { | 827 { |
839 if (!m_targetElementInstance) { | 828 if (!m_targetElementInstance) { |
840 ASSERT(!inDocument()); | 829 ASSERT(!inDocument()); |
841 return 0; | 830 return 0; |
842 } | 831 } |
843 | 832 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 | 963 |
975 if (m_resource) | 964 if (m_resource) |
976 m_resource->removeClient(this); | 965 m_resource->removeClient(this); |
977 | 966 |
978 m_resource = resource; | 967 m_resource = resource; |
979 if (m_resource) | 968 if (m_resource) |
980 m_resource->addClient(this); | 969 m_resource->addClient(this); |
981 } | 970 } |
982 | 971 |
983 } | 972 } |
OLD | NEW |