| 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 24 matching lines...) Expand all Loading... |
| 35 namespace WebCore { | 35 namespace WebCore { |
| 36 | 36 |
| 37 // Animated property definitions | 37 // Animated property definitions |
| 38 | 38 |
| 39 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEImageElement) | 39 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEImageElement) |
| 40 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) | 40 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) |
| 41 END_REGISTER_ANIMATED_PROPERTIES | 41 END_REGISTER_ANIMATED_PROPERTIES |
| 42 | 42 |
| 43 inline SVGFEImageElement::SVGFEImageElement(Document& document) | 43 inline SVGFEImageElement::SVGFEImageElement(Document& document) |
| 44 : SVGFilterPrimitiveStandardAttributes(SVGNames::feImageTag, document) | 44 : SVGFilterPrimitiveStandardAttributes(SVGNames::feImageTag, document) |
| 45 , SVGURIReference(this) |
| 45 , m_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create(this, SVGName
s::preserveAspectRatioAttr, SVGPreserveAspectRatio::create())) | 46 , m_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create(this, SVGName
s::preserveAspectRatioAttr, SVGPreserveAspectRatio::create())) |
| 46 , m_href(SVGAnimatedString::create(this, XLinkNames::hrefAttr, SVGString::cr
eate())) | |
| 47 { | 47 { |
| 48 ScriptWrappable::init(this); | 48 ScriptWrappable::init(this); |
| 49 addToPropertyMap(m_preserveAspectRatio); | 49 addToPropertyMap(m_preserveAspectRatio); |
| 50 addToPropertyMap(m_href); | |
| 51 registerAnimatedPropertiesForSVGFEImageElement(); | 50 registerAnimatedPropertiesForSVGFEImageElement(); |
| 52 } | 51 } |
| 53 | 52 |
| 54 PassRefPtr<SVGFEImageElement> SVGFEImageElement::create(Document& document) | 53 PassRefPtr<SVGFEImageElement> SVGFEImageElement::create(Document& document) |
| 55 { | 54 { |
| 56 return adoptRef(new SVGFEImageElement(document)); | 55 return adoptRef(new SVGFEImageElement(document)); |
| 57 } | 56 } |
| 58 | 57 |
| 59 SVGFEImageElement::~SVGFEImageElement() | 58 SVGFEImageElement::~SVGFEImageElement() |
| 60 { | 59 { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 74 if (m_cachedImage) { | 73 if (m_cachedImage) { |
| 75 m_cachedImage->removeClient(this); | 74 m_cachedImage->removeClient(this); |
| 76 m_cachedImage = 0; | 75 m_cachedImage = 0; |
| 77 } | 76 } |
| 78 | 77 |
| 79 document().accessSVGExtensions()->removeAllTargetReferencesForElement(this); | 78 document().accessSVGExtensions()->removeAllTargetReferencesForElement(this); |
| 80 } | 79 } |
| 81 | 80 |
| 82 void SVGFEImageElement::fetchImageResource() | 81 void SVGFEImageElement::fetchImageResource() |
| 83 { | 82 { |
| 84 FetchRequest request(ResourceRequest(ownerDocument()->completeURL(m_href->cu
rrentValue()->value())), localName()); | 83 FetchRequest request(ResourceRequest(ownerDocument()->completeURL(hrefString
())), localName()); |
| 85 m_cachedImage = document().fetcher()->fetchImage(request); | 84 m_cachedImage = document().fetcher()->fetchImage(request); |
| 86 | 85 |
| 87 if (m_cachedImage) | 86 if (m_cachedImage) |
| 88 m_cachedImage->addClient(this); | 87 m_cachedImage->addClient(this); |
| 89 } | 88 } |
| 90 | 89 |
| 91 void SVGFEImageElement::buildPendingResource() | 90 void SVGFEImageElement::buildPendingResource() |
| 92 { | 91 { |
| 93 clearResourceReferences(); | 92 clearResourceReferences(); |
| 94 if (!inDocument()) | 93 if (!inDocument()) |
| 95 return; | 94 return; |
| 96 | 95 |
| 97 AtomicString id; | 96 AtomicString id; |
| 98 Element* target = SVGURIReference::targetElementFromIRIString(m_href->curren
tValue()->value(), document(), &id); | 97 Element* target = SVGURIReference::targetElementFromIRIString(hrefString(),
document(), &id); |
| 99 if (!target) { | 98 if (!target) { |
| 100 if (id.isEmpty()) | 99 if (id.isEmpty()) |
| 101 fetchImageResource(); | 100 fetchImageResource(); |
| 102 else { | 101 else { |
| 103 document().accessSVGExtensions()->addPendingResource(id, this); | 102 document().accessSVGExtensions()->addPendingResource(id, this); |
| 104 ASSERT(hasPendingResources()); | 103 ASSERT(hasPendingResources()); |
| 105 } | 104 } |
| 106 } else if (target->isSVGElement()) { | 105 } else if (target->isSVGElement()) { |
| 107 // 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 |
| 108 // 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. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 126 { | 125 { |
| 127 if (!isSupportedAttribute(name)) { | 126 if (!isSupportedAttribute(name)) { |
| 128 SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value); | 127 SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value); |
| 129 return; | 128 return; |
| 130 } | 129 } |
| 131 | 130 |
| 132 SVGParsingError parseError = NoError; | 131 SVGParsingError parseError = NoError; |
| 133 | 132 |
| 134 if (name == SVGNames::preserveAspectRatioAttr) { | 133 if (name == SVGNames::preserveAspectRatioAttr) { |
| 135 m_preserveAspectRatio->setBaseValueAsString(value, parseError); | 134 m_preserveAspectRatio->setBaseValueAsString(value, parseError); |
| 136 } else if (name.matches(XLinkNames::hrefAttr)) { | 135 } else if (SVGURIReference::parseAttribute(name, value, parseError)) { |
| 137 m_href->setBaseValueAsString(value, parseError); | |
| 138 } else { | 136 } else { |
| 139 ASSERT_NOT_REACHED(); | 137 ASSERT_NOT_REACHED(); |
| 140 } | 138 } |
| 141 | 139 |
| 142 reportAttributeParsingError(parseError, name, value); | 140 reportAttributeParsingError(parseError, name, value); |
| 143 } | 141 } |
| 144 | 142 |
| 145 void SVGFEImageElement::svgAttributeChanged(const QualifiedName& attrName) | 143 void SVGFEImageElement::svgAttributeChanged(const QualifiedName& attrName) |
| 146 { | 144 { |
| 147 if (!isSupportedAttribute(attrName)) { | 145 if (!isSupportedAttribute(attrName)) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 return; | 188 return; |
| 191 | 189 |
| 192 if (RenderObject* renderer = this->renderer()) | 190 if (RenderObject* renderer = this->renderer()) |
| 193 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 191 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |
| 194 } | 192 } |
| 195 | 193 |
| 196 PassRefPtr<FilterEffect> SVGFEImageElement::build(SVGFilterBuilder*, Filter* fil
ter) | 194 PassRefPtr<FilterEffect> SVGFEImageElement::build(SVGFilterBuilder*, Filter* fil
ter) |
| 197 { | 195 { |
| 198 if (m_cachedImage) | 196 if (m_cachedImage) |
| 199 return FEImage::createWithImage(filter, m_cachedImage->imageForRenderer(
renderer()), m_preserveAspectRatio->currentValue()); | 197 return FEImage::createWithImage(filter, m_cachedImage->imageForRenderer(
renderer()), m_preserveAspectRatio->currentValue()); |
| 200 return FEImage::createWithIRIReference(filter, document(), m_href->currentVa
lue()->value(), m_preserveAspectRatio->currentValue()); | 198 return FEImage::createWithIRIReference(filter, document(), hrefString(), m_p
reserveAspectRatio->currentValue()); |
| 201 } | 199 } |
| 202 | 200 |
| 203 } | 201 } |
| OLD | NEW |