OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2010 Dirk Schulze <krit@webkit.org> | 4 * Copyright (C) 2010 Dirk Schulze <krit@webkit.org> |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 return true; | 64 return true; |
65 } | 65 } |
66 | 66 |
67 void SVGFEImageElement::clearResourceReferences() | 67 void SVGFEImageElement::clearResourceReferences() |
68 { | 68 { |
69 if (m_cachedImage) { | 69 if (m_cachedImage) { |
70 m_cachedImage->removeClient(this); | 70 m_cachedImage->removeClient(this); |
71 m_cachedImage = 0; | 71 m_cachedImage = 0; |
72 } | 72 } |
73 | 73 |
74 document().accessSVGExtensions().removeAllTargetReferencesForElement(this); | 74 removeAllOutgoingReferences(); |
75 } | 75 } |
76 | 76 |
77 void SVGFEImageElement::fetchImageResource() | 77 void SVGFEImageElement::fetchImageResource() |
78 { | 78 { |
79 FetchRequest request(ResourceRequest(ownerDocument()->completeURL(hrefString
())), localName()); | 79 FetchRequest request(ResourceRequest(ownerDocument()->completeURL(hrefString
())), localName()); |
80 m_cachedImage = document().fetcher()->fetchImage(request); | 80 m_cachedImage = document().fetcher()->fetchImage(request); |
81 | 81 |
82 if (m_cachedImage) | 82 if (m_cachedImage) |
83 m_cachedImage->addClient(this); | 83 m_cachedImage->addClient(this); |
84 } | 84 } |
85 | 85 |
86 void SVGFEImageElement::buildPendingResource() | 86 void SVGFEImageElement::buildPendingResource() |
87 { | 87 { |
88 clearResourceReferences(); | 88 clearResourceReferences(); |
89 if (!inDocument()) | 89 if (!inDocument()) |
90 return; | 90 return; |
91 | 91 |
92 AtomicString id; | 92 AtomicString id; |
93 Element* target = SVGURIReference::targetElementFromIRIString(hrefString(),
treeScope(), &id); | 93 Element* target = SVGURIReference::targetElementFromIRIString(hrefString(),
treeScope(), &id); |
94 if (!target) { | 94 if (!target) { |
95 if (id.isEmpty()) | 95 if (id.isEmpty()) |
96 fetchImageResource(); | 96 fetchImageResource(); |
97 else { | 97 else { |
98 document().accessSVGExtensions().addPendingResource(id, this); | 98 document().accessSVGExtensions().addPendingResource(id, this); |
99 ASSERT(hasPendingResources()); | 99 ASSERT(hasPendingResources()); |
100 } | 100 } |
101 } else if (target->isSVGElement()) { | 101 } else if (target->isSVGElement()) { |
102 // Register us with the target in the dependencies map. Any change of hr
efElement | 102 // Register us with the target in the dependencies map. Any change of hr
efElement |
103 // that leads to relayout/repainting now informs us, so we can react to
it. | 103 // that leads to relayout/repainting now informs us, so we can react to
it. |
104 document().accessSVGExtensions().addElementReferencingTarget(this, toSVG
Element(target)); | 104 addReferenceTo(toSVGElement(target)); |
105 } | 105 } |
106 | 106 |
107 invalidate(); | 107 invalidate(); |
108 } | 108 } |
109 | 109 |
110 bool SVGFEImageElement::isSupportedAttribute(const QualifiedName& attrName) | 110 bool SVGFEImageElement::isSupportedAttribute(const QualifiedName& attrName) |
111 { | 111 { |
112 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 112 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
113 if (supportedAttributes.isEmpty()) { | 113 if (supportedAttributes.isEmpty()) { |
114 SVGURIReference::addSupportedAttributes(supportedAttributes); | 114 SVGURIReference::addSupportedAttributes(supportedAttributes); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 188 } |
189 | 189 |
190 PassRefPtr<FilterEffect> SVGFEImageElement::build(SVGFilterBuilder*, Filter* fil
ter) | 190 PassRefPtr<FilterEffect> SVGFEImageElement::build(SVGFilterBuilder*, Filter* fil
ter) |
191 { | 191 { |
192 if (m_cachedImage) | 192 if (m_cachedImage) |
193 return FEImage::createWithImage(filter, m_cachedImage->imageForRenderer(
renderer()), m_preserveAspectRatio->currentValue()); | 193 return FEImage::createWithImage(filter, m_cachedImage->imageForRenderer(
renderer()), m_preserveAspectRatio->currentValue()); |
194 return FEImage::createWithIRIReference(filter, treeScope(), hrefString(), m_
preserveAspectRatio->currentValue()); | 194 return FEImage::createWithIRIReference(filter, treeScope(), hrefString(), m_
preserveAspectRatio->currentValue()); |
195 } | 195 } |
196 | 196 |
197 } | 197 } |
OLD | NEW |