1 /*
2 * Copyright (C) 1999 Lars Knoll <knoll@kde.org>
3 * Copyright (C) 1999 Antti Koivisto <koivisto@kde.org>
4 * Copyright (C) 2000 Dirk Mueller <mueller@kde.org>
5 * Copyright (C) 2006 Allan Sandfeld Jensen <kde@carewolf.com>
6 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved.
8 * Copyright (C) 2010 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
20 *
21 * You should have received a copy of the GNU Library General Public License
22 * along with this library; see the file COPYING.LIB. If not, write to
23 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 * Boston, MA 02110-1301, USA.
25 *
26 */
27
28 #include "config.h"
29 #include "RenderImageResourceStyleImage.h"
30
31 #include "RenderObject.h"
32 #include "StyleCachedImage.h"
33
34 namespace WebCore {
35
RenderImageResourceStyleImage(StyleImage * styleImage)36 RenderImageResourceStyleImage::RenderImageResourceStyleImage(StyleImage* styleImage)
37 : m_styleImage(styleImage)
38 {
39 ASSERT(m_styleImage);
40 }
41
~RenderImageResourceStyleImage()42 RenderImageResourceStyleImage::~RenderImageResourceStyleImage()
43 {
44 }
45
initialize(RenderObject * renderer)46 void RenderImageResourceStyleImage::initialize(RenderObject* renderer)
47 {
48 RenderImageResource::initialize(renderer);
49
50 if (m_styleImage->isCachedImage())
51 m_cachedImage = static_cast<StyleCachedImage*>(m_styleImage.get())->cachedImage();
52
53 m_styleImage->addClient(m_renderer);
54 }
55
shutdown()56 void RenderImageResourceStyleImage::shutdown()
57 {
58 ASSERT(m_renderer);
59 m_styleImage->removeClient(m_renderer);
60 m_cachedImage = 0;
61 }
62
63 } // namespace WebCore
64