| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 result = SlowMapToVisualRectInAncestorSpace( | 98 result = SlowMapToVisualRectInAncestorSpace( |
| 99 object, *context.paint_invalidation_container, rect); | 99 object, *context.paint_invalidation_container, rect); |
| 100 } else if (object == context.paint_invalidation_container) { | 100 } else if (object == context.paint_invalidation_container) { |
| 101 result = LayoutRect(rect); | 101 result = LayoutRect(rect); |
| 102 } else { | 102 } else { |
| 103 // For non-root SVG, the input rect is in local SVG coordinates in which | 103 // For non-root SVG, the input rect is in local SVG coordinates in which |
| 104 // paint offset doesn't apply. | 104 // paint offset doesn't apply. |
| 105 if (!is_svg_child) | 105 if (!is_svg_child) |
| 106 rect.MoveBy(Point(object.PaintOffset())); | 106 rect.MoveBy(Point(object.PaintOffset())); |
| 107 | 107 |
| 108 const auto* container_contents_properties = | 108 auto container_contents_properties = |
| 109 context.paint_invalidation_container->ContentsProperties(); | 109 context.paint_invalidation_container->ContentsProperties(); |
| 110 | |
| 111 if (context.tree_builder_context_->current.transform == | 110 if (context.tree_builder_context_->current.transform == |
| 112 container_contents_properties->Transform() && | 111 container_contents_properties.Transform() && |
| 113 context.tree_builder_context_->current.clip == | 112 context.tree_builder_context_->current.clip == |
| 114 container_contents_properties->Clip()) { | 113 container_contents_properties.Clip()) { |
| 115 result = LayoutRect(rect); | 114 result = LayoutRect(rect); |
| 116 } else { | 115 } else { |
| 117 // Use enclosingIntRect to ensure the final visual rect will cover the | 116 // Use enclosingIntRect to ensure the final visual rect will cover the |
| 118 // rect in source coordinates no matter if the painting will use pixel | 117 // rect in source coordinates no matter if the painting will use pixel |
| 119 // snapping, when transforms are applied. If there is no transform, | 118 // snapping, when transforms are applied. If there is no transform, |
| 120 // enclosingIntRect is applied in the last step of paint invalidation | 119 // enclosingIntRect is applied in the last step of paint invalidation |
| 121 // (see CompositedLayerMapping::setContentsNeedDisplayInRect()). | 120 // (see CompositedLayerMapping::setContentsNeedDisplayInRect()). |
| 122 if (!is_svg_child && context.tree_builder_context_->current.transform != | 121 if (!is_svg_child && context.tree_builder_context_->current.transform != |
| 123 container_contents_properties->Transform()) | 122 container_contents_properties.Transform()) |
| 124 rect = Rect(EnclosingIntRect(rect)); | 123 rect = Rect(EnclosingIntRect(rect)); |
| 125 | 124 |
| 126 PropertyTreeState current_tree_state( | 125 PropertyTreeState current_tree_state( |
| 127 context.tree_builder_context_->current.transform, | 126 context.tree_builder_context_->current.transform, |
| 128 context.tree_builder_context_->current.clip, nullptr); | 127 context.tree_builder_context_->current.clip, nullptr); |
| 129 | 128 |
| 130 FloatClipRect float_rect((FloatRect(rect))); | 129 FloatClipRect float_rect((FloatRect(rect))); |
| 131 GeometryMapper::SourceToDestinationVisualRect( | 130 GeometryMapper::SourceToDestinationVisualRect( |
| 132 current_tree_state, *container_contents_properties, float_rect); | 131 current_tree_state, container_contents_properties, float_rect); |
| 133 result = LayoutRect(float_rect.Rect()); | 132 result = LayoutRect(float_rect.Rect()); |
| 134 } | 133 } |
| 135 | 134 |
| 136 // Convert the result to the container's contents space. | 135 // Convert the result to the container's contents space. |
| 137 result.MoveBy(-context.paint_invalidation_container->PaintOffset()); | 136 result.MoveBy(-context.paint_invalidation_container->PaintOffset()); |
| 138 } | 137 } |
| 139 | 138 |
| 140 object.AdjustVisualRectForRasterEffects(result); | 139 object.AdjustVisualRectForRasterEffects(result); |
| 141 | 140 |
| 142 PaintLayer::MapRectInPaintInvalidationContainerToBacking( | 141 PaintLayer::MapRectInPaintInvalidationContainerToBacking( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 const PaintInvalidatorContext& context) { | 173 const PaintInvalidatorContext& context) { |
| 175 // In SPv2, locationInBacking is in the space of their local transform node. | 174 // In SPv2, locationInBacking is in the space of their local transform node. |
| 176 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 175 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 177 return object.PaintOffset(); | 176 return object.PaintOffset(); |
| 178 | 177 |
| 179 LayoutPoint point; | 178 LayoutPoint point; |
| 180 if (object != context.paint_invalidation_container) { | 179 if (object != context.paint_invalidation_container) { |
| 181 point.MoveBy(object.PaintOffset()); | 180 point.MoveBy(object.PaintOffset()); |
| 182 | 181 |
| 183 const auto* container_transform = | 182 const auto* container_transform = |
| 184 context.paint_invalidation_container->ContentsProperties()->Transform(); | 183 context.paint_invalidation_container->ContentsProperties().Transform(); |
| 185 if (context.tree_builder_context_->current.transform != | 184 if (context.tree_builder_context_->current.transform != |
| 186 container_transform) { | 185 container_transform) { |
| 187 FloatRect rect = FloatRect(FloatPoint(point), FloatSize()); | 186 FloatRect rect = FloatRect(FloatPoint(point), FloatSize()); |
| 188 GeometryMapper::SourceToDestinationRect( | 187 GeometryMapper::SourceToDestinationRect( |
| 189 context.tree_builder_context_->current.transform, container_transform, | 188 context.tree_builder_context_->current.transform, container_transform, |
| 190 rect); | 189 rect); |
| 191 point = LayoutPoint(rect.Location()); | 190 point = LayoutPoint(rect.Location()); |
| 192 } | 191 } |
| 193 | 192 |
| 194 // Convert the result to the container's contents space. | 193 // Convert the result to the container's contents space. |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 } | 505 } |
| 507 | 506 |
| 508 void PaintInvalidator::ProcessPendingDelayedPaintInvalidations() { | 507 void PaintInvalidator::ProcessPendingDelayedPaintInvalidations() { |
| 509 for (auto target : pending_delayed_paint_invalidations_) { | 508 for (auto target : pending_delayed_paint_invalidations_) { |
| 510 target->GetMutableForPainting().SetShouldDoFullPaintInvalidation( | 509 target->GetMutableForPainting().SetShouldDoFullPaintInvalidation( |
| 511 kPaintInvalidationDelayedFull); | 510 kPaintInvalidationDelayedFull); |
| 512 } | 511 } |
| 513 } | 512 } |
| 514 | 513 |
| 515 } // namespace blink | 514 } // namespace blink |
| OLD | NEW |