2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
30 #include <wtf/PassRefPtr.h>
31 #include <wtf/RefCounted.h>
32 #include <wtf/RefPtr.h>
39 typedef void* WrappedImagePtr;
41 class StyleImage : public RefCounted<StyleImage> {
43 virtual ~StyleImage() { }
45 bool operator==(const StyleImage& other) const
47 return data() == other.data();
50 virtual PassRefPtr<CSSValue> cssValue() const = 0;
52 virtual bool canRender(float /*multiplier*/) const { return true; }
53 virtual bool isLoaded() const { return true; }
54 virtual bool errorOccurred() const { return false; }
55 virtual IntSize imageSize(const RenderObject*, float multiplier) const = 0;
56 virtual bool imageHasRelativeWidth() const = 0;
57 virtual bool imageHasRelativeHeight() const = 0;
58 virtual bool usesImageContainerSize() const = 0;
59 virtual void setImageContainerSize(const IntSize&) = 0;
60 virtual void addClient(RenderObject*) = 0;
61 virtual void removeClient(RenderObject*) = 0;
62 virtual PassRefPtr<Image> image(RenderObject*, const IntSize&) const = 0;
63 virtual WrappedImagePtr data() const = 0;
65 ALWAYS_INLINE bool isCachedImage() const { return m_isCachedImage; }
66 ALWAYS_INLINE bool isPendingImage() const { return m_isPendingImage; }
67 ALWAYS_INLINE bool isGeneratedImage() const { return m_isGeneratedImage; }
69 static bool imagesEquivalent(StyleImage* image1, StyleImage* image2)
71 if (image1 != image2) {
72 if (!image1 || !image2)
74 return *image1 == *image2;
81 : m_isCachedImage(false)
82 , m_isPendingImage(false)
83 , m_isGeneratedImage(false)
86 bool m_isCachedImage:1;
87 bool m_isPendingImage:1;
88 bool m_isGeneratedImage:1;