| 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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 DCHECK(m_object.hasLocationInBacking() == | 435 DCHECK(m_object.hasLocationInBacking() == |
| 436 locationInBackingMap().contains(&m_object)); | 436 locationInBackingMap().contains(&m_object)); |
| 437 if (location == m_object.visualRect().location()) { | 437 if (location == m_object.visualRect().location()) { |
| 438 if (m_object.hasLocationInBacking()) { | 438 if (m_object.hasLocationInBacking()) { |
| 439 locationInBackingMap().erase(&m_object); | 439 locationInBackingMap().erase(&m_object); |
| 440 m_object.getMutableForPainting().setHasPreviousLocationInBacking(false); | 440 m_object.getMutableForPainting().setHasPreviousLocationInBacking(false); |
| 441 } | 441 } |
| 442 } else { | 442 } else { |
| 443 locationInBackingMap().set(&m_object, location); | 443 locationInBackingMap().set(&m_object, location); |
| 444 m_object.getMutableForPainting().setHasPreviousLocationInBacking(true); | 444 m_object.getMutableForPainting().setHasPreviousLocationInBacking(true); |
| 445 m_object.m_rareStat.addReason(ReasonLOPreviousLocation); |
| 446 |
| 447 if (m_object.visualRect().isEmpty()) |
| 448 m_object.m_rareStat.addReason(ReasonLocationOffsetObject); |
| 449 if (m_object.isBox()) |
| 450 m_object.m_rareStat.addReason(ReasonLocationOffsetBox); |
| 451 if (m_object.isText()) |
| 452 m_object.m_rareStat.addReason(ReasonLocationOffsetText); |
| 453 if (m_object.isLayoutInline()) |
| 454 m_object.m_rareStat.addReason(ReasonLocationOffsetInline); |
| 455 if (m_object.isSVG()) |
| 456 m_object.m_rareStat.addReason(ReasonLocationOffsetSVG); |
| 445 } | 457 } |
| 446 } | 458 } |
| 447 | 459 |
| 448 void ObjectPaintInvalidatorWithContext::fullyInvalidatePaint( | 460 void ObjectPaintInvalidatorWithContext::fullyInvalidatePaint( |
| 449 PaintInvalidationReason reason, | 461 PaintInvalidationReason reason, |
| 450 const LayoutRect& oldVisualRect, | 462 const LayoutRect& oldVisualRect, |
| 451 const LayoutRect& newVisualRect) { | 463 const LayoutRect& newVisualRect) { |
| 452 // The following logic avoids invalidating twice if one set of bounds contains | 464 // The following logic avoids invalidating twice if one set of bounds contains |
| 453 // the other. | 465 // the other. |
| 454 if (!newVisualRect.contains(oldVisualRect)) { | 466 if (!newVisualRect.contains(oldVisualRect)) { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 | 658 |
| 647 m_context.paintingLayer->setNeedsRepaint(); | 659 m_context.paintingLayer->setNeedsRepaint(); |
| 648 m_object.invalidateDisplayItemClients(reason); | 660 m_object.invalidateDisplayItemClients(reason); |
| 649 return reason; | 661 return reason; |
| 650 } | 662 } |
| 651 | 663 |
| 652 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() | 664 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() |
| 653 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {} | 665 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {} |
| 654 | 666 |
| 655 } // namespace blink | 667 } // namespace blink |
| OLD | NEW |