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

Side by Side Diff: Source/core/layout/LayoutObject.cpp

Issue 1026823002: [S.P.] Don't draw frames of animated images that are offscreen (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/LayoutImage.cpp ('k') | Source/platform/graphics/PaintInvalidationReason.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 1193
1194 void LayoutObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv alidationState) 1194 void LayoutObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv alidationState)
1195 { 1195 {
1196 ASSERT(!needsLayout()); 1196 ASSERT(!needsLayout());
1197 1197
1198 // If we didn't need paint invalidation then our children don't need as well . 1198 // If we didn't need paint invalidation then our children don't need as well .
1199 // Skip walking down the tree as everything should be fine below us. 1199 // Skip walking down the tree as everything should be fine below us.
1200 if (!shouldCheckForPaintInvalidation(paintInvalidationState)) 1200 if (!shouldCheckForPaintInvalidation(paintInvalidationState))
1201 return; 1201 return;
1202 1202
1203 invalidatePaintIfNeeded(paintInvalidationState, paintInvalidationState.paint InvalidationContainer()); 1203 PaintInvalidationReason reason = invalidatePaintIfNeeded(paintInvalidationSt ate, paintInvalidationState.paintInvalidationContainer());
1204 clearPaintInvalidationState(paintInvalidationState); 1204 if (reason != PaintInvalidationDelayedFull) {
1205 clearPaintInvalidationState(paintInvalidationState);
1206 } else {
1207 // Mark this object as needing paint invalidation again in the next fram e, due to the request for delayed paint invalidation.
1208 setShouldDoFullPaintInvalidation(reason);
1209 }
1210
1205 invalidatePaintOfSubtreesIfNeeded(paintInvalidationState); 1211 invalidatePaintOfSubtreesIfNeeded(paintInvalidationState);
1206 } 1212 }
1207 1213
1208 void LayoutObject::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationStat e& childPaintInvalidationState) 1214 void LayoutObject::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationStat e& childPaintInvalidationState)
1209 { 1215 {
1210 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli ng()) { 1216 for (LayoutObject* child = slowFirstChild(); child; child = child->nextSibli ng()) {
1211 if (!child->isOutOfFlowPositioned()) 1217 if (!child->isOutOfFlowPositioned())
1212 child->invalidateTreeIfNeeded(childPaintInvalidationState); 1218 child->invalidateTreeIfNeeded(childPaintInvalidationState);
1213 } 1219 }
1214 } 1220 }
(...skipping 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after
3098 return PaintInvalidationForcedByLayout; 3104 return PaintInvalidationForcedByLayout;
3099 case DocumentLifecycle::InCompositingUpdate: 3105 case DocumentLifecycle::InCompositingUpdate:
3100 return PaintInvalidationCompositingUpdate; 3106 return PaintInvalidationCompositingUpdate;
3101 default: 3107 default:
3102 return PaintInvalidationFull; 3108 return PaintInvalidationFull;
3103 } 3109 }
3104 } 3110 }
3105 3111
3106 void LayoutObject::setShouldDoFullPaintInvalidation(PaintInvalidationReason reas on) 3112 void LayoutObject::setShouldDoFullPaintInvalidation(PaintInvalidationReason reas on)
3107 { 3113 {
3114
3115
3108 // Only full invalidation reasons are allowed. 3116 // Only full invalidation reasons are allowed.
3109 ASSERT(isFullPaintInvalidationReason(reason)); 3117 ASSERT(isFullPaintInvalidationReason(reason) || reason == PaintInvalidationD elayedFull);
3110 3118
3111 if (m_bitfields.fullPaintInvalidationReason() == PaintInvalidationNone) { 3119 if (m_bitfields.fullPaintInvalidationReason() == PaintInvalidationNone) {
3112 if (reason == PaintInvalidationFull) 3120 if (reason == PaintInvalidationFull)
3113 reason = documentLifecycleBasedPaintInvalidationReason(document().li fecycle()); 3121 reason = documentLifecycleBasedPaintInvalidationReason(document().li fecycle());
3114 m_bitfields.setFullPaintInvalidationReason(reason); 3122 m_bitfields.setFullPaintInvalidationReason(reason);
3115 } 3123 }
3116 3124
3117 ASSERT(document().lifecycle().state() != DocumentLifecycle::InPaintInvalidat ion);
3118 frame()->page()->animator().scheduleVisualUpdate(); // In case that this is called outside of FrameView::updateLayoutAndStyleForPainting(). 3125 frame()->page()->animator().scheduleVisualUpdate(); // In case that this is called outside of FrameView::updateLayoutAndStyleForPainting().
3119 markContainerChainForPaintInvalidation(); 3126 markContainerChainForPaintInvalidation();
3127 ASSERT(document().lifecycle().state() != DocumentLifecycle::InPaintInvalidat ion || reason == PaintInvalidationDelayedFull);
chrishtr 2015/03/20 16:58:54 I also restored the asserts in this method to avoi
3120 } 3128 }
3121 3129
3122 void LayoutObject::setMayNeedPaintInvalidation() 3130 void LayoutObject::setMayNeedPaintInvalidation()
3123 { 3131 {
3124 if (mayNeedPaintInvalidation()) 3132 if (mayNeedPaintInvalidation())
3125 return; 3133 return;
3126 m_bitfields.setMayNeedPaintInvalidation(true); 3134 m_bitfields.setMayNeedPaintInvalidation(true);
3127 // Make sure our parent is marked as needing invalidation. 3135 // Make sure our parent is marked as needing invalidation.
3128 markContainerChainForPaintInvalidation(); 3136 markContainerChainForPaintInvalidation();
3129 frame()->page()->animator().scheduleVisualUpdate(); // In case that this is called outside of FrameView::updateLayoutAndStyleForPainting(). 3137 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
3223 { 3231 {
3224 if (object1) { 3232 if (object1) {
3225 const blink::LayoutObject* root = object1; 3233 const blink::LayoutObject* root = object1;
3226 while (root->parent()) 3234 while (root->parent())
3227 root = root->parent(); 3235 root = root->parent();
3228 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3236 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3229 } 3237 }
3230 } 3238 }
3231 3239
3232 #endif 3240 #endif
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutImage.cpp ('k') | Source/platform/graphics/PaintInvalidationReason.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698