| 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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 } | 678 } |
| 679 | 679 |
| 680 void HTMLImageElement::forceReload() const | 680 void HTMLImageElement::forceReload() const |
| 681 { | 681 { |
| 682 imageLoader().updateFromElement(ImageLoader::UpdateForcedReload, m_referrerP
olicy); | 682 imageLoader().updateFromElement(ImageLoader::UpdateForcedReload, m_referrerP
olicy); |
| 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.toLocalDOMWindow()); | 687 ASSERT(eventTarget.toLocalDOMWindow()); |
| 688 if (!cachedImage()) { | |
| 689 exceptionState.throwDOMException(InvalidStateError, "No image can be ret
rieved from the provided element."); | |
| 690 return ScriptPromise(); | |
| 691 } | |
| 692 if (cachedImage()->getImage()->isSVGImage()) { | |
| 693 SVGImage* image = toSVGImage(cachedImage()->getImage()); | |
| 694 if (!image->hasIntrinsicDimensions()) { | |
| 695 exceptionState.throwDOMException(InvalidStateError, "The image eleme
nt contains an SVG image without intrinsic dimensions."); | |
| 696 return ScriptPromise(); | |
| 697 } | |
| 698 } | |
| 699 if (!sw || !sh) { | 688 if (!sw || !sh) { |
| 700 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); | 689 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); |
| 701 return ScriptPromise(); | 690 return ScriptPromise(); |
| 702 } | 691 } |
| 703 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat
e(this, IntRect(sx, sy, sw, sh), eventTarget.toLocalDOMWindow()->document(), opt
ions)); | 692 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat
e(this, IntRect(sx, sy, sw, sh), eventTarget.toLocalDOMWindow()->document(), opt
ions)); |
| 704 } | 693 } |
| 705 | 694 |
| 706 void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior be
havior) | 695 void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior be
havior) |
| 707 { | 696 { |
| 708 if (!document().isActive()) | 697 if (!document().isActive()) |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 { | 805 { |
| 817 ImageResource* image = cachedImage(); | 806 ImageResource* image = cachedImage(); |
| 818 if (!image) | 807 if (!image) |
| 819 return IntSize(); | 808 return IntSize(); |
| 820 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat
ion(layoutObject()), 1.0f); | 809 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat
ion(layoutObject()), 1.0f); |
| 821 ASSERT(lSize.fraction().isZero()); | 810 ASSERT(lSize.fraction().isZero()); |
| 822 return IntSize(lSize.width(), lSize.height()); | 811 return IntSize(lSize.width(), lSize.height()); |
| 823 } | 812 } |
| 824 | 813 |
| 825 } // namespace blink | 814 } // namespace blink |
| OLD | NEW |