| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv
ed. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv
ed. |
| 5 * Copyright (C) 2010 Google Inc. All rights reserved. | 5 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 return ScriptPromise(); | 692 return ScriptPromise(); |
| 693 } | 693 } |
| 694 if (cachedImage()->image()->isSVGImage()) { | 694 if (cachedImage()->image()->isSVGImage()) { |
| 695 exceptionState.throwDOMException(InvalidStateError, "The image element c
ontains an SVG image, which is unsupported."); | 695 exceptionState.throwDOMException(InvalidStateError, "The image element c
ontains an SVG image, which is unsupported."); |
| 696 return ScriptPromise(); | 696 return ScriptPromise(); |
| 697 } | 697 } |
| 698 if (!sw || !sh) { | 698 if (!sw || !sh) { |
| 699 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); | 699 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); |
| 700 return ScriptPromise(); | 700 return ScriptPromise(); |
| 701 } | 701 } |
| 702 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat
e(this, IntRect(sx, sy, sw, sh), eventTarget.toDOMWindow()->document())); | 702 if (!cachedImage()->image()->currentFrameHasSingleSecurityOrigin()) { |
| 703 exceptionState.throwSecurityError("The source image contains image data
from multiple origins."); |
| 704 return ScriptPromise(); |
| 705 } |
| 706 Document* document = eventTarget.toDOMWindow()->document(); |
| 707 if (!cachedImage()->passesAccessControlCheck(document->securityOrigin()) &&
document->securityOrigin()->taintsCanvas(src())) { |
| 708 exceptionState.throwSecurityError("Cross-origin access to the source ima
ge is denied."); |
| 709 return ScriptPromise(); |
| 710 } |
| 711 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat
e(this, IntRect(sx, sy, sw, sh))); |
| 703 } | 712 } |
| 704 | 713 |
| 705 void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior be
havior) | 714 void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior be
havior) |
| 706 { | 715 { |
| 707 if (!document().isActive()) | 716 if (!document().isActive()) |
| 708 return; | 717 return; |
| 709 | 718 |
| 710 bool foundURL = false; | 719 bool foundURL = false; |
| 711 ImageCandidate candidate = findBestFitImageFromPictureParent(); | 720 ImageCandidate candidate = findBestFitImageFromPictureParent(); |
| 712 if (!candidate.isEmpty()) { | 721 if (!candidate.isEmpty()) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 { | 814 { |
| 806 ImageResource* image = cachedImage(); | 815 ImageResource* image = cachedImage(); |
| 807 if (!image) | 816 if (!image) |
| 808 return IntSize(); | 817 return IntSize(); |
| 809 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat
ion(layoutObject()), 1.0f); | 818 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat
ion(layoutObject()), 1.0f); |
| 810 ASSERT(lSize.fraction().isZero()); | 819 ASSERT(lSize.fraction().isZero()); |
| 811 return IntSize(lSize.width(), lSize.height()); | 820 return IntSize(lSize.width(), lSize.height()); |
| 812 } | 821 } |
| 813 | 822 |
| 814 } | 823 } |
| OLD | NEW |