]>
git.saurik.com Git - iphone-api.git/blob - WebCore/StyleImage.h
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.
28 #include <wtf/PassRefPtr.h>
29 #include <wtf/RefCounted.h>
30 #include <wtf/RefPtr.h>
38 typedef void* WrappedImagePtr
;
40 class StyleImage
: public RefCounted
<StyleImage
> {
42 virtual ~StyleImage() { }
44 bool operator==(const StyleImage
& other
)
46 return data() == other
.data();
49 virtual PassRefPtr
<CSSValue
> cssValue() = 0;
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; }
66 static bool imagesEquivalent(StyleImage
* image1
, StyleImage
* image2
)
68 if (image1
!= image2
) {
69 if (!image1
|| !image2
)
71 return *image1
== *image2
;