| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 return true; | 68 return true; |
| 69 } | 69 } |
| 70 | 70 |
| 71 void SVGFEImageElement::clearResourceReferences() | 71 void SVGFEImageElement::clearResourceReferences() |
| 72 { | 72 { |
| 73 if (m_cachedImage) { | 73 if (m_cachedImage) { |
| 74 m_cachedImage->removeClient(this); | 74 m_cachedImage->removeClient(this); |
| 75 m_cachedImage = 0; | 75 m_cachedImage = 0; |
| 76 } | 76 } |
| 77 | 77 |
| 78 document().accessSVGExtensions()->removeAllTargetReferencesForElement(this); | 78 document().accessSVGExtensions().removeAllTargetReferencesForElement(this); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void SVGFEImageElement::fetchImageResource() | 81 void SVGFEImageElement::fetchImageResource() |
| 82 { | 82 { |
| 83 FetchRequest request(ResourceRequest(ownerDocument()->completeURL(hrefString
())), localName()); | 83 FetchRequest request(ResourceRequest(ownerDocument()->completeURL(hrefString
())), localName()); |
| 84 m_cachedImage = document().fetcher()->fetchImage(request); | 84 m_cachedImage = document().fetcher()->fetchImage(request); |
| 85 | 85 |
| 86 if (m_cachedImage) | 86 if (m_cachedImage) |
| 87 m_cachedImage->addClient(this); | 87 m_cachedImage->addClient(this); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void SVGFEImageElement::buildPendingResource() | 90 void SVGFEImageElement::buildPendingResource() |
| 91 { | 91 { |
| 92 clearResourceReferences(); | 92 clearResourceReferences(); |
| 93 if (!inDocument()) | 93 if (!inDocument()) |
| 94 return; | 94 return; |
| 95 | 95 |
| 96 AtomicString id; | 96 AtomicString id; |
| 97 Element* target = SVGURIReference::targetElementFromIRIString(hrefString(),
document(), &id); | 97 Element* target = SVGURIReference::targetElementFromIRIString(hrefString(),
document(), &id); |
| 98 if (!target) { | 98 if (!target) { |
| 99 if (id.isEmpty()) | 99 if (id.isEmpty()) |
| 100 fetchImageResource(); | 100 fetchImageResource(); |
| 101 else { | 101 else { |
| 102 document().accessSVGExtensions()->addPendingResource(id, this); | 102 document().accessSVGExtensions().addPendingResource(id, this); |
| 103 ASSERT(hasPendingResources()); | 103 ASSERT(hasPendingResources()); |
| 104 } | 104 } |
| 105 } else if (target->isSVGElement()) { | 105 } else if (target->isSVGElement()) { |
| 106 // Register us with the target in the dependencies map. Any change of hr
efElement | 106 // Register us with the target in the dependencies map. Any change of hr
efElement |
| 107 // that leads to relayout/repainting now informs us, so we can react to
it. | 107 // that leads to relayout/repainting now informs us, so we can react to
it. |
| 108 document().accessSVGExtensions()->addElementReferencingTarget(this, toSV
GElement(target)); | 108 document().accessSVGExtensions().addElementReferencingTarget(this, toSVG
Element(target)); |
| 109 } | 109 } |
| 110 | 110 |
| 111 invalidate(); | 111 invalidate(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 bool SVGFEImageElement::isSupportedAttribute(const QualifiedName& attrName) | 114 bool SVGFEImageElement::isSupportedAttribute(const QualifiedName& attrName) |
| 115 { | 115 { |
| 116 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 116 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 117 if (supportedAttributes.isEmpty()) { | 117 if (supportedAttributes.isEmpty()) { |
| 118 SVGURIReference::addSupportedAttributes(supportedAttributes); | 118 SVGURIReference::addSupportedAttributes(supportedAttributes); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 192 } |
| 193 | 193 |
| 194 PassRefPtr<FilterEffect> SVGFEImageElement::build(SVGFilterBuilder*, Filter* fil
ter) | 194 PassRefPtr<FilterEffect> SVGFEImageElement::build(SVGFilterBuilder*, Filter* fil
ter) |
| 195 { | 195 { |
| 196 if (m_cachedImage) | 196 if (m_cachedImage) |
| 197 return FEImage::createWithImage(filter, m_cachedImage->imageForRenderer(
renderer()), m_preserveAspectRatio->currentValue()); | 197 return FEImage::createWithImage(filter, m_cachedImage->imageForRenderer(
renderer()), m_preserveAspectRatio->currentValue()); |
| 198 return FEImage::createWithIRIReference(filter, document(), hrefString(), m_p
reserveAspectRatio->currentValue()); | 198 return FEImage::createWithIRIReference(filter, document(), hrefString(), m_p
reserveAspectRatio->currentValue()); |
| 199 } | 199 } |
| 200 | 200 |
| 201 } | 201 } |
| OLD | NEW |