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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutImageResource.h

Issue 2469873002: [ImageResource 4] Split ImageResource into Resource and Image parts (Closed)
Patch Set: style Created 4 years 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 * Copyright (C) 1999 Antti Koivisto <koivisto@kde.org> 3 * Copyright (C) 1999 Antti Koivisto <koivisto@kde.org>
4 * Copyright (C) 2006 Allan Sandfeld Jensen <kde@carewolf.com> 4 * Copyright (C) 2006 Allan Sandfeld Jensen <kde@carewolf.com>
5 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 5 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> 8 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Library General Public 11 * modify it under the terms of the GNU Library General Public
12 * License as published by the Free Software Foundation; either 12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version. 13 * version 2 of the License, or (at your option) any later version.
14 * 14 *
15 * This library is distributed in the hope that it will be useful, 15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Library General Public License for more details. 18 * Library General Public License for more details.
19 * 19 *
20 * You should have received a copy of the GNU Library General Public License 20 * You should have received a copy of the GNU Library General Public License
21 * along with this library; see the file COPYING.LIB. If not, write to 21 * along with this library; see the file COPYING.LIB. If not, write to
22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 * Boston, MA 02110-1301, USA. 23 * Boston, MA 02110-1301, USA.
24 * 24 *
25 */ 25 */
26 26
27 #ifndef LayoutImageResource_h 27 #ifndef LayoutImageResource_h
28 #define LayoutImageResource_h 28 #define LayoutImageResource_h
29 29
30 #include "core/fetch/ImageResource.h" 30 #include "core/fetch/ImageResourceContent.h"
31 #include "core/style/StyleImage.h" 31 #include "core/style/StyleImage.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 class LayoutObject; 35 class LayoutObject;
36 36
37 class LayoutImageResource 37 class LayoutImageResource
38 : public GarbageCollectedFinalized<LayoutImageResource> { 38 : public GarbageCollectedFinalized<LayoutImageResource> {
39 WTF_MAKE_NONCOPYABLE(LayoutImageResource); 39 WTF_MAKE_NONCOPYABLE(LayoutImageResource);
40 40
41 public: 41 public:
42 virtual ~LayoutImageResource(); 42 virtual ~LayoutImageResource();
43 43
44 static LayoutImageResource* create() { return new LayoutImageResource; } 44 static LayoutImageResource* create() { return new LayoutImageResource; }
45 45
46 virtual void initialize(LayoutObject*); 46 virtual void initialize(LayoutObject*);
47 virtual void shutdown(); 47 virtual void shutdown();
48 48
49 void setImageResource(ImageResource*); 49 void setImageResource(ImageResourceContent*);
50 ImageResource* cachedImage() const { return m_cachedImage.get(); } 50 ImageResourceContent* cachedImage() const { return m_cachedImage.get(); }
51 virtual bool hasImage() const { return m_cachedImage; } 51 virtual bool hasImage() const { return m_cachedImage; }
52 52
53 void resetAnimation(); 53 void resetAnimation();
54 bool maybeAnimated() const; 54 bool maybeAnimated() const;
55 55
56 virtual PassRefPtr<Image> image(const IntSize&, float) const; 56 virtual PassRefPtr<Image> image(const IntSize&, float) const;
57 virtual bool errorOccurred() const { 57 virtual bool errorOccurred() const {
58 return m_cachedImage && m_cachedImage->errorOccurred(); 58 return m_cachedImage && m_cachedImage->errorOccurred();
59 } 59 }
60 60
61 virtual bool imageHasRelativeSize() const { 61 virtual bool imageHasRelativeSize() const {
62 return m_cachedImage ? m_cachedImage->imageHasRelativeSize() : false; 62 return m_cachedImage ? m_cachedImage->imageHasRelativeSize() : false;
63 } 63 }
64 64
65 virtual LayoutSize imageSize(float multiplier) const; 65 virtual LayoutSize imageSize(float multiplier) const;
66 66
67 virtual WrappedImagePtr imagePtr() const { return m_cachedImage.get(); } 67 virtual WrappedImagePtr imagePtr() const { return m_cachedImage.get(); }
68 68
69 DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(m_cachedImage); } 69 DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(m_cachedImage); }
70 70
71 protected: 71 protected:
72 LayoutImageResource(); 72 LayoutImageResource();
73 LayoutObject* m_layoutObject; 73 LayoutObject* m_layoutObject;
74 Member<ImageResource> m_cachedImage; 74 Member<ImageResourceContent> m_cachedImage;
75 }; 75 };
76 76
77 } // namespace blink 77 } // namespace blink
78 78
79 #endif // LayoutImage_h 79 #endif // LayoutImage_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutImage.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutImageResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698