| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 return new ImageResource(request, ResourceLoaderOptions()); | 68 return new ImageResource(request, ResourceLoaderOptions()); |
| 69 } | 69 } |
| 70 | 70 |
| 71 ~ImageResource() override; | 71 ~ImageResource() override; |
| 72 | 72 |
| 73 blink::Image* | 73 blink::Image* |
| 74 getImage(); // Returns the nullImage() if the image is not available yet. | 74 getImage(); // Returns the nullImage() if the image is not available yet. |
| 75 bool hasImage() const { return m_image.get(); } | 75 bool hasImage() const { return m_image.get(); } |
| 76 | 76 |
| 77 static std::pair<blink::Image*, float> brokenImage( | 77 static std::pair<blink::Image*, float> brokenImage( |
| 78 float | 78 float deviceScaleFactor); // Returns an image and the image's resolution |
| 79 deviceScaleFactor); // Returns an image and the image's resolution sc
ale factor. | 79 // scale factor. |
| 80 bool willPaintBrokenImage() const; | 80 bool willPaintBrokenImage() const; |
| 81 | 81 |
| 82 bool usesImageContainerSize() const; | 82 bool usesImageContainerSize() const; |
| 83 bool imageHasRelativeSize() const; | 83 bool imageHasRelativeSize() const; |
| 84 // The device pixel ratio we got from the server for this image, or 1.0. | 84 // The device pixel ratio we got from the server for this image, or 1.0. |
| 85 float devicePixelRatioHeaderValue() const { | 85 float devicePixelRatioHeaderValue() const { |
| 86 return m_devicePixelRatioHeaderValue; | 86 return m_devicePixelRatioHeaderValue; |
| 87 } | 87 } |
| 88 bool hasDevicePixelRatioHeaderValue() const { | 88 bool hasDevicePixelRatioHeaderValue() const { |
| 89 return m_hasDevicePixelRatioHeaderValue; | 89 return m_hasDevicePixelRatioHeaderValue; |
| 90 } | 90 } |
| 91 | 91 |
| 92 enum SizeType { | 92 enum SizeType { |
| 93 IntrinsicSize, // Report the intrinsic size. | 93 // Report the intrinsic size. |
| 94 IntrinsicCorrectedToDPR, // Report the intrinsic size corrected to account
for image density. | 94 IntrinsicSize, |
| 95 |
| 96 // Report the intrinsic size corrected to account for image density. |
| 97 IntrinsicCorrectedToDPR, |
| 95 }; | 98 }; |
| 96 // This method takes a zoom multiplier that can be used to increase the natura
l size of the image by the zoom. | 99 |
| 100 // This method takes a zoom multiplier that can be used to increase the |
| 101 // natural size of the image by the zoom. |
| 97 LayoutSize imageSize( | 102 LayoutSize imageSize( |
| 98 RespectImageOrientationEnum shouldRespectImageOrientation, | 103 RespectImageOrientationEnum shouldRespectImageOrientation, |
| 99 float multiplier, | 104 float multiplier, |
| 100 SizeType = IntrinsicSize); | 105 SizeType = IntrinsicSize); |
| 101 | 106 |
| 102 bool isAccessAllowed(SecurityOrigin*); | 107 bool isAccessAllowed(SecurityOrigin*); |
| 103 | 108 |
| 104 void updateImageAnimationPolicy(); | 109 void updateImageAnimationPolicy(); |
| 105 | 110 |
| 106 // If this ImageResource has the Lo-Fi response headers, reload it with | 111 // If this ImageResource has the Lo-Fi response headers, reload it with the |
| 107 // the Lo-Fi state set to off and bypassing the cache. | 112 // Lo-Fi state set to off and bypassing the cache. |
| 108 void reloadIfLoFi(ResourceFetcher*); | 113 void reloadIfLoFi(ResourceFetcher*); |
| 109 | 114 |
| 110 void didAddClient(ResourceClient*) override; | 115 void didAddClient(ResourceClient*) override; |
| 111 | 116 |
| 112 void addObserver(ImageResourceObserver*); | 117 void addObserver(ImageResourceObserver*); |
| 113 void removeObserver(ImageResourceObserver*); | 118 void removeObserver(ImageResourceObserver*); |
| 114 | 119 |
| 115 ResourcePriority priorityFromObservers() override; | 120 ResourcePriority priorityFromObservers() override; |
| 116 | 121 |
| 117 void allClientsAndObserversRemoved() override; | 122 void allClientsAndObserversRemoved() override; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 bool m_hasDevicePixelRatioHeaderValue; | 204 bool m_hasDevicePixelRatioHeaderValue; |
| 200 HashCountedSet<ImageResourceObserver*> m_observers; | 205 HashCountedSet<ImageResourceObserver*> m_observers; |
| 201 HashCountedSet<ImageResourceObserver*> m_finishedObservers; | 206 HashCountedSet<ImageResourceObserver*> m_finishedObservers; |
| 202 }; | 207 }; |
| 203 | 208 |
| 204 DEFINE_RESOURCE_TYPE_CASTS(Image); | 209 DEFINE_RESOURCE_TYPE_CASTS(Image); |
| 205 | 210 |
| 206 } // namespace blink | 211 } // namespace blink |
| 207 | 212 |
| 208 #endif | 213 #endif |
| OLD | NEW |