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

Side by Side Diff: Source/core/rendering/RenderImage.h

Issue 25105004: Use srcset's resource pixel density to determine intrinsic size (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cleantests
Patch Set: Fixed crash+rebased Created 7 years, 2 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
« no previous file with comments | « Source/core/html/parser/HTMLSrcsetParser.cpp ('k') | Source/core/rendering/RenderImage.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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 void areaElementFocusChanged(HTMLAreaElement*); 54 void areaElementFocusChanged(HTMLAreaElement*);
55 55
56 void highQualityRepaintTimerFired(Timer<RenderImage>*); 56 void highQualityRepaintTimerFired(Timer<RenderImage>*);
57 57
58 void setIsGeneratedContent(bool generated = true) { m_isGeneratedContent = g enerated; } 58 void setIsGeneratedContent(bool generated = true) { m_isGeneratedContent = g enerated; }
59 59
60 bool isGeneratedContent() const { return m_isGeneratedContent; } 60 bool isGeneratedContent() const { return m_isGeneratedContent; }
61 61
62 String altText() const { return m_altText; } 62 String altText() const { return m_altText; }
63 63
64 inline void setImageDevicePixelRatio(float factor) { m_imageDevicePixelRatio = factor; }
65 float imageDevicePixelRatio() const { return m_imageDevicePixelRatio; }
66
64 protected: 67 protected:
65 virtual bool needsPreferredWidthsRecalculation() const OVERRIDE FINAL; 68 virtual bool needsPreferredWidthsRecalculation() const OVERRIDE FINAL;
66 virtual RenderBox* embeddedContentBox() const OVERRIDE FINAL; 69 virtual RenderBox* embeddedContentBox() const OVERRIDE FINAL;
67 virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, doub le& intrinsicRatio, bool& isPercentageIntrinsicSize) const OVERRIDE FINAL; 70 virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, doub le& intrinsicRatio, bool& isPercentageIntrinsicSize) const OVERRIDE FINAL;
68 71
69 virtual void styleDidChange(StyleDifference, const RenderStyle*) OVERRIDE FI NAL; 72 virtual void styleDidChange(StyleDifference, const RenderStyle*) OVERRIDE FI NAL;
70 73
71 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0); 74 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
72 75
73 void paintIntoRect(GraphicsContext*, const LayoutRect&); 76 void paintIntoRect(GraphicsContext*, const LayoutRect&);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 void updateInnerContentRect(); 108 void updateInnerContentRect();
106 109
107 void paintAreaElementFocusRing(PaintInfo&); 110 void paintAreaElementFocusRing(PaintInfo&);
108 111
109 // Text to display as long as the image isn't available. 112 // Text to display as long as the image isn't available.
110 String m_altText; 113 String m_altText;
111 OwnPtr<RenderImageResource> m_imageResource; 114 OwnPtr<RenderImageResource> m_imageResource;
112 bool m_needsToSetSizeForAltText; 115 bool m_needsToSetSizeForAltText;
113 bool m_didIncrementVisuallyNonEmptyPixelCount; 116 bool m_didIncrementVisuallyNonEmptyPixelCount;
114 bool m_isGeneratedContent; 117 bool m_isGeneratedContent;
118 float m_imageDevicePixelRatio;
115 119
116 friend class RenderImageScaleObserver; 120 friend class RenderImageScaleObserver;
117 }; 121 };
118 122
119 inline RenderImage* toRenderImage(RenderObject* object) 123 inline RenderImage* toRenderImage(RenderObject* object)
120 { 124 {
121 ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderImage()); 125 ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderImage());
122 return static_cast<RenderImage*>(object); 126 return static_cast<RenderImage*>(object);
123 } 127 }
124 128
125 inline const RenderImage* toRenderImage(const RenderObject* object) 129 inline const RenderImage* toRenderImage(const RenderObject* object)
126 { 130 {
127 ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderImage()); 131 ASSERT_WITH_SECURITY_IMPLICATION(!object || object->isRenderImage());
128 return static_cast<const RenderImage*>(object); 132 return static_cast<const RenderImage*>(object);
129 } 133 }
130 134
131 // This will catch anyone doing an unnecessary cast. 135 // This will catch anyone doing an unnecessary cast.
132 void toRenderImage(const RenderImage*); 136 void toRenderImage(const RenderImage*);
133 137
134 } // namespace WebCore 138 } // namespace WebCore
135 139
136 #endif // RenderImage_h 140 #endif // RenderImage_h
OLDNEW
« no previous file with comments | « Source/core/html/parser/HTMLSrcsetParser.cpp ('k') | Source/core/rendering/RenderImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698