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(); | |
492 | |
493 // The outline may change shape because of position change of descendants. For | 491 // The outline may change shape because of position change of descendants. For |
494 // simplicity, just force full paint invalidation if this object is marked for | 492 // simplicity, just force full paint invalidation if this object is marked for |
chrishtr
2017/02/03 02:00:11
Comment needs updating.
Xianzhu
2017/02/03 04:38:35
Done.
| |
495 // checking paint invalidation for any reason. | 493 // checking paint invalidation for any reason. |
496 // TODO(wangxianzhu): Optimize this. | 494 if (m_object.outlineMayBeAffectedByDescendants() || |
497 if (style.hasOutline()) | 495 m_object.previousOutlineMayBeAffectedByDescendants()) { |
496 m_object.getMutableForPainting() | |
497 .updatePreviousOutlineMayBeAffectedByDescendants(); | |
498 return PaintInvalidationOutline; | 498 return PaintInvalidationOutline; |
499 } | |
499 | 500 |
500 // If the size is zero on one of our bounds then we know we're going to have | 501 // 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. | 502 // to do a full invalidation of either old bounds or new bounds. |
502 if (m_context.oldVisualRect.isEmpty()) | 503 if (m_context.oldVisualRect.isEmpty()) |
503 return PaintInvalidationBecameVisible; | 504 return PaintInvalidationBecameVisible; |
504 if (m_context.newVisualRect.isEmpty()) | 505 if (m_context.newVisualRect.isEmpty()) |
505 return PaintInvalidationBecameInvisible; | 506 return PaintInvalidationBecameInvisible; |
506 | 507 |
507 // If we shifted, we don't know the exact reason so we are conservative and | 508 // 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 | 509 // 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 | 605 |
605 m_context.paintingLayer->setNeedsRepaint(); | 606 m_context.paintingLayer->setNeedsRepaint(); |
606 m_object.invalidateDisplayItemClients(reason); | 607 m_object.invalidateDisplayItemClients(reason); |
607 return reason; | 608 return reason; |
608 } | 609 } |
609 | 610 |
610 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() | 611 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() |
611 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {} | 612 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {} |
612 | 613 |
613 } // namespace blink | 614 } // namespace blink |
OLD | NEW |