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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 return ScriptPromise(); | 693 return ScriptPromise(); |
694 } | 694 } |
695 if (cachedImage()->image()->isSVGImage()) { | 695 if (cachedImage()->image()->isSVGImage()) { |
696 exceptionState.throwDOMException(InvalidStateError, "The image element c
ontains an SVG image, which is unsupported."); | 696 exceptionState.throwDOMException(InvalidStateError, "The image element c
ontains an SVG image, which is unsupported."); |
697 return ScriptPromise(); | 697 return ScriptPromise(); |
698 } | 698 } |
699 if (!sw || !sh) { | 699 if (!sw || !sh) { |
700 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); | 700 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); |
701 return ScriptPromise(); | 701 return ScriptPromise(); |
702 } | 702 } |
703 if (!cachedImage()->image()->currentFrameHasSingleSecurityOrigin()) { | |
704 exceptionState.throwSecurityError("The source image contains image data
from multiple origins."); | |
705 return ScriptPromise(); | |
706 } | |
707 Document* document = eventTarget.toDOMWindow()->document(); | 703 Document* document = eventTarget.toDOMWindow()->document(); |
708 if (!cachedImage()->passesAccessControlCheck(document->securityOrigin()) &&
document->securityOrigin()->taintsCanvas(src())) { | 704 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat
e(this, IntRect(sx, sy, sw, sh), |
709 exceptionState.throwSecurityError("Cross-origin access to the source ima
ge is denied."); | 705 !(!cachedImage()->image()->currentFrameHasSingleSecurityOrigin() |
710 return ScriptPromise(); | 706 || (!cachedImage()->passesAccessControlCheck(document->securityOrigin()) &&
document->securityOrigin()->taintsCanvas(src()))))); |
711 } | |
712 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat
e(this, IntRect(sx, sy, sw, sh))); | |
713 } | 707 } |
714 | 708 |
715 void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior be
havior) | 709 void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior be
havior) |
716 { | 710 { |
717 if (!document().isActive()) | 711 if (!document().isActive()) |
718 return; | 712 return; |
719 | 713 |
720 bool foundURL = false; | 714 bool foundURL = false; |
721 ImageCandidate candidate = findBestFitImageFromPictureParent(); | 715 ImageCandidate candidate = findBestFitImageFromPictureParent(); |
722 if (!candidate.isEmpty()) { | 716 if (!candidate.isEmpty()) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 { | 809 { |
816 ImageResource* image = cachedImage(); | 810 ImageResource* image = cachedImage(); |
817 if (!image) | 811 if (!image) |
818 return IntSize(); | 812 return IntSize(); |
819 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat
ion(layoutObject()), 1.0f); | 813 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat
ion(layoutObject()), 1.0f); |
820 ASSERT(lSize.fraction().isZero()); | 814 ASSERT(lSize.fraction().isZero()); |
821 return IntSize(lSize.width(), lSize.height()); | 815 return IntSize(lSize.width(), lSize.height()); |
822 } | 816 } |
823 | 817 |
824 } | 818 } |
OLD | NEW |