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

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

Issue 1463793002: Simplify ImageResource::canRender() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 blink::Image* image(); // Returns the nullImage() if the image is not availa ble yet. 60 blink::Image* image(); // Returns the nullImage() if the image is not availa ble yet.
61 bool hasImage() const { return m_image.get(); } 61 bool hasImage() const { return m_image.get(); }
62 // Side effect: ensures decoded image is in cache, therefore should only be called when about to draw the image. 62 // Side effect: ensures decoded image is in cache, therefore should only be called when about to draw the image.
63 // FIXME: Decoding image on the main thread is expensive, so rather than for cing decode, consider returning false 63 // FIXME: Decoding image on the main thread is expensive, so rather than for cing decode, consider returning false
64 // when image is not decoded yet, as we do in case of deferred decoding. 64 // when image is not decoded yet, as we do in case of deferred decoding.
65 bool currentFrameKnownToBeOpaque(const LayoutObject*); 65 bool currentFrameKnownToBeOpaque(const LayoutObject*);
66 66
67 static std::pair<blink::Image*, float> brokenImage(float deviceScaleFactor); // Returns an image and the image's resolution scale factor. 67 static std::pair<blink::Image*, float> brokenImage(float deviceScaleFactor); // Returns an image and the image's resolution scale factor.
68 bool willPaintBrokenImage() const; 68 bool willPaintBrokenImage() const;
69 69
70 bool canRender(const LayoutObject& layoutObject, float multiplier) { return !errorOccurred() && !imageSizeForLayoutObject(&layoutObject, multiplier).isEmpty (); } 70 // Assumes that image rotation or scale doesn't effect the image size being empty or not.
71 bool canRender() { return !errorOccurred() && !imageSizeForLayoutObject(null ptr, 1).isEmpty(); }
71 72
72 bool usesImageContainerSize() const; 73 bool usesImageContainerSize() const;
73 bool imageHasRelativeWidth() const; 74 bool imageHasRelativeWidth() const;
74 bool imageHasRelativeHeight() const; 75 bool imageHasRelativeHeight() const;
75 // The device pixel ratio we got from the server for this image, or 1.0. 76 // The device pixel ratio we got from the server for this image, or 1.0.
76 float devicePixelRatioHeaderValue() const { return m_devicePixelRatioHeaderV alue; } 77 float devicePixelRatioHeaderValue() const { return m_devicePixelRatioHeaderV alue; }
77 bool hasDevicePixelRatioHeaderValue() const { return m_hasDevicePixelRatioHe aderValue; } 78 bool hasDevicePixelRatioHeaderValue() const { return m_hasDevicePixelRatioHe aderValue; }
78 79
79 enum SizeType { 80 enum SizeType {
80 IntrinsicSize, // Report the intrinsic size. 81 IntrinsicSize, // Report the intrinsic size.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 145
145 RefPtr<blink::Image> m_image; 146 RefPtr<blink::Image> m_image;
146 bool m_hasDevicePixelRatioHeaderValue; 147 bool m_hasDevicePixelRatioHeaderValue;
147 }; 148 };
148 149
149 DEFINE_RESOURCE_TYPE_CASTS(Image); 150 DEFINE_RESOURCE_TYPE_CASTS(Image);
150 151
151 } 152 }
152 153
153 #endif 154 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698