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

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

Issue 369423002: Have srcset respond to viewport changes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Self review nits Created 6 years, 5 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) 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
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; } 64 inline void setImageDevicePixelRatio(float factor) { m_imageDevicePixelRatio = factor; }
65 float imageDevicePixelRatio() const { return m_imageDevicePixelRatio; } 65 float imageDevicePixelRatio() const { return m_imageDevicePixelRatio; }
66 66
67 virtual void intrinsicSizeChanged() OVERRIDE
68 {
69 if (m_imageResource)
70 imageChanged(m_imageResource->imagePtr());
71 }
72
67 protected: 73 protected:
68 virtual bool needsPreferredWidthsRecalculation() const OVERRIDE FINAL; 74 virtual bool needsPreferredWidthsRecalculation() const OVERRIDE FINAL;
69 virtual RenderBox* embeddedContentBox() const OVERRIDE FINAL; 75 virtual RenderBox* embeddedContentBox() const OVERRIDE FINAL;
70 virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, doub le& intrinsicRatio) const OVERRIDE FINAL; 76 virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, doub le& intrinsicRatio) const OVERRIDE FINAL;
71 77
72 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) OVERRIDE; 78 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) OVERRIDE;
73 79
74 void paintIntoRect(GraphicsContext*, const LayoutRect&); 80 void paintIntoRect(GraphicsContext*, const LayoutRect&);
75 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE FINAL; 81 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE FINAL;
76 virtual void layout() OVERRIDE; 82 virtual void layout() OVERRIDE;
77 virtual bool updateImageLoadingPriorities() OVERRIDE FINAL; 83 virtual bool updateImageLoadingPriorities() OVERRIDE FINAL;
78 84
79 virtual void intrinsicSizeChanged() OVERRIDE
80 {
81 if (m_imageResource)
82 imageChanged(m_imageResource->imagePtr());
83 }
84
85 private: 85 private:
86 virtual const char* renderName() const OVERRIDE { return "RenderImage"; } 86 virtual const char* renderName() const OVERRIDE { return "RenderImage"; }
87 87
88 virtual bool isImage() const OVERRIDE { return true; } 88 virtual bool isImage() const OVERRIDE { return true; }
89 virtual bool isRenderImage() const OVERRIDE FINAL { return true; } 89 virtual bool isRenderImage() const OVERRIDE FINAL { return true; }
90 90
91 virtual void paintReplaced(PaintInfo&, const LayoutPoint&) OVERRIDE; 91 virtual void paintReplaced(PaintInfo&, const LayoutPoint&) OVERRIDE;
92 92
93 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, unsigned maxDepthToTest) const OVERRIDE FINAL; 93 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, unsigned maxDepthToTest) const OVERRIDE FINAL;
94 virtual bool computeBackgroundIsKnownToBeObscured() OVERRIDE FINAL; 94 virtual bool computeBackgroundIsKnownToBeObscured() OVERRIDE FINAL;
(...skipping 21 matching lines...) Expand all
116 float m_imageDevicePixelRatio; 116 float m_imageDevicePixelRatio;
117 117
118 friend class RenderImageScaleObserver; 118 friend class RenderImageScaleObserver;
119 }; 119 };
120 120
121 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderImage, isRenderImage()); 121 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderImage, isRenderImage());
122 122
123 } // namespace WebCore 123 } // namespace WebCore
124 124
125 #endif // RenderImage_h 125 #endif // RenderImage_h
OLDNEW
« Source/core/html/HTMLImageElement.cpp ('K') | « Source/core/loader/ImageLoader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698