| 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 |
| 437 PaintInvalidationReason | 438 PaintInvalidationReason |
| 438 ObjectPaintInvalidatorWithContext::computePaintInvalidationReason() { | 439 ObjectPaintInvalidatorWithContext::computePaintInvalidationReason() { |
| 439 // This is before any early return to ensure the background obscuration status | 440 // This is before any early return to ensure the background obscuration status |
| 440 // is saved. | 441 // is saved. |
| 441 bool backgroundObscurationChanged = false; | 442 bool backgroundObscurationChanged = false; |
| 442 bool backgroundObscured = m_object.backgroundIsKnownToBeObscured(); | 443 bool backgroundObscured = m_object.backgroundIsKnownToBeObscured(); |
| 443 if (backgroundObscured != m_object.previousBackgroundObscured()) { | 444 if (backgroundObscured != m_object.previousBackgroundObscured()) { |
| 444 m_object.getMutableForPainting().setPreviousBackgroundObscured( | 445 m_object.getMutableForPainting().setPreviousBackgroundObscured( |
| 445 backgroundObscured); | 446 backgroundObscured); |
| 446 backgroundObscurationChanged = true; | 447 backgroundObscurationChanged = true; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 // before us in the tree. | 498 // before us in the tree. |
| 498 if (m_context.newBounds.location() != m_context.oldBounds.location()) | 499 if (m_context.newBounds.location() != m_context.oldBounds.location()) |
| 499 return PaintInvalidationBoundsChange; | 500 return PaintInvalidationBoundsChange; |
| 500 | 501 |
| 501 if (locationChanged) | 502 if (locationChanged) |
| 502 return PaintInvalidationLocationChange; | 503 return PaintInvalidationLocationChange; |
| 503 | 504 |
| 504 return PaintInvalidationIncremental; | 505 return PaintInvalidationIncremental; |
| 505 } | 506 } |
| 506 | 507 |
| 508 DISABLE_CFI_PERF |
| 507 void ObjectPaintInvalidatorWithContext::invalidateSelectionIfNeeded( | 509 void ObjectPaintInvalidatorWithContext::invalidateSelectionIfNeeded( |
| 508 PaintInvalidationReason reason) { | 510 PaintInvalidationReason reason) { |
| 509 // Update selection rect when we are doing full invalidation (in case that the | 511 // Update selection rect when we are doing full invalidation (in case that the |
| 510 // object is moved, composite status changed, etc.) or | 512 // object is moved, composite status changed, etc.) or |
| 511 // shouldInvalidationSelection is set (in case that the selection itself | 513 // shouldInvalidationSelection is set (in case that the selection itself |
| 512 // changed). | 514 // changed). |
| 513 bool fullInvalidation = isImmediateFullPaintInvalidationReason(reason); | 515 bool fullInvalidation = isImmediateFullPaintInvalidationReason(reason); |
| 514 if (!fullInvalidation && !m_object.shouldInvalidateSelection()) | 516 if (!fullInvalidation && !m_object.shouldInvalidateSelection()) |
| 515 return; | 517 return; |
| 516 | 518 |
| 517 LayoutRect oldSelectionRect = selectionPaintInvalidationMap().get(&m_object); | 519 LayoutRect oldSelectionRect = selectionPaintInvalidationMap().get(&m_object); |
| 518 LayoutRect newSelectionRect = m_object.localSelectionRect(); | 520 LayoutRect newSelectionRect = m_object.localSelectionRect(); |
| 519 if (!newSelectionRect.isEmpty()) { | 521 if (!newSelectionRect.isEmpty()) { |
| 520 m_context.mapLocalRectToPaintInvalidationBacking(m_object, | 522 m_context.mapLocalRectToPaintInvalidationBacking(m_object, |
| 521 newSelectionRect); | 523 newSelectionRect); |
| 522 newSelectionRect.move(m_object.scrollAdjustmentForPaintInvalidation( | 524 newSelectionRect.move(m_object.scrollAdjustmentForPaintInvalidation( |
| 523 *m_context.paintInvalidationContainer)); | 525 *m_context.paintInvalidationContainer)); |
| 524 } | 526 } |
| 525 | 527 |
| 526 setPreviousSelectionPaintInvalidationRect(m_object, newSelectionRect); | 528 setPreviousSelectionPaintInvalidationRect(m_object, newSelectionRect); |
| 527 | 529 |
| 528 if (!fullInvalidation) { | 530 if (!fullInvalidation) { |
| 529 fullyInvalidatePaint(PaintInvalidationSelection, oldSelectionRect, | 531 fullyInvalidatePaint(PaintInvalidationSelection, oldSelectionRect, |
| 530 newSelectionRect); | 532 newSelectionRect); |
| 531 m_context.paintingLayer->setNeedsRepaint(); | 533 m_context.paintingLayer->setNeedsRepaint(); |
| 532 m_object.invalidateDisplayItemClients(PaintInvalidationSelection); | 534 m_object.invalidateDisplayItemClients(PaintInvalidationSelection); |
| 533 } | 535 } |
| 534 } | 536 } |
| 535 | 537 |
| 538 DISABLE_CFI_PERF |
| 536 PaintInvalidationReason | 539 PaintInvalidationReason |
| 537 ObjectPaintInvalidatorWithContext::invalidatePaintIfNeededWithComputedReason( | 540 ObjectPaintInvalidatorWithContext::invalidatePaintIfNeededWithComputedReason( |
| 538 PaintInvalidationReason reason) { | 541 PaintInvalidationReason reason) { |
| 539 // We need to invalidate the selection before checking for whether we are | 542 // We need to invalidate the selection before checking for whether we are |
| 540 // doing a full invalidation. This is because we need to update the previous | 543 // doing a full invalidation. This is because we need to update the previous |
| 541 // selection rect regardless. | 544 // selection rect regardless. |
| 542 invalidateSelectionIfNeeded(reason); | 545 invalidateSelectionIfNeeded(reason); |
| 543 | 546 |
| 544 if (reason == PaintInvalidationIncremental && !incrementallyInvalidatePaint()) | 547 if (reason == PaintInvalidationIncremental && !incrementallyInvalidatePaint()) |
| 545 reason = PaintInvalidationNone; | 548 reason = PaintInvalidationNone; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 569 | 572 |
| 570 m_context.paintingLayer->setNeedsRepaint(); | 573 m_context.paintingLayer->setNeedsRepaint(); |
| 571 m_object.invalidateDisplayItemClients(reason); | 574 m_object.invalidateDisplayItemClients(reason); |
| 572 return reason; | 575 return reason; |
| 573 } | 576 } |
| 574 | 577 |
| 575 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() | 578 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() |
| 576 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {} | 579 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {} |
| 577 | 580 |
| 578 } // namespace blink | 581 } // namespace blink |
| OLD | NEW |