| 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 | 421 |
| 422 void ObjectPaintInvalidator::slowSetPaintingLayerNeedsRepaint() { | 422 void ObjectPaintInvalidator::slowSetPaintingLayerNeedsRepaint() { |
| 423 if (PaintLayer* paintingLayer = m_object.paintingLayer()) | 423 if (PaintLayer* paintingLayer = m_object.paintingLayer()) |
| 424 paintingLayer->setNeedsRepaint(); | 424 paintingLayer->setNeedsRepaint(); |
| 425 } | 425 } |
| 426 | 426 |
| 427 LayoutPoint ObjectPaintInvalidator::previousLocationInBacking() const { | 427 LayoutPoint ObjectPaintInvalidator::previousLocationInBacking() const { |
| 428 DCHECK(m_object.hasPreviousLocationInBacking() == | 428 DCHECK(m_object.hasPreviousLocationInBacking() == |
| 429 locationInBackingMap().contains(&m_object)); | 429 locationInBackingMap().contains(&m_object)); |
| 430 return m_object.hasPreviousLocationInBacking() | 430 return m_object.hasPreviousLocationInBacking() |
| 431 ? locationInBackingMap().get(&m_object) | 431 ? locationInBackingMap().at(&m_object) |
| 432 : m_object.previousVisualRect().location(); | 432 : m_object.previousVisualRect().location(); |
| 433 } | 433 } |
| 434 | 434 |
| 435 void ObjectPaintInvalidator::setPreviousLocationInBacking( | 435 void ObjectPaintInvalidator::setPreviousLocationInBacking( |
| 436 const LayoutPoint& location) { | 436 const LayoutPoint& location) { |
| 437 DCHECK(m_object.hasPreviousLocationInBacking() == | 437 DCHECK(m_object.hasPreviousLocationInBacking() == |
| 438 locationInBackingMap().contains(&m_object)); | 438 locationInBackingMap().contains(&m_object)); |
| 439 if (location == m_object.previousVisualRect().location()) { | 439 if (location == m_object.previousVisualRect().location()) { |
| 440 if (m_object.hasPreviousLocationInBacking()) { | 440 if (m_object.hasPreviousLocationInBacking()) { |
| 441 locationInBackingMap().erase(&m_object); | 441 locationInBackingMap().erase(&m_object); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 // shouldInvalidationSelection is set (in case that the selection itself | 543 // shouldInvalidationSelection is set (in case that the selection itself |
| 544 // changed). | 544 // changed). |
| 545 bool fullInvalidation = isImmediateFullPaintInvalidationReason(reason); | 545 bool fullInvalidation = isImmediateFullPaintInvalidationReason(reason); |
| 546 if (!fullInvalidation && !m_object.shouldInvalidateSelection()) | 546 if (!fullInvalidation && !m_object.shouldInvalidateSelection()) |
| 547 return; | 547 return; |
| 548 | 548 |
| 549 DCHECK(m_object.hasPreviousSelectionVisualRect() == | 549 DCHECK(m_object.hasPreviousSelectionVisualRect() == |
| 550 selectionVisualRectMap().contains(&m_object)); | 550 selectionVisualRectMap().contains(&m_object)); |
| 551 LayoutRect oldSelectionRect; | 551 LayoutRect oldSelectionRect; |
| 552 if (m_object.hasPreviousSelectionVisualRect()) | 552 if (m_object.hasPreviousSelectionVisualRect()) |
| 553 oldSelectionRect = selectionVisualRectMap().get(&m_object); | 553 oldSelectionRect = selectionVisualRectMap().at(&m_object); |
| 554 LayoutRect newSelectionRect = m_object.localSelectionRect(); | 554 LayoutRect newSelectionRect = m_object.localSelectionRect(); |
| 555 if (!newSelectionRect.isEmpty()) { | 555 if (!newSelectionRect.isEmpty()) { |
| 556 m_context.mapLocalRectToPaintInvalidationBacking(m_object, | 556 m_context.mapLocalRectToPaintInvalidationBacking(m_object, |
| 557 newSelectionRect); | 557 newSelectionRect); |
| 558 newSelectionRect.move(m_object.scrollAdjustmentForPaintInvalidation( | 558 newSelectionRect.move(m_object.scrollAdjustmentForPaintInvalidation( |
| 559 *m_context.paintInvalidationContainer)); | 559 *m_context.paintInvalidationContainer)); |
| 560 } | 560 } |
| 561 | 561 |
| 562 setPreviousSelectionVisualRect(m_object, newSelectionRect); | 562 setPreviousSelectionVisualRect(m_object, newSelectionRect); |
| 563 | 563 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 | 611 |
| 612 m_context.paintingLayer->setNeedsRepaint(); | 612 m_context.paintingLayer->setNeedsRepaint(); |
| 613 m_object.invalidateDisplayItemClients(reason); | 613 m_object.invalidateDisplayItemClients(reason); |
| 614 return reason; | 614 return reason; |
| 615 } | 615 } |
| 616 | 616 |
| 617 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() | 617 DisablePaintInvalidationStateAsserts::DisablePaintInvalidationStateAsserts() |
| 618 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {} | 618 : m_disabler(&gDisablePaintInvalidationStateAsserts, true) {} |
| 619 | 619 |
| 620 } // namespace blink | 620 } // namespace blink |
| OLD | NEW |