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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp

Issue 2820233002: Always report maybe-clipped when painting fragmented content (Closed)
Patch Set: none 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
OLDNEW
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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 local_painting_info.sub_pixel_accumulation); 463 local_painting_info.sub_pixel_accumulation);
464 RepeatFixedPositionObjectInPages(single_fragment[0], painting_info, 464 RepeatFixedPositionObjectInPages(single_fragment[0], painting_info,
465 layer_fragments); 465 layer_fragments);
466 } else { 466 } else {
467 paint_layer_for_fragments->CollectFragments( 467 paint_layer_for_fragments->CollectFragments(
468 layer_fragments, local_painting_info.root_layer, 468 layer_fragments, local_painting_info.root_layer,
469 local_painting_info.paint_dirty_rect, cache_slot, 469 local_painting_info.paint_dirty_rect, cache_slot,
470 geometry_mapper_option, kIgnorePlatformOverlayScrollbarSize, 470 geometry_mapper_option, kIgnorePlatformOverlayScrollbarSize,
471 respect_overflow_clip, &offset_from_root, 471 respect_overflow_clip, &offset_from_root,
472 local_painting_info.sub_pixel_accumulation); 472 local_painting_info.sub_pixel_accumulation);
473 // PaintLayer::collectFragments depends on the paint dirty rect in
474 // complicated ways. For now, always assume a partially painted output
475 // for fragmented content.
476 if (layer_fragments.size() > 1)
477 result = kMayBeClippedByPaintDirtyRect;
473 } 478 }
474 479
475 if (paint_flags & kPaintLayerPaintingAncestorClippingMaskPhase) { 480 if (paint_flags & kPaintLayerPaintingAncestorClippingMaskPhase) {
476 // Fragment offsets have been computed in the clipping container's 481 // Fragment offsets have been computed in the clipping container's
477 // layer's coordinate system, but for the rest of painting we need 482 // layer's coordinate system, but for the rest of painting we need
478 // them in the layer coordinate. So move them and the foreground rect 483 // them in the layer coordinate. So move them and the foreground rect
479 // that is also in the clipper's space. 484 // that is also in the clipper's space.
480 LayoutSize negative_offset(-offset_to_clipper.X(), 485 LayoutSize negative_offset(-offset_to_clipper.X(),
481 -offset_to_clipper.Y()); 486 -offset_to_clipper.Y());
482 for (auto& fragment : layer_fragments) { 487 for (auto& fragment : layer_fragments) {
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 // FIXME: We should make sure that we don't walk past paintingInfo.rootLayer 695 // FIXME: We should make sure that we don't walk past paintingInfo.rootLayer
691 // here. m_paintLayer may be the "root", and then we should avoid looking at 696 // here. m_paintLayer may be the "root", and then we should avoid looking at
692 // its parent. 697 // its parent.
693 PaintLayer* parent_layer = paint_layer_.Parent(); 698 PaintLayer* parent_layer = paint_layer_.Parent();
694 699
695 PaintLayer::GeometryMapperOption geometry_mapper_option = 700 PaintLayer::GeometryMapperOption geometry_mapper_option =
696 PaintLayer::kDoNotUseGeometryMapper; 701 PaintLayer::kDoNotUseGeometryMapper;
697 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) 702 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
698 geometry_mapper_option = PaintLayer::kUseGeometryMapper; 703 geometry_mapper_option = PaintLayer::kUseGeometryMapper;
699 704
705 PaintResult result = kFullyPainted;
700 PaintLayer* pagination_layer = paint_layer_.EnclosingPaginationLayer(); 706 PaintLayer* pagination_layer = paint_layer_.EnclosingPaginationLayer();
701 PaintLayerFragments layer_fragments; 707 PaintLayerFragments layer_fragments;
702 bool is_fixed_position_object_in_paged_media = 708 bool is_fixed_position_object_in_paged_media =
703 this->IsFixedPositionObjectInPagedMedia(); 709 this->IsFixedPositionObjectInPagedMedia();
704 if (!pagination_layer || is_fixed_position_object_in_paged_media) { 710 if (!pagination_layer || is_fixed_position_object_in_paged_media) {
705 // We don't need to collect any fragments in the regular way here. We have 711 // We don't need to collect any fragments in the regular way here. We have
706 // already calculated a clip rectangle for the ancestry if it was needed, 712 // already calculated a clip rectangle for the ancestry if it was needed,
707 // and clipping this layer is something that can be done further down the 713 // and clipping this layer is something that can be done further down the
708 // path, when the transform has been applied. 714 // path, when the transform has been applied.
709 PaintLayerFragment fragment; 715 PaintLayerFragment fragment;
(...skipping 22 matching lines...) Expand all
732 painting_info.GetGlobalPaintFlags()); 738 painting_info.GetGlobalPaintFlags());
733 739
734 // FIXME: we don't check if paginationLayer is within 740 // FIXME: we don't check if paginationLayer is within
735 // paintingInfo.rootLayer 741 // paintingInfo.rootLayer
736 // here. 742 // here.
737 pagination_layer->CollectFragments( 743 pagination_layer->CollectFragments(
738 layer_fragments, painting_info.root_layer, 744 layer_fragments, painting_info.root_layer,
739 painting_info.paint_dirty_rect, cache_slot, geometry_mapper_option, 745 painting_info.paint_dirty_rect, cache_slot, geometry_mapper_option,
740 kIgnorePlatformOverlayScrollbarSize, respect_overflow_clip, nullptr, 746 kIgnorePlatformOverlayScrollbarSize, respect_overflow_clip, nullptr,
741 painting_info.sub_pixel_accumulation, &transformed_extent); 747 painting_info.sub_pixel_accumulation, &transformed_extent);
748 // PaintLayer::collectFragments depends on the paint dirty rect in
749 // complicated ways. For now, always assume a partially painted output
750 // for fragmented content.
751 if (layer_fragments.size() > 1)
752 result = kMayBeClippedByPaintDirtyRect;
742 } 753 }
743 754
744 Optional<DisplayItemCacheSkipper> cache_skipper; 755 Optional<DisplayItemCacheSkipper> cache_skipper;
745 if (layer_fragments.size() > 1) 756 if (layer_fragments.size() > 1)
746 cache_skipper.emplace(context); 757 cache_skipper.emplace(context);
747 758
748 ClipRect ancestor_background_clip_rect; 759 ClipRect ancestor_background_clip_rect;
749 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 760 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
750 if (parent_layer) { 761 if (parent_layer) {
751 // Calculate the clip rectangle that the ancestors establish. 762 // Calculate the clip rectangle that the ancestors establish.
752 ClipRectsContext clip_rects_context( 763 ClipRectsContext clip_rects_context(
753 painting_info.root_layer, 764 painting_info.root_layer,
754 (paint_flags & kPaintLayerUncachedClipRects) ? kUncachedClipRects 765 (paint_flags & kPaintLayerUncachedClipRects) ? kUncachedClipRects
755 : kPaintingClipRects, 766 : kPaintingClipRects,
756 kIgnorePlatformOverlayScrollbarSize); 767 kIgnorePlatformOverlayScrollbarSize);
757 if (ShouldRespectOverflowClip(paint_flags, 768 if (ShouldRespectOverflowClip(paint_flags,
758 paint_layer_.GetLayoutObject()) == 769 paint_layer_.GetLayoutObject()) ==
759 kIgnoreOverflowClip) 770 kIgnoreOverflowClip)
760 clip_rects_context.SetIgnoreOverflowClip(); 771 clip_rects_context.SetIgnoreOverflowClip();
761 paint_layer_.Clipper(geometry_mapper_option) 772 paint_layer_.Clipper(geometry_mapper_option)
762 .CalculateBackgroundClipRect(clip_rects_context, 773 .CalculateBackgroundClipRect(clip_rects_context,
763 ancestor_background_clip_rect); 774 ancestor_background_clip_rect);
764 } 775 }
765 } 776 }
766 777
767 PaintResult result = kFullyPainted;
768 for (const auto& fragment : layer_fragments) { 778 for (const auto& fragment : layer_fragments) {
769 Optional<LayerClipRecorder> clip_recorder; 779 Optional<LayerClipRecorder> clip_recorder;
770 if (parent_layer && !RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 780 if (parent_layer && !RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
771 ClipRect clip_rect_for_fragment(ancestor_background_clip_rect); 781 ClipRect clip_rect_for_fragment(ancestor_background_clip_rect);
772 // A fixed-position object is repeated on every page instead of paginated, 782 // A fixed-position object is repeated on every page instead of paginated,
773 // so we should apply the original ancestor clip rect. 783 // so we should apply the original ancestor clip rect.
774 if (!is_fixed_position_object_in_paged_media) 784 if (!is_fixed_position_object_in_paged_media)
775 clip_rect_for_fragment.MoveBy(fragment.pagination_offset); 785 clip_rect_for_fragment.MoveBy(fragment.pagination_offset);
776 clip_rect_for_fragment.Intersect(fragment.background_rect); 786 clip_rect_for_fragment.Intersect(fragment.background_rect);
777 if (clip_rect_for_fragment.IsEmpty()) 787 if (clip_rect_for_fragment.IsEmpty())
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 context, layout_object, kPaintPhaseClippingMask)) 1235 context, layout_object, kPaintPhaseClippingMask))
1226 return; 1236 return;
1227 1237
1228 IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect()); 1238 IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect());
1229 LayoutObjectDrawingRecorder drawing_recorder( 1239 LayoutObjectDrawingRecorder drawing_recorder(
1230 context, layout_object, kPaintPhaseClippingMask, snapped_clip_rect); 1240 context, layout_object, kPaintPhaseClippingMask, snapped_clip_rect);
1231 context.FillRect(snapped_clip_rect, Color::kBlack); 1241 context.FillRect(snapped_clip_rect, Color::kBlack);
1232 } 1242 }
1233 1243
1234 } // namespace blink 1244 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698