Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: Source/core/fetch/ImageResource.h

Issue 46313002: Support the DPR header for client hints. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: with cache tests Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/http/tests/resources/dpr.php ('k') | Source/core/fetch/ImageResource.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 static std::pair<WebCore::Image*, float> brokenImage(float deviceScaleFactor ); // Returns an image and the image's resolution scale factor. 59 static std::pair<WebCore::Image*, float> brokenImage(float deviceScaleFactor ); // Returns an image and the image's resolution scale factor.
60 bool willPaintBrokenImage() const; 60 bool willPaintBrokenImage() const;
61 61
62 bool canRender(const RenderObject* renderer, float multiplier) { return !err orOccurred() && !imageSizeForRenderer(renderer, multiplier).isEmpty(); } 62 bool canRender(const RenderObject* renderer, float multiplier) { return !err orOccurred() && !imageSizeForRenderer(renderer, multiplier).isEmpty(); }
63 63
64 void setContainerSizeForRenderer(const ImageResourceClient*, const IntSize&, float); 64 void setContainerSizeForRenderer(const ImageResourceClient*, const IntSize&, float);
65 bool usesImageContainerSize() const; 65 bool usesImageContainerSize() const;
66 bool imageHasRelativeWidth() const; 66 bool imageHasRelativeWidth() const;
67 bool imageHasRelativeHeight() const; 67 bool imageHasRelativeHeight() const;
68 // The device pixel ratio we got from the server for this image, or 1.0.
69 float devicePixelRatioHeaderValue() const { return m_devicePixelRatioHeaderV alue; }
70 bool hasDevicePixelRatioHeaderValue() const { return m_hasDevicePixelRatioHe aderValue; }
68 71
69 enum SizeType { 72 enum SizeType {
70 NormalSize, // Report the size of the image associated with a certain re nderer 73 NormalSize, // Report the size of the image associated with a certain re nderer
71 IntrinsicSize // Report the intrinsic size, i.e. ignore whatever has bee n set extrinsically. 74 IntrinsicSize // Report the intrinsic size, i.e. ignore whatever has bee n set extrinsically.
72 }; 75 };
73 // This method takes a zoom multiplier that can be used to increase the natu ral size of the image by the zoom. 76 // This method takes a zoom multiplier that can be used to increase the natu ral size of the image by the zoom.
74 LayoutSize imageSizeForRenderer(const RenderObject*, float multiplier, SizeT ype = NormalSize); // returns the size of the complete image. 77 LayoutSize imageSizeForRenderer(const RenderObject*, float multiplier, SizeT ype = NormalSize); // returns the size of the complete image.
75 void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHei ght, FloatSize& intrinsicRatio); 78 void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHei ght, FloatSize& intrinsicRatio);
76 79
77 bool isAccessAllowed(SecurityOrigin*); 80 bool isAccessAllowed(SecurityOrigin*);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 void updateImage(bool allDataReceived); 112 void updateImage(bool allDataReceived);
110 void clearImage(); 113 void clearImage();
111 // If not null, changeRect is the changed part of the image. 114 // If not null, changeRect is the changed part of the image.
112 void notifyObservers(const IntRect* changeRect = 0); 115 void notifyObservers(const IntRect* changeRect = 0);
113 116
114 virtual void switchClientsToRevalidatedResource() OVERRIDE; 117 virtual void switchClientsToRevalidatedResource() OVERRIDE;
115 118
116 typedef pair<IntSize, float> SizeAndZoom; 119 typedef pair<IntSize, float> SizeAndZoom;
117 typedef HashMap<const ImageResourceClient*, SizeAndZoom> ContainerSizeReques ts; 120 typedef HashMap<const ImageResourceClient*, SizeAndZoom> ContainerSizeReques ts;
118 ContainerSizeRequests m_pendingContainerSizeRequests; 121 ContainerSizeRequests m_pendingContainerSizeRequests;
122 float m_devicePixelRatioHeaderValue;
119 123
120 RefPtr<WebCore::Image> m_image; 124 RefPtr<WebCore::Image> m_image;
121 OwnPtr<SVGImageCache> m_svgImageCache; 125 OwnPtr<SVGImageCache> m_svgImageCache;
122 bool m_loadingMultipartContent; 126 bool m_loadingMultipartContent;
127 bool m_hasDevicePixelRatioHeaderValue;
123 }; 128 };
124 129
125 } 130 }
126 131
127 #endif 132 #endif
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/resources/dpr.php ('k') | Source/core/fetch/ImageResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698