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

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

Issue 136823005: Fix distorted image issue when open some images in a new browser window. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: not plumb knowledge to ImageResource Created 6 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 bool imageHasRelativeWidth() const; 68 bool imageHasRelativeWidth() const;
69 bool imageHasRelativeHeight() const; 69 bool imageHasRelativeHeight() const;
70 // The device pixel ratio we got from the server for this image, or 1.0. 70 // The device pixel ratio we got from the server for this image, or 1.0.
71 float devicePixelRatioHeaderValue() const { return m_devicePixelRatioHeaderV alue; } 71 float devicePixelRatioHeaderValue() const { return m_devicePixelRatioHeaderV alue; }
72 bool hasDevicePixelRatioHeaderValue() const { return m_hasDevicePixelRatioHe aderValue; } 72 bool hasDevicePixelRatioHeaderValue() const { return m_hasDevicePixelRatioHe aderValue; }
73 73
74 enum SizeType { 74 enum SizeType {
75 NormalSize, // Report the size of the image associated with a certain re nderer 75 NormalSize, // Report the size of the image associated with a certain re nderer
76 IntrinsicSize // Report the intrinsic size, i.e. ignore whatever has bee n set extrinsically. 76 IntrinsicSize // Report the intrinsic size, i.e. ignore whatever has bee n set extrinsically.
77 }; 77 };
78 LayoutSize bitmapImageSizeRespectingOrientation(float) const;
78 // This method takes a zoom multiplier that can be used to increase the natu ral size of the image by the zoom. 79 // This method takes a zoom multiplier that can be used to increase the natu ral size of the image by the zoom.
79 LayoutSize imageSizeForRenderer(const RenderObject*, float multiplier, SizeT ype = NormalSize); // returns the size of the complete image. 80 LayoutSize imageSizeForRenderer(const RenderObject*, float multiplier, SizeT ype = NormalSize); // returns the size of the complete image.
80 void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHei ght, FloatSize& intrinsicRatio); 81 void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHei ght, FloatSize& intrinsicRatio);
81 82
82 bool isAccessAllowed(SecurityOrigin*); 83 bool isAccessAllowed(SecurityOrigin*);
83 84
84 virtual void didAddClient(ResourceClient*) OVERRIDE; 85 virtual void didAddClient(ResourceClient*) OVERRIDE;
85 virtual void didRemoveClient(ResourceClient*) OVERRIDE; 86 virtual void didRemoveClient(ResourceClient*) OVERRIDE;
86 87
87 virtual void allClientsRemoved() OVERRIDE; 88 virtual void allClientsRemoved() OVERRIDE;
(...skipping 23 matching lines...) Expand all
111 112
112 private: 113 private:
113 void clear(); 114 void clear();
114 115
115 void setCustomAcceptHeader(); 116 void setCustomAcceptHeader();
116 void createImage(); 117 void createImage();
117 void updateImage(bool allDataReceived); 118 void updateImage(bool allDataReceived);
118 void clearImage(); 119 void clearImage();
119 // If not null, changeRect is the changed part of the image. 120 // If not null, changeRect is the changed part of the image.
120 void notifyObservers(const IntRect* changeRect = 0); 121 void notifyObservers(const IntRect* changeRect = 0);
122 void applyMultiplier(LayoutSize&, float) const;
121 123
122 virtual void switchClientsToRevalidatedResource() OVERRIDE; 124 virtual void switchClientsToRevalidatedResource() OVERRIDE;
123 125
124 typedef pair<IntSize, float> SizeAndZoom; 126 typedef pair<IntSize, float> SizeAndZoom;
125 typedef HashMap<const ImageResourceClient*, SizeAndZoom> ContainerSizeReques ts; 127 typedef HashMap<const ImageResourceClient*, SizeAndZoom> ContainerSizeReques ts;
126 ContainerSizeRequests m_pendingContainerSizeRequests; 128 ContainerSizeRequests m_pendingContainerSizeRequests;
127 float m_devicePixelRatioHeaderValue; 129 float m_devicePixelRatioHeaderValue;
128 130
129 RefPtr<WebCore::Image> m_image; 131 RefPtr<WebCore::Image> m_image;
130 OwnPtr<SVGImageCache> m_svgImageCache; 132 OwnPtr<SVGImageCache> m_svgImageCache;
131 bool m_loadingMultipartContent; 133 bool m_loadingMultipartContent;
132 bool m_hasDevicePixelRatioHeaderValue; 134 bool m_hasDevicePixelRatioHeaderValue;
133 }; 135 };
134 136
135 DEFINE_RESOURCE_TYPE_CASTS(Image); 137 DEFINE_RESOURCE_TYPE_CASTS(Image);
136 138
137 } 139 }
138 140
139 #endif 141 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698