| OLD | NEW |
| 1 /* | 1 /* |
| 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
| 3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org> | 3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org> |
| 4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 5 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 5 Copyright (C) 2004, 2005, 2006, 2007 Apple 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 22 matching lines...) Expand all Loading... |
| 33 #include "wtf/HashMap.h" | 33 #include "wtf/HashMap.h" |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 class ImageResourceClient; | 37 class ImageResourceClient; |
| 38 class FetchRequest; | 38 class FetchRequest; |
| 39 class ResourceFetcher; | 39 class ResourceFetcher; |
| 40 class FloatSize; | 40 class FloatSize; |
| 41 class Length; | 41 class Length; |
| 42 class MemoryCache; | 42 class MemoryCache; |
| 43 class LayoutObject; | |
| 44 class SecurityOrigin; | 43 class SecurityOrigin; |
| 45 | 44 |
| 46 class CORE_EXPORT ImageResource final : public Resource, public ImageObserver { | 45 class CORE_EXPORT ImageResource final : public Resource, public ImageObserver { |
| 47 friend class MemoryCache; | 46 friend class MemoryCache; |
| 48 | 47 |
| 49 public: | 48 public: |
| 50 typedef ImageResourceClient ClientType; | 49 typedef ImageResourceClient ClientType; |
| 51 | 50 |
| 52 static ResourcePtr<ImageResource> fetch(FetchRequest&, ResourceFetcher*); | 51 static ResourcePtr<ImageResource> fetch(FetchRequest&, ResourceFetcher*); |
| 53 | 52 |
| 54 ImageResource(blink::Image*); | 53 ImageResource(blink::Image*); |
| 55 // Exposed for testing | 54 // Exposed for testing |
| 56 ImageResource(const ResourceRequest&, blink::Image*); | 55 ImageResource(const ResourceRequest&, blink::Image*); |
| 57 ~ImageResource() override; | 56 ~ImageResource() override; |
| 58 | 57 |
| 59 void load(ResourceFetcher*, const ResourceLoaderOptions&) override; | 58 void load(ResourceFetcher*, const ResourceLoaderOptions&) override; |
| 60 | 59 |
| 61 blink::Image* image(); // Returns the nullImage() if the image is not availa
ble yet. | 60 blink::Image* image(); // Returns the nullImage() if the image is not availa
ble yet. |
| 62 bool hasImage() const { return m_image.get(); } | 61 bool hasImage() const { return m_image.get(); } |
| 63 // Side effect: ensures decoded image is in cache, therefore should only be
called when about to draw the image. | |
| 64 bool currentFrameKnownToBeOpaque(const LayoutObject*); | |
| 65 | 62 |
| 66 static std::pair<blink::Image*, float> brokenImage(float deviceScaleFactor);
// Returns an image and the image's resolution scale factor. | 63 static std::pair<blink::Image*, float> brokenImage(float deviceScaleFactor);
// Returns an image and the image's resolution scale factor. |
| 67 bool willPaintBrokenImage() const; | 64 bool willPaintBrokenImage() const; |
| 68 | 65 |
| 69 // Assumes that image rotation or scale doesn't effect the image size being
empty or not. | 66 // Assumes that image rotation or scale doesn't effect the image size being
empty or not. |
| 70 bool canRender() { return !errorOccurred() && !imageSize(DoNotRespectImageOr
ientation, 1).isEmpty(); } | 67 bool canRender() { return !errorOccurred() && !imageSize(DoNotRespectImageOr
ientation, 1).isEmpty(); } |
| 71 | 68 |
| 72 bool usesImageContainerSize() const; | 69 bool usesImageContainerSize() const; |
| 73 bool imageHasRelativeWidth() const; | 70 bool imageHasRelativeWidth() const; |
| 74 bool imageHasRelativeHeight() const; | 71 bool imageHasRelativeHeight() const; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 141 |
| 145 RefPtr<blink::Image> m_image; | 142 RefPtr<blink::Image> m_image; |
| 146 bool m_hasDevicePixelRatioHeaderValue; | 143 bool m_hasDevicePixelRatioHeaderValue; |
| 147 }; | 144 }; |
| 148 | 145 |
| 149 DEFINE_RESOURCE_TYPE_CASTS(Image); | 146 DEFINE_RESOURCE_TYPE_CASTS(Image); |
| 150 | 147 |
| 151 } | 148 } |
| 152 | 149 |
| 153 #endif | 150 #endif |
| OLD | NEW |