| 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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 } | 683 } |
| 684 | 684 |
| 685 ScriptPromise HTMLImageElement::createImageBitmap(ScriptState* scriptState, Even
tTarget& eventTarget, int sx, int sy, int sw, int sh, const ImageBitmapOptions&
options, ExceptionState& exceptionState) | 685 ScriptPromise HTMLImageElement::createImageBitmap(ScriptState* scriptState, Even
tTarget& eventTarget, int sx, int sy, int sw, int sh, const ImageBitmapOptions&
options, ExceptionState& exceptionState) |
| 686 { | 686 { |
| 687 ASSERT(eventTarget.toDOMWindow()); | 687 ASSERT(eventTarget.toDOMWindow()); |
| 688 if (!cachedImage()) { | 688 if (!cachedImage()) { |
| 689 exceptionState.throwDOMException(InvalidStateError, "No image can be ret
rieved from the provided element."); | 689 exceptionState.throwDOMException(InvalidStateError, "No image can be ret
rieved from the provided element."); |
| 690 return ScriptPromise(); | 690 return ScriptPromise(); |
| 691 } | 691 } |
| 692 if (cachedImage()->getImage()->isSVGImage()) { | 692 if (cachedImage()->getImage()->isSVGImage()) { |
| 693 exceptionState.throwDOMException(InvalidStateError, "The image element c
ontains an SVG image, which is unsupported."); | 693 SVGImage* image = toSVGImage(cachedImage()->getImage()); |
| 694 return ScriptPromise(); | 694 if (!image->hasIntrinsicDimensions()) { |
| 695 exceptionState.throwDOMException(InvalidStateError, "The image eleme
nt contains an SVG image without intrinsic dimensions."); |
| 696 return ScriptPromise(); |
| 697 } |
| 695 } | 698 } |
| 696 if (!sw || !sh) { | 699 if (!sw || !sh) { |
| 697 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")); |
| 698 return ScriptPromise(); | 701 return ScriptPromise(); |
| 699 } | 702 } |
| 700 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat
e(this, IntRect(sx, sy, sw, sh), eventTarget.toDOMWindow()->document(), options)
); | 703 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat
e(this, IntRect(sx, sy, sw, sh), eventTarget.toDOMWindow()->document(), options)
); |
| 701 } | 704 } |
| 702 | 705 |
| 703 void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior be
havior) | 706 void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior be
havior) |
| 704 { | 707 { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 { | 816 { |
| 814 ImageResource* image = cachedImage(); | 817 ImageResource* image = cachedImage(); |
| 815 if (!image) | 818 if (!image) |
| 816 return IntSize(); | 819 return IntSize(); |
| 817 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat
ion(layoutObject()), 1.0f); | 820 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat
ion(layoutObject()), 1.0f); |
| 818 ASSERT(lSize.fraction().isZero()); | 821 ASSERT(lSize.fraction().isZero()); |
| 819 return IntSize(lSize.width(), lSize.height()); | 822 return IntSize(lSize.width(), lSize.height()); |
| 820 } | 823 } |
| 821 | 824 |
| 822 } // namespace blink | 825 } // namespace blink |
| OLD | NEW |