Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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( | |
| 208 SourceImageStatus* status, | |
| 209 AccelerationHint hint, | |
| 210 SnapshotReason reason, | |
| 211 const FloatSize& defaultObjectSize) const { | |
| 212 if (!cachedImage()) { | |
|
Justin Novosad
2017/03/01 20:56:29
What happened to that extra check I saw you put in
fserb
2017/03/06 21:05:13
it's there. :)
| |
| 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); | |
|
Justin Novosad
2017/03/01 20:56:30
This needs to be tested in a layout test. Example
fserb
2017/03/06 21:05:13
done.
| |
| 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 width(); | |
| 247 return cachedImage()->getImage()->width(); | |
| 248 } | |
| 249 | |
| 250 int SVGImageElement::sourceHeight() { | |
| 251 if (!cachedImage()) | |
| 252 return height(); | |
| 253 return cachedImage()->getImage()->height(); | |
| 254 } | |
| 255 | |
| 207 } // namespace blink | 256 } // namespace blink |
| OLD | NEW |