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

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

Issue 2229643002: Don't invalidate paint on background image change if it's obscured (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@BackgroundObscured
Patch Set: - Created 4 years, 4 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) 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 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 1389
1390 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "LayoutObject: :invalidatePaintIfNeeded()", 1390 TRACE_EVENT2(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), "LayoutObject: :invalidatePaintIfNeeded()",
1391 "object", this->debugName().ascii(), 1391 "object", this->debugName().ascii(),
1392 "info", jsonObjectForOldAndNewRects(oldBounds, oldLocation, newBounds, n ewLocation)); 1392 "info", jsonObjectForOldAndNewRects(oldBounds, oldLocation, newBounds, n ewLocation));
1393 1393
1394 bool backgroundObscured = backgroundIsKnownToBeObscured(); 1394 bool backgroundObscured = backgroundIsKnownToBeObscured();
1395 if (!isFullPaintInvalidationReason(invalidationReason) && backgroundObscured != m_bitfields.previousBackgroundObscured()) 1395 if (!isFullPaintInvalidationReason(invalidationReason) && backgroundObscured != m_bitfields.previousBackgroundObscured())
1396 invalidationReason = PaintInvalidationBackgroundObscurationChange; 1396 invalidationReason = PaintInvalidationBackgroundObscurationChange;
1397 m_bitfields.setPreviousBackgroundObscured(backgroundObscured); 1397 m_bitfields.setPreviousBackgroundObscured(backgroundObscured);
1398 1398
1399 if (invalidationReason == PaintInvalidationNone) { 1399 if (invalidationReason == PaintInvalidationNone || invalidationReason == Pai ntInvalidationDelayedFull) {
1400 // TODO(trchen): Currently we don't keep track of paint offset of layout objects. 1400 // TODO(trchen): Currently we don't keep track of paint offset of layout objects.
1401 // There are corner cases that the display items need to be invalidated for paint offset 1401 // There are corner cases that the display items need to be invalidated for paint offset
1402 // mutation, but incurs no pixel difference (i.e. bounds stay the same) so no rect-based 1402 // mutation, but incurs no pixel difference (i.e. bounds stay the same) so no rect-based
1403 // invalidation is issued. See crbug.com/508383 and crbug.com/515977. 1403 // invalidation is issued. See crbug.com/508383 and crbug.com/515977.
1404 // This is a workaround to force display items to update paint offset. 1404 // This is a workaround to force display items to update paint offset.
1405 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && paint InvalidationState.forcedSubtreeInvalidationCheckingWithinContainer()) 1405 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && paint InvalidationState.forcedSubtreeInvalidationCheckingWithinContainer())
1406 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalida tionState, PaintInvalidationLocationChange); 1406 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalida tionState, PaintInvalidationLocationChange);
1407 1407
1408 return invalidationReason; 1408 return invalidationReason;
1409 } 1409 }
(...skipping 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after
3420 } 3420 }
3421 3421
3422 void LayoutObject::setMayNeedPaintInvalidationSubtree() 3422 void LayoutObject::setMayNeedPaintInvalidationSubtree()
3423 { 3423 {
3424 if (mayNeedPaintInvalidationSubtree()) 3424 if (mayNeedPaintInvalidationSubtree())
3425 return; 3425 return;
3426 m_bitfields.setMayNeedPaintInvalidationSubtree(true); 3426 m_bitfields.setMayNeedPaintInvalidationSubtree(true);
3427 setMayNeedPaintInvalidation(); 3427 setMayNeedPaintInvalidation();
3428 } 3428 }
3429 3429
3430 void LayoutObject::setMayNeedPaintInvalidationAnimatgedBackgroundImage()
3431 {
3432 if (mayNeedPaintInvalidationAnimatedBackgroundImage())
3433 return;
3434 m_bitfields.setMayNeedPaintInvalidationAnimatedBackgroundImage(true);
3435 setMayNeedPaintInvalidation();
3436 }
3437
3430 void LayoutObject::clearPaintInvalidationFlags(const PaintInvalidationState& pai ntInvalidationState) 3438 void LayoutObject::clearPaintInvalidationFlags(const PaintInvalidationState& pai ntInvalidationState)
3431 { 3439 {
3432 // paintInvalidationStateIsDirty should be kept in sync with the 3440 // paintInvalidationStateIsDirty should be kept in sync with the
3433 // booleans that are cleared below. 3441 // booleans that are cleared below.
3434 ASSERT(!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() || paintInvalidationStateIsDirty()); 3442 ASSERT(!shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState() || paintInvalidationStateIsDirty());
3435 clearShouldDoFullPaintInvalidation(); 3443 clearShouldDoFullPaintInvalidation();
3436 m_bitfields.setChildShouldCheckForPaintInvalidation(false); 3444 m_bitfields.setChildShouldCheckForPaintInvalidation(false);
3437 m_bitfields.setMayNeedPaintInvalidation(false); 3445 m_bitfields.setMayNeedPaintInvalidation(false);
3438 m_bitfields.setMayNeedPaintInvalidationSubtree(false); 3446 m_bitfields.setMayNeedPaintInvalidationSubtree(false);
3447 m_bitfields.setMayNeedPaintInvalidationAnimatedBackgroundImage(false);
3439 m_bitfields.setShouldInvalidateSelection(false); 3448 m_bitfields.setShouldInvalidateSelection(false);
3440 } 3449 }
3441 3450
3442 bool LayoutObject::isAllowedToModifyLayoutTreeStructure(Document& document) 3451 bool LayoutObject::isAllowedToModifyLayoutTreeStructure(Document& document)
3443 { 3452 {
3444 return DeprecatedDisableModifyLayoutTreeStructureAsserts::canModifyLayoutTre eStateInAnyState() 3453 return DeprecatedDisableModifyLayoutTreeStructureAsserts::canModifyLayoutTre eStateInAnyState()
3445 || document.lifecycle().stateAllowsLayoutTreeMutations(); 3454 || document.lifecycle().stateAllowsLayoutTreeMutations();
3446 } 3455 }
3447 3456
3448 DeprecatedDisableModifyLayoutTreeStructureAsserts::DeprecatedDisableModifyLayout TreeStructureAsserts() 3457 DeprecatedDisableModifyLayoutTreeStructureAsserts::DeprecatedDisableModifyLayout TreeStructureAsserts()
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
3653 const blink::LayoutObject* root = object1; 3662 const blink::LayoutObject* root = object1;
3654 while (root->parent()) 3663 while (root->parent())
3655 root = root->parent(); 3664 root = root->parent();
3656 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3665 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3657 } else { 3666 } else {
3658 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); 3667 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)");
3659 } 3668 }
3660 } 3669 }
3661 3670
3662 #endif 3671 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698