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

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

Issue 2000483003: Rework timeline/frame scheduling logic for SVGImage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unittest Created 4 years, 6 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 } 242 }
243 243
244 void CSSCrossfadeValue::crossfadeChanged(const IntRect&) 244 void CSSCrossfadeValue::crossfadeChanged(const IntRect&)
245 { 245 {
246 for (const auto& curr : clients()) { 246 for (const auto& curr : clients()) {
247 LayoutObject* client = const_cast<LayoutObject*>(curr.key); 247 LayoutObject* client = const_cast<LayoutObject*>(curr.key);
248 client->imageChanged(static_cast<WrappedImagePtr>(this)); 248 client->imageChanged(static_cast<WrappedImagePtr>(this));
249 } 249 }
250 } 250 }
251 251
252 bool CSSCrossfadeValue::willRenderImage() const
253 {
254 for (const auto& curr : clients()) {
255 if (const_cast<LayoutObject*>(curr.key)->willRenderImage())
256 return true;
257 }
258 return false;
259 }
260
252 void CSSCrossfadeValue::CrossfadeSubimageObserverProxy::imageChanged(ImageResour ce*, const IntRect* rect) 261 void CSSCrossfadeValue::CrossfadeSubimageObserverProxy::imageChanged(ImageResour ce*, const IntRect* rect)
253 { 262 {
254 if (m_ready) 263 if (m_ready)
255 m_ownerValue->crossfadeChanged(*rect); 264 m_ownerValue->crossfadeChanged(*rect);
256 } 265 }
257 266
267 bool CSSCrossfadeValue::CrossfadeSubimageObserverProxy::willRenderImage()
268 {
269 // If the images are not ready/loaded we won't paint them. If the images
270 // are ready then ask the clients.
271 return m_ready && m_ownerValue->willRenderImage();
272 }
273
258 bool CSSCrossfadeValue::hasFailedOrCanceledSubresources() const 274 bool CSSCrossfadeValue::hasFailedOrCanceledSubresources() const
259 { 275 {
260 if (m_cachedFromImage && m_cachedFromImage->loadFailedOrCanceled()) 276 if (m_cachedFromImage && m_cachedFromImage->loadFailedOrCanceled())
261 return true; 277 return true;
262 if (m_cachedToImage && m_cachedToImage->loadFailedOrCanceled()) 278 if (m_cachedToImage && m_cachedToImage->loadFailedOrCanceled())
263 return true; 279 return true;
264 return false; 280 return false;
265 } 281 }
266 282
267 bool CSSCrossfadeValue::equals(const CSSCrossfadeValue& other) const 283 bool CSSCrossfadeValue::equals(const CSSCrossfadeValue& other) const
268 { 284 {
269 return compareCSSValuePtr(m_fromValue, other.m_fromValue) 285 return compareCSSValuePtr(m_fromValue, other.m_fromValue)
270 && compareCSSValuePtr(m_toValue, other.m_toValue) 286 && compareCSSValuePtr(m_toValue, other.m_toValue)
271 && compareCSSValuePtr(m_percentageValue, other.m_percentageValue); 287 && compareCSSValuePtr(m_percentageValue, other.m_percentageValue);
272 } 288 }
273 289
274 DEFINE_TRACE_AFTER_DISPATCH(CSSCrossfadeValue) 290 DEFINE_TRACE_AFTER_DISPATCH(CSSCrossfadeValue)
275 { 291 {
276 visitor->trace(m_fromValue); 292 visitor->trace(m_fromValue);
277 visitor->trace(m_toValue); 293 visitor->trace(m_toValue);
278 visitor->trace(m_percentageValue); 294 visitor->trace(m_percentageValue);
279 visitor->trace(m_cachedFromImage); 295 visitor->trace(m_cachedFromImage);
280 visitor->trace(m_cachedToImage); 296 visitor->trace(m_cachedToImage);
281 visitor->trace(m_crossfadeSubimageObserver); 297 visitor->trace(m_crossfadeSubimageObserver);
282 CSSImageGeneratorValue::traceAfterDispatch(visitor); 298 CSSImageGeneratorValue::traceAfterDispatch(visitor);
283 } 299 }
284 300
285 } // namespace blink 301 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698