]> git.saurik.com Git - iphone-api.git/blob - WebCore/StyleImage.h
Adding the WebCore headers (for Cydget).
[iphone-api.git] / WebCore / StyleImage.h
1 /*
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.
6 *
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.
11 *
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.
16 *
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.
21 *
22 */
23
24 #ifndef StyleImage_h
25 #define StyleImage_h
26
27 #include "IntSize.h"
28 #include <wtf/PassRefPtr.h>
29 #include <wtf/RefCounted.h>
30 #include <wtf/RefPtr.h>
31
32 namespace WebCore {
33
34 class CSSValue;
35 class Image;
36 class RenderObject;
37
38 typedef void* WrappedImagePtr;
39
40 class StyleImage : public RefCounted<StyleImage> {
41 public:
42 virtual ~StyleImage() { }
43
44 bool operator==(const StyleImage& other)
45 {
46 return data() == other.data();
47 }
48
49 virtual PassRefPtr<CSSValue> cssValue() = 0;
50
51 virtual bool canRender(float /*multiplier*/) const { return true; }
52 virtual bool isLoaded() const { return true; }
53 virtual bool errorOccurred() const { return false; }
54 virtual IntSize imageSize(const RenderObject*, float multiplier) const = 0;
55 virtual bool imageHasRelativeWidth() const = 0;
56 virtual bool imageHasRelativeHeight() const = 0;
57 virtual bool usesImageContainerSize() const = 0;
58 virtual void setImageContainerSize(const IntSize&) = 0;
59 virtual void addClient(RenderObject*) = 0;
60 virtual void removeClient(RenderObject*) = 0;
61 virtual Image* image(RenderObject*, const IntSize&) const = 0;
62 virtual WrappedImagePtr data() const = 0;
63 virtual bool isCachedImage() const { return false; }
64 virtual bool isGeneratedImage() const { return false; }
65
66 static bool imagesEquivalent(StyleImage* image1, StyleImage* image2)
67 {
68 if (image1 != image2) {
69 if (!image1 || !image2)
70 return false;
71 return *image1 == *image2;
72 }
73 return true;
74 }
75
76 protected:
77 StyleImage() { }
78 };
79
80 }
81 #endif