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

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

Issue 2923683002: Fix nested border radius with composited child. (Closed)
Patch Set: Add tests and fix tests 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
index bea0b2b92a1e6ba000bf830e3065c3c771a8d571..035d4e26ce2b23f559475a69c7decd1696842c3d 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -550,26 +550,6 @@ void CompositedLayerMapping::UpdateCompositingReasons() {
owning_layer_.GetSquashingDisallowedReasons());
}
-bool CompositedLayerMapping::AncestorRoundedCornersWontClip(
- const LayoutBoxModelObject& child,
- const LayoutBoxModelObject& clipping_ancestor) {
- LayoutRect local_visual_rect = composited_bounds_;
- child.MapToVisualRectInAncestorSpace(&clipping_ancestor, local_visual_rect);
- FloatRoundedRect rounded_clip_rect =
- clipping_ancestor.Style()->GetRoundedInnerBorderFor(
- clipping_ancestor.LocalVisualRect());
- FloatRect inner_clip_rect = rounded_clip_rect.RadiusCenterRect();
- // The first condition catches cases where the child is certainly inside
- // the rounded corner portion of the border, and cannot be clipped by
- // the rounded portion. The second catches cases where the child is
- // entirely outside the rectangular border (ignoring rounded corners) so
- // is also unaffected by the rounded corners. In both cases the existing
- // rectangular clip is adequate and the mask is unnecessary.
- return inner_clip_rect.Contains(FloatRect(local_visual_rect)) ||
- !local_visual_rect.Intersects(
- EnclosingLayoutRect(rounded_clip_rect.Rect()));
-}
-
void CompositedLayerMapping::
OwningLayerClippedOrMaskedByLayerNotAboveCompositedAncestor(
const PaintLayer* scroll_parent,
@@ -620,10 +600,20 @@ void CompositedLayerMapping::
// should be via mask or by compositing the parent too.
// https://bugs.chromium.org/p/chromium/issues/detail?id=615870
DCHECK(clipping_container->Style());
- owning_layer_is_masked =
- owning_layer_is_clipped &&
- clipping_container->Style()->HasBorderRadius() &&
- !AncestorRoundedCornersWontClip(GetLayoutObject(), *clipping_container);
+ bool clip_rect_has_radius = clip_rect.HasRadius();
+ LayoutRect local_visual_rect = composited_bounds_;
chrishtr 2017/06/09 17:29:30 2. local_visual_rect is in the space of owning_lay
Stephen Chennney 2017/06/09 20:52:37 Acknowledged.
+ GetLayoutObject().MapToVisualRectInAncestorSpace(clipping_container,
chrishtr 2017/06/09 17:29:30 (1) and (2) lead me to conclude that you should us
Stephen Chennney 2017/06/09 20:52:37 Acknowledged.
+ local_visual_rect);
+ clip_rect.Intersect(local_visual_rect);
+ owning_layer_is_masked = owning_layer_is_clipped && clip_rect_has_radius &&
+ !clip_rect.IsEmpty() &&
+ clip_rect.Rect() != local_visual_rect;
+
+#ifndef NDEBUG
+ LOG(INFO) << "clipped? " << owning_layer_is_clipped << " masked? "
+ << owning_layer_is_masked << "clip_rect: " << clip_rect.ToString()
+ << " local rect " << local_visual_rect.ToString();
+#endif
}
const PaintLayer* CompositedLayerMapping::ScrollParent() {

Powered by Google App Engine
This is Rietveld 408576698