| 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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 | 481 |
| 482 if (m_context.oldVisualRect.isEmpty() && m_context.newVisualRect.isEmpty()) | 482 if (m_context.oldVisualRect.isEmpty() && m_context.newVisualRect.isEmpty()) |
| 483 return PaintInvalidationNone; | 483 return PaintInvalidationNone; |
| 484 | 484 |
| 485 if (backgroundObscurationChanged) | 485 if (backgroundObscurationChanged) |
| 486 return PaintInvalidationBackgroundObscurationChange; | 486 return PaintInvalidationBackgroundObscurationChange; |
| 487 | 487 |
| 488 if (m_object.paintedOutputOfObjectHasNoEffectRegardlessOfSize()) | 488 if (m_object.paintedOutputOfObjectHasNoEffectRegardlessOfSize()) |
| 489 return PaintInvalidationNone; | 489 return PaintInvalidationNone; |
| 490 | 490 |
| 491 const ComputedStyle& style = m_object.styleRef(); | 491 // Force full paint invalidation if the outline may be affected by descendants |
| 492 | 492 // and this object is marked for checking paint invalidation for any reason. |
| 493 // The outline may change shape because of position change of descendants. For | 493 if (m_object.outlineMayBeAffectedByDescendants() || |
| 494 // simplicity, just force full paint invalidation if this object is marked for | 494 m_object.previousOutlineMayBeAffectedByDescendants()) { |
| 495 // checking paint invalidation for any reason. | 495 m_object.getMutableForPainting() |
| 496 // TODO(wangxianzhu): Optimize this. | 496 .updatePreviousOutlineMayBeAffectedByDescendants(); |
| 497 if (style.hasOutline()) | |
| 498 return PaintInvalidationOutline; | 497 return PaintInvalidationOutline; |
| 498 } |
| 499 | 499 |
| 500 // If the size is zero on one of our bounds then we know we're going to have | 500 // If the size is zero on one of our bounds then we know we're going to have |
| 501 // to do a full invalidation of either old bounds or new bounds. | 501 // to do a full invalidation of either old bounds or new bounds. |
| 502 if (m_context.oldVisualRect.isEmpty()) | 502 if (m_context.oldVisualRect.isEmpty()) |
| 503 return PaintInvalidationBecameVisible; | 503 return PaintInvalidationBecameVisible; |
| 504 if (m_context.newVisualRect.isEmpty()) | 504 if (m_context.newVisualRect.isEmpty()) |
| 505 return PaintInvalidationBecameInvisible; | 505 return PaintInvalidationBecameInvisible; |
| 506 | 506 |
| 507 // If we shifted, we don't know the exact reason so we are conservative and | 507 // If we shifted, we don't know the exact reason so we are conservative and |
| 508 // trigger a full invalidation. Shifting could be caused by some layout | 508 // trigger a full invalidation. Shifting could be caused by some layout |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 | 604 |
| 605 m_context.paintingLayer->setNeedsRepaint(); | 605 m_context.paintingLayer->setNeedsRepaint(); |
| 606 m_object.invalidateDisplayItemClients(reason); | 606 m_object.invalidateDisplayItemClients(reason); |
| 607 return reason; | 607 return reason; |
| 608 } | 608 } |
| 609 | 609 |
| 610 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() | 610 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() |
| 611 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {} | 611 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {} |
| 612 | 612 |
| 613 } // namespace blink | 613 } // namespace blink |
| OLD | NEW |