| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGUseElement) | 64 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGUseElement) |
| 65 REGISTER_LOCAL_ANIMATED_PROPERTY(x) | 65 REGISTER_LOCAL_ANIMATED_PROPERTY(x) |
| 66 REGISTER_LOCAL_ANIMATED_PROPERTY(y) | 66 REGISTER_LOCAL_ANIMATED_PROPERTY(y) |
| 67 REGISTER_LOCAL_ANIMATED_PROPERTY(width) | 67 REGISTER_LOCAL_ANIMATED_PROPERTY(width) |
| 68 REGISTER_LOCAL_ANIMATED_PROPERTY(height) | 68 REGISTER_LOCAL_ANIMATED_PROPERTY(height) |
| 69 REGISTER_LOCAL_ANIMATED_PROPERTY(href) | 69 REGISTER_LOCAL_ANIMATED_PROPERTY(href) |
| 70 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | 70 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) |
| 71 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) | 71 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) |
| 72 END_REGISTER_ANIMATED_PROPERTIES | 72 END_REGISTER_ANIMATED_PROPERTIES |
| 73 | 73 |
| 74 inline SVGUseElement::SVGUseElement(const QualifiedName& tagName, Document* docu
ment, bool wasInsertedByParser) | 74 inline SVGUseElement::SVGUseElement(const QualifiedName& tagName, Document& docu
ment, bool wasInsertedByParser) |
| 75 : SVGGraphicsElement(tagName, document) | 75 : SVGGraphicsElement(tagName, document) |
| 76 , m_x(LengthModeWidth) | 76 , m_x(LengthModeWidth) |
| 77 , m_y(LengthModeHeight) | 77 , m_y(LengthModeHeight) |
| 78 , m_width(LengthModeWidth) | 78 , m_width(LengthModeWidth) |
| 79 , m_height(LengthModeHeight) | 79 , m_height(LengthModeHeight) |
| 80 , m_wasInsertedByParser(wasInsertedByParser) | 80 , m_wasInsertedByParser(wasInsertedByParser) |
| 81 , m_haveFiredLoadEvent(false) | 81 , m_haveFiredLoadEvent(false) |
| 82 , m_needsShadowTreeRecreation(false) | 82 , m_needsShadowTreeRecreation(false) |
| 83 , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired) | 83 , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired) |
| 84 { | 84 { |
| 85 ASSERT(hasCustomStyleCallbacks()); | 85 ASSERT(hasCustomStyleCallbacks()); |
| 86 ASSERT(hasTagName(SVGNames::useTag)); | 86 ASSERT(hasTagName(SVGNames::useTag)); |
| 87 ScriptWrappable::init(this); | 87 ScriptWrappable::init(this); |
| 88 registerAnimatedPropertiesForSVGUseElement(); | 88 registerAnimatedPropertiesForSVGUseElement(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 PassRefPtr<SVGUseElement> SVGUseElement::create(const QualifiedName& tagName, Do
cument* document, bool wasInsertedByParser) | 91 PassRefPtr<SVGUseElement> SVGUseElement::create(const QualifiedName& tagName, Do
cument& document, bool wasInsertedByParser) |
| 92 { | 92 { |
| 93 // Always build a #shadow-root for SVGUseElement. | 93 // Always build a #shadow-root for SVGUseElement. |
| 94 RefPtr<SVGUseElement> use = adoptRef(new SVGUseElement(tagName, document, wa
sInsertedByParser)); | 94 RefPtr<SVGUseElement> use = adoptRef(new SVGUseElement(tagName, document, wa
sInsertedByParser)); |
| 95 use->ensureUserAgentShadowRoot(); | 95 use->ensureUserAgentShadowRoot(); |
| 96 return use.release(); | 96 return use.release(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 SVGUseElement::~SVGUseElement() | 99 SVGUseElement::~SVGUseElement() |
| 100 { | 100 { |
| 101 setDocumentResource(0); | 101 setDocumentResource(0); |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 ASSERT(!use->resourceIsStillLoading()); | 714 ASSERT(!use->resourceIsStillLoading()); |
| 715 | 715 |
| 716 ASSERT(referencedDocument()); | 716 ASSERT(referencedDocument()); |
| 717 Element* targetElement = SVGURIReference::targetElementFromIRIString(use
->hrefCurrentValue(), *referencedDocument()); | 717 Element* targetElement = SVGURIReference::targetElementFromIRIString(use
->hrefCurrentValue(), *referencedDocument()); |
| 718 SVGElement* target = 0; | 718 SVGElement* target = 0; |
| 719 if (targetElement && targetElement->isSVGElement()) | 719 if (targetElement && targetElement->isSVGElement()) |
| 720 target = toSVGElement(targetElement); | 720 target = toSVGElement(targetElement); |
| 721 | 721 |
| 722 // Don't ASSERT(target) here, it may be "pending", too. | 722 // Don't ASSERT(target) here, it may be "pending", too. |
| 723 // Setup sub-shadow tree root node | 723 // Setup sub-shadow tree root node |
| 724 RefPtr<SVGGElement> cloneParent = SVGGElement::create(SVGNames::gTag, re
ferencedDocument()); | 724 RefPtr<SVGGElement> cloneParent = SVGGElement::create(SVGNames::gTag, *r
eferencedDocument()); |
| 725 use->cloneChildNodes(cloneParent.get()); | 725 use->cloneChildNodes(cloneParent.get()); |
| 726 | 726 |
| 727 // Spec: In the generated content, the 'use' will be replaced by 'g', wh
ere all attributes from the | 727 // Spec: In the generated content, the 'use' will be replaced by 'g', wh
ere all attributes from the |
| 728 // 'use' element except for x, y, width, height and xlink:href are trans
ferred to the generated 'g' element. | 728 // 'use' element except for x, y, width, height and xlink:href are trans
ferred to the generated 'g' element. |
| 729 transferUseAttributesToReplacedElement(use, cloneParent.get()); | 729 transferUseAttributesToReplacedElement(use, cloneParent.get()); |
| 730 | 730 |
| 731 if (target && !isDisallowedElement(target)) { | 731 if (target && !isDisallowedElement(target)) { |
| 732 RefPtr<Element> newChild = target->cloneElementWithChildren(); | 732 RefPtr<Element> newChild = target->cloneElementWithChildren(); |
| 733 ASSERT(newChild->isSVGElement()); | 733 ASSERT(newChild->isSVGElement()); |
| 734 cloneParent->appendChild(newChild.release()); | 734 cloneParent->appendChild(newChild.release()); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 761 | 761 |
| 762 void SVGUseElement::expandSymbolElementsInShadowTree(Node* element) | 762 void SVGUseElement::expandSymbolElementsInShadowTree(Node* element) |
| 763 { | 763 { |
| 764 if (element->hasTagName(SVGNames::symbolTag)) { | 764 if (element->hasTagName(SVGNames::symbolTag)) { |
| 765 // Spec: The referenced 'symbol' and its contents are deep-cloned into t
he generated tree, | 765 // Spec: The referenced 'symbol' and its contents are deep-cloned into t
he generated tree, |
| 766 // with the exception that the 'symbol' is replaced by an 'svg'. This ge
nerated 'svg' will | 766 // with the exception that the 'symbol' is replaced by an 'svg'. This ge
nerated 'svg' will |
| 767 // always have explicit values for attributes width and height. If attri
butes width and/or | 767 // always have explicit values for attributes width and height. If attri
butes width and/or |
| 768 // height are provided on the 'use' element, then these attributes will
be transferred to | 768 // height are provided on the 'use' element, then these attributes will
be transferred to |
| 769 // the generated 'svg'. If attributes width and/or height are not specif
ied, the generated | 769 // the generated 'svg'. If attributes width and/or height are not specif
ied, the generated |
| 770 // 'svg' element will use values of 100% for these attributes. | 770 // 'svg' element will use values of 100% for these attributes. |
| 771 RefPtr<SVGSVGElement> svgElement = SVGSVGElement::create(SVGNames::svgTa
g, referencedDocument()); | 771 ASSERT(referencedDocument()); |
| 772 RefPtr<SVGSVGElement> svgElement = SVGSVGElement::create(SVGNames::svgTa
g, *referencedDocument()); |
| 772 | 773 |
| 773 // Transfer all data (attributes, etc.) from <symbol> to the new <svg> e
lement. | 774 // Transfer all data (attributes, etc.) from <symbol> to the new <svg> e
lement. |
| 774 svgElement->cloneDataFromElement(*toElement(element)); | 775 svgElement->cloneDataFromElement(*toElement(element)); |
| 775 | 776 |
| 776 // Only clone symbol children, and add them to the new <svg> element | 777 // Only clone symbol children, and add them to the new <svg> element |
| 777 for (Node* child = element->firstChild(); child; child = child->nextSibl
ing()) { | 778 for (Node* child = element->firstChild(); child; child = child->nextSibl
ing()) { |
| 778 RefPtr<Node> newChild = child->cloneNode(true); | 779 RefPtr<Node> newChild = child->cloneNode(true); |
| 779 svgElement->appendChild(newChild.release()); | 780 svgElement->appendChild(newChild.release()); |
| 780 } | 781 } |
| 781 | 782 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 | 993 |
| 993 if (m_resource) | 994 if (m_resource) |
| 994 m_resource->removeClient(this); | 995 m_resource->removeClient(this); |
| 995 | 996 |
| 996 m_resource = resource; | 997 m_resource = resource; |
| 997 if (m_resource) | 998 if (m_resource) |
| 998 m_resource->addClient(this); | 999 m_resource->addClient(this); |
| 999 } | 1000 } |
| 1000 | 1001 |
| 1001 } | 1002 } |
| OLD | NEW |