Chromium Code Reviews| 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 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 757 if (layer_fragments.size() > 1) | 757 if (layer_fragments.size() > 1) |
| 758 result = kMayBeClippedByPaintDirtyRect; | 758 result = kMayBeClippedByPaintDirtyRect; |
| 759 } | 759 } |
| 760 | 760 |
| 761 Optional<DisplayItemCacheSkipper> cache_skipper; | 761 Optional<DisplayItemCacheSkipper> cache_skipper; |
| 762 if (layer_fragments.size() > 1) | 762 if (layer_fragments.size() > 1) |
| 763 cache_skipper.emplace(context); | 763 cache_skipper.emplace(context); |
| 764 | 764 |
| 765 ClipRect ancestor_background_clip_rect; | 765 ClipRect ancestor_background_clip_rect; |
| 766 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 766 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 767 if (parent_layer) { | 767 if (painting_info.root_layer == &paint_layer_) { |
| 768 // This workaround a bug in squash layer painting. | |
|
chrishtr
2017/04/25 22:11:04
Nit: please change to "This works around a bug in
trchen
2017/04/25 23:16:00
Done.
| |
| 769 // Squashed layers paint into a backing in its compositing container's | |
| 770 // space, but painting_info.root_layer points to the squashed layer | |
| 771 // itself, thus PaintLayerClipper would return a clip rect in the | |
| 772 // squashed layer's local space, instead of the backing's space. | |
| 773 // Fortunately, CompositedLayerMapping::DoPaintTask already applied | |
| 774 // appropriate ancestor clip for us, we can simply skip it. | |
| 775 DCHECK_EQ(paint_layer_.GetCompositingState(), kPaintsIntoGroupedBacking); | |
| 776 ancestor_background_clip_rect.SetRect(FloatClipRect()); | |
| 777 } else if (parent_layer) { | |
| 768 // Calculate the clip rectangle that the ancestors establish. | 778 // Calculate the clip rectangle that the ancestors establish. |
| 769 ClipRectsContext clip_rects_context( | 779 ClipRectsContext clip_rects_context( |
| 770 painting_info.root_layer, | 780 painting_info.root_layer, |
| 771 (paint_flags & kPaintLayerUncachedClipRects) ? kUncachedClipRects | 781 (paint_flags & kPaintLayerUncachedClipRects) ? kUncachedClipRects |
| 772 : kPaintingClipRects, | 782 : kPaintingClipRects, |
| 773 kIgnorePlatformOverlayScrollbarSize); | 783 kIgnorePlatformOverlayScrollbarSize); |
| 774 if (ShouldRespectOverflowClip(paint_flags, | 784 if (ShouldRespectOverflowClip(paint_flags, |
| 775 paint_layer_.GetLayoutObject()) == | 785 paint_layer_.GetLayoutObject()) == |
| 776 kIgnoreOverflowClip) | 786 kIgnoreOverflowClip) |
| 777 clip_rects_context.SetIgnoreOverflowClip(); | 787 clip_rects_context.SetIgnoreOverflowClip(); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1241 context, layout_object, kPaintPhaseClippingMask)) | 1251 context, layout_object, kPaintPhaseClippingMask)) |
| 1242 return; | 1252 return; |
| 1243 | 1253 |
| 1244 IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect()); | 1254 IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect()); |
| 1245 LayoutObjectDrawingRecorder drawing_recorder( | 1255 LayoutObjectDrawingRecorder drawing_recorder( |
| 1246 context, layout_object, kPaintPhaseClippingMask, snapped_clip_rect); | 1256 context, layout_object, kPaintPhaseClippingMask, snapped_clip_rect); |
| 1247 context.FillRect(snapped_clip_rect, Color::kBlack); | 1257 context.FillRect(snapped_clip_rect, Color::kBlack); |
| 1248 } | 1258 } |
| 1249 | 1259 |
| 1250 } // namespace blink | 1260 } // namespace blink |
| OLD | NEW |