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

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: 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
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 static std::pair<WebCore::Image*, float> brokenImage(float deviceScaleFactor ); // Returns an image and the image's resolution scale factor. 58 static std::pair<WebCore::Image*, float> brokenImage(float deviceScaleFactor ); // Returns an image and the image's resolution scale factor.
59 bool willPaintBrokenImage() const; 59 bool willPaintBrokenImage() const;
60 60
61 bool canRender(const RenderObject* renderer, float multiplier) { return !err orOccurred() && !imageSizeForRenderer(renderer, multiplier).isEmpty(); } 61 bool canRender(const RenderObject* renderer, float multiplier) { return !err orOccurred() && !imageSizeForRenderer(renderer, multiplier).isEmpty(); }
62 62
63 void setContainerSizeForRenderer(const ImageResourceClient*, const IntSize&, float); 63 void setContainerSizeForRenderer(const ImageResourceClient*, const IntSize&, float);
64 bool usesImageContainerSize() const; 64 bool usesImageContainerSize() const;
65 bool imageHasRelativeWidth() const; 65 bool imageHasRelativeWidth() const;
66 bool imageHasRelativeHeight() const; 66 bool imageHasRelativeHeight() const;
67 // The device pixel resolution we got from the server for this image, or 1.0
pdr. 2013/10/26 01:26:31 Nit: change this to: // The device pixel ratio we
68 float dprHeaderValue() const { return m_dprHeaderValue; }
pdr. 2013/10/26 01:26:31 Bikeshed: Do you mind spelling dpr out? For exampl
69 bool hasDprHeaderValue() const { return m_hasDprHeaderValue; }
67 70
68 enum SizeType { 71 enum SizeType {
69 NormalSize, // Report the size of the image associated with a certain re nderer 72 NormalSize, // Report the size of the image associated with a certain re nderer
70 IntrinsicSize // Report the intrinsic size, i.e. ignore whatever has bee n set extrinsically. 73 IntrinsicSize // Report the intrinsic size, i.e. ignore whatever has bee n set extrinsically.
71 }; 74 };
72 // This method takes a zoom multiplier that can be used to increase the natu ral size of the image by the zoom. 75 // This method takes a zoom multiplier that can be used to increase the natu ral size of the image by the zoom.
73 LayoutSize imageSizeForRenderer(const RenderObject*, float multiplier, SizeT ype = NormalSize); // returns the size of the complete image. 76 LayoutSize imageSizeForRenderer(const RenderObject*, float multiplier, SizeT ype = NormalSize); // returns the size of the complete image.
74 void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHei ght, FloatSize& intrinsicRatio); 77 void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHei ght, FloatSize& intrinsicRatio);
75 78
76 virtual void didAddClient(ResourceClient*); 79 virtual void didAddClient(ResourceClient*);
(...skipping 29 matching lines...) Expand all
106 void updateImage(bool allDataReceived); 109 void updateImage(bool allDataReceived);
107 void clearImage(); 110 void clearImage();
108 // If not null, changeRect is the changed part of the image. 111 // If not null, changeRect is the changed part of the image.
109 void notifyObservers(const IntRect* changeRect = 0); 112 void notifyObservers(const IntRect* changeRect = 0);
110 113
111 virtual void switchClientsToRevalidatedResource() OVERRIDE; 114 virtual void switchClientsToRevalidatedResource() OVERRIDE;
112 115
113 typedef pair<IntSize, float> SizeAndZoom; 116 typedef pair<IntSize, float> SizeAndZoom;
114 typedef HashMap<const ImageResourceClient*, SizeAndZoom> ContainerSizeReques ts; 117 typedef HashMap<const ImageResourceClient*, SizeAndZoom> ContainerSizeReques ts;
115 ContainerSizeRequests m_pendingContainerSizeRequests; 118 ContainerSizeRequests m_pendingContainerSizeRequests;
119 float m_dprHeaderValue;
116 120
117 RefPtr<WebCore::Image> m_image; 121 RefPtr<WebCore::Image> m_image;
118 OwnPtr<SVGImageCache> m_svgImageCache; 122 OwnPtr<SVGImageCache> m_svgImageCache;
119 bool m_loadingMultipartContent; 123 bool m_loadingMultipartContent;
124 bool m_hasDprHeaderValue;
120 }; 125 };
121 126
122 } 127 }
123 128
124 #endif 129 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698