| 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/LayoutView.h" | 9 #include "core/layout/LayoutView.h" |
| 10 #include "core/layout/api/LayoutPartItem.h" | 10 #include "core/layout/api/LayoutPartItem.h" |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 invalidationRect, reason); | 421 invalidationRect, reason); |
| 422 | 422 |
| 423 if (invalidationRect.contains(newVisualRect)) | 423 if (invalidationRect.contains(newVisualRect)) |
| 424 return; | 424 return; |
| 425 } | 425 } |
| 426 | 426 |
| 427 invalidatePaintUsingContainer(*m_context.paintInvalidationContainer, | 427 invalidatePaintUsingContainer(*m_context.paintInvalidationContainer, |
| 428 newVisualRect, reason); | 428 newVisualRect, reason); |
| 429 } | 429 } |
| 430 | 430 |
| 431 DISABLE_CFI_PERF |
| 431 PaintInvalidationReason | 432 PaintInvalidationReason |
| 432 ObjectPaintInvalidatorWithContext::computePaintInvalidationReason() { | 433 ObjectPaintInvalidatorWithContext::computePaintInvalidationReason() { |
| 433 // This is before any early return to ensure the background obscuration status | 434 // This is before any early return to ensure the background obscuration status |
| 434 // is saved. | 435 // is saved. |
| 435 bool backgroundObscurationChanged = false; | 436 bool backgroundObscurationChanged = false; |
| 436 bool backgroundObscured = m_object.backgroundIsKnownToBeObscured(); | 437 bool backgroundObscured = m_object.backgroundIsKnownToBeObscured(); |
| 437 if (backgroundObscured != m_object.previousBackgroundObscured()) { | 438 if (backgroundObscured != m_object.previousBackgroundObscured()) { |
| 438 m_object.getMutableForPainting().setPreviousBackgroundObscured( | 439 m_object.getMutableForPainting().setPreviousBackgroundObscured( |
| 439 backgroundObscured); | 440 backgroundObscured); |
| 440 backgroundObscurationChanged = true; | 441 backgroundObscurationChanged = true; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 // paint invalidation reason if needed. | 490 // paint invalidation reason if needed. |
| 490 if (m_object.isBox()) | 491 if (m_object.isBox()) |
| 491 return PaintInvalidationIncremental; | 492 return PaintInvalidationIncremental; |
| 492 | 493 |
| 493 if (m_context.oldVisualRect != m_context.newVisualRect) | 494 if (m_context.oldVisualRect != m_context.newVisualRect) |
| 494 return PaintInvalidationBoundsChange; | 495 return PaintInvalidationBoundsChange; |
| 495 | 496 |
| 496 return PaintInvalidationNone; | 497 return PaintInvalidationNone; |
| 497 } | 498 } |
| 498 | 499 |
| 500 DISABLE_CFI_PERF |
| 499 void ObjectPaintInvalidatorWithContext::invalidateSelectionIfNeeded( | 501 void ObjectPaintInvalidatorWithContext::invalidateSelectionIfNeeded( |
| 500 PaintInvalidationReason reason) { | 502 PaintInvalidationReason reason) { |
| 501 // Update selection rect when we are doing full invalidation (in case that the | 503 // Update selection rect when we are doing full invalidation (in case that the |
| 502 // object is moved, composite status changed, etc.) or | 504 // object is moved, composite status changed, etc.) or |
| 503 // shouldInvalidationSelection is set (in case that the selection itself | 505 // shouldInvalidationSelection is set (in case that the selection itself |
| 504 // changed). | 506 // changed). |
| 505 bool fullInvalidation = isImmediateFullPaintInvalidationReason(reason); | 507 bool fullInvalidation = isImmediateFullPaintInvalidationReason(reason); |
| 506 if (!fullInvalidation && !m_object.shouldInvalidateSelection()) | 508 if (!fullInvalidation && !m_object.shouldInvalidateSelection()) |
| 507 return; | 509 return; |
| 508 | 510 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 522 setPreviousSelectionVisualRect(m_object, newSelectionRect); | 524 setPreviousSelectionVisualRect(m_object, newSelectionRect); |
| 523 | 525 |
| 524 if (!fullInvalidation) { | 526 if (!fullInvalidation) { |
| 525 fullyInvalidatePaint(PaintInvalidationSelection, oldSelectionRect, | 527 fullyInvalidatePaint(PaintInvalidationSelection, oldSelectionRect, |
| 526 newSelectionRect); | 528 newSelectionRect); |
| 527 m_context.paintingLayer->setNeedsRepaint(); | 529 m_context.paintingLayer->setNeedsRepaint(); |
| 528 m_object.invalidateDisplayItemClients(PaintInvalidationSelection); | 530 m_object.invalidateDisplayItemClients(PaintInvalidationSelection); |
| 529 } | 531 } |
| 530 } | 532 } |
| 531 | 533 |
| 534 DISABLE_CFI_PERF |
| 532 PaintInvalidationReason | 535 PaintInvalidationReason |
| 533 ObjectPaintInvalidatorWithContext::invalidatePaintIfNeededWithComputedReason( | 536 ObjectPaintInvalidatorWithContext::invalidatePaintIfNeededWithComputedReason( |
| 534 PaintInvalidationReason reason) { | 537 PaintInvalidationReason reason) { |
| 535 // We need to invalidate the selection before checking for whether we are | 538 // We need to invalidate the selection before checking for whether we are |
| 536 // doing a full invalidation. This is because we need to update the previous | 539 // doing a full invalidation. This is because we need to update the previous |
| 537 // selection rect regardless. | 540 // selection rect regardless. |
| 538 invalidateSelectionIfNeeded(reason); | 541 invalidateSelectionIfNeeded(reason); |
| 539 | 542 |
| 540 switch (reason) { | 543 switch (reason) { |
| 541 case PaintInvalidationNone: | 544 case PaintInvalidationNone: |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 | 580 |
| 578 m_context.paintingLayer->setNeedsRepaint(); | 581 m_context.paintingLayer->setNeedsRepaint(); |
| 579 m_object.invalidateDisplayItemClients(reason); | 582 m_object.invalidateDisplayItemClients(reason); |
| 580 return reason; | 583 return reason; |
| 581 } | 584 } |
| 582 | 585 |
| 583 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() | 586 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() |
| 584 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {} | 587 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {} |
| 585 | 588 |
| 586 } // namespace blink | 589 } // namespace blink |
| OLD | NEW |