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

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

Issue 923953002: Move rendering/RenderImage* to layout/LayoutImage* (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« no previous file with comments | « Source/core/paint/SVGImagePainter.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
(Empty)
1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.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.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22 *
23 */
24
25 #ifndef RenderImage_h
26 #define RenderImage_h
27
28 #include "core/rendering/RenderImageResource.h"
29 #include "core/rendering/RenderReplaced.h"
30
31 namespace blink {
32
33 class HTMLAreaElement;
34 class HTMLMapElement;
35
36 class RenderImage : public RenderReplaced {
37 public:
38 // These are the paddings to use when displaying either alt text or an image .
39 static const unsigned short paddingWidth = 4;
40 static const unsigned short paddingHeight = 4;
41
42 RenderImage(Element*);
43 virtual ~RenderImage();
44 virtual void destroy() override;
45
46 static RenderImage* createAnonymous(Document*);
47
48 void setImageResource(PassOwnPtr<RenderImageResource>);
49
50 RenderImageResource* imageResource() { return m_imageResource.get(); }
51 const RenderImageResource* imageResource() const { return m_imageResource.ge t(); }
52 ImageResource* cachedImage() const { return m_imageResource ? m_imageResourc e->cachedImage() : 0; }
53
54 HTMLMapElement* imageMap() const;
55 void areaElementFocusChanged(HTMLAreaElement*);
56
57 void setIsGeneratedContent(bool generated = true) { m_isGeneratedContent = g enerated; }
58
59 bool isGeneratedContent() const { return m_isGeneratedContent; }
60
61 inline void setImageDevicePixelRatio(float factor) { m_imageDevicePixelRatio = factor; }
62 float imageDevicePixelRatio() const { return m_imageDevicePixelRatio; }
63
64 virtual void intrinsicSizeChanged() override
65 {
66 if (m_imageResource)
67 imageChanged(m_imageResource->imagePtr());
68 }
69
70 protected:
71 virtual bool needsPreferredWidthsRecalculation() const override final;
72 virtual RenderBox* embeddedContentBox() const override final;
73 virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, doub le& intrinsicRatio) const override final;
74
75 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) override;
76
77 virtual void paint(const PaintInfo&, const LayoutPoint&) override final;
78
79 virtual void layout() override;
80 virtual bool updateImageLoadingPriorities() override final;
81
82 virtual bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectRenderImage || RenderReplaced::isOfType(type); }
83
84 private:
85 virtual const char* renderName() const override { return "RenderImage"; }
86
87 virtual bool isImage() const override { return true; }
88
89 virtual void paintReplaced(const PaintInfo&, const LayoutPoint&) override;
90
91 virtual bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect, unsigned maxDepthToTest) const override final;
92 virtual bool computeBackgroundIsKnownToBeObscured() override final;
93
94 virtual bool backgroundShouldAlwaysBeClipped() const override { return true; }
95
96 virtual LayoutUnit minimumReplacedHeight() const override;
97
98 virtual void notifyFinished(Resource*) override final;
99 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct ion) override final;
100
101 virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance, InlineFlowBox*) const override final;
102
103 void repaintOrMarkForLayout(const IntRect* = 0);
104 void updateIntrinsicSizeIfNeeded(const LayoutSize&);
105 // Update the size of the image to be rendered. Object-fit may cause this to be different from the CSS box's content rect.
106 void updateInnerContentRect();
107
108 // Text to display as long as the image isn't available.
109 OwnPtr<RenderImageResource> m_imageResource;
110 bool m_didIncrementVisuallyNonEmptyPixelCount;
111 bool m_isGeneratedContent;
112 float m_imageDevicePixelRatio;
113
114 friend class RenderImageScaleObserver;
115 };
116
117 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(RenderImage, isRenderImage());
118
119 } // namespace blink
120
121 #endif // RenderImage_h
OLDNEW
« no previous file with comments | « Source/core/paint/SVGImagePainter.cpp ('k') | Source/core/rendering/RenderImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698