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

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

Issue 1694263003: Add Image::updateConcreteSize() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor-size-calculation-in
Patch Set: Add some documentation and polish title of test. Created 4 years, 10 months 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
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
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() && !imageSize(DoNotRespectImageOr ientation, 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 void updateConcreteObjectSize(const LayoutSize& defaultObjectSize);
fs 2016/02/23 11:44:23 Thought: Could we avoid adding additional logistic
davve 2016/02/23 13:15:30 Sounds interesting and likely a good idea. Not sur
fs 2016/02/23 14:52:00 Since it's a definite maybe, creating an issue mig
83 enum SizeType { 84 enum SizeType {
84 IntrinsicSize, // Report the intrinsic size. 85 IntrinsicSize, // Report the intrinsic size.
85 IntrinsicCorrectedToDPR, // Report the intrinsic size corrected to accou nt for image density. 86 IntrinsicCorrectedToDPR, // Report the intrinsic size corrected to accou nt for image density.
86 }; 87 };
87 // This method takes a zoom multiplier that can be used to increase the natu ral size of the image by the zoom. 88 // 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); 89 LayoutSize imageSize(RespectImageOrientationEnum shouldRespectImageOrientati on, float multiplier, SizeType = IntrinsicSize);
89 void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHei ght, FloatSize& intrinsicRatio); 90 void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHei ght, FloatSize& intrinsicRatio);
90 91
91 bool isAccessAllowed(SecurityOrigin*); 92 bool isAccessAllowed(SecurityOrigin*);
92 93
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 158
158 RefPtr<blink::Image> m_image; 159 RefPtr<blink::Image> m_image;
159 bool m_hasDevicePixelRatioHeaderValue; 160 bool m_hasDevicePixelRatioHeaderValue;
160 }; 161 };
161 162
162 DEFINE_RESOURCE_TYPE_CASTS(Image); 163 DEFINE_RESOURCE_TYPE_CASTS(Image);
163 164
164 } // namespace blink 165 } // namespace blink
165 166
166 #endif 167 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698