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

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

Issue 2923683002: Fix nested border radius with composited child. (Closed)
Patch Set: Fix the issue with missing masks Created 3 years, 6 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/LocalFrameView.h" 7 #include "core/frame/LocalFrameView.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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 418
419 PaintLayerFragments layer_fragments; 419 PaintLayerFragments layer_fragments;
420 if (should_paint_content || should_paint_self_outline || 420 if (should_paint_content || should_paint_self_outline ||
421 is_painting_overlay_scrollbars) { 421 is_painting_overlay_scrollbars) {
422 // Collect the fragments. This will compute the clip rectangles and paint 422 // Collect the fragments. This will compute the clip rectangles and paint
423 // offsets for each layer fragment. 423 // offsets for each layer fragment.
424 ClipRectsCacheSlot cache_slot = (paint_flags & kPaintLayerUncachedClipRects) 424 ClipRectsCacheSlot cache_slot = (paint_flags & kPaintLayerUncachedClipRects)
425 ? kUncachedClipRects 425 ? kUncachedClipRects
426 : kPaintingClipRects; 426 : kPaintingClipRects;
427 LayoutPoint offset_to_clipper; 427 LayoutPoint offset_to_clipper;
428 PaintLayer* paint_layer_for_fragments = &paint_layer_; 428 const PaintLayer* paint_layer_for_fragments = &paint_layer_;
429 if (paint_flags & kPaintLayerPaintingAncestorClippingMaskPhase) { 429 if (paint_flags & kPaintLayerPaintingAncestorClippingMaskPhase) {
430 // Compute fragments and their clips with respect to the clipping 430 // Compute fragments and their clips with respect to the outermost
431 // container. The paint rect is in this layer's space, so convert it 431 // clipping container. This handles nested border radius by including
432 // to the clipper's layer's space. The rootLayer is also changed to 432 // all of them in the mask.
433 // the clipper's layer to simplify coordinate system adjustments. 433 //
434 // The change to rootLayer must persist to correctly record the clips. 434 // The paint rect is in this layer's space, so convert it to the clipper's
435 // layer's space. The rootLayer is also changed to the clipper's layer to
436 // simplify coordinate system adjustments. The change to rootLayer must
437 // persist to correctly record the clips.
435 paint_layer_for_fragments = 438 paint_layer_for_fragments =
436 paint_layer_.ClippingContainer()->EnclosingLayer(); 439 paint_layer_.ClippingContainer()->EnclosingLayer();
440 while (const PaintLayer* new_clip_root =
chrishtr 2017/06/09 22:45:28 You can stop at the PaintLayer indicated by Compos
Stephen Chennney 2017/06/12 14:43:29 Will do.
441 paint_layer_for_fragments->ClippingContainer()
442 ->EnclosingLayer()) {
443 paint_layer_for_fragments = new_clip_root;
444 }
437 local_painting_info.root_layer = paint_layer_for_fragments; 445 local_painting_info.root_layer = paint_layer_for_fragments;
438 paint_layer_.ConvertToLayerCoords(local_painting_info.root_layer, 446 paint_layer_.ConvertToLayerCoords(local_painting_info.root_layer,
439 offset_to_clipper); 447 offset_to_clipper);
440 local_painting_info.paint_dirty_rect.MoveBy(offset_to_clipper); 448 local_painting_info.paint_dirty_rect.MoveBy(offset_to_clipper);
441 } 449 }
442 450
443 PaintLayer::GeometryMapperOption geometry_mapper_option = 451 PaintLayer::GeometryMapperOption geometry_mapper_option =
444 PaintLayer::kDoNotUseGeometryMapper; 452 PaintLayer::kDoNotUseGeometryMapper;
445 if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) 453 if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled())
446 geometry_mapper_option = PaintLayer::kUseGeometryMapper; 454 geometry_mapper_option = PaintLayer::kUseGeometryMapper;
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 // The ancestor is the thing that needs to clip, so do not include 1006 // The ancestor is the thing that needs to clip, so do not include
999 // this layer's clips. 1007 // this layer's clips.
1000 clipping_rule = LayerClipRecorder::kDoNotIncludeSelfForBorderRadius; 1008 clipping_rule = LayerClipRecorder::kDoNotIncludeSelfForBorderRadius;
1001 break; 1009 break;
1002 } 1010 }
1003 default: 1011 default:
1004 clipping_rule = LayerClipRecorder::kIncludeSelfForBorderRadius; 1012 clipping_rule = LayerClipRecorder::kIncludeSelfForBorderRadius;
1005 break; 1013 break;
1006 } 1014 }
1007 1015
1008 // TODO(schenney): Nested border-radius clips are not applied to composited
1009 // children, probably due to an incorrect clipRoot.
1010 // https://bugs.chromium.org/p/chromium/issues/detail?id=672561
1011 clip_recorder.emplace(context, paint_layer_.GetLayoutObject(), clip_type, 1016 clip_recorder.emplace(context, paint_layer_.GetLayoutObject(), clip_type,
1012 clip_rect, painting_info.root_layer, 1017 clip_rect, painting_info.root_layer,
1013 fragment.pagination_offset, paint_flags, 1018 fragment.pagination_offset, paint_flags,
1014 clipping_rule); 1019 clipping_rule);
1015 } 1020 }
1016 1021
1017 // If we are painting a mask for any reason and we have already processed the 1022 // If we are painting a mask for any reason and we have already processed the
1018 // clips, there is no need to go through the remaining painting pipeline. 1023 // clips, there is no need to go through the remaining painting pipeline.
1019 // We know that the mask just needs the area bounded by the clip rects to be 1024 // We know that the mask just needs the area bounded by the clip rects to be
1020 // filled with black. 1025 // filled with black.
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 context, layout_object, kPaintPhaseClippingMask)) 1259 context, layout_object, kPaintPhaseClippingMask))
1255 return; 1260 return;
1256 1261
1257 IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect()); 1262 IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect());
1258 LayoutObjectDrawingRecorder drawing_recorder( 1263 LayoutObjectDrawingRecorder drawing_recorder(
1259 context, layout_object, kPaintPhaseClippingMask, snapped_clip_rect); 1264 context, layout_object, kPaintPhaseClippingMask, snapped_clip_rect);
1260 context.FillRect(snapped_clip_rect, Color::kBlack); 1265 context.FillRect(snapped_clip_rect, Color::kBlack);
1261 } 1266 }
1262 1267
1263 } // namespace blink 1268 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698