| 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 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 #ifndef ImageResource_h | 23 #ifndef ImageResource_h |
| 24 #define ImageResource_h | 24 #define ImageResource_h |
| 25 | 25 |
| 26 #include "core/CoreExport.h" | 26 #include "core/CoreExport.h" |
| 27 #include "core/fetch/ResourcePtr.h" | 27 #include "core/fetch/ResourcePtr.h" |
| 28 #include "platform/geometry/IntRect.h" | 28 #include "platform/geometry/IntRect.h" |
| 29 #include "platform/geometry/IntSizeHash.h" | 29 #include "platform/geometry/IntSizeHash.h" |
| 30 #include "platform/geometry/LayoutSize.h" | 30 #include "platform/geometry/LayoutSize.h" |
| 31 #include "platform/graphics/ImageObserver.h" | 31 #include "platform/graphics/ImageObserver.h" |
| 32 #include "platform/graphics/ImageOrientation.h" |
| 32 #include "wtf/HashMap.h" | 33 #include "wtf/HashMap.h" |
| 33 | 34 |
| 34 namespace blink { | 35 namespace blink { |
| 35 | 36 |
| 36 class ImageResourceClient; | 37 class ImageResourceClient; |
| 37 class FetchRequest; | 38 class FetchRequest; |
| 38 class ResourceFetcher; | 39 class ResourceFetcher; |
| 39 class FloatSize; | 40 class FloatSize; |
| 40 class Length; | 41 class Length; |
| 41 class MemoryCache; | 42 class MemoryCache; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 59 | 60 |
| 60 blink::Image* image(); // Returns the nullImage() if the image is not availa
ble yet. | 61 blink::Image* image(); // Returns the nullImage() if the image is not availa
ble yet. |
| 61 bool hasImage() const { return m_image.get(); } | 62 bool hasImage() const { return m_image.get(); } |
| 62 // Side effect: ensures decoded image is in cache, therefore should only be
called when about to draw the image. | 63 // Side effect: ensures decoded image is in cache, therefore should only be
called when about to draw the image. |
| 63 bool currentFrameKnownToBeOpaque(const LayoutObject*); | 64 bool currentFrameKnownToBeOpaque(const LayoutObject*); |
| 64 | 65 |
| 65 static std::pair<blink::Image*, float> brokenImage(float deviceScaleFactor);
// Returns an image and the image's resolution scale factor. | 66 static std::pair<blink::Image*, float> brokenImage(float deviceScaleFactor);
// Returns an image and the image's resolution scale factor. |
| 66 bool willPaintBrokenImage() const; | 67 bool willPaintBrokenImage() const; |
| 67 | 68 |
| 68 // Assumes that image rotation or scale doesn't effect the image size being
empty or not. | 69 // Assumes that image rotation or scale doesn't effect the image size being
empty or not. |
| 69 bool canRender() { return !errorOccurred() && !imageSizeForLayoutObject(null
ptr, 1).isEmpty(); } | 70 bool canRender() { return !errorOccurred() && !imageSize(DoNotRespectImageOr
ientation, 1).isEmpty(); } |
| 70 | 71 |
| 71 bool usesImageContainerSize() const; | 72 bool usesImageContainerSize() const; |
| 72 bool imageHasRelativeWidth() const; | 73 bool imageHasRelativeWidth() const; |
| 73 bool imageHasRelativeHeight() const; | 74 bool imageHasRelativeHeight() const; |
| 74 // The device pixel ratio we got from the server for this image, or 1.0. | 75 // The device pixel ratio we got from the server for this image, or 1.0. |
| 75 float devicePixelRatioHeaderValue() const { return m_devicePixelRatioHeaderV
alue; } | 76 float devicePixelRatioHeaderValue() const { return m_devicePixelRatioHeaderV
alue; } |
| 76 bool hasDevicePixelRatioHeaderValue() const { return m_hasDevicePixelRatioHe
aderValue; } | 77 bool hasDevicePixelRatioHeaderValue() const { return m_hasDevicePixelRatioHe
aderValue; } |
| 77 | 78 |
| 78 enum SizeType { | 79 enum SizeType { |
| 79 IntrinsicSize, // Report the intrinsic size. | 80 IntrinsicSize, // Report the intrinsic size. |
| 80 IntrinsicCorrectedToDPR, // Report the intrinsic size corrected to accou
nt for image density. | 81 IntrinsicCorrectedToDPR, // Report the intrinsic size corrected to accou
nt for image density. |
| 81 }; | 82 }; |
| 82 // This method takes a zoom multiplier that can be used to increase the natu
ral size of the image by the zoom. | 83 // This method takes a zoom multiplier that can be used to increase the natu
ral size of the image by the zoom. |
| 83 LayoutSize imageSizeForLayoutObject(const LayoutObject*, float multiplier, S
izeType = IntrinsicSize); // returns the size of the complete image. | 84 LayoutSize imageSize(RespectImageOrientationEnum shouldRespectImageOrientati
on, float multiplier, SizeType = IntrinsicSize); |
| 84 void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHei
ght, FloatSize& intrinsicRatio); | 85 void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHei
ght, FloatSize& intrinsicRatio); |
| 85 | 86 |
| 86 bool isAccessAllowed(SecurityOrigin*); | 87 bool isAccessAllowed(SecurityOrigin*); |
| 87 | 88 |
| 88 void updateImageAnimationPolicy(); | 89 void updateImageAnimationPolicy(); |
| 89 | 90 |
| 90 void didAddClient(ResourceClient*) override; | 91 void didAddClient(ResourceClient*) override; |
| 91 void didRemoveClient(ResourceClient*) override; | 92 void didRemoveClient(ResourceClient*) override; |
| 92 | 93 |
| 93 void allClientsRemoved() override; | 94 void allClientsRemoved() override; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 144 |
| 144 RefPtr<blink::Image> m_image; | 145 RefPtr<blink::Image> m_image; |
| 145 bool m_hasDevicePixelRatioHeaderValue; | 146 bool m_hasDevicePixelRatioHeaderValue; |
| 146 }; | 147 }; |
| 147 | 148 |
| 148 DEFINE_RESOURCE_TYPE_CASTS(Image); | 149 DEFINE_RESOURCE_TYPE_CASTS(Image); |
| 149 | 150 |
| 150 } | 151 } |
| 151 | 152 |
| 152 #endif | 153 #endif |
| OLD | NEW |