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

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

Issue 1491193003: Fix several corner case issues of scrollbar paint invalidation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after
1515 return invalidationRect; 1515 return invalidationRect;
1516 } 1516 }
1517 1517
1518 void LayoutObject::adjustPreviousPaintInvalidationForScrollIfNeeded(const Double Size& scrollDelta) 1518 void LayoutObject::adjustPreviousPaintInvalidationForScrollIfNeeded(const Double Size& scrollDelta)
1519 { 1519 {
1520 if (containerForPaintInvalidation().usesCompositedScrolling()) 1520 if (containerForPaintInvalidation().usesCompositedScrolling())
1521 return; 1521 return;
1522 m_previousPaintInvalidationRect.move(LayoutSize(scrollDelta)); 1522 m_previousPaintInvalidationRect.move(LayoutSize(scrollDelta));
1523 } 1523 }
1524 1524
1525 void LayoutObject::clearPreviousPaintInvalidationRects()
1526 {
1527 setPreviousPaintInvalidationRect(LayoutRect());
1528 }
1529
1525 void LayoutObject::incrementallyInvalidatePaint(const LayoutBoxModelObject& pain tInvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds , const LayoutPoint& positionFromPaintInvalidationBacking) 1530 void LayoutObject::incrementallyInvalidatePaint(const LayoutBoxModelObject& pain tInvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds , const LayoutPoint& positionFromPaintInvalidationBacking)
1526 { 1531 {
1527 ASSERT(oldBounds.location() == newBounds.location()); 1532 ASSERT(oldBounds.location() == newBounds.location());
1528 1533
1529 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX(); 1534 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX();
1530 if (deltaRight > 0) { 1535 if (deltaRight > 0) {
1531 LayoutRect invalidationRect(oldBounds.maxX(), newBounds.y(), deltaRight, newBounds.height()); 1536 LayoutRect invalidationRect(oldBounds.maxX(), newBounds.y(), deltaRight, newBounds.height());
1532 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInva lidationContainer); 1537 adjustInvalidationRectForCompositedScrolling(invalidationRect, paintInva lidationContainer);
1533 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRe ct, PaintInvalidationIncremental); 1538 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRe ct, PaintInvalidationIncremental);
1534 } else if (deltaRight < 0) { 1539 } else if (deltaRight < 0) {
(...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after
3400 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect, PaintInvalidationLayer); 3405 invalidatePaintUsingContainer(paintInvalidationContainer, invalidationRect, PaintInvalidationLayer);
3401 3406
3402 // The PaintController may have changed. Pass the previous paint invalidatio n rect to the new PaintController. 3407 // The PaintController may have changed. Pass the previous paint invalidatio n rect to the new PaintController.
3403 // The rect will be updated if it changes during the next paint invalidation . 3408 // The rect will be updated if it changes during the next paint invalidation .
3404 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLa yer, &invalidationRect); 3409 invalidateDisplayItemClients(paintInvalidationContainer, PaintInvalidationLa yer, &invalidationRect);
3405 3410
3406 // This method may be used to invalidate paint of an object changing paint i nvalidation container. 3411 // This method may be used to invalidate paint of an object changing paint i nvalidation container.
3407 // Clear previous paint invalidation rect on the original paint invalidation container to avoid 3412 // Clear previous paint invalidation rect on the original paint invalidation container to avoid
3408 // under-invalidation if the new paint invalidation rect on the new paint in validation container 3413 // under-invalidation if the new paint invalidation rect on the new paint in validation container
3409 // happens to be the same as the old one. 3414 // happens to be the same as the old one.
3410 setPreviousPaintInvalidationRect(LayoutRect()); 3415 clearPreviousPaintInvalidationRects();
3411 } 3416 }
3412 3417
3413 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants() 3418 void LayoutObject::invalidatePaintIncludingNonCompositingDescendants()
3414 { 3419 {
3415 // Since we're only painting non-composited layers, we know that they all sh are the same paintInvalidationContainer. 3420 // Since we're only painting non-composited layers, we know that they all sh are the same paintInvalidationContainer.
3416 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validation(); 3421 const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintIn validation();
3417 traverseNonCompositingDescendants(*this, [&paintInvalidationContainer](Layou tObject& object) { 3422 traverseNonCompositingDescendants(*this, [&paintInvalidationContainer](Layou tObject& object) {
3418 object.invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationC ontainer, PaintInvalidationLayer); 3423 object.invalidatePaintOfPreviousPaintInvalidationRect(paintInvalidationC ontainer, PaintInvalidationLayer);
3419 }); 3424 });
3420 } 3425 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
3499 const blink::LayoutObject* root = object1; 3504 const blink::LayoutObject* root = object1;
3500 while (root->parent()) 3505 while (root->parent())
3501 root = root->parent(); 3506 root = root->parent();
3502 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3507 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3503 } else { 3508 } else {
3504 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3509 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3505 } 3510 }
3506 } 3511 }
3507 3512
3508 #endif 3513 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698