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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGImageElement.cpp

Issue 2723093004: Adds SVGImageElement as a CanvasImageSource (Closed)
Patch Set: Tests added Created 3 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Rob Buis <buis@kde.org>
4 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> 4 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 197
198 const AtomicString SVGImageElement::imageSourceURL() const { 198 const AtomicString SVGImageElement::imageSourceURL() const {
199 return AtomicString(hrefString()); 199 return AtomicString(hrefString());
200 } 200 }
201 201
202 void SVGImageElement::didMoveToNewDocument(Document& oldDocument) { 202 void SVGImageElement::didMoveToNewDocument(Document& oldDocument) {
203 imageLoader().elementDidMoveToNewDocument(); 203 imageLoader().elementDidMoveToNewDocument();
204 SVGGraphicsElement::didMoveToNewDocument(oldDocument); 204 SVGGraphicsElement::didMoveToNewDocument(oldDocument);
205 } 205 }
206 206
207 PassRefPtr<Image> SVGImageElement::getSourceImageForCanvas(
fs 2017/03/01 21:20:41 This (and other method implementations) appear to
fserb 2017/03/06 21:05:13 Done.
208 SourceImageStatus* status,
209 AccelerationHint hint,
210 SnapshotReason reason,
211 const FloatSize& defaultObjectSize) const {
212 if (!imageLoader().imageComplete() || !cachedImage()) {
213 *status = IncompleteSourceImageStatus;
214 return nullptr;
215 }
216
217 if (cachedImage()->errorOccurred()) {
218 *status = UndecodableSourceImageStatus;
219 return nullptr;
220 }
221
222 *status = NormalSourceImageStatus;
223 return cachedImage()->getImage()->imageForDefaultFrame();
224 }
225
226 bool SVGImageElement::wouldTaintOrigin(
227 SecurityOrigin* destinationSecurityOrigin) const {
228 if (!cachedImage())
229 return false;
230 return !cachedImage()->isAccessAllowed(destinationSecurityOrigin);
231 }
232
233 FloatSize SVGImageElement::elementSize(
234 const FloatSize& defaultObjectSize) const {
235 if (!cachedImage())
236 return FloatSize();
237 return FloatSize(cachedImage()->getImage()->size());
238 }
239
240 bool SVGImageElement::isAccelerated() const {
241 return false;
242 }
243
244 int SVGImageElement::sourceWidth() {
245 if (!cachedImage())
246 return 0;
247 return cachedImage()->getImage()->width();
248 }
249
250 int SVGImageElement::sourceHeight() {
251 if (!cachedImage())
252 return 0;
253 return cachedImage()->getImage()->height();
254 }
255
207 } // namespace blink 256 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698