| 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/PaintInvalidator.h" | 5 #include "core/paint/PaintInvalidator.h" |
| 6 | 6 |
| 7 #include "core/editing/FrameSelection.h" | 7 #include "core/editing/FrameSelection.h" |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
| 10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 if (context.forcedSubtreeInvalidationFlags & PaintInvalidatorContext::Forced
SubtreeSlowPathRect) { | 66 if (context.forcedSubtreeInvalidationFlags & PaintInvalidatorContext::Forced
SubtreeSlowPathRect) { |
| 67 result = slowMapToVisualRectInAncestorSpace(object, *context.paintInvali
dationContainer, rect); | 67 result = slowMapToVisualRectInAncestorSpace(object, *context.paintInvali
dationContainer, rect); |
| 68 } else if (object == context.paintInvalidationContainer) { | 68 } else if (object == context.paintInvalidationContainer) { |
| 69 result = LayoutRect(rect); | 69 result = LayoutRect(rect); |
| 70 } else { | 70 } else { |
| 71 rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); | 71 rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); |
| 72 | 72 |
| 73 GeometryPropertyTreeState currentTreeState(context.treeBuilderContext.cu
rrent.transform, context.treeBuilderContext.current.clip, context.treeBuilderCon
text.currentEffect); | 73 GeometryPropertyTreeState currentTreeState(context.treeBuilderContext.cu
rrent.transform, context.treeBuilderContext.current.clip, context.treeBuilderCon
text.currentEffect); |
| 74 GeometryPropertyTreeState containerTreeState; | 74 GeometryPropertyTreeState containerTreeState; |
| 75 const ObjectPaintProperties* containerPaintProperties = context.paintInv
alidationContainer->objectPaintProperties(); | 75 const ObjectPaintProperties* containerPaintProperties = context.paintInv
alidationContainer->objectPaintProperties(); |
| 76 containerPaintProperties->getContentsProperties(containerTreeState); | 76 LayoutPoint paintOffsetFromContainerTreeState; |
| 77 containerPaintProperties->getContentsPropertyTreeState(containerTreeStat
e, paintOffsetFromContainerTreeState); |
| 77 | 78 |
| 78 bool success = false; | 79 bool success = false; |
| 79 result = LayoutRect(geometryMapper.mapToVisualRectInDestinationSpace(rec
t, currentTreeState, containerTreeState, success)); | 80 result = LayoutRect(geometryMapper.mapToVisualRectInDestinationSpace(rec
t, currentTreeState, containerTreeState, success)); |
| 80 DCHECK(success); | 81 DCHECK(success); |
| 81 result.moveBy(-containerPaintProperties->localBorderBoxProperties()->pai
ntOffset); | 82 |
| 83 // Convert the result from containerTreeState space to the container's c
ontents space. |
| 84 result.moveBy(-paintOffsetFromContainerTreeState); |
| 82 } | 85 } |
| 83 | 86 |
| 84 if (context.paintInvalidationContainer->layer()->groupedMapping()) | 87 if (context.paintInvalidationContainer->layer()->groupedMapping()) |
| 85 PaintLayer::mapRectInPaintInvalidationContainerToBacking(*context.paintI
nvalidationContainer, result); | 88 PaintLayer::mapRectInPaintInvalidationContainerToBacking(*context.paintI
nvalidationContainer, result); |
| 86 return result; | 89 return result; |
| 87 } | 90 } |
| 88 | 91 |
| 89 void PaintInvalidatorContext::mapLocalRectToPaintInvalidationBacking(const Layou
tObject& object, LayoutRect& rect) const | 92 void PaintInvalidatorContext::mapLocalRectToPaintInvalidationBacking(const Layou
tObject& object, LayoutRect& rect) const |
| 90 { | 93 { |
| 91 GeometryMapper geometryMapper; | 94 GeometryMapper geometryMapper; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 107 | 110 |
| 108 return mapLocalRectToPaintInvalidationBacking(object, localRect, context); | 111 return mapLocalRectToPaintInvalidationBacking(object, localRect, context); |
| 109 } | 112 } |
| 110 | 113 |
| 111 LayoutPoint PaintInvalidator::computeLocationFromPaintInvalidationBacking(const
LayoutObject& object, const PaintInvalidatorContext& context) | 114 LayoutPoint PaintInvalidator::computeLocationFromPaintInvalidationBacking(const
LayoutObject& object, const PaintInvalidatorContext& context) |
| 112 { | 115 { |
| 113 FloatPoint point; | 116 FloatPoint point; |
| 114 if (object != context.paintInvalidationContainer) { | 117 if (object != context.paintInvalidationContainer) { |
| 115 point.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset))
; | 118 point.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset))
; |
| 116 | 119 |
| 117 bool success = false; | |
| 118 GeometryPropertyTreeState currentTreeState(context.treeBuilderContext.cu
rrent.transform, context.treeBuilderContext.current.clip, context.treeBuilderCon
text.currentEffect); | 120 GeometryPropertyTreeState currentTreeState(context.treeBuilderContext.cu
rrent.transform, context.treeBuilderContext.current.clip, context.treeBuilderCon
text.currentEffect); |
| 119 GeometryPropertyTreeState containerTreeState; | 121 GeometryPropertyTreeState containerTreeState; |
| 120 context.paintInvalidationContainer->objectPaintProperties()->getContents
Properties(containerTreeState); | 122 LayoutPoint paintOffsetFromContainerTreeState; |
| 123 context.paintInvalidationContainer->objectPaintProperties()->getContents
PropertyTreeState(containerTreeState, paintOffsetFromContainerTreeState); |
| 124 |
| 125 bool success = false; |
| 121 point = m_geometryMapper.mapRectToDestinationSpace(FloatRect(point, Floa
tSize()), currentTreeState, containerTreeState, success).location(); | 126 point = m_geometryMapper.mapRectToDestinationSpace(FloatRect(point, Floa
tSize()), currentTreeState, containerTreeState, success).location(); |
| 122 DCHECK(success); | 127 DCHECK(success); |
| 128 |
| 129 // Convert the result from containerTreeState space to the container's c
ontents space. |
| 130 point.moveBy(-paintOffsetFromContainerTreeState); |
| 123 } | 131 } |
| 124 | 132 |
| 125 if (context.paintInvalidationContainer->layer()->groupedMapping()) | 133 if (context.paintInvalidationContainer->layer()->groupedMapping()) |
| 126 PaintLayer::mapPointInPaintInvalidationContainerToBacking(*context.paint
InvalidationContainer, point); | 134 PaintLayer::mapPointInPaintInvalidationContainerToBacking(*context.paint
InvalidationContainer, point); |
| 127 | 135 |
| 128 return LayoutPoint(point); | 136 return LayoutPoint(point); |
| 129 } | 137 } |
| 130 | 138 |
| 131 void PaintInvalidator::updatePaintingLayer(const LayoutObject& object, PaintInva
lidatorContext& context) | 139 void PaintInvalidator::updatePaintingLayer(const LayoutObject& object, PaintInva
lidatorContext& context) |
| 132 { | 140 { |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 object.getMutableForPainting().clearPaintInvalidationFlags(); | 321 object.getMutableForPainting().clearPaintInvalidationFlags(); |
| 314 } | 322 } |
| 315 | 323 |
| 316 void PaintInvalidator::processPendingDelayedPaintInvalidations() | 324 void PaintInvalidator::processPendingDelayedPaintInvalidations() |
| 317 { | 325 { |
| 318 for (auto target : m_pendingDelayedPaintInvalidations) | 326 for (auto target : m_pendingDelayedPaintInvalidations) |
| 319 target->getMutableForPainting().setShouldDoFullPaintInvalidation(PaintIn
validationDelayedFull); | 327 target->getMutableForPainting().setShouldDoFullPaintInvalidation(PaintIn
validationDelayedFull); |
| 320 } | 328 } |
| 321 | 329 |
| 322 } // namespace blink | 330 } // namespace blink |
| OLD | NEW |