| 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 void HTMLImageElement::forceReload() const | 685 void HTMLImageElement::forceReload() const |
| 686 { | 686 { |
| 687 imageLoader().updateFromElement(ImageLoader::UpdateForcedReload, m_referrerP
olicy); | 687 imageLoader().updateFromElement(ImageLoader::UpdateForcedReload, m_referrerP
olicy); |
| 688 } | 688 } |
| 689 | 689 |
| 690 ScriptPromise HTMLImageElement::createImageBitmap(ScriptState* scriptState, Even
tTarget& eventTarget, int sx, int sy, int sw, int sh, const ImageBitmapOptions&
options, ExceptionState& exceptionState) | 690 ScriptPromise HTMLImageElement::createImageBitmap(ScriptState* scriptState, Even
tTarget& eventTarget, int sx, int sy, int sw, int sh, const ImageBitmapOptions&
options, ExceptionState& exceptionState) |
| 691 { | 691 { |
| 692 ASSERT(eventTarget.toLocalDOMWindow()); | 692 ASSERT(eventTarget.toLocalDOMWindow()); |
| 693 if (!sw || !sh) { | 693 if (!ImageBitmap::isSWSHValid(sw, sh, exceptionState)) |
| 694 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); | |
| 695 return ScriptPromise(); | 694 return ScriptPromise(); |
| 696 } | 695 if (!ImageBitmap::isResizeOptionValid(options, exceptionState)) |
| 696 return ScriptPromise(); |
| 697 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat
e(this, IntRect(sx, sy, sw, sh), eventTarget.toLocalDOMWindow()->document(), opt
ions)); | 697 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat
e(this, IntRect(sx, sy, sw, sh), eventTarget.toLocalDOMWindow()->document(), opt
ions)); |
| 698 } | 698 } |
| 699 | 699 |
| 700 void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior be
havior) | 700 void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior be
havior) |
| 701 { | 701 { |
| 702 if (!document().isActive()) | 702 if (!document().isActive()) |
| 703 return; | 703 return; |
| 704 | 704 |
| 705 bool foundURL = false; | 705 bool foundURL = false; |
| 706 ImageCandidate candidate = findBestFitImageFromPictureParent(); | 706 ImageCandidate candidate = findBestFitImageFromPictureParent(); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 { | 826 { |
| 827 ImageResource* image = cachedImage(); | 827 ImageResource* image = cachedImage(); |
| 828 if (!image) | 828 if (!image) |
| 829 return IntSize(); | 829 return IntSize(); |
| 830 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat
ion(layoutObject()), 1.0f); | 830 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat
ion(layoutObject()), 1.0f); |
| 831 ASSERT(lSize.fraction().isZero()); | 831 ASSERT(lSize.fraction().isZero()); |
| 832 return IntSize(lSize.width(), lSize.height()); | 832 return IntSize(lSize.width(), lSize.height()); |
| 833 } | 833 } |
| 834 | 834 |
| 835 } // namespace blink | 835 } // namespace blink |
| OLD | NEW |