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

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 2859483006: cc: Enable composited border-radius scrolling.
Patch Set: Make respect-clip-for-non-composited-scrollers-when-prefering-compositing-to-lcd-text.html not a re… Created 3 years, 7 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 /* 1 /*
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 void CompositedLayerMapping::UpdateCompositingReasons() { 545 void CompositedLayerMapping::UpdateCompositingReasons() {
546 // All other layers owned by this mapping will have the same compositing 546 // All other layers owned by this mapping will have the same compositing
547 // reason for their lifetime, so they are initialized only when created. 547 // reason for their lifetime, so they are initialized only when created.
548 graphics_layer_->SetCompositingReasons(owning_layer_.GetCompositingReasons()); 548 graphics_layer_->SetCompositingReasons(owning_layer_.GetCompositingReasons());
549 graphics_layer_->SetSquashingDisallowedReasons( 549 graphics_layer_->SetSquashingDisallowedReasons(
550 owning_layer_.GetSquashingDisallowedReasons()); 550 owning_layer_.GetSquashingDisallowedReasons());
551 } 551 }
552 552
553 bool CompositedLayerMapping::AncestorRoundedCornersWontClip( 553 bool CompositedLayerMapping::AncestorRoundedCornersWontClip(
554 const LayoutBoxModelObject& child, 554 const LayoutBoxModelObject& child,
555 const LayoutBoxModelObject& clipping_ancestor) { 555 const LayoutBoxModelObject& clipping_ancestor) {
trchen 2017/05/22 23:00:06 This has to be changed as well. If there is anythi
sunxd 2017/06/15 15:59:10 There was a bug about nested border-radius clippin
Stephen Chennney 2017/06/15 17:44:24 Yes, the nested border radius mask code will look
sunxd 2017/06/15 19:59:20 Done.
556 LayoutRect local_visual_rect = composited_bounds_; 556 LayoutRect local_visual_rect = composited_bounds_;
557 child.MapToVisualRectInAncestorSpace(&clipping_ancestor, local_visual_rect); 557 child.MapToVisualRectInAncestorSpace(&clipping_ancestor, local_visual_rect);
558 FloatRoundedRect rounded_clip_rect = 558 FloatRoundedRect rounded_clip_rect =
559 clipping_ancestor.Style()->GetRoundedInnerBorderFor( 559 clipping_ancestor.Style()->GetRoundedInnerBorderFor(
560 clipping_ancestor.LocalVisualRect()); 560 clipping_ancestor.LocalVisualRect());
561 FloatRect inner_clip_rect = rounded_clip_rect.RadiusCenterRect(); 561 FloatRect inner_clip_rect = rounded_clip_rect.RadiusCenterRect();
562 // The first condition catches cases where the child is certainly inside 562 // The first condition catches cases where the child is certainly inside
563 // the rounded corner portion of the border, and cannot be clipped by 563 // the rounded corner portion of the border, and cannot be clipped by
564 // the rounded portion. The second catches cases where the child is 564 // the rounded portion. The second catches cases where the child is
565 // entirely outside the rectangular border (ignoring rounded corners) so 565 // entirely outside the rectangular border (ignoring rounded corners) so
(...skipping 18 matching lines...) Expand all
584 const PaintLayer* compositing_ancestor = 584 const PaintLayer* compositing_ancestor =
585 owning_layer_.EnclosingLayerWithCompositedLayerMapping(kExcludeSelf); 585 owning_layer_.EnclosingLayerWithCompositedLayerMapping(kExcludeSelf);
586 if (!compositing_ancestor) 586 if (!compositing_ancestor)
587 return; 587 return;
588 588
589 const LayoutBoxModelObject* clipping_container = 589 const LayoutBoxModelObject* clipping_container =
590 owning_layer_.ClippingContainer(); 590 owning_layer_.ClippingContainer();
591 if (!clipping_container) 591 if (!clipping_container)
592 return; 592 return;
593 593
594 if (clipping_container->EnclosingLayer() == scroll_parent)
595 return;
596
597 if (compositing_ancestor->GetLayoutObject().IsDescendantOf( 594 if (compositing_ancestor->GetLayoutObject().IsDescendantOf(
598 clipping_container)) 595 clipping_container))
599 return; 596 return;
600 597
601 // We ignore overflow clip here; we want composited overflow content to 598 // We ignore overflow clip here; we want composited overflow content to
602 // behave as if it lives in an unclipped universe so it can prepaint, etc. 599 // behave as if it lives in an unclipped universe so it can prepaint, etc.
603 // This means that we need to check if we are actually clipped before 600 // This means that we need to check if we are actually clipped before
604 // setting up m_ancestorClippingLayer otherwise 601 // setting up m_ancestorClippingLayer otherwise
605 // updateAncestorClippingLayerGeometry will fail as the clip rect will be 602 // updateAncestorClippingLayerGeometry will fail as the clip rect will be
606 // infinite. 603 // infinite.
(...skipping 10 matching lines...) Expand all
617 owning_layer_is_clipped = parent_clip_rect != LayoutRect::InfiniteIntRect(); 614 owning_layer_is_clipped = parent_clip_rect != LayoutRect::InfiniteIntRect();
618 615
619 // TODO(schenney): CSS clips are not applied to composited children, and 616 // TODO(schenney): CSS clips are not applied to composited children, and
620 // should be via mask or by compositing the parent too. 617 // should be via mask or by compositing the parent too.
621 // https://bugs.chromium.org/p/chromium/issues/detail?id=615870 618 // https://bugs.chromium.org/p/chromium/issues/detail?id=615870
622 DCHECK(clipping_container->Style()); 619 DCHECK(clipping_container->Style());
623 owning_layer_is_masked = 620 owning_layer_is_masked =
624 owning_layer_is_clipped && 621 owning_layer_is_clipped &&
625 clipping_container->Style()->HasBorderRadius() && 622 clipping_container->Style()->HasBorderRadius() &&
626 !AncestorRoundedCornersWontClip(GetLayoutObject(), *clipping_container); 623 !AncestorRoundedCornersWontClip(GetLayoutObject(), *clipping_container);
624
625 if (clipping_container->EnclosingLayer() == scroll_parent)
626 owning_layer_is_clipped = owning_layer_is_masked;
trchen 2017/05/22 23:00:06 Could you document what does this line do? Actuall
sunxd 2017/06/15 15:59:10 Sure. It was added due to this bug: crbug.com/4507
Stephen Chennney 2017/06/15 17:44:24 Will we not now have the same problem as crbug.com
sunxd 2017/06/15 19:59:20 Oh sorry I think this change should be reverted as
627 } 627 }
628 628
629 const PaintLayer* CompositedLayerMapping::ScrollParent() { 629 const PaintLayer* CompositedLayerMapping::ScrollParent() {
630 const PaintLayer* scroll_parent = owning_layer_.ScrollParent(); 630 const PaintLayer* scroll_parent = owning_layer_.ScrollParent();
631 if (scroll_parent && !scroll_parent->NeedsCompositedScrolling()) 631 if (scroll_parent && !scroll_parent->NeedsCompositedScrolling())
632 return nullptr; 632 return nullptr;
633 return scroll_parent; 633 return scroll_parent;
634 } 634 }
635 635
636 bool CompositedLayerMapping::UpdateGraphicsLayerConfiguration() { 636 bool CompositedLayerMapping::UpdateGraphicsLayerConfiguration() {
(...skipping 3025 matching lines...) Expand 10 before | Expand all | Expand 10 after
3662 } else if (graphics_layer == decoration_outline_layer_.get()) { 3662 } else if (graphics_layer == decoration_outline_layer_.get()) {
3663 name = "Decoration Layer"; 3663 name = "Decoration Layer";
3664 } else { 3664 } else {
3665 NOTREACHED(); 3665 NOTREACHED();
3666 } 3666 }
3667 3667
3668 return name; 3668 return name;
3669 } 3669 }
3670 3670
3671 } // namespace blink 3671 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698