| Index: third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp
|
| diff --git a/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp b/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp
|
| index 5dac2b6796a97570578b3be9562eb3e3e32904dc..8da60adff69277ad1642617b892d8d33f8709110 100644
|
| --- a/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp
|
| +++ b/third_party/WebKit/Source/core/paint/ObjectPaintInvalidator.cpp
|
| @@ -33,8 +33,20 @@ static void setPreviousSelectionVisualRect(const LayoutObject& object,
|
| selectionVisualRectMap().set(&object, rect);
|
| }
|
|
|
| +typedef HashMap<const LayoutObject*, LayoutPoint> LocationInBackingMap;
|
| +static LocationInBackingMap& locationInBackingMap() {
|
| + DEFINE_STATIC_LOCAL(LocationInBackingMap, map, ());
|
| + return map;
|
| +}
|
| +
|
| void ObjectPaintInvalidator::objectWillBeDestroyed(const LayoutObject& object) {
|
| + // TODO(wangxianzhu): Use the same mechanism as for locatinInBackingMap().
|
| selectionVisualRectMap().remove(&object);
|
| +
|
| + DCHECK(object.hasPreviousLocationInBacking() ==
|
| + locationInBackingMap().contains(&object));
|
| + if (object.hasPreviousLocationInBacking())
|
| + locationInBackingMap().remove(&object);
|
| }
|
|
|
| // TODO(trchen): Use std::function<void, LayoutObject&> when available.
|
| @@ -370,6 +382,29 @@ void ObjectPaintInvalidator::slowSetPaintingLayerNeedsRepaint() {
|
| paintingLayer->setNeedsRepaint();
|
| }
|
|
|
| +LayoutPoint ObjectPaintInvalidator::previousLocationInBacking() const {
|
| + DCHECK(m_object.hasPreviousLocationInBacking() ==
|
| + locationInBackingMap().contains(&m_object));
|
| + return m_object.hasPreviousLocationInBacking()
|
| + ? locationInBackingMap().get(&m_object)
|
| + : m_object.previousVisualRect().location();
|
| +}
|
| +
|
| +void ObjectPaintInvalidator::setPreviousLocationInBacking(
|
| + const LayoutPoint& location) {
|
| + DCHECK(m_object.hasPreviousLocationInBacking() ==
|
| + locationInBackingMap().contains(&m_object));
|
| + if (location == m_object.previousVisualRect().location()) {
|
| + if (m_object.hasPreviousLocationInBacking()) {
|
| + locationInBackingMap().remove(&m_object);
|
| + m_object.getMutableForPainting().setHasPreviousLocationInBacking(false);
|
| + }
|
| + } else {
|
| + locationInBackingMap().set(&m_object, location);
|
| + m_object.getMutableForPainting().setHasPreviousLocationInBacking(true);
|
| + }
|
| +}
|
| +
|
| void ObjectPaintInvalidatorWithContext::fullyInvalidatePaint(
|
| PaintInvalidationReason reason,
|
| const LayoutRect& oldVisualRect,
|
|
|