OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/PaintLayerPainter.h" | 5 #include "core/paint/PaintLayerPainter.h" |
6 | 6 |
7 #include "core/frame/LocalFrame.h" | 7 #include "core/frame/LocalFrame.h" |
8 #include "core/layout/LayoutView.h" | 8 #include "core/layout/LayoutView.h" |
9 #include "core/paint/ClipPathClipper.h" | 9 #include "core/paint/ClipPathClipper.h" |
10 #include "core/paint/FilterPainter.h" | 10 #include "core/paint/FilterPainter.h" |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
751 if (layer_fragments.size() > 1) | 751 if (layer_fragments.size() > 1) |
752 result = kMayBeClippedByPaintDirtyRect; | 752 result = kMayBeClippedByPaintDirtyRect; |
753 } | 753 } |
754 | 754 |
755 Optional<DisplayItemCacheSkipper> cache_skipper; | 755 Optional<DisplayItemCacheSkipper> cache_skipper; |
756 if (layer_fragments.size() > 1) | 756 if (layer_fragments.size() > 1) |
757 cache_skipper.emplace(context); | 757 cache_skipper.emplace(context); |
758 | 758 |
759 ClipRect ancestor_background_clip_rect; | 759 ClipRect ancestor_background_clip_rect; |
760 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 760 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
761 if (parent_layer) { | 761 if (painting_info.root_layer == &paint_layer_) { |
762 // This workaround a bug in squash layer painting. | |
chrishtr
2017/04/23 17:13:44
Nit: "This works around a bug in squashed-layer pa
| |
763 // Squashed layers paint into a backing in its compositing container's | |
764 // space, but painting_info.root_layer points to the squashed layer | |
765 // itself, thus PaintLayerClipper would return a clip rect in the | |
766 // squashed layer's local space, instead of the backing's space. | |
767 // Fortunately, CompositedLayerMapping::DoPaintTask already applied | |
768 // appropriate ancestor clip for us, we can simply skip it. | |
769 DCHECK_EQ(paint_layer_.GetCompositingState(), kPaintsIntoGroupedBacking); | |
770 ancestor_background_clip_rect.SetRect(FloatClipRect()); | |
771 } else if (parent_layer) { | |
762 // Calculate the clip rectangle that the ancestors establish. | 772 // Calculate the clip rectangle that the ancestors establish. |
763 ClipRectsContext clip_rects_context( | 773 ClipRectsContext clip_rects_context( |
764 painting_info.root_layer, | 774 painting_info.root_layer, |
765 (paint_flags & kPaintLayerUncachedClipRects) ? kUncachedClipRects | 775 (paint_flags & kPaintLayerUncachedClipRects) ? kUncachedClipRects |
766 : kPaintingClipRects, | 776 : kPaintingClipRects, |
767 kIgnorePlatformOverlayScrollbarSize); | 777 kIgnorePlatformOverlayScrollbarSize); |
768 if (ShouldRespectOverflowClip(paint_flags, | 778 if (ShouldRespectOverflowClip(paint_flags, |
769 paint_layer_.GetLayoutObject()) == | 779 paint_layer_.GetLayoutObject()) == |
770 kIgnoreOverflowClip) | 780 kIgnoreOverflowClip) |
771 clip_rects_context.SetIgnoreOverflowClip(); | 781 clip_rects_context.SetIgnoreOverflowClip(); |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1235 context, layout_object, kPaintPhaseClippingMask)) | 1245 context, layout_object, kPaintPhaseClippingMask)) |
1236 return; | 1246 return; |
1237 | 1247 |
1238 IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect()); | 1248 IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect()); |
1239 LayoutObjectDrawingRecorder drawing_recorder( | 1249 LayoutObjectDrawingRecorder drawing_recorder( |
1240 context, layout_object, kPaintPhaseClippingMask, snapped_clip_rect); | 1250 context, layout_object, kPaintPhaseClippingMask, snapped_clip_rect); |
1241 context.FillRect(snapped_clip_rect, Color::kBlack); | 1251 context.FillRect(snapped_clip_rect, Color::kBlack); |
1242 } | 1252 } |
1243 | 1253 |
1244 } // namespace blink | 1254 } // namespace blink |
OLD | NEW |