OLD | NEW |
| (Empty) |
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 #include "config.h" | |
25 #include "core/layout/style/StyleFetchedImage.h" | |
26 | |
27 #include "core/css/CSSImageValue.h" | |
28 #include "core/fetch/ImageResource.h" | |
29 #include "core/layout/LayoutObject.h" | |
30 | |
31 namespace blink { | |
32 | |
33 StyleFetchedImage::StyleFetchedImage(ImageResource* image) | |
34 : m_image(image) | |
35 { | |
36 m_isImageResource = true; | |
37 m_image->addClient(this); | |
38 } | |
39 | |
40 StyleFetchedImage::~StyleFetchedImage() | |
41 { | |
42 m_image->removeClient(this); | |
43 } | |
44 | |
45 PassRefPtrWillBeRawPtr<CSSValue> StyleFetchedImage::cssValue() const | |
46 { | |
47 return CSSImageValue::create(m_image->url(), const_cast<StyleFetchedImage*>(
this)); | |
48 } | |
49 | |
50 bool StyleFetchedImage::canRender(const LayoutObject& layoutObject, float multip
lier) const | |
51 { | |
52 return m_image->canRender(layoutObject, multiplier); | |
53 } | |
54 | |
55 bool StyleFetchedImage::isLoaded() const | |
56 { | |
57 return m_image->isLoaded(); | |
58 } | |
59 | |
60 bool StyleFetchedImage::errorOccurred() const | |
61 { | |
62 return m_image->errorOccurred(); | |
63 } | |
64 | |
65 LayoutSize StyleFetchedImage::imageSize(const LayoutObject* layoutObject, float
multiplier) const | |
66 { | |
67 return m_image->imageSizeForLayoutObject(layoutObject, multiplier); | |
68 } | |
69 | |
70 bool StyleFetchedImage::imageHasRelativeWidth() const | |
71 { | |
72 return m_image->imageHasRelativeWidth(); | |
73 } | |
74 | |
75 bool StyleFetchedImage::imageHasRelativeHeight() const | |
76 { | |
77 return m_image->imageHasRelativeHeight(); | |
78 } | |
79 | |
80 void StyleFetchedImage::computeIntrinsicDimensions(const LayoutObject*, Length&
intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) | |
81 { | |
82 m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrins
icRatio); | |
83 } | |
84 | |
85 bool StyleFetchedImage::usesImageContainerSize() const | |
86 { | |
87 return m_image->usesImageContainerSize(); | |
88 } | |
89 | |
90 void StyleFetchedImage::setContainerSizeForLayoutObject(const LayoutObject* layo
utObject, const IntSize& imageContainerSize, float imageContainerZoomFactor) | |
91 { | |
92 m_image->setContainerSizeForLayoutObject(layoutObject, imageContainerSize, i
mageContainerZoomFactor); | |
93 } | |
94 | |
95 void StyleFetchedImage::addClient(LayoutObject* layoutObject) | |
96 { | |
97 m_image->addClient(layoutObject); | |
98 } | |
99 | |
100 void StyleFetchedImage::removeClient(LayoutObject* layoutObject) | |
101 { | |
102 m_image->removeClient(layoutObject); | |
103 } | |
104 | |
105 PassRefPtr<Image> StyleFetchedImage::image(LayoutObject* layoutObject, const Int
Size&) const | |
106 { | |
107 return m_image->imageForLayoutObject(layoutObject); | |
108 } | |
109 | |
110 bool StyleFetchedImage::knownToBeOpaque(const LayoutObject* layoutObject) const | |
111 { | |
112 return m_image->currentFrameKnownToBeOpaque(layoutObject); | |
113 } | |
114 | |
115 } | |
OLD | NEW |