Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: Source/core/svg/SVGFEImageElement.cpp

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGFEConvolveMatrixElement.cpp ('k') | Source/core/svg/SVGFitToViewBox.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 clearResourceReferences(); 66 clearResourceReferences();
67 } 67 }
68 68
69 void SVGFEImageElement::clearResourceReferences() 69 void SVGFEImageElement::clearResourceReferences()
70 { 70 {
71 if (m_cachedImage) { 71 if (m_cachedImage) {
72 m_cachedImage->removeClient(this); 72 m_cachedImage->removeClient(this);
73 m_cachedImage = 0; 73 m_cachedImage = 0;
74 } 74 }
75 75
76 ASSERT(document()); 76 document().accessSVGExtensions()->removeAllTargetReferencesForElement(this);
77 document()->accessSVGExtensions()->removeAllTargetReferencesForElement(this) ;
78 } 77 }
79 78
80 void SVGFEImageElement::fetchImageResource() 79 void SVGFEImageElement::fetchImageResource()
81 { 80 {
82 FetchRequest request(ResourceRequest(ownerDocument()->completeURL(hrefCurren tValue())), localName()); 81 FetchRequest request(ResourceRequest(ownerDocument()->completeURL(hrefCurren tValue())), localName());
83 m_cachedImage = document()->fetcher()->fetchImage(request); 82 m_cachedImage = document().fetcher()->fetchImage(request);
84 83
85 if (m_cachedImage) 84 if (m_cachedImage)
86 m_cachedImage->addClient(this); 85 m_cachedImage->addClient(this);
87 } 86 }
88 87
89 void SVGFEImageElement::buildPendingResource() 88 void SVGFEImageElement::buildPendingResource()
90 { 89 {
91 clearResourceReferences(); 90 clearResourceReferences();
92 if (!inDocument()) 91 if (!inDocument())
93 return; 92 return;
94 93
95 String id; 94 String id;
96 Element* target = SVGURIReference::targetElementFromIRIString(hrefCurrentVal ue(), document(), &id); 95 Element* target = SVGURIReference::targetElementFromIRIString(hrefCurrentVal ue(), &document(), &id);
97 if (!target) { 96 if (!target) {
98 if (id.isEmpty()) 97 if (id.isEmpty())
99 fetchImageResource(); 98 fetchImageResource();
100 else { 99 else {
101 document()->accessSVGExtensions()->addPendingResource(id, this); 100 document().accessSVGExtensions()->addPendingResource(id, this);
102 ASSERT(hasPendingResources()); 101 ASSERT(hasPendingResources());
103 } 102 }
104 } else if (target->isSVGElement()) { 103 } else if (target->isSVGElement()) {
105 // Register us with the target in the dependencies map. Any change of hr efElement 104 // Register us with the target in the dependencies map. Any change of hr efElement
106 // that leads to relayout/repainting now informs us, so we can react to it. 105 // that leads to relayout/repainting now informs us, so we can react to it.
107 document()->accessSVGExtensions()->addElementReferencingTarget(this, toS VGElement(target)); 106 document().accessSVGExtensions()->addElementReferencingTarget(this, toSV GElement(target));
108 } 107 }
109 108
110 invalidate(); 109 invalidate();
111 } 110 }
112 111
113 bool SVGFEImageElement::isSupportedAttribute(const QualifiedName& attrName) 112 bool SVGFEImageElement::isSupportedAttribute(const QualifiedName& attrName)
114 { 113 {
115 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); 114 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
116 if (supportedAttributes.isEmpty()) { 115 if (supportedAttributes.isEmpty()) {
117 SVGURIReference::addSupportedAttributes(supportedAttributes); 116 SVGURIReference::addSupportedAttributes(supportedAttributes);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 return; 193 return;
195 194
196 if (RenderObject* renderer = this->renderer()) 195 if (RenderObject* renderer = this->renderer())
197 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); 196 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
198 } 197 }
199 198
200 PassRefPtr<FilterEffect> SVGFEImageElement::build(SVGFilterBuilder*, Filter* fil ter) 199 PassRefPtr<FilterEffect> SVGFEImageElement::build(SVGFilterBuilder*, Filter* fil ter)
201 { 200 {
202 if (m_cachedImage) 201 if (m_cachedImage)
203 return FEImage::createWithImage(filter, m_cachedImage->imageForRenderer( renderer()), preserveAspectRatioCurrentValue()); 202 return FEImage::createWithImage(filter, m_cachedImage->imageForRenderer( renderer()), preserveAspectRatioCurrentValue());
204 return FEImage::createWithIRIReference(filter, document(), hrefCurrentValue( ), preserveAspectRatioCurrentValue()); 203 return FEImage::createWithIRIReference(filter, &document(), hrefCurrentValue (), preserveAspectRatioCurrentValue());
205 } 204 }
206 205
207 void SVGFEImageElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) con st 206 void SVGFEImageElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) con st
208 { 207 {
209 SVGFilterPrimitiveStandardAttributes::addSubresourceAttributeURLs(urls); 208 SVGFilterPrimitiveStandardAttributes::addSubresourceAttributeURLs(urls);
210 209
211 addSubresourceURL(urls, document()->completeURL(hrefCurrentValue())); 210 addSubresourceURL(urls, document().completeURL(hrefCurrentValue()));
212 } 211 }
213 212
214 } 213 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGFEConvolveMatrixElement.cpp ('k') | Source/core/svg/SVGFitToViewBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698