| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 LayoutRect result; | 76 LayoutRect result; |
| 77 if (context.forcedSubtreeInvalidationFlags & | 77 if (context.forcedSubtreeInvalidationFlags & |
| 78 PaintInvalidatorContext::ForcedSubtreeSlowPathRect) { | 78 PaintInvalidatorContext::ForcedSubtreeSlowPathRect) { |
| 79 result = slowMapToVisualRectInAncestorSpace( | 79 result = slowMapToVisualRectInAncestorSpace( |
| 80 object, *context.paintInvalidationContainer, rect); | 80 object, *context.paintInvalidationContainer, rect); |
| 81 } else if (object == context.paintInvalidationContainer) { | 81 } else if (object == context.paintInvalidationContainer) { |
| 82 result = LayoutRect(rect); | 82 result = LayoutRect(rect); |
| 83 } else { | 83 } else { |
| 84 rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); | 84 rect.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); |
| 85 | 85 |
| 86 GeometryPropertyTreeState currentTreeState( | 86 PropertyTreeState currentTreeState( |
| 87 context.treeBuilderContext.current.transform, | 87 context.treeBuilderContext.current.transform, |
| 88 context.treeBuilderContext.current.clip, | 88 context.treeBuilderContext.current.clip, |
| 89 context.treeBuilderContext.currentEffect); | 89 context.treeBuilderContext.currentEffect, |
| 90 GeometryPropertyTreeState containerTreeState; | 90 context.treeBuilderContext.current.scroll); |
| 91 const ObjectPaintProperties* containerPaintProperties = | 91 const ObjectPaintProperties* containerPaintProperties = |
| 92 context.paintInvalidationContainer->objectPaintProperties(); | 92 context.paintInvalidationContainer->objectPaintProperties(); |
| 93 LayoutPoint paintOffsetFromContainerTreeState; | 93 auto containerContentsProperties = |
| 94 containerPaintProperties->getContentsPropertyTreeState( | 94 containerPaintProperties->contentsProperties(); |
| 95 containerTreeState, paintOffsetFromContainerTreeState); | |
| 96 | 95 |
| 97 bool success = false; | 96 bool success = false; |
| 98 result = LayoutRect(geometryMapper.mapToVisualRectInDestinationSpace( | 97 result = LayoutRect(geometryMapper.mapToVisualRectInDestinationSpace( |
| 99 rect, currentTreeState, containerTreeState, success)); | 98 rect, currentTreeState, containerContentsProperties.propertyTreeState, |
| 99 success)); |
| 100 DCHECK(success); | 100 DCHECK(success); |
| 101 | 101 |
| 102 // Convert the result from containerTreeState space to the container's conte
nts space. | 102 // Convert the result to the container's contents space. |
| 103 result.moveBy(-paintOffsetFromContainerTreeState); | 103 result.moveBy(-containerContentsProperties.paintOffset); |
| 104 } | 104 } |
| 105 | 105 |
| 106 if (context.paintInvalidationContainer->layer()->groupedMapping()) | 106 if (context.paintInvalidationContainer->layer()->groupedMapping()) |
| 107 PaintLayer::mapRectInPaintInvalidationContainerToBacking( | 107 PaintLayer::mapRectInPaintInvalidationContainerToBacking( |
| 108 *context.paintInvalidationContainer, result); | 108 *context.paintInvalidationContainer, result); |
| 109 return result; | 109 return result; |
| 110 } | 110 } |
| 111 | 111 |
| 112 void PaintInvalidatorContext::mapLocalRectToPaintInvalidationBacking( | 112 void PaintInvalidatorContext::mapLocalRectToPaintInvalidationBacking( |
| 113 const LayoutObject& object, | 113 const LayoutObject& object, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 137 return mapLocalRectToPaintInvalidationBacking(object, localRect, context); | 137 return mapLocalRectToPaintInvalidationBacking(object, localRect, context); |
| 138 } | 138 } |
| 139 | 139 |
| 140 LayoutPoint PaintInvalidator::computeLocationFromPaintInvalidationBacking( | 140 LayoutPoint PaintInvalidator::computeLocationFromPaintInvalidationBacking( |
| 141 const LayoutObject& object, | 141 const LayoutObject& object, |
| 142 const PaintInvalidatorContext& context) { | 142 const PaintInvalidatorContext& context) { |
| 143 FloatPoint point; | 143 FloatPoint point; |
| 144 if (object != context.paintInvalidationContainer) { | 144 if (object != context.paintInvalidationContainer) { |
| 145 point.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); | 145 point.moveBy(FloatPoint(context.treeBuilderContext.current.paintOffset)); |
| 146 | 146 |
| 147 GeometryPropertyTreeState currentTreeState( | 147 PropertyTreeState currentTreeState( |
| 148 context.treeBuilderContext.current.transform, | 148 context.treeBuilderContext.current.transform, |
| 149 context.treeBuilderContext.current.clip, | 149 context.treeBuilderContext.current.clip, |
| 150 context.treeBuilderContext.currentEffect); | 150 context.treeBuilderContext.currentEffect, |
| 151 GeometryPropertyTreeState containerTreeState; | 151 context.treeBuilderContext.current.scroll); |
| 152 LayoutPoint paintOffsetFromContainerTreeState; | 152 const ObjectPaintProperties* containerPaintProperties = |
| 153 context.paintInvalidationContainer->objectPaintProperties() | 153 context.paintInvalidationContainer->objectPaintProperties(); |
| 154 ->getContentsPropertyTreeState(containerTreeState, | 154 auto containerContentsProperties = |
| 155 paintOffsetFromContainerTreeState); | 155 containerPaintProperties->contentsProperties(); |
| 156 | 156 |
| 157 bool success = false; | 157 bool success = false; |
| 158 point = m_geometryMapper | 158 point = m_geometryMapper |
| 159 .mapRectToDestinationSpace(FloatRect(point, FloatSize()), | 159 .mapRectToDestinationSpace( |
| 160 currentTreeState, containerTreeState, | 160 FloatRect(point, FloatSize()), currentTreeState, |
| 161 success) | 161 containerContentsProperties.propertyTreeState, success) |
| 162 .location(); | 162 .location(); |
| 163 DCHECK(success); | 163 DCHECK(success); |
| 164 | 164 |
| 165 // Convert the result from containerTreeState space to the container's conte
nts space. | 165 // Convert the result to the container's contents space. |
| 166 point.moveBy(-paintOffsetFromContainerTreeState); | 166 point.moveBy(-containerContentsProperties.paintOffset); |
| 167 } | 167 } |
| 168 | 168 |
| 169 if (context.paintInvalidationContainer->layer()->groupedMapping()) | 169 if (context.paintInvalidationContainer->layer()->groupedMapping()) |
| 170 PaintLayer::mapPointInPaintInvalidationContainerToBacking( | 170 PaintLayer::mapPointInPaintInvalidationContainerToBacking( |
| 171 *context.paintInvalidationContainer, point); | 171 *context.paintInvalidationContainer, point); |
| 172 | 172 |
| 173 return LayoutPoint(point); | 173 return LayoutPoint(point); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void PaintInvalidator::updatePaintingLayer(const LayoutObject& object, | 176 void PaintInvalidator::updatePaintingLayer(const LayoutObject& object, |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 object.getMutableForPainting().clearPaintInvalidationFlags(); | 428 object.getMutableForPainting().clearPaintInvalidationFlags(); |
| 429 } | 429 } |
| 430 | 430 |
| 431 void PaintInvalidator::processPendingDelayedPaintInvalidations() { | 431 void PaintInvalidator::processPendingDelayedPaintInvalidations() { |
| 432 for (auto target : m_pendingDelayedPaintInvalidations) | 432 for (auto target : m_pendingDelayedPaintInvalidations) |
| 433 target->getMutableForPainting().setShouldDoFullPaintInvalidation( | 433 target->getMutableForPainting().setShouldDoFullPaintInvalidation( |
| 434 PaintInvalidationDelayedFull); | 434 PaintInvalidationDelayedFull); |
| 435 } | 435 } |
| 436 | 436 |
| 437 } // namespace blink | 437 } // namespace blink |
| OLD | NEW |