| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 void load(ResourceFetcher*, const ResourceLoaderOptions&) override; | 66 void load(ResourceFetcher*, const ResourceLoaderOptions&) override; |
| 67 | 67 |
| 68 blink::Image* image(); // Returns the nullImage() if the image is not availa
ble yet. | 68 blink::Image* image(); // Returns the nullImage() if the image is not availa
ble yet. |
| 69 bool hasImage() const { return m_image.get(); } | 69 bool hasImage() const { return m_image.get(); } |
| 70 | 70 |
| 71 static std::pair<blink::Image*, float> brokenImage(float deviceScaleFactor);
// Returns an image and the image's resolution scale factor. | 71 static std::pair<blink::Image*, float> brokenImage(float deviceScaleFactor);
// Returns an image and the image's resolution scale factor. |
| 72 bool willPaintBrokenImage() const; | 72 bool willPaintBrokenImage() const; |
| 73 | 73 |
| 74 // Assumes that image rotation or scale doesn't effect the image size being
empty or not. | 74 // Assumes that image rotation or scale doesn't effect the image size being
empty or not. |
| 75 bool canRender() { return !errorOccurred() && !imageSize(DoNotRespectImageOr
ientation, 1).isEmpty(); } | 75 bool canRender() { return !errorOccurred() && !defaultConcreteObjectSize(DoN
otRespectImageOrientation, 1).isEmpty(); } |
| 76 | 76 |
| 77 bool usesImageContainerSize() const; | 77 bool usesImageContainerSize() const; |
| 78 bool imageHasRelativeSize() const; | 78 bool imageHasRelativeSize() const; |
| 79 // The device pixel ratio we got from the server for this image, or 1.0. | 79 // The device pixel ratio we got from the server for this image, or 1.0. |
| 80 float devicePixelRatioHeaderValue() const { return m_devicePixelRatioHeaderV
alue; } | 80 float devicePixelRatioHeaderValue() const { return m_devicePixelRatioHeaderV
alue; } |
| 81 bool hasDevicePixelRatioHeaderValue() const { return m_hasDevicePixelRatioHe
aderValue; } | 81 bool hasDevicePixelRatioHeaderValue() const { return m_hasDevicePixelRatioHe
aderValue; } |
| 82 | 82 |
| 83 enum SizeType { | 83 enum SizeType { |
| 84 IntrinsicSize, // Report the intrinsic size. | 84 IntrinsicSize, // Report the intrinsic size. |
| 85 IntrinsicCorrectedToDPR, // Report the intrinsic size corrected to accou
nt for image density. | 85 IntrinsicCorrectedToDPR, // Report the intrinsic size corrected to accou
nt for image density. |
| 86 }; | 86 }; |
| 87 // This method takes a zoom multiplier that can be used to increase the natu
ral size of the image by the zoom. | 87 // This method takes a zoom multiplier that can be used to increase the natu
ral size of the image by the zoom. |
| 88 LayoutSize imageSize(RespectImageOrientationEnum shouldRespectImageOrientati
on, float multiplier, SizeType = IntrinsicSize); | 88 LayoutSize concreteObjectSize(const FloatSize& defaultObjectSize, RespectIma
geOrientationEnum shouldRespectImageOrientation, float multiplier, SizeType = In
trinsicSize); |
| 89 LayoutSize defaultConcreteObjectSize(RespectImageOrientationEnum shouldRespe
ctImageOrientation, float multiplier, SizeType sizeType = IntrinsicSize) |
| 90 { |
| 91 return concreteObjectSize(FloatSize(300, 150), shouldRespectImageOrienta
tion, multiplier, sizeType); |
| 92 } |
| 89 void computeIntrinsicDimensions(FloatSize& intrinsicSize, FloatSize& intrins
icRatio); | 93 void computeIntrinsicDimensions(FloatSize& intrinsicSize, FloatSize& intrins
icRatio); |
| 90 | 94 |
| 91 bool isAccessAllowed(SecurityOrigin*); | 95 bool isAccessAllowed(SecurityOrigin*); |
| 92 | 96 |
| 93 void updateImageAnimationPolicy(); | 97 void updateImageAnimationPolicy(); |
| 94 | 98 |
| 95 // If this ImageResource has the Lo-Fi response headers, reload it with | 99 // If this ImageResource has the Lo-Fi response headers, reload it with |
| 96 // the Lo-Fi state set to off and bypassing the cache. | 100 // the Lo-Fi state set to off and bypassing the cache. |
| 97 void reloadIfLoFi(ResourceFetcher*); | 101 void reloadIfLoFi(ResourceFetcher*); |
| 98 | 102 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 161 |
| 158 RefPtr<blink::Image> m_image; | 162 RefPtr<blink::Image> m_image; |
| 159 bool m_hasDevicePixelRatioHeaderValue; | 163 bool m_hasDevicePixelRatioHeaderValue; |
| 160 }; | 164 }; |
| 161 | 165 |
| 162 DEFINE_RESOURCE_TYPE_CASTS(Image); | 166 DEFINE_RESOURCE_TYPE_CASTS(Image); |
| 163 | 167 |
| 164 } // namespace blink | 168 } // namespace blink |
| 165 | 169 |
| 166 #endif | 170 #endif |
| OLD | NEW |