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

Unified Diff: Source/core/layout/LayoutObject.cpp

Issue 1008043002: [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 side-by-side diff with in-line comments
Download patch
Index: Source/core/layout/LayoutObject.cpp
diff --git a/Source/core/layout/LayoutObject.cpp b/Source/core/layout/LayoutObject.cpp
index 2fa594d795b58033d5ff04abe59b35de5c51df22..f6b846aa3c2d2a2c392b0a520c657810f31417c3 100644
--- a/Source/core/layout/LayoutObject.cpp
+++ b/Source/core/layout/LayoutObject.cpp
@@ -1198,8 +1198,14 @@ void LayoutObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInv
if (!shouldCheckForPaintInvalidation(paintInvalidationState))
return;
- invalidatePaintIfNeeded(paintInvalidationState, paintInvalidationState.paintInvalidationContainer());
- clearPaintInvalidationState(paintInvalidationState);
+ PaintInvalidationReason reason = invalidatePaintIfNeeded(paintInvalidationState, paintInvalidationState.paintInvalidationContainer());
+ if (reason != PaintInvalidationDelayedFull) {
+ clearPaintInvalidationState(paintInvalidationState);
+ } else {
+ // Mark this object as needing paint invalidation again in the next frame, due to the request for delayed paint invalidation.
+ setShouldDoFullPaintInvalidation();
Xianzhu 2015/03/17 23:34:01 Should we let this be for slimming-paint only?
chrishtr 2015/03/17 23:55:56 In this CL it only takes effect if PaintInvalidati
Xianzhu 2015/03/18 16:37:01 Acknowledged.
+ }
+
invalidatePaintOfSubtreesIfNeeded(paintInvalidationState);
}
@@ -1269,8 +1275,9 @@ void LayoutObject::invalidateSelectionIfNeeded(const LayoutBoxModelObject& paint
PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(const PaintInvalidationState& paintInvalidationState, const LayoutBoxModelObject& paintInvalidationContainer)
{
LayoutView* v = view();
- if (v->document().printing())
+ if (v->document().printing()) {
return PaintInvalidationNone; // Don't invalidate paints if we're printing.
+ }
Xianzhu 2015/03/18 19:24:53 Nit: unnecessary change
chrishtr 2015/03/19 22:01:27 Done.
const LayoutRect oldBounds = previousPaintInvalidationRect();
const LayoutPoint oldLocation = previousPositionFromPaintInvalidationBacking();
@@ -1289,15 +1296,17 @@ PaintInvalidationReason LayoutObject::invalidatePaintIfNeeded(const PaintInvalid
// paint invalidations. We can then skip issuing of paint invalidations for the child
// renderers as they'll be covered by the LayoutView.
// However, slimming paint mode requires paint invalidation of the child renderers.
- if (view()->doingFullPaintInvalidation() && !RuntimeEnabledFeatures::slimmingPaintEnabled())
+ if (view()->doingFullPaintInvalidation() && !RuntimeEnabledFeatures::slimmingPaintEnabled()) {
return invalidationReason;
+ }
Xianzhu 2015/03/18 19:24:53 Ditto.
chrishtr 2015/03/19 22:01:27 Done.
TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "LayoutObject::invalidatePaintIfNeeded()",
"object", this->debugName().ascii(),
"info", jsonObjectForOldAndNewRects(oldBounds, oldLocation, newBounds, newLocation));
- if (invalidationReason == PaintInvalidationNone)
+ if (invalidationReason == PaintInvalidationNone) {
return invalidationReason;
+ }
Xianzhu 2015/03/18 19:24:53 Ditto.
chrishtr 2015/03/19 22:01:26 Done.
if (RuntimeEnabledFeatures::slimmingPaintEnabled())
invalidateDisplayItemClients(paintInvalidationContainer);
@@ -3109,7 +3118,6 @@ void LayoutObject::setShouldDoFullPaintInvalidation(PaintInvalidationReason reas
m_bitfields.setFullPaintInvalidationReason(reason);
}
- ASSERT(document().lifecycle().state() != DocumentLifecycle::InPaintInvalidation);
frame()->page()->animator().scheduleVisualUpdate(); // In case that this is called outside of FrameView::updateLayoutAndStyleForPainting().
markContainerChainForPaintInvalidation();
}

Powered by Google App Engine
This is Rietveld 408576698