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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 } | 658 } |
659 | 659 |
660 // We don't walk the target tree element-by-element, and clone each elem
ent, | 660 // We don't walk the target tree element-by-element, and clone each elem
ent, |
661 // but instead use cloneElementWithChildren(). This is an optimization f
or the common | 661 // but instead use cloneElementWithChildren(). This is an optimization f
or the common |
662 // case where <use> doesn't contain disallowed elements (ie. <foreignObj
ect>). | 662 // case where <use> doesn't contain disallowed elements (ie. <foreignObj
ect>). |
663 // Though if there are disallowed elements in the subtree, we have to re
move them. | 663 // Though if there are disallowed elements in the subtree, we have to re
move them. |
664 // For instance: <use> on <g> containing <foreignObject> (indirect case)
. | 664 // For instance: <use> on <g> containing <foreignObject> (indirect case)
. |
665 if (subtreeContainsDisallowedElement(cloneParent.get())) | 665 if (subtreeContainsDisallowedElement(cloneParent.get())) |
666 removeDisallowedElementsFromSubtree(*cloneParent); | 666 removeDisallowedElementsFromSubtree(*cloneParent); |
667 | 667 |
668 RefPtr<Node> replacingElement(cloneParent.get()); | 668 RefPtrWillBeRawPtr<Node> replacingElement(cloneParent.get()); |
669 | 669 |
670 // Replace <use> with referenced content. | 670 // Replace <use> with referenced content. |
671 ASSERT(use->parentNode()); | 671 ASSERT(use->parentNode()); |
672 use->parentNode()->replaceChild(cloneParent.release(), use); | 672 use->parentNode()->replaceChild(cloneParent.release(), use); |
673 | 673 |
674 // Expand the siblings because the *element* is replaced and we will | 674 // Expand the siblings because the *element* is replaced and we will |
675 // lose the sibling chain when we are back from recursion. | 675 // lose the sibling chain when we are back from recursion. |
676 element = replacingElement.get(); | 676 element = replacingElement.get(); |
677 for (RefPtr<Node> sibling = element->nextSibling(); sibling; sibling = s
ibling->nextSibling()) | 677 for (RefPtrWillBeRawPtr<Node> sibling = element->nextSibling(); sibling;
sibling = sibling->nextSibling()) |
678 expandUseElementsInShadowTree(sibling.get()); | 678 expandUseElementsInShadowTree(sibling.get()); |
679 } | 679 } |
680 | 680 |
681 for (RefPtr<Node> child = element->firstChild(); child; child = child->nextS
ibling()) | 681 for (RefPtrWillBeRawPtr<Node> child = element->firstChild(); child; child =
child->nextSibling()) |
682 expandUseElementsInShadowTree(child.get()); | 682 expandUseElementsInShadowTree(child.get()); |
683 } | 683 } |
684 | 684 |
685 void SVGUseElement::expandSymbolElementsInShadowTree(Node* element) | 685 void SVGUseElement::expandSymbolElementsInShadowTree(Node* element) |
686 { | 686 { |
687 ASSERT(element); | 687 ASSERT(element); |
688 if (isSVGSymbolElement(*element)) { | 688 if (isSVGSymbolElement(*element)) { |
689 // Spec: The referenced 'symbol' and its contents are deep-cloned into t
he generated tree, | 689 // Spec: The referenced 'symbol' and its contents are deep-cloned into t
he generated tree, |
690 // with the exception that the 'symbol' is replaced by an 'svg'. This ge
nerated 'svg' will | 690 // with the exception that the 'symbol' is replaced by an 'svg'. This ge
nerated 'svg' will |
691 // always have explicit values for attributes width and height. If attri
butes width and/or | 691 // always have explicit values for attributes width and height. If attri
butes width and/or |
(...skipping 11 matching lines...) Expand all Loading... |
703 svgElement->appendChild(child->cloneNode(true)); | 703 svgElement->appendChild(child->cloneNode(true)); |
704 | 704 |
705 // 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, |
706 // 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 |
707 // case where <use> doesn't contain disallowed elements (ie. <foreignObj
ect>). | 707 // case where <use> doesn't contain disallowed elements (ie. <foreignObj
ect>). |
708 // 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. |
709 // For instance: <use> on <g> containing <foreignObject> (indirect case)
. | 709 // For instance: <use> on <g> containing <foreignObject> (indirect case)
. |
710 if (subtreeContainsDisallowedElement(svgElement.get())) | 710 if (subtreeContainsDisallowedElement(svgElement.get())) |
711 removeDisallowedElementsFromSubtree(*svgElement); | 711 removeDisallowedElementsFromSubtree(*svgElement); |
712 | 712 |
713 RefPtr<Node> replacingElement(svgElement.get()); | 713 RefPtrWillBeRawPtr<Node> replacingElement(svgElement.get()); |
714 | 714 |
715 // Replace <symbol> with <svg>. | 715 // Replace <symbol> with <svg>. |
716 element->parentNode()->replaceChild(svgElement.release(), element); | 716 element->parentNode()->replaceChild(svgElement.release(), element); |
717 | 717 |
718 // Expand the siblings because the *element* is replaced and we will | 718 // Expand the siblings because the *element* is replaced and we will |
719 // lose the sibling chain when we are back from recursion. | 719 // lose the sibling chain when we are back from recursion. |
720 element = replacingElement.get(); | 720 element = replacingElement.get(); |
721 for (RefPtr<Node> sibling = element->nextSibling(); sibling; sibling = s
ibling->nextSibling()) | 721 for (RefPtrWillBeRawPtr<Node> sibling = element->nextSibling(); sibling;
sibling = sibling->nextSibling()) |
722 expandSymbolElementsInShadowTree(sibling.get()); | 722 expandSymbolElementsInShadowTree(sibling.get()); |
723 } | 723 } |
724 | 724 |
725 for (RefPtr<Node> child = element->firstChild(); child; child = child->nextS
ibling()) | 725 for (RefPtrWillBeRawPtr<Node> child = element->firstChild(); child; child =
child->nextSibling()) |
726 expandSymbolElementsInShadowTree(child.get()); | 726 expandSymbolElementsInShadowTree(child.get()); |
727 } | 727 } |
728 | 728 |
729 void SVGUseElement::transferEventListenersToShadowTree(SVGElement* shadowTreeTar
getElement) | 729 void SVGUseElement::transferEventListenersToShadowTree(SVGElement* shadowTreeTar
getElement) |
730 { | 730 { |
731 if (!shadowTreeTargetElement) | 731 if (!shadowTreeTargetElement) |
732 return; | 732 return; |
733 | 733 |
734 SVGElement* originalElement = shadowTreeTargetElement->correspondingElement(
); | 734 SVGElement* originalElement = shadowTreeTargetElement->correspondingElement(
); |
735 ASSERT(originalElement); | 735 ASSERT(originalElement); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 m_resource->addClient(this); | 877 m_resource->addClient(this); |
878 } | 878 } |
879 | 879 |
880 void SVGUseElement::trace(Visitor* visitor) | 880 void SVGUseElement::trace(Visitor* visitor) |
881 { | 881 { |
882 visitor->trace(m_targetElementInstance); | 882 visitor->trace(m_targetElementInstance); |
883 SVGGraphicsElement::trace(visitor); | 883 SVGGraphicsElement::trace(visitor); |
884 } | 884 } |
885 | 885 |
886 } | 886 } |
OLD | NEW |