Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 2835783002: Change painting root for squashed layers to the composting container (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 layers_needing_paint_invalidation.push_back(layers[i].paint_layer); 1013 layers_needing_paint_invalidation.push_back(layers[i].paint_layer);
1014 } 1014 }
1015 layers[i].offset_from_layout_object = new_offset_from_layout_object; 1015 layers[i].offset_from_layout_object = new_offset_from_layout_object;
1016 layers[i].offset_from_layout_object_set = true; 1016 layers[i].offset_from_layout_object_set = true;
1017 1017
1018 layers[i].paint_layer->SetSubpixelAccumulation(subpixel_accumulation); 1018 layers[i].paint_layer->SetSubpixelAccumulation(subpixel_accumulation);
1019 } 1019 }
1020 1020
1021 squashing_layer->SetPosition(squash_layer_bounds.Location()); 1021 squashing_layer->SetPosition(squash_layer_bounds.Location());
1022 squashing_layer->SetSize(FloatSize(squash_layer_bounds.Size())); 1022 squashing_layer->SetSize(FloatSize(squash_layer_bounds.Size()));
1023 LayoutSize offset_from_layout_object_exclude_subpixel_accumulation = squash_la yer_origin_in_compositing_container_space - compositing_container->SubpixelAccum ulation();
1024 DCHECK(offset_from_layout_object_exclude_subpixel_accumulation.Fraction().IsZe ro());
1025 DCHECK_EQ(owning_layer_.EnclosingLayerWithCompositedLayerMapping(kExcludeSelf) , compositing_container);
1026 squashing_layer->SetOffsetFromLayoutObject(RoundedIntSize(offset_from_layout_o bject_exclude_subpixel_accumulation), GraphicsLayer::kDontSetNeedsDisplay);
1023 1027
1024 *offset_from_transformed_ancestor = 1028 *offset_from_transformed_ancestor =
1025 compositing_container_offset_from_transformed_ancestor; 1029 compositing_container_offset_from_transformed_ancestor;
1026 offset_from_transformed_ancestor->Move( 1030 offset_from_transformed_ancestor->Move(
1027 squash_layer_origin_in_compositing_container_space); 1031 squash_layer_origin_in_compositing_container_space);
1028 1032
1029 for (size_t i = 0; i < layers.size(); ++i) 1033 for (size_t i = 0; i < layers.size(); ++i)
1030 layers[i].local_clip_rect_for_squashed_layer = 1034 layers[i].local_clip_rect_for_squashed_layer =
1031 LocalClipRectForSquashedLayer(owning_layer_, layers[i], layers); 1035 LocalClipRectForSquashedLayer(owning_layer_, layers[i], layers);
1032 } 1036 }
(...skipping 1964 matching lines...) Expand 10 before | Expand all | Expand 10 after
2997 } 3001 }
2998 3002
2999 void CompositedLayerMapping::DoPaintTask( 3003 void CompositedLayerMapping::DoPaintTask(
3000 const GraphicsLayerPaintInfo& paint_info, 3004 const GraphicsLayerPaintInfo& paint_info,
3001 const GraphicsLayer& graphics_layer, 3005 const GraphicsLayer& graphics_layer,
3002 const PaintLayerFlags& paint_layer_flags, 3006 const PaintLayerFlags& paint_layer_flags,
3003 GraphicsContext& context, 3007 GraphicsContext& context,
3004 const IntRect& clip /* In the coords of rootLayer */) const { 3008 const IntRect& clip /* In the coords of rootLayer */) const {
3005 FontCachePurgePreventer font_cache_purge_preventer; 3009 FontCachePurgePreventer font_cache_purge_preventer;
3006 3010
3011 PaintLayer* painting_root = paint_info.paint_layer;
3007 IntSize offset = paint_info.offset_from_layout_object; 3012 IntSize offset = paint_info.offset_from_layout_object;
3013 if (paint_info.paint_layer->GetCompositingState() == kPaintsIntoGroupedBacking ) {
3014 painting_root = owning_layer_.EnclosingLayerWithCompositedLayerMapping(kExcl udeSelf);
3015 offset = graphics_layer.OffsetFromLayoutObject();
3016 }
3017
3008 AffineTransform translation; 3018 AffineTransform translation;
3009 translation.Translate(-offset.Width(), -offset.Height()); 3019 translation.Translate(-offset.Width(), -offset.Height());
3010 TransformRecorder transform_recorder(context, graphics_layer, translation); 3020 TransformRecorder transform_recorder(context, graphics_layer, translation);
3011 3021
3012 // The dirtyRect is in the coords of the painting root. 3022 // The dirtyRect is in the coords of the painting root.
3013 IntRect dirty_rect(clip); 3023 IntRect dirty_rect(clip);
3014 dirty_rect.Move(offset); 3024 dirty_rect.Move(offset);
3015 3025
3016 if (paint_layer_flags & (kPaintLayerPaintingOverflowContents | 3026 if (paint_layer_flags & (kPaintLayerPaintingOverflowContents |
3017 kPaintLayerPaintingAncestorClippingMaskPhase)) { 3027 kPaintLayerPaintingAncestorClippingMaskPhase)) {
3018 dirty_rect.Move( 3028 dirty_rect.Move(
3019 RoundedIntSize(paint_info.paint_layer->SubpixelAccumulation())); 3029 RoundedIntSize(painting_root->SubpixelAccumulation()));
3020 } else { 3030 } else {
3021 LayoutRect bounds = paint_info.composited_bounds; 3031 LayoutRect bounds = paint_info.composited_bounds;
3022 bounds.Move(paint_info.paint_layer->SubpixelAccumulation()); 3032 bounds.Move(painting_root->SubpixelAccumulation());
3023 dirty_rect.Intersect(PixelSnappedIntRect(bounds)); 3033 dirty_rect.Intersect(PixelSnappedIntRect(bounds));
3024 } 3034 }
3025 3035
3026 #if DCHECK_IS_ON() 3036 #if DCHECK_IS_ON()
3027 if (!GetLayoutObject().View()->GetFrame() || 3037 if (!GetLayoutObject().View()->GetFrame() ||
3028 !GetLayoutObject().View()->GetFrame()->ShouldThrottleRendering()) 3038 !GetLayoutObject().View()->GetFrame()->ShouldThrottleRendering())
3029 paint_info.paint_layer->GetLayoutObject().AssertSubtreeIsLaidOut(); 3039 painting_root->GetLayoutObject().AssertSubtreeIsLaidOut();
3030 #endif 3040 #endif
3031 3041
3032 float device_scale_factor = blink::DeviceScaleFactorDeprecated( 3042 float device_scale_factor = blink::DeviceScaleFactorDeprecated(
3033 paint_info.paint_layer->GetLayoutObject().GetFrame()); 3043 painting_root->GetLayoutObject().GetFrame());
3034 context.SetDeviceScaleFactor(device_scale_factor); 3044 context.SetDeviceScaleFactor(device_scale_factor);
3035 3045
3036 if (paint_info.paint_layer->GetCompositingState() != 3046 if (paint_info.paint_layer->GetCompositingState() !=
3037 kPaintsIntoGroupedBacking) { 3047 kPaintsIntoGroupedBacking) {
3038 // FIXME: GraphicsLayers need a way to split for multicol. 3048 // FIXME: GraphicsLayers need a way to split for multicol.
3039 PaintLayerPaintingInfo painting_info( 3049 PaintLayerPaintingInfo painting_info(
3040 paint_info.paint_layer, LayoutRect(dirty_rect), kGlobalPaintNormalPhase, 3050 painting_root, LayoutRect(dirty_rect), kGlobalPaintNormalPhase,
3041 paint_info.paint_layer->SubpixelAccumulation()); 3051 painting_root->SubpixelAccumulation());
3042 PaintLayerPainter(*paint_info.paint_layer) 3052 PaintLayerPainter(*paint_info.paint_layer)
3043 .PaintLayerContents(context, painting_info, paint_layer_flags); 3053 .PaintLayerContents(context, painting_info, paint_layer_flags);
3044 3054
3045 if (paint_info.paint_layer->ContainsDirtyOverlayScrollbars()) 3055 if (paint_info.paint_layer->ContainsDirtyOverlayScrollbars())
3046 PaintLayerPainter(*paint_info.paint_layer) 3056 PaintLayerPainter(*paint_info.paint_layer)
3047 .PaintLayerContents( 3057 .PaintLayerContents(
3048 context, painting_info, 3058 context, painting_info,
3049 paint_layer_flags | kPaintLayerPaintingOverlayScrollbars); 3059 paint_layer_flags | kPaintLayerPaintingOverlayScrollbars);
3050 } else { 3060 } else {
3051 PaintLayerPaintingInfo painting_info( 3061 PaintLayerPaintingInfo painting_info(
3052 paint_info.paint_layer, LayoutRect(dirty_rect), kGlobalPaintNormalPhase, 3062 painting_root, LayoutRect(dirty_rect), kGlobalPaintNormalPhase,
3053 paint_info.paint_layer->SubpixelAccumulation()); 3063 painting_root->SubpixelAccumulation());
3054 3064
3055 // PaintLayer::paintLayer assumes that the caller clips to the passed rect. 3065 // PaintLayer::paintLayer assumes that the caller clips to the passed rect.
3056 // Squashed layers need to do this clipping in software, since there is no 3066 // Squashed layers need to do this clipping in software, since there is no
3057 // graphics layer to clip them precisely. Furthermore, in some cases we 3067 // graphics layer to clip them precisely. Furthermore, in some cases we
3058 // squash layers that need clipping in software from clipping ancestors (see 3068 // squash layers that need clipping in software from clipping ancestors (see
3059 // CompositedLayerMapping::localClipRectForSquashedLayer()). 3069 // CompositedLayerMapping::localClipRectForSquashedLayer()).
3060 // FIXME: Is it correct to clip to dirtyRect in slimming paint mode? 3070 // FIXME: Is it correct to clip to dirtyRect in slimming paint mode?
3061 // FIXME: Combine similar code here and LayerClipRecorder. 3071 // FIXME: Combine similar code here and LayerClipRecorder.
3062 dirty_rect.Intersect(paint_info.local_clip_rect_for_squashed_layer); 3072 dirty_rect.Intersect(paint_info.local_clip_rect_for_squashed_layer);
3063 context.GetPaintController().CreateAndAppend<ClipDisplayItem>( 3073 context.GetPaintController().CreateAndAppend<ClipDisplayItem>(
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
3604 } else if (graphics_layer == decoration_outline_layer_.get()) { 3614 } else if (graphics_layer == decoration_outline_layer_.get()) {
3605 name = "Decoration Layer"; 3615 name = "Decoration Layer";
3606 } else { 3616 } else {
3607 NOTREACHED(); 3617 NOTREACHED();
3608 } 3618 }
3609 3619
3610 return name; 3620 return name;
3611 } 3621 }
3612 3622
3613 } // namespace blink 3623 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698