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

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

Issue 1951043002: Don't let PaintInvalidationLocationChange shadow other reasons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp ('k') | no next file » | 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 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, old Bounds, newBounds); 1477 fullyInvalidatePaint(paintInvalidationContainer, invalidationReason, old Bounds, newBounds);
1478 1478
1479 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidationCont ainer, paintInvalidationState, invalidationReason); 1479 invalidateDisplayItemClientsWithPaintInvalidationState(paintInvalidationCont ainer, paintInvalidationState, invalidationReason);
1480 return invalidationReason; 1480 return invalidationReason;
1481 } 1481 }
1482 1482
1483 PaintInvalidationReason LayoutObject::getPaintInvalidationReason(const LayoutBox ModelObject& paintInvalidationContainer, 1483 PaintInvalidationReason LayoutObject::getPaintInvalidationReason(const LayoutBox ModelObject& paintInvalidationContainer,
1484 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalida tionBacking, 1484 const LayoutRect& oldBounds, const LayoutPoint& oldPositionFromPaintInvalida tionBacking,
1485 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInvalida tionBacking) const 1485 const LayoutRect& newBounds, const LayoutPoint& newPositionFromPaintInvalida tionBacking) const
1486 { 1486 {
1487 // First check for InvalidationLocationChange to avoid it from being hidden by other
1488 // invalidation reasons because we'll need to force check for paint invalida tion for
1489 // children when location of this object changed.
1490 if (newPositionFromPaintInvalidationBacking != oldPositionFromPaintInvalidat ionBacking)
1491 return PaintInvalidationLocationChange;
1492
1493 if (shouldDoFullPaintInvalidation()) 1487 if (shouldDoFullPaintInvalidation())
1494 return m_bitfields.fullPaintInvalidationReason(); 1488 return m_bitfields.fullPaintInvalidationReason();
1495 1489
1496 // The outline may change shape because of position change of descendants. F or simplicity, 1490 // The outline may change shape because of position change of descendants. F or simplicity,
1497 // just force full paint invalidation if this object is marked for checking paint invalidation 1491 // just force full paint invalidation if this object is marked for checking paint invalidation
1498 // for any reason. 1492 // for any reason.
1499 if (styleRef().hasOutline()) 1493 if (styleRef().hasOutline())
1500 return PaintInvalidationOutline; 1494 return PaintInvalidationOutline;
1501 1495
1496 bool locationChanged = newPositionFromPaintInvalidationBacking != oldPositio nFromPaintInvalidationBacking;
1497
1502 // If the bounds are the same then we know that none of the statements below 1498 // If the bounds are the same then we know that none of the statements below
1503 // can match, so we can early out since we will not need to do any 1499 // can match, so we can early out.
1504 // invalidation.
1505 if (oldBounds == newBounds) 1500 if (oldBounds == newBounds)
1506 return PaintInvalidationNone; 1501 return locationChanged && !oldBounds.isEmpty() ? PaintInvalidationLocati onChange : PaintInvalidationNone;
1507 1502
1508 // If we shifted, we don't know the exact reason so we are conservative and trigger a full invalidation. Shifting could 1503 // If we shifted, we don't know the exact reason so we are conservative and trigger a full invalidation. Shifting could
1509 // be caused by some layout property (left / top) or some in-flow layoutObje ct inserted / removed before us in the tree. 1504 // be caused by some layout property (left / top) or some in-flow layoutObje ct inserted / removed before us in the tree.
1510 if (newBounds.location() != oldBounds.location()) 1505 if (newBounds.location() != oldBounds.location())
1511 return PaintInvalidationBoundsChange; 1506 return PaintInvalidationBoundsChange;
1512 1507
1513 // This covers the case where we mark containing blocks for layout 1508 // This covers the case where we mark containing blocks for layout
1514 // and they change size but don't have anything to paint. This is 1509 // and they change size but don't have anything to paint. This is
1515 // a pretty common case for <body> as we add / remove children 1510 // a pretty common case for <body> as we add / remove children
1516 // (and the default background is done by FrameView). 1511 // (and the default background is done by FrameView).
1517 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && skipInvalidationWhe nLaidOutChildren()) 1512 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && skipInvalidationWhe nLaidOutChildren())
1518 return PaintInvalidationNone; 1513 return PaintInvalidationNone;
1519 1514
1520 // If the size is zero on one of our bounds then we know we're going to have 1515 // If the size is zero on one of our bounds then we know we're going to have
1521 // to do a full invalidation of either old bounds or new bounds. If we fall 1516 // to do a full invalidation of either old bounds or new bounds. If we fall
1522 // into the incremental invalidation we'll issue two invalidations instead 1517 // into the incremental invalidation we'll issue two invalidations instead
1523 // of one. 1518 // of one.
1524 if (oldBounds.isEmpty()) 1519 if (oldBounds.isEmpty())
1525 return PaintInvalidationBecameVisible; 1520 return PaintInvalidationBecameVisible;
1526 if (newBounds.isEmpty()) 1521 if (newBounds.isEmpty())
1527 return PaintInvalidationBecameInvisible; 1522 return PaintInvalidationBecameInvisible;
1528 1523
1524 if (locationChanged)
1525 return PaintInvalidationLocationChange;
1526
1529 return PaintInvalidationIncremental; 1527 return PaintInvalidationIncremental;
1530 } 1528 }
1531 1529
1532 void LayoutObject::adjustInvalidationRectForCompositedScrolling(LayoutRect& rect , const LayoutBoxModelObject& paintInvalidationContainer) const 1530 void LayoutObject::adjustInvalidationRectForCompositedScrolling(LayoutRect& rect , const LayoutBoxModelObject& paintInvalidationContainer) const
1533 { 1531 {
1534 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati onContainer != this) { 1532 if (paintInvalidationContainer.usesCompositedScrolling() && &paintInvalidati onContainer != this) {
1535 LayoutSize offset(-toLayoutBox(&paintInvalidationContainer)->scrolledCon tentOffset()); 1533 LayoutSize offset(-toLayoutBox(&paintInvalidationContainer)->scrolledCon tentOffset());
1536 rect.move(offset); 1534 rect.move(offset);
1537 } 1535 }
1538 } 1536 }
(...skipping 2167 matching lines...) Expand 10 before | Expand all | Expand 10 after
3706 const blink::LayoutObject* root = object1; 3704 const blink::LayoutObject* root = object1;
3707 while (root->parent()) 3705 while (root->parent())
3708 root = root->parent(); 3706 root = root->parent();
3709 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3707 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3710 } else { 3708 } else {
3711 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3709 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3712 } 3710 }
3713 } 3711 }
3714 3712
3715 #endif 3713 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698