| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // For SVG, the input rect is in local SVG coordinates in which paint | 85 // For SVG, the input rect is in local SVG coordinates in which paint |
| 86 // offset doesn't apply. | 86 // offset doesn't apply. |
| 87 if (!is_svg_child) | 87 if (!is_svg_child) |
| 88 rect.MoveBy(Point(object.PaintOffset())); | 88 rect.MoveBy(Point(object.PaintOffset())); |
| 89 // Use enclosingIntRect to ensure the final visual rect will cover the | 89 // Use enclosingIntRect to ensure the final visual rect will cover the |
| 90 // rect in source coordinates no matter if the painting will use pixel | 90 // rect in source coordinates no matter if the painting will use pixel |
| 91 // snapping. | 91 // snapping. |
| 92 return LayoutRect(EnclosingIntRect(rect)); | 92 return LayoutRect(EnclosingIntRect(rect)); |
| 93 } | 93 } |
| 94 | 94 |
| 95 // If kForcedSubtreeNoRasterInvalidation is set, we map the rect to the |
| 96 // temporary root paint property state instead of the paint invalidation |
| 97 // backing. |
| 98 bool map_to_backing = |
| 99 !(context.forced_subtree_invalidation_flags & |
| 100 PaintInvalidatorContext::kForcedSubtreeNoRasterInvalidation); |
| 101 |
| 95 LayoutRect result; | 102 LayoutRect result; |
| 96 if (context.forced_subtree_invalidation_flags & | 103 if (context.forced_subtree_invalidation_flags & |
| 97 PaintInvalidatorContext::kForcedSubtreeSlowPathRect) { | 104 PaintInvalidatorContext::kForcedSubtreeSlowPathRect) { |
| 98 result = SlowMapToVisualRectInAncestorSpace( | 105 result = SlowMapToVisualRectInAncestorSpace( |
| 99 object, *context.paint_invalidation_container, rect); | 106 object, *context.paint_invalidation_container, rect); |
| 100 } else if (object == context.paint_invalidation_container) { | 107 } else if (object == context.paint_invalidation_container) { |
| 108 DCHECK(map_to_backing); |
| 101 result = LayoutRect(rect); | 109 result = LayoutRect(rect); |
| 102 } else { | 110 } else { |
| 103 // For non-root SVG, the input rect is in local SVG coordinates in which | 111 // For non-root SVG, the input rect is in local SVG coordinates in which |
| 104 // paint offset doesn't apply. | 112 // paint offset doesn't apply. |
| 105 if (!is_svg_child) | 113 if (!is_svg_child) |
| 106 rect.MoveBy(Point(object.PaintOffset())); | 114 rect.MoveBy(Point(object.PaintOffset())); |
| 107 | 115 |
| 108 auto container_contents_properties = | 116 auto container_contents_properties = |
| 109 context.paint_invalidation_container->ContentsProperties(); | 117 map_to_backing |
| 118 ? context.paint_invalidation_container->ContentsProperties() |
| 119 : PropertyTreeState::Root(); |
| 110 if (context.tree_builder_context_->current.transform == | 120 if (context.tree_builder_context_->current.transform == |
| 111 container_contents_properties.Transform() && | 121 container_contents_properties.Transform() && |
| 112 context.tree_builder_context_->current.clip == | 122 context.tree_builder_context_->current.clip == |
| 113 container_contents_properties.Clip()) { | 123 container_contents_properties.Clip()) { |
| 114 result = LayoutRect(rect); | 124 result = LayoutRect(rect); |
| 115 } else { | 125 } else { |
| 116 // Use enclosingIntRect to ensure the final visual rect will cover the | 126 // Use enclosingIntRect to ensure the final visual rect will cover the |
| 117 // rect in source coordinates no matter if the painting will use pixel | 127 // rect in source coordinates no matter if the painting will use pixel |
| 118 // snapping, when transforms are applied. If there is no transform, | 128 // snapping, when transforms are applied. If there is no transform, |
| 119 // enclosingIntRect is applied in the last step of paint invalidation | 129 // enclosingIntRect is applied in the last step of paint invalidation |
| 120 // (see CompositedLayerMapping::setContentsNeedDisplayInRect()). | 130 // (see CompositedLayerMapping::setContentsNeedDisplayInRect()). |
| 121 if (!is_svg_child && context.tree_builder_context_->current.transform != | 131 if (!is_svg_child && context.tree_builder_context_->current.transform != |
| 122 container_contents_properties.Transform()) | 132 container_contents_properties.Transform()) |
| 123 rect = Rect(EnclosingIntRect(rect)); | 133 rect = Rect(EnclosingIntRect(rect)); |
| 124 | 134 |
| 125 PropertyTreeState current_tree_state( | 135 PropertyTreeState current_tree_state( |
| 126 context.tree_builder_context_->current.transform, | 136 context.tree_builder_context_->current.transform, |
| 127 context.tree_builder_context_->current.clip, nullptr); | 137 context.tree_builder_context_->current.clip, nullptr); |
| 128 | 138 |
| 129 FloatClipRect float_rect((FloatRect(rect))); | 139 FloatClipRect float_rect((FloatRect(rect))); |
| 130 GeometryMapper::SourceToDestinationVisualRect( | 140 GeometryMapper::SourceToDestinationVisualRect( |
| 131 current_tree_state, container_contents_properties, float_rect); | 141 current_tree_state, container_contents_properties, float_rect); |
| 132 result = LayoutRect(float_rect.Rect()); | 142 result = LayoutRect(float_rect.Rect()); |
| 133 } | 143 } |
| 134 | 144 |
| 135 // Convert the result to the container's contents space. | 145 // Convert the result to the container's contents space. |
| 136 result.MoveBy(-context.paint_invalidation_container->PaintOffset()); | 146 if (map_to_backing) |
| 147 result.MoveBy(-context.paint_invalidation_container->PaintOffset()); |
| 137 } | 148 } |
| 138 | 149 |
| 139 object.AdjustVisualRectForRasterEffects(result); | 150 object.AdjustVisualRectForRasterEffects(result); |
| 151 if (!map_to_backing) |
| 152 return result; |
| 140 | 153 |
| 141 PaintLayer::MapRectInPaintInvalidationContainerToBacking( | 154 PaintLayer::MapRectInPaintInvalidationContainerToBacking( |
| 142 *context.paint_invalidation_container, result); | 155 *context.paint_invalidation_container, result); |
| 143 | 156 |
| 144 result.Move(object.ScrollAdjustmentForPaintInvalidation( | 157 result.Move(object.ScrollAdjustmentForPaintInvalidation( |
| 145 *context.paint_invalidation_container)); | 158 *context.paint_invalidation_container)); |
| 146 | 159 |
| 147 return result; | 160 return result; |
| 148 } | 161 } |
| 149 | 162 |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 context.forced_subtree_invalidation_flags |= | 347 context.forced_subtree_invalidation_flags |= |
| 335 PaintInvalidatorContext::kForcedSubtreeFullInvalidation; | 348 PaintInvalidatorContext::kForcedSubtreeFullInvalidation; |
| 336 } | 349 } |
| 337 | 350 |
| 338 if (object == context.paint_invalidation_container) { | 351 if (object == context.paint_invalidation_container) { |
| 339 // When we hit a new paint invalidation container, we don't need to | 352 // When we hit a new paint invalidation container, we don't need to |
| 340 // continue forcing a check for paint invalidation, since we're | 353 // continue forcing a check for paint invalidation, since we're |
| 341 // descending into a different invalidation container. (For instance if | 354 // descending into a different invalidation container. (For instance if |
| 342 // our parents were moved, the entire container will just move.) | 355 // our parents were moved, the entire container will just move.) |
| 343 if (object != context.paint_invalidation_container_for_stacked_contents) { | 356 if (object != context.paint_invalidation_container_for_stacked_contents) { |
| 344 // However, we need to keep ForcedSubtreeVisualRectUpdate and | 357 // However, we need to keep kForcedSubtreeVisualRectUpdate and |
| 345 // ForcedSubtreeFullInvalidationForStackedContents flags if the current | 358 // kForcedSubtreeFullInvalidationForStackedContents flags if the current |
| 346 // object isn't the paint invalidation container of stacked contents. | 359 // object isn't the paint invalidation container of stacked contents. |
| 347 context.forced_subtree_invalidation_flags &= | 360 context.forced_subtree_invalidation_flags &= |
| 348 (PaintInvalidatorContext::kForcedSubtreeVisualRectUpdate | | 361 (PaintInvalidatorContext::kForcedSubtreeVisualRectUpdate | |
| 349 PaintInvalidatorContext:: | 362 PaintInvalidatorContext:: |
| 350 kForcedSubtreeFullInvalidationForStackedContents); | 363 kForcedSubtreeFullInvalidationForStackedContents); |
| 351 } else { | 364 } else { |
| 352 context.forced_subtree_invalidation_flags = 0; | 365 context.forced_subtree_invalidation_flags = 0; |
| 353 } | 366 } |
| 354 } | 367 } |
| 355 | 368 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 | 542 |
| 530 void PaintInvalidator::ProcessPendingDelayedPaintInvalidations() { | 543 void PaintInvalidator::ProcessPendingDelayedPaintInvalidations() { |
| 531 for (auto target : pending_delayed_paint_invalidations_) { | 544 for (auto target : pending_delayed_paint_invalidations_) { |
| 532 target->GetMutableForPainting() | 545 target->GetMutableForPainting() |
| 533 .SetShouldDoFullPaintInvalidationWithoutGeometryChange( | 546 .SetShouldDoFullPaintInvalidationWithoutGeometryChange( |
| 534 PaintInvalidationReason::kDelayedFull); | 547 PaintInvalidationReason::kDelayedFull); |
| 535 } | 548 } |
| 536 } | 549 } |
| 537 | 550 |
| 538 } // namespace blink | 551 } // namespace blink |
| OLD | NEW |