Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(698)

Side by Side Diff: third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp

Issue 1706083002: Split ImageResourceClient into ResourceClient and ImageResourceObserver [1/2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More consistent Client/Observer Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 CSSCrossfadeValue::~CSSCrossfadeValue() 119 CSSCrossfadeValue::~CSSCrossfadeValue()
120 { 120 {
121 #if !ENABLE(OILPAN) 121 #if !ENABLE(OILPAN)
122 dispose(); 122 dispose();
123 #endif 123 #endif
124 } 124 }
125 125
126 void CSSCrossfadeValue::dispose() 126 void CSSCrossfadeValue::dispose()
127 { 127 {
128 if (m_cachedFromImage) { 128 if (m_cachedFromImage) {
129 m_cachedFromImage->removeClient(&m_crossfadeSubimageObserver); 129 m_cachedFromImage->removeObserver(&m_crossfadeSubimageObserver);
130 m_cachedFromImage = nullptr; 130 m_cachedFromImage = nullptr;
131 } 131 }
132 if (m_cachedToImage) { 132 if (m_cachedToImage) {
133 m_cachedToImage->removeClient(&m_crossfadeSubimageObserver); 133 m_cachedToImage->removeObserver(&m_crossfadeSubimageObserver);
134 m_cachedToImage = nullptr; 134 m_cachedToImage = nullptr;
135 } 135 }
136 } 136 }
137 137
138 String CSSCrossfadeValue::customCSSText() const 138 String CSSCrossfadeValue::customCSSText() const
139 { 139 {
140 StringBuilder result; 140 StringBuilder result;
141 result.appendLiteral("-webkit-cross-fade("); 141 result.appendLiteral("-webkit-cross-fade(");
142 result.append(m_fromValue->cssText()); 142 result.append(m_fromValue->cssText());
143 result.appendLiteral(", "); 143 result.appendLiteral(", ");
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 void CSSCrossfadeValue::loadSubimages(Document* document) 195 void CSSCrossfadeValue::loadSubimages(Document* document)
196 { 196 {
197 RefPtrWillBeRawPtr<ImageResource> oldCachedFromImage = m_cachedFromImage; 197 RefPtrWillBeRawPtr<ImageResource> oldCachedFromImage = m_cachedFromImage;
198 RefPtrWillBeRawPtr<ImageResource> oldCachedToImage = m_cachedToImage; 198 RefPtrWillBeRawPtr<ImageResource> oldCachedToImage = m_cachedToImage;
199 199
200 m_cachedFromImage = cachedImageForCSSValue(m_fromValue.get(), document); 200 m_cachedFromImage = cachedImageForCSSValue(m_fromValue.get(), document);
201 m_cachedToImage = cachedImageForCSSValue(m_toValue.get(), document); 201 m_cachedToImage = cachedImageForCSSValue(m_toValue.get(), document);
202 202
203 if (m_cachedFromImage != oldCachedFromImage) { 203 if (m_cachedFromImage != oldCachedFromImage) {
204 if (oldCachedFromImage) 204 if (oldCachedFromImage)
205 oldCachedFromImage->removeClient(&m_crossfadeSubimageObserver); 205 oldCachedFromImage->removeObserver(&m_crossfadeSubimageObserver);
206 if (m_cachedFromImage) 206 if (m_cachedFromImage)
207 m_cachedFromImage->addClient(&m_crossfadeSubimageObserver); 207 m_cachedFromImage->addObserver(&m_crossfadeSubimageObserver);
208 } 208 }
209 209
210 if (m_cachedToImage != oldCachedToImage) { 210 if (m_cachedToImage != oldCachedToImage) {
211 if (oldCachedToImage) 211 if (oldCachedToImage)
212 oldCachedToImage->removeClient(&m_crossfadeSubimageObserver); 212 oldCachedToImage->removeObserver(&m_crossfadeSubimageObserver);
213 if (m_cachedToImage) 213 if (m_cachedToImage)
214 m_cachedToImage->addClient(&m_crossfadeSubimageObserver); 214 m_cachedToImage->addObserver(&m_crossfadeSubimageObserver);
215 } 215 }
216 216
217 m_crossfadeSubimageObserver.setReady(true); 217 m_crossfadeSubimageObserver.setReady(true);
218 } 218 }
219 219
220 PassRefPtr<Image> CSSCrossfadeValue::image(const LayoutObject* layoutObject, con st IntSize& size) 220 PassRefPtr<Image> CSSCrossfadeValue::image(const LayoutObject* layoutObject, con st IntSize& size)
221 { 221 {
222 if (size.isEmpty()) 222 if (size.isEmpty())
223 return nullptr; 223 return nullptr;
224 224
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 visitor->trace(m_fromValue); 277 visitor->trace(m_fromValue);
278 visitor->trace(m_toValue); 278 visitor->trace(m_toValue);
279 visitor->trace(m_percentageValue); 279 visitor->trace(m_percentageValue);
280 visitor->trace(m_cachedFromImage); 280 visitor->trace(m_cachedFromImage);
281 visitor->trace(m_cachedToImage); 281 visitor->trace(m_cachedToImage);
282 visitor->trace(m_crossfadeSubimageObserver); 282 visitor->trace(m_crossfadeSubimageObserver);
283 CSSImageGeneratorValue::traceAfterDispatch(visitor); 283 CSSImageGeneratorValue::traceAfterDispatch(visitor);
284 } 284 }
285 285
286 } // namespace blink 286 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698