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

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

Issue 2923683002: Fix nested border radius with composited child. (Closed)
Patch Set: Split tests, check layer sizes, document 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 420
421 PaintLayerFragments layer_fragments; 421 PaintLayerFragments layer_fragments;
422 if (should_paint_content || should_paint_self_outline || 422 if (should_paint_content || should_paint_self_outline ||
423 is_painting_overlay_scrollbars) { 423 is_painting_overlay_scrollbars) {
424 // Collect the fragments. This will compute the clip rectangles and paint 424 // Collect the fragments. This will compute the clip rectangles and paint
425 // offsets for each layer fragment. 425 // offsets for each layer fragment.
426 ClipRectsCacheSlot cache_slot = (paint_flags & kPaintLayerUncachedClipRects) 426 ClipRectsCacheSlot cache_slot = (paint_flags & kPaintLayerUncachedClipRects)
427 ? kUncachedClipRects 427 ? kUncachedClipRects
428 : kPaintingClipRects; 428 : kPaintingClipRects;
429 LayoutPoint offset_to_clipper; 429 LayoutPoint offset_to_clipper;
430 PaintLayer* paint_layer_for_fragments = &paint_layer_; 430 const PaintLayer* paint_layer_for_fragments = &paint_layer_;
431 if (paint_flags & kPaintLayerPaintingAncestorClippingMaskPhase) { 431 if (paint_flags & kPaintLayerPaintingAncestorClippingMaskPhase) {
432 // Compute fragments and their clips with respect to the clipping 432 // Compute fragments and their clips with respect to the outermost
433 // container. The paint rect is in this layer's space, so convert it 433 // clipping container. This handles nested border radius by including
434 // to the clipper's layer's space. The rootLayer is also changed to 434 // all of them in the mask.
435 // the clipper's layer to simplify coordinate system adjustments. 435 //
436 // The change to rootLayer must persist to correctly record the clips. 436 // The paint rect is in this layer's space, so convert it to the clipper's
437 // layer's space. The rootLayer is also changed to the clipper's layer to
438 // simplify coordinate system adjustments. The change to rootLayer must
439 // persist to correctly record the clips.
437 paint_layer_for_fragments = 440 paint_layer_for_fragments =
438 paint_layer_.ClippingContainer()->EnclosingLayer(); 441 paint_layer_.EnclosingLayerWithCompositedLayerMapping(kExcludeSelf);
439 local_painting_info.root_layer = paint_layer_for_fragments; 442 local_painting_info.root_layer = paint_layer_for_fragments;
440 paint_layer_.ConvertToLayerCoords(local_painting_info.root_layer, 443 paint_layer_.ConvertToLayerCoords(local_painting_info.root_layer,
441 offset_to_clipper); 444 offset_to_clipper);
442 local_painting_info.paint_dirty_rect.MoveBy(offset_to_clipper); 445 local_painting_info.paint_dirty_rect.MoveBy(offset_to_clipper);
443 } 446 }
444 447
445 PaintLayer::GeometryMapperOption geometry_mapper_option = 448 PaintLayer::GeometryMapperOption geometry_mapper_option =
446 PaintLayer::kDoNotUseGeometryMapper; 449 PaintLayer::kDoNotUseGeometryMapper;
447 if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled()) 450 if (RuntimeEnabledFeatures::SlimmingPaintInvalidationEnabled())
448 geometry_mapper_option = PaintLayer::kUseGeometryMapper; 451 geometry_mapper_option = PaintLayer::kUseGeometryMapper;
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 // 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
1004 // this layer's clips. 1007 // this layer's clips.
1005 clipping_rule = LayerClipRecorder::kDoNotIncludeSelfForBorderRadius; 1008 clipping_rule = LayerClipRecorder::kDoNotIncludeSelfForBorderRadius;
1006 break; 1009 break;
1007 } 1010 }
1008 default: 1011 default:
1009 clipping_rule = LayerClipRecorder::kIncludeSelfForBorderRadius; 1012 clipping_rule = LayerClipRecorder::kIncludeSelfForBorderRadius;
1010 break; 1013 break;
1011 } 1014 }
1012 1015
1013 // TODO(schenney): Nested border-radius clips are not applied to composited
1014 // children, probably due to an incorrect clipRoot.
1015 // https://bugs.chromium.org/p/chromium/issues/detail?id=672561
1016 clip_recorder.emplace(context, paint_layer_.GetLayoutObject(), clip_type, 1016 clip_recorder.emplace(context, paint_layer_.GetLayoutObject(), clip_type,
1017 clip_rect, painting_info.root_layer, 1017 clip_rect, painting_info.root_layer,
1018 fragment.pagination_offset, paint_flags, 1018 fragment.pagination_offset, paint_flags,
1019 clipping_rule); 1019 clipping_rule);
1020 } 1020 }
1021 1021
1022 // 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
1023 // 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.
1024 // 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
1025 // filled with black. 1025 // filled with black.
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 context, layout_object, kPaintPhaseClippingMask)) 1259 context, layout_object, kPaintPhaseClippingMask))
1260 return; 1260 return;
1261 1261
1262 IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect()); 1262 IntRect snapped_clip_rect = PixelSnappedIntRect(clip_rect.Rect());
1263 LayoutObjectDrawingRecorder drawing_recorder( 1263 LayoutObjectDrawingRecorder drawing_recorder(
1264 context, layout_object, kPaintPhaseClippingMask, snapped_clip_rect); 1264 context, layout_object, kPaintPhaseClippingMask, snapped_clip_rect);
1265 context.FillRect(snapped_clip_rect, Color::kBlack); 1265 context.FillRect(snapped_clip_rect, Color::kBlack);
1266 } 1266 }
1267 1267
1268 } // namespace blink 1268 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.cpp ('k') | third_party/WebKit/Source/core/paint/PaintLayerPaintingInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698