Chromium Code Reviews| Index: third_party/WebKit/Source/core/svg/SVGImageElement.cpp |
| diff --git a/third_party/WebKit/Source/core/svg/SVGImageElement.cpp b/third_party/WebKit/Source/core/svg/SVGImageElement.cpp |
| index 99f083eae214dccc6296751d4afa06fb065655c7..d2efdee99bdcd176ed9584731398d9576f65f1ec 100644 |
| --- a/third_party/WebKit/Source/core/svg/SVGImageElement.cpp |
| +++ b/third_party/WebKit/Source/core/svg/SVGImageElement.cpp |
| @@ -204,4 +204,53 @@ void SVGImageElement::didMoveToNewDocument(Document& oldDocument) { |
| SVGGraphicsElement::didMoveToNewDocument(oldDocument); |
| } |
| +PassRefPtr<Image> SVGImageElement::getSourceImageForCanvas( |
| + SourceImageStatus* status, |
| + AccelerationHint hint, |
| + SnapshotReason reason, |
| + const FloatSize& defaultObjectSize) const { |
| + 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. :)
|
| + *status = IncompleteSourceImageStatus; |
| + return nullptr; |
| + } |
| + |
| + if (cachedImage()->errorOccurred()) { |
| + *status = UndecodableSourceImageStatus; |
| + return nullptr; |
| + } |
| + |
| + *status = NormalSourceImageStatus; |
| + return cachedImage()->getImage()->imageForDefaultFrame(); |
| +} |
| + |
| +bool SVGImageElement::wouldTaintOrigin( |
| + SecurityOrigin* destinationSecurityOrigin) const { |
| + if (!cachedImage()) |
| + return false; |
| + 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.
|
| +} |
| + |
| +FloatSize SVGImageElement::elementSize( |
| + const FloatSize& defaultObjectSize) const { |
| + if (!cachedImage()) |
| + return FloatSize(); |
| + return FloatSize(cachedImage()->getImage()->size()); |
| +} |
| + |
| +bool SVGImageElement::isAccelerated() const { |
| + return false; |
| +} |
| + |
| +int SVGImageElement::sourceWidth() { |
| + if (!cachedImage()) |
| + return width(); |
| + return cachedImage()->getImage()->width(); |
| +} |
| + |
| +int SVGImageElement::sourceHeight() { |
| + if (!cachedImage()) |
| + return height(); |
| + return cachedImage()->getImage()->height(); |
| +} |
| + |
| } // namespace blink |