| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/paint/ObjectPaintInvalidator.h" | 5 #include "core/paint/ObjectPaintInvalidator.h" |
| 6 | 6 |
| 7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
| 9 #include "core/layout/LayoutBlockFlow.h" | 9 #include "core/layout/LayoutBlockFlow.h" |
| 10 #include "core/layout/LayoutView.h" | 10 #include "core/layout/LayoutView.h" |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 invalidationRect, reason); | 427 invalidationRect, reason); |
| 428 | 428 |
| 429 if (invalidationRect.contains(newBounds)) | 429 if (invalidationRect.contains(newBounds)) |
| 430 return; | 430 return; |
| 431 } | 431 } |
| 432 | 432 |
| 433 invalidatePaintUsingContainer(*m_context.paintInvalidationContainer, | 433 invalidatePaintUsingContainer(*m_context.paintInvalidationContainer, |
| 434 newBounds, reason); | 434 newBounds, reason); |
| 435 } | 435 } |
| 436 | 436 |
| 437 DISABLE_CFI_PERF | |
| 438 PaintInvalidationReason | 437 PaintInvalidationReason |
| 439 ObjectPaintInvalidatorWithContext::computePaintInvalidationReason() { | 438 ObjectPaintInvalidatorWithContext::computePaintInvalidationReason() { |
| 440 // This is before any early return to ensure the background obscuration status | 439 // This is before any early return to ensure the background obscuration status |
| 441 // is saved. | 440 // is saved. |
| 442 bool backgroundObscurationChanged = false; | 441 bool backgroundObscurationChanged = false; |
| 443 bool backgroundObscured = m_object.backgroundIsKnownToBeObscured(); | 442 bool backgroundObscured = m_object.backgroundIsKnownToBeObscured(); |
| 444 if (backgroundObscured != m_object.previousBackgroundObscured()) { | 443 if (backgroundObscured != m_object.previousBackgroundObscured()) { |
| 445 m_object.getMutableForPainting().setPreviousBackgroundObscured( | 444 m_object.getMutableForPainting().setPreviousBackgroundObscured( |
| 446 backgroundObscured); | 445 backgroundObscured); |
| 447 backgroundObscurationChanged = true; | 446 backgroundObscurationChanged = true; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 // before us in the tree. | 497 // before us in the tree. |
| 499 if (m_context.newBounds.location() != m_context.oldBounds.location()) | 498 if (m_context.newBounds.location() != m_context.oldBounds.location()) |
| 500 return PaintInvalidationBoundsChange; | 499 return PaintInvalidationBoundsChange; |
| 501 | 500 |
| 502 if (locationChanged) | 501 if (locationChanged) |
| 503 return PaintInvalidationLocationChange; | 502 return PaintInvalidationLocationChange; |
| 504 | 503 |
| 505 return PaintInvalidationIncremental; | 504 return PaintInvalidationIncremental; |
| 506 } | 505 } |
| 507 | 506 |
| 508 DISABLE_CFI_PERF | |
| 509 void ObjectPaintInvalidatorWithContext::invalidateSelectionIfNeeded( | 507 void ObjectPaintInvalidatorWithContext::invalidateSelectionIfNeeded( |
| 510 PaintInvalidationReason reason) { | 508 PaintInvalidationReason reason) { |
| 511 // Update selection rect when we are doing full invalidation (in case that the | 509 // Update selection rect when we are doing full invalidation (in case that the |
| 512 // object is moved, composite status changed, etc.) or | 510 // object is moved, composite status changed, etc.) or |
| 513 // shouldInvalidationSelection is set (in case that the selection itself | 511 // shouldInvalidationSelection is set (in case that the selection itself |
| 514 // changed). | 512 // changed). |
| 515 bool fullInvalidation = isImmediateFullPaintInvalidationReason(reason); | 513 bool fullInvalidation = isImmediateFullPaintInvalidationReason(reason); |
| 516 if (!fullInvalidation && !m_object.shouldInvalidateSelection()) | 514 if (!fullInvalidation && !m_object.shouldInvalidateSelection()) |
| 517 return; | 515 return; |
| 518 | 516 |
| 519 LayoutRect oldSelectionRect = selectionPaintInvalidationMap().get(&m_object); | 517 LayoutRect oldSelectionRect = selectionPaintInvalidationMap().get(&m_object); |
| 520 LayoutRect newSelectionRect = m_object.localSelectionRect(); | 518 LayoutRect newSelectionRect = m_object.localSelectionRect(); |
| 521 if (!newSelectionRect.isEmpty()) { | 519 if (!newSelectionRect.isEmpty()) { |
| 522 m_context.mapLocalRectToPaintInvalidationBacking(m_object, | 520 m_context.mapLocalRectToPaintInvalidationBacking(m_object, |
| 523 newSelectionRect); | 521 newSelectionRect); |
| 524 newSelectionRect.move(m_object.scrollAdjustmentForPaintInvalidation( | 522 newSelectionRect.move(m_object.scrollAdjustmentForPaintInvalidation( |
| 525 *m_context.paintInvalidationContainer)); | 523 *m_context.paintInvalidationContainer)); |
| 526 } | 524 } |
| 527 | 525 |
| 528 setPreviousSelectionPaintInvalidationRect(m_object, newSelectionRect); | 526 setPreviousSelectionPaintInvalidationRect(m_object, newSelectionRect); |
| 529 | 527 |
| 530 if (!fullInvalidation) { | 528 if (!fullInvalidation) { |
| 531 fullyInvalidatePaint(PaintInvalidationSelection, oldSelectionRect, | 529 fullyInvalidatePaint(PaintInvalidationSelection, oldSelectionRect, |
| 532 newSelectionRect); | 530 newSelectionRect); |
| 533 m_context.paintingLayer->setNeedsRepaint(); | 531 m_context.paintingLayer->setNeedsRepaint(); |
| 534 m_object.invalidateDisplayItemClients(PaintInvalidationSelection); | 532 m_object.invalidateDisplayItemClients(PaintInvalidationSelection); |
| 535 } | 533 } |
| 536 } | 534 } |
| 537 | 535 |
| 538 DISABLE_CFI_PERF | |
| 539 PaintInvalidationReason | 536 PaintInvalidationReason |
| 540 ObjectPaintInvalidatorWithContext::invalidatePaintIfNeededWithComputedReason( | 537 ObjectPaintInvalidatorWithContext::invalidatePaintIfNeededWithComputedReason( |
| 541 PaintInvalidationReason reason) { | 538 PaintInvalidationReason reason) { |
| 542 // We need to invalidate the selection before checking for whether we are | 539 // We need to invalidate the selection before checking for whether we are |
| 543 // doing a full invalidation. This is because we need to update the previous | 540 // doing a full invalidation. This is because we need to update the previous |
| 544 // selection rect regardless. | 541 // selection rect regardless. |
| 545 invalidateSelectionIfNeeded(reason); | 542 invalidateSelectionIfNeeded(reason); |
| 546 | 543 |
| 547 if (reason == PaintInvalidationIncremental && !incrementallyInvalidatePaint()) | 544 if (reason == PaintInvalidationIncremental && !incrementallyInvalidatePaint()) |
| 548 reason = PaintInvalidationNone; | 545 reason = PaintInvalidationNone; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 572 | 569 |
| 573 m_context.paintingLayer->setNeedsRepaint(); | 570 m_context.paintingLayer->setNeedsRepaint(); |
| 574 m_object.invalidateDisplayItemClients(reason); | 571 m_object.invalidateDisplayItemClients(reason); |
| 575 return reason; | 572 return reason; |
| 576 } | 573 } |
| 577 | 574 |
| 578 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() | 575 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() |
| 579 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {} | 576 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {} |
| 580 | 577 |
| 581 } // namespace blink | 578 } // namespace blink |
| OLD | NEW |