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 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 // height are provided on the 'use' element, then these attributes will
be transferred to | 692 // height are provided on the 'use' element, then these attributes will
be transferred to |
693 // the generated 'svg'. If attributes width and/or height are not specif
ied, the generated | 693 // the generated 'svg'. If attributes width and/or height are not specif
ied, the generated |
694 // 'svg' element will use values of 100% for these attributes. | 694 // 'svg' element will use values of 100% for these attributes. |
695 ASSERT(referencedScope()); | 695 ASSERT(referencedScope()); |
696 RefPtrWillBeRawPtr<SVGSVGElement> svgElement = SVGSVGElement::create(ref
erencedScope()->document()); | 696 RefPtrWillBeRawPtr<SVGSVGElement> svgElement = SVGSVGElement::create(ref
erencedScope()->document()); |
697 | 697 |
698 // Transfer all data (attributes, etc.) from <symbol> to the new <svg> e
lement. | 698 // Transfer all data (attributes, etc.) from <symbol> to the new <svg> e
lement. |
699 svgElement->cloneDataFromElement(*toElement(element)); | 699 svgElement->cloneDataFromElement(*toElement(element)); |
700 | 700 |
701 // Only clone symbol children, and add them to the new <svg> element | 701 // Only clone symbol children, and add them to the new <svg> element |
702 for (Node* child = element->firstChild(); child; child = child->nextSibl
ing()) { | 702 for (Node* child = element->firstChild(); child; child = child->nextSibl
ing()) |
703 RefPtr<Node> newChild = child->cloneNode(true); | 703 svgElement->appendChild(child->cloneNode(true)); |
704 svgElement->appendChild(newChild.release()); | |
705 } | |
706 | 704 |
707 // We don't walk the target tree element-by-element, and clone each elem
ent, | 705 // We don't walk the target tree element-by-element, and clone each elem
ent, |
708 // but instead use cloneNode(deep=true). This is an optimization for the
common | 706 // but instead use cloneNode(deep=true). This is an optimization for the
common |
709 // case where <use> doesn't contain disallowed elements (ie. <foreignObj
ect>). | 707 // case where <use> doesn't contain disallowed elements (ie. <foreignObj
ect>). |
710 // Though if there are disallowed elements in the subtree, we have to re
move them. | 708 // Though if there are disallowed elements in the subtree, we have to re
move them. |
711 // For instance: <use> on <g> containing <foreignObject> (indirect case)
. | 709 // For instance: <use> on <g> containing <foreignObject> (indirect case)
. |
712 if (subtreeContainsDisallowedElement(svgElement.get())) | 710 if (subtreeContainsDisallowedElement(svgElement.get())) |
713 removeDisallowedElementsFromSubtree(*svgElement); | 711 removeDisallowedElementsFromSubtree(*svgElement); |
714 | 712 |
715 RefPtr<Node> replacingElement(svgElement.get()); | 713 RefPtr<Node> replacingElement(svgElement.get()); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 m_resource->addClient(this); | 877 m_resource->addClient(this); |
880 } | 878 } |
881 | 879 |
882 void SVGUseElement::trace(Visitor* visitor) | 880 void SVGUseElement::trace(Visitor* visitor) |
883 { | 881 { |
884 visitor->trace(m_targetElementInstance); | 882 visitor->trace(m_targetElementInstance); |
885 SVGGraphicsElement::trace(visitor); | 883 SVGGraphicsElement::trace(visitor); |
886 } | 884 } |
887 | 885 |
888 } | 886 } |
OLD | NEW |