OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "CSSCrossfadeValue.h" | 27 #include "CSSCrossfadeValue.h" |
28 | 28 |
29 #include "CSSImageValue.h" | 29 #include "CSSImageValue.h" |
30 #include "CachedImage.h" | 30 #include "CachedImage.h" |
31 #include "CachedResourceLoader.h" | 31 #include "CachedResourceLoader.h" |
32 #include "CrossfadeGeneratedImage.h" | 32 #include "CrossfadeGeneratedImage.h" |
33 #include "ImageBuffer.h" | 33 #include "ImageBuffer.h" |
34 #include "RenderObject.h" | 34 #include "RenderObject.h" |
35 #include "StyleCachedImage.h" | 35 #include "StyleCachedImage.h" |
36 #include "StyleGeneratedImage.h" | 36 #include "StyleGeneratedImage.h" |
37 #include "WebCoreMemoryInstrumentation.h" | |
38 #include <wtf/text/StringBuilder.h> | 37 #include <wtf/text/StringBuilder.h> |
39 | 38 |
40 namespace WebCore { | 39 namespace WebCore { |
41 | 40 |
42 static bool subimageIsPending(CSSValue* value) | 41 static bool subimageIsPending(CSSValue* value) |
43 { | 42 { |
44 if (value->isImageValue()) | 43 if (value->isImageValue()) |
45 return static_cast<CSSImageValue*>(value)->cachedOrPendingImage()->isPen
dingImage(); | 44 return static_cast<CSSImageValue*>(value)->cachedOrPendingImage()->isPen
dingImage(); |
46 | 45 |
47 if (value->isImageGeneratorValue()) | 46 if (value->isImageGeneratorValue()) |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 if (m_cachedToImage != oldCachedToImage) { | 161 if (m_cachedToImage != oldCachedToImage) { |
163 if (oldCachedToImage) | 162 if (oldCachedToImage) |
164 oldCachedToImage->removeClient(&m_crossfadeSubimageObserver); | 163 oldCachedToImage->removeClient(&m_crossfadeSubimageObserver); |
165 if (m_cachedToImage) | 164 if (m_cachedToImage) |
166 m_cachedToImage->addClient(&m_crossfadeSubimageObserver); | 165 m_cachedToImage->addClient(&m_crossfadeSubimageObserver); |
167 } | 166 } |
168 | 167 |
169 m_crossfadeSubimageObserver.setReady(true); | 168 m_crossfadeSubimageObserver.setReady(true); |
170 } | 169 } |
171 | 170 |
172 void CSSCrossfadeValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObje
ctInfo) const | |
173 { | |
174 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); | |
175 CSSImageGeneratorValue::reportBaseClassMemoryUsage(memoryObjectInfo); | |
176 info.addMember(m_fromValue, "fromValue"); | |
177 info.addMember(m_toValue, "toValue"); | |
178 info.addMember(m_percentageValue, "percentageValue"); | |
179 // FIXME: add instrumentation for | |
180 // m_cachedFromImage | |
181 // m_cachedToImage | |
182 // m_generatedImage | |
183 } | |
184 | |
185 PassRefPtr<Image> CSSCrossfadeValue::image(RenderObject* renderer, const IntSize
& size) | 171 PassRefPtr<Image> CSSCrossfadeValue::image(RenderObject* renderer, const IntSize
& size) |
186 { | 172 { |
187 if (size.isEmpty()) | 173 if (size.isEmpty()) |
188 return 0; | 174 return 0; |
189 | 175 |
190 CachedResourceLoader* cachedResourceLoader = renderer->document()->cachedRes
ourceLoader(); | 176 CachedResourceLoader* cachedResourceLoader = renderer->document()->cachedRes
ourceLoader(); |
191 CachedImage* cachedFromImage = cachedImageForCSSValue(m_fromValue.get(), cac
hedResourceLoader); | 177 CachedImage* cachedFromImage = cachedImageForCSSValue(m_fromValue.get(), cac
hedResourceLoader); |
192 CachedImage* cachedToImage = cachedImageForCSSValue(m_toValue.get(), cachedR
esourceLoader); | 178 CachedImage* cachedToImage = cachedImageForCSSValue(m_toValue.get(), cachedR
esourceLoader); |
193 | 179 |
194 if (!cachedFromImage || !cachedToImage) | 180 if (!cachedFromImage || !cachedToImage) |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 } | 216 } |
231 | 217 |
232 bool CSSCrossfadeValue::equals(const CSSCrossfadeValue& other) const | 218 bool CSSCrossfadeValue::equals(const CSSCrossfadeValue& other) const |
233 { | 219 { |
234 return compareCSSValuePtr(m_fromValue, other.m_fromValue) | 220 return compareCSSValuePtr(m_fromValue, other.m_fromValue) |
235 && compareCSSValuePtr(m_toValue, other.m_toValue) | 221 && compareCSSValuePtr(m_toValue, other.m_toValue) |
236 && compareCSSValuePtr(m_percentageValue, other.m_percentageValue); | 222 && compareCSSValuePtr(m_percentageValue, other.m_percentageValue); |
237 } | 223 } |
238 | 224 |
239 } // namespace WebCore | 225 } // namespace WebCore |
OLD | NEW |