 Chromium Code Reviews
 Chromium Code Reviews Issue 1026823002:
  [S.P.] Don't draw frames of animated images that are offscreen  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk
    
  
    Issue 1026823002:
  [S.P.] Don't draw frames of animated images that are offscreen  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk| OLD | NEW | 
|---|---|
| 1 /* | 1 /* | 
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 
| 4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 
| 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. | 
| 7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. | 
| 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 
| 9 * | 9 * | 
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or | 
| (...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1196 | 1196 | 
| 1197 void LayoutObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv alidationState) | 1197 void LayoutObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv alidationState) | 
| 1198 { | 1198 { | 
| 1199 ASSERT(!needsLayout()); | 1199 ASSERT(!needsLayout()); | 
| 1200 | 1200 | 
| 1201 // If we didn't need paint invalidation then our children don't need as well . | 1201 // If we didn't need paint invalidation then our children don't need as well . | 
| 1202 // Skip walking down the tree as everything should be fine below us. | 1202 // Skip walking down the tree as everything should be fine below us. | 
| 1203 if (!shouldCheckForPaintInvalidation(paintInvalidationState)) | 1203 if (!shouldCheckForPaintInvalidation(paintInvalidationState)) | 
| 1204 return; | 1204 return; | 
| 1205 | 1205 | 
| 1206 invalidatePaintIfNeeded(paintInvalidationState, paintInvalidationState.paint InvalidationContainer()); | 1206 PaintInvalidationReason reason = invalidatePaintIfNeeded(paintInvalidationSt ate, paintInvalidationState.paintInvalidationContainer()); | 
| 1207 clearPaintInvalidationState(paintInvalidationState); | 1207 if (reason != PaintInvalidationDelayedFull) { | 
| 1208 clearPaintInvalidationState(paintInvalidationState); | |
| 1209 } else { | |
| 1210 // Mark this object as needing paint invalidation again in the next fram e, due to the request for delayed paint invalidation. | |
| 1211 setShouldDoFullPaintInvalidation(reason); | |
| 1212 } | |
| 1213 | |
| 1208 invalidatePaintOfSubtreesIfNeeded(paintInvalidationState); | 1214 invalidatePaintOfSubtreesIfNeeded(paintInvalidationState); | 
| 1209 } | 1215 } | 
| 1210 | 1216 | 
| 1211 void LayoutObject::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationStat e& childPaintInvalidationState) | 1217 void LayoutObject::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationStat e& childPaintInvalidationState) | 
| 1212 { | 1218 { | 
| 1213 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli ng()) { | 1219 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli ng()) { | 
| 1214 if (!child->isOutOfFlowPositioned()) | 1220 if (!child->isOutOfFlowPositioned()) | 
| 1215 child->invalidateTreeIfNeeded(childPaintInvalidationState); | 1221 child->invalidateTreeIfNeeded(childPaintInvalidationState); | 
| 1216 } | 1222 } | 
| 1217 } | 1223 } | 
| (...skipping 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3102 case DocumentLifecycle::InCompositingUpdate: | 3108 case DocumentLifecycle::InCompositingUpdate: | 
| 3103 return PaintInvalidationCompositingUpdate; | 3109 return PaintInvalidationCompositingUpdate; | 
| 3104 default: | 3110 default: | 
| 3105 return PaintInvalidationFull; | 3111 return PaintInvalidationFull; | 
| 3106 } | 3112 } | 
| 3107 } | 3113 } | 
| 3108 | 3114 | 
| 3109 void LayoutObject::setShouldDoFullPaintInvalidation(PaintInvalidationReason reas on) | 3115 void LayoutObject::setShouldDoFullPaintInvalidation(PaintInvalidationReason reas on) | 
| 3110 { | 3116 { | 
| 3111 // Only full invalidation reasons are allowed. | 3117 // Only full invalidation reasons are allowed. | 
| 3112 ASSERT(isFullPaintInvalidationReason(reason)); | 3118 ASSERT(isFullPaintInvalidationReason(reason) || reason == PaintInvalidationD elayedFull); | 
| 3113 | 3119 | 
| 3114 if (m_bitfields.fullPaintInvalidationReason() == PaintInvalidationNone) { | 3120 if (m_bitfields.fullPaintInvalidationReason() == PaintInvalidationNone) { | 
| 3115 if (reason == PaintInvalidationFull) | 3121 if (reason == PaintInvalidationFull) | 
| 3116 reason = documentLifecycleBasedPaintInvalidationReason(document().li fecycle()); | 3122 reason = documentLifecycleBasedPaintInvalidationReason(document().li fecycle()); | 
| 3117 m_bitfields.setFullPaintInvalidationReason(reason); | 3123 m_bitfields.setFullPaintInvalidationReason(reason); | 
| 3118 } | 3124 } | 
| 3119 | 3125 | 
| 3120 ASSERT(document().lifecycle().state() != DocumentLifecycle::InPaintInvalidat ion); | |
| 3121 frame()->page()->animator().scheduleVisualUpdate(); // In case that this is called outside of FrameView::updateLayoutAndStyleForPainting(). | 3126 frame()->page()->animator().scheduleVisualUpdate(); // In case that this is called outside of FrameView::updateLayoutAndStyleForPainting(). | 
| 3122 markContainerChainForPaintInvalidation(); | 3127 markContainerChainForPaintInvalidation(); | 
| 3128 ASSERT(document().lifecycle().state() != DocumentLifecycle::InPaintInvalidat ion || reason == PaintInvalidationDelayedFull); | |
| 
esprehn
2015/03/25 05:06:36
This still can let in bugs with the bits, if you u
 
chrishtr
2015/03/25 23:30:35
Done.
 | |
| 3123 } | 3129 } | 
| 3124 | 3130 | 
| 3125 void LayoutObject::setMayNeedPaintInvalidation() | 3131 void LayoutObject::setMayNeedPaintInvalidation() | 
| 3126 { | 3132 { | 
| 3127 if (mayNeedPaintInvalidation()) | 3133 if (mayNeedPaintInvalidation()) | 
| 3128 return; | 3134 return; | 
| 3129 m_bitfields.setMayNeedPaintInvalidation(true); | 3135 m_bitfields.setMayNeedPaintInvalidation(true); | 
| 3130 // Make sure our parent is marked as needing invalidation. | 3136 // Make sure our parent is marked as needing invalidation. | 
| 3131 markContainerChainForPaintInvalidation(); | 3137 markContainerChainForPaintInvalidation(); | 
| 3132 frame()->page()->animator().scheduleVisualUpdate(); // In case that this is called outside of FrameView::updateLayoutAndStyleForPainting(). | 3138 frame()->page()->animator().scheduleVisualUpdate(); // In case that this is called outside of FrameView::updateLayoutAndStyleForPainting(). | 
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3226 { | 3232 { | 
| 3227 if (object1) { | 3233 if (object1) { | 
| 3228 const blink::LayoutObject* root = object1; | 3234 const blink::LayoutObject* root = object1; | 
| 3229 while (root->parent()) | 3235 while (root->parent()) | 
| 3230 root = root->parent(); | 3236 root = root->parent(); | 
| 3231 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3237 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 
| 3232 } | 3238 } | 
| 3233 } | 3239 } | 
| 3234 | 3240 | 
| 3235 #endif | 3241 #endif | 
| OLD | NEW |