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

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp

Issue 2194273002: Fix border radius on composited children. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improve clip recording code Created 4 years, 1 month 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/paint/PaintLayerClipper.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
index 1a7b0d47a54ab09c57564cb94854127dc27d0ffb..7bad7c304f7576fa9303c8fcc913419acb64b943 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
@@ -314,11 +314,29 @@ void PaintLayerClipper::calculateRects(
LayoutRect& layerBounds,
ClipRect& backgroundRect,
ClipRect& foregroundRect,
- const LayoutPoint* offsetFromRoot) const {
+ const LayoutPoint* offsetFromRoot,
+ const bool addAncestorClips) const {
if (m_geometryMapper) {
calculateRectsWithGeometryMapper(context, paintDirtyRect, layerBounds,
backgroundRect, foregroundRect,
offsetFromRoot);
+
+ // CSS clip (different than clipping due to overflow) can clip to any box,
+ // even if it falls outside of the border box.
Stephen Chennney 2016/11/08 21:42:52 Wrong base? I'm not sure I changed this.
+ LayoutBoxModelObject& layoutObject = *m_layer.layoutObject();
+ LayoutPoint offset;
+ if (offsetFromRoot)
+ offset = *offsetFromRoot;
+ else
+ m_layer.convertToLayerCoords(context.rootLayer, offset);
+ if (layoutObject.hasClip()) {
+ // Clip applies to *us* as well, so go ahead and update the damageRect.
+ LayoutRect newPosClip = toLayoutBox(layoutObject).clipRect(offset);
+ backgroundRect.intersect(newPosClip);
+ backgroundRect.setIsClippedByClipCss();
+ foregroundRect.intersect(newPosClip);
+ foregroundRect.setIsClippedByClipCss();
+ }
return;
}
@@ -343,11 +361,12 @@ void PaintLayerClipper::calculateRects(
layerBounds = LayoutRect(offset, LayoutSize(m_layer.size()));
// Update the clip rects that will be passed to child layers.
- if (shouldClipOverflow(context)) {
+ if (addAncestorClips || shouldClipOverflow(context)) {
Stephen Chennney 2016/11/08 21:42:52 Trying to get rid of this by having the layoutObje
+ if (addAncestorClips) fprintf(stderr, "Preparing due to addAncestorClips\n");
foregroundRect.intersect(
toLayoutBox(layoutObject)
.overflowClipRect(offset, context.overlayScrollbarClipBehavior));
- if (layoutObject.styleRef().hasBorderRadius())
+ if (layoutObject.styleRef().hasBorderRadius() || addAncestorClips)
foregroundRect.setHasRadius(true);
// FIXME: Does not do the right thing with columns yet, since we don't yet

Powered by Google App Engine
This is Rietveld 408576698