| 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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 // If it doesn't exist, we just return the default. | 680 // If it doesn't exist, we just return the default. |
| 681 sourceSizeValue(element, document(), value); | 681 sourceSizeValue(element, document(), value); |
| 682 return value; | 682 return value; |
| 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, Optional<IntRect> cropRect, const ImageBitmapOptions& opti
ons, ExceptionState& exceptionState) |
| 691 { | 691 { |
| 692 ASSERT(eventTarget.toLocalDOMWindow()); | 692 ASSERT(eventTarget.toLocalDOMWindow()); |
| 693 if (!sw || !sh) { | 693 if ((cropRect && !ImageBitmap::isSourceSizeValid(cropRect->width(), cropRect
->height(), exceptionState)) |
| 694 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); | 694 || !ImageBitmap::isSourceSizeValid(bitmapSourceSize().width(), bitmapSou
rceSize().height(), exceptionState)) |
| 695 return ScriptPromise(); | 695 return ScriptPromise(); |
| 696 } | 696 if (!ImageBitmap::isResizeOptionValid(options, exceptionState)) |
| 697 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat
e(this, IntRect(sx, sy, sw, sh), eventTarget.toLocalDOMWindow()->document(), opt
ions)); | 697 return ScriptPromise(); |
| 698 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat
e(this, cropRect, eventTarget.toLocalDOMWindow()->document(), options)); |
| 698 } | 699 } |
| 699 | 700 |
| 700 void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior be
havior) | 701 void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior be
havior) |
| 701 { | 702 { |
| 702 if (!document().isActive()) | 703 if (!document().isActive()) |
| 703 return; | 704 return; |
| 704 | 705 |
| 705 bool foundURL = false; | 706 bool foundURL = false; |
| 706 ImageCandidate candidate = findBestFitImageFromPictureParent(); | 707 ImageCandidate candidate = findBestFitImageFromPictureParent(); |
| 707 if (!candidate.isEmpty()) { | 708 if (!candidate.isEmpty()) { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 { | 827 { |
| 827 ImageResource* image = cachedImage(); | 828 ImageResource* image = cachedImage(); |
| 828 if (!image) | 829 if (!image) |
| 829 return IntSize(); | 830 return IntSize(); |
| 830 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat
ion(layoutObject()), 1.0f); | 831 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat
ion(layoutObject()), 1.0f); |
| 831 ASSERT(lSize.fraction().isZero()); | 832 ASSERT(lSize.fraction().isZero()); |
| 832 return IntSize(lSize.width(), lSize.height()); | 833 return IntSize(lSize.width(), lSize.height()); |
| 833 } | 834 } |
| 834 | 835 |
| 835 } // namespace blink | 836 } // namespace blink |
| OLD | NEW |