| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/PrePaintTreeWalk.h" | 5 #include "core/paint/PrePaintTreeWalk.h" |
| 6 | 6 |
| 7 #include "core/dom/DocumentLifecycle.h" | 7 #include "core/dom/DocumentLifecycle.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/layout/LayoutMultiColumnSpannerPlaceholder.h" | 10 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // TODO(flackr): This should be refactored in the future to be clearer (i.e. | 122 // TODO(flackr): This should be refactored in the future to be clearer (i.e. |
| 123 // update layer position and ancestor inputs updates in the same walk). | 123 // update layer position and ancestor inputs updates in the same walk). |
| 124 paint_layer->UpdateLayerPosition(); | 124 paint_layer->UpdateLayerPosition(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 if (paint_layer->IsRootLayer() || object.HasOverflowClip()) | 127 if (paint_layer->IsRootLayer() || object.HasOverflowClip()) |
| 128 context.ancestor_overflow_paint_layer = paint_layer; | 128 context.ancestor_overflow_paint_layer = paint_layer; |
| 129 } | 129 } |
| 130 | 130 |
| 131 LayoutRect PrePaintTreeWalk::ComputeClipRectForContext( | 131 LayoutRect PrePaintTreeWalk::ComputeClipRectForContext( |
| 132 const PaintPropertyTreeBuilderContext::ContainingBlockContext& context, | 132 const PaintPropertyTreeBuilderFragmentContext::ContainingBlockContext& |
| 133 context, |
| 133 const EffectPaintPropertyNode* effect, | 134 const EffectPaintPropertyNode* effect, |
| 134 const PropertyTreeState& ancestor_state, | 135 const PropertyTreeState& ancestor_state, |
| 135 const LayoutPoint& ancestor_paint_offset) { | 136 const LayoutPoint& ancestor_paint_offset) { |
| 136 PropertyTreeState local_state(context.transform, context.clip, effect); | 137 PropertyTreeState local_state(context.transform, context.clip, effect); |
| 137 | 138 |
| 138 const auto& clip_rect = | 139 const auto& clip_rect = |
| 139 GeometryMapper::SourceToDestinationClipRect(local_state, ancestor_state); | 140 GeometryMapper::SourceToDestinationClipRect(local_state, ancestor_state); |
| 140 // HasRadius() is ignored because it doesn't affect descendants' visual rects. | 141 // HasRadius() is ignored because it doesn't affect descendants' visual rects. |
| 141 LayoutRect result(clip_rect.Rect()); | 142 LayoutRect result(clip_rect.Rect()); |
| 142 if (!clip_rect.IsInfinite()) | 143 if (!clip_rect.IsInfinite()) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 const auto& old_clip_rects = | 188 const auto& old_clip_rects = |
| 188 paint_layer.Clipper(PaintLayer::kDoNotUseGeometryMapper) | 189 paint_layer.Clipper(PaintLayer::kDoNotUseGeometryMapper) |
| 189 .PaintingClipRects(context.ancestor_transformed_or_root_paint_layer, | 190 .PaintingClipRects(context.ancestor_transformed_or_root_paint_layer, |
| 190 respect_overflow_clip, LayoutSize()); | 191 respect_overflow_clip, LayoutSize()); |
| 191 #endif | 192 #endif |
| 192 | 193 |
| 193 const LayoutPoint& ancestor_paint_offset = | 194 const LayoutPoint& ancestor_paint_offset = |
| 194 context.ancestor_transformed_or_root_paint_layer->GetLayoutObject() | 195 context.ancestor_transformed_or_root_paint_layer->GetLayoutObject() |
| 195 .PaintOffset(); | 196 .PaintOffset(); |
| 196 | 197 |
| 197 const auto* effect = context.tree_builder_context->current_effect; | 198 // TODO(chrishtr): generalize this for multicol. |
| 198 auto overflow_clip_rect = | 199 const auto* effect = |
| 199 ComputeClipRectForContext(context.tree_builder_context->current, effect, | 200 context.tree_builder_context->fragments[0].current_effect; |
| 200 ancestor_state, ancestor_paint_offset); | 201 auto overflow_clip_rect = ComputeClipRectForContext( |
| 202 context.tree_builder_context->fragments[0].current, effect, |
| 203 ancestor_state, ancestor_paint_offset); |
| 201 #ifdef CHECK_CLIP_RECTS | 204 #ifdef CHECK_CLIP_RECTS |
| 202 CHECK(overflow_clip_rect == old_clip_rects.OverflowClipRect().Rect()) | 205 CHECK(overflow_clip_rect == old_clip_rects.OverflowClipRect().Rect()) |
| 203 << " new=" << overflow_clip_rect.ToString() | 206 << " new=" << overflow_clip_rect.ToString() |
| 204 << " old=" << old_clip_rects.OverflowClipRect().Rect().ToString(); | 207 << " old=" << old_clip_rects.OverflowClipRect().Rect().ToString(); |
| 205 #endif | 208 #endif |
| 206 | 209 |
| 207 auto fixed_clip_rect = | 210 auto fixed_clip_rect = ComputeClipRectForContext( |
| 208 ComputeClipRectForContext(context.tree_builder_context->fixed_position, | 211 context.tree_builder_context->fragments[0].fixed_position, effect, |
| 209 effect, ancestor_state, ancestor_paint_offset); | 212 ancestor_state, ancestor_paint_offset); |
| 210 #ifdef CHECK_CLIP_RECTS | 213 #ifdef CHECK_CLIP_RECTS |
| 211 CHECK(fixed_clip_rect == old_clip_rects.FixedClipRect().Rect()) | 214 CHECK(fixed_clip_rect == old_clip_rects.FixedClipRect().Rect()) |
| 212 << " new=" << fixed_clip_rect.ToString() | 215 << " new=" << fixed_clip_rect.ToString() |
| 213 << " old=" << old_clip_rects.FixedClipRect().Rect().ToString(); | 216 << " old=" << old_clip_rects.FixedClipRect().Rect().ToString(); |
| 214 #endif | 217 #endif |
| 215 | 218 |
| 216 auto pos_clip_rect = | 219 auto pos_clip_rect = ComputeClipRectForContext( |
| 217 ComputeClipRectForContext(context.tree_builder_context->absolute_position, | 220 context.tree_builder_context->fragments[0].absolute_position, effect, |
| 218 effect, ancestor_state, ancestor_paint_offset); | 221 ancestor_state, ancestor_paint_offset); |
| 219 #ifdef CHECK_CLIP_RECTS | 222 #ifdef CHECK_CLIP_RECTS |
| 220 CHECK(pos_clip_rect == old_clip_rects.PosClipRect().Rect()) | 223 CHECK(pos_clip_rect == old_clip_rects.PosClipRect().Rect()) |
| 221 << " new=" << pos_clip_rect.ToString() | 224 << " new=" << pos_clip_rect.ToString() |
| 222 << " old=" << old_clip_rects.PosClipRect().Rect().ToString(); | 225 << " old=" << old_clip_rects.PosClipRect().Rect().ToString(); |
| 223 #endif | 226 #endif |
| 224 | 227 |
| 225 const auto* previous_clip_rects = paint_layer.PreviousPaintingClipRects(); | 228 const auto* previous_clip_rects = paint_layer.PreviousPaintingClipRects(); |
| 226 if (!previous_clip_rects || | 229 if (!previous_clip_rects || |
| 227 overflow_clip_rect != previous_clip_rects->OverflowClipRect().Rect() || | 230 overflow_clip_rect != previous_clip_rects->OverflowClipRect().Rect() || |
| 228 fixed_clip_rect != previous_clip_rects->FixedClipRect().Rect() || | 231 fixed_clip_rect != previous_clip_rects->FixedClipRect().Rect() || |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 continue; | 305 continue; |
| 303 } | 306 } |
| 304 Walk(*child, context); | 307 Walk(*child, context); |
| 305 } | 308 } |
| 306 | 309 |
| 307 if (object.IsLayoutPart()) { | 310 if (object.IsLayoutPart()) { |
| 308 const LayoutPart& layout_part = ToLayoutPart(object); | 311 const LayoutPart& layout_part = ToLayoutPart(object); |
| 309 FrameView* frame_view = layout_part.ChildFrameView(); | 312 FrameView* frame_view = layout_part.ChildFrameView(); |
| 310 if (frame_view) { | 313 if (frame_view) { |
| 311 if (context.tree_builder_context) { | 314 if (context.tree_builder_context) { |
| 312 context.tree_builder_context->current.paint_offset += | 315 context.tree_builder_context->fragments[0].current.paint_offset += |
| 313 layout_part.ReplacedContentRect().Location() - | 316 layout_part.ReplacedContentRect().Location() - |
| 314 frame_view->FrameRect().Location(); | 317 frame_view->FrameRect().Location(); |
| 315 context.tree_builder_context->current.paint_offset = | 318 context.tree_builder_context->fragments[0].current.paint_offset = |
| 316 RoundedIntPoint(context.tree_builder_context->current.paint_offset); | 319 RoundedIntPoint(context.tree_builder_context->fragments[0] |
| 320 .current.paint_offset); |
| 317 } | 321 } |
| 318 Walk(*frame_view, context); | 322 Walk(*frame_view, context); |
| 319 } | 323 } |
| 320 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). | 324 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). |
| 321 } | 325 } |
| 322 | 326 |
| 323 object.GetMutableForPainting().ClearPaintFlags(); | 327 object.GetMutableForPainting().ClearPaintFlags(); |
| 324 } | 328 } |
| 325 | 329 |
| 326 } // namespace blink | 330 } // namespace blink |
| OLD | NEW |