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

Side by Side 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: Super hacky patch Created 4 years, 3 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) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 return clipRect; 182 return clipRect;
183 183
184 LayoutPoint clippingRootOffset; 184 LayoutPoint clippingRootOffset;
185 m_layer.convertToLayerCoords(clippingRootLayer, clippingRootOffset); 185 m_layer.convertToLayerCoords(clippingRootLayer, clippingRootOffset);
186 clipRect.moveBy(-clippingRootOffset); 186 clipRect.moveBy(-clippingRootOffset);
187 187
188 return clipRect; 188 return clipRect;
189 } 189 }
190 190
191 void PaintLayerClipper::calculateRects(const ClipRectsContext& context, const La youtRect& paintDirtyRect, LayoutRect& layerBounds, 191 void PaintLayerClipper::calculateRects(const ClipRectsContext& context, const La youtRect& paintDirtyRect, LayoutRect& layerBounds,
192 ClipRect& backgroundRect, ClipRect& foregroundRect, const LayoutPoint* offse tFromRoot) const 192 ClipRect& backgroundRect, ClipRect& foregroundRect, const LayoutPoint* offse tFromRoot, const bool addAncestorClips) const
193 { 193 {
194 bool isClippingRoot = &m_layer == context.rootLayer; 194 bool isClippingRoot = &m_layer == context.rootLayer;
195 LayoutBoxModelObject& layoutObject = *m_layer.layoutObject(); 195 LayoutBoxModelObject& layoutObject = *m_layer.layoutObject();
196 196
197 if (!isClippingRoot && m_layer.parent()) { 197 if (!isClippingRoot && m_layer.parent()) {
198 backgroundRect = backgroundClipRect(context); 198 backgroundRect = backgroundClipRect(context);
199 backgroundRect.move(context.subPixelAccumulation); 199 backgroundRect.move(context.subPixelAccumulation);
200 backgroundRect.intersect(paintDirtyRect); 200 backgroundRect.intersect(paintDirtyRect);
201 } else { 201 } else {
202 backgroundRect = paintDirtyRect; 202 backgroundRect = paintDirtyRect;
203 } 203 }
204 204
205 foregroundRect = backgroundRect; 205 foregroundRect = backgroundRect;
206 206
207 LayoutPoint offset; 207 LayoutPoint offset;
208 if (offsetFromRoot) 208 if (offsetFromRoot)
209 offset = *offsetFromRoot; 209 offset = *offsetFromRoot;
210 else 210 else
211 m_layer.convertToLayerCoords(context.rootLayer, offset); 211 m_layer.convertToLayerCoords(context.rootLayer, offset);
212 layerBounds = LayoutRect(offset, LayoutSize(m_layer.size())); 212 layerBounds = LayoutRect(offset, LayoutSize(m_layer.size()));
213 213
214 // Update the clip rects that will be passed to child layers. 214 // Update the clip rects that will be passed to child layers.
215 if ((layoutObject.hasOverflowClip() || layoutObject.styleRef().containsPaint ()) && shouldRespectOverflowClip(context)) { 215 if (addAncestorClips || ((layoutObject.hasOverflowClip() || layoutObject.sty leRef().containsPaint()) && shouldRespectOverflowClip(context))) {
216 foregroundRect.intersect(toLayoutBox(layoutObject).overflowClipRect(offs et, context.overlayScrollbarClipBehavior)); 216 foregroundRect.intersect(toLayoutBox(layoutObject).overflowClipRect(offs et, context.overlayScrollbarClipBehavior));
217 if (layoutObject.styleRef().hasBorderRadius()) 217 if (layoutObject.styleRef().hasBorderRadius() || addAncestorClips)
chrishtr 2016/10/21 23:16:20 What does this one achieve? It seems to force sett
Stephen Chennney 2016/10/24 20:15:27 This is the hackish part of the whole thing. It's
218 foregroundRect.setHasRadius(true); 218 foregroundRect.setHasRadius(true);
219 219
220 // FIXME: Does not do the right thing with columns yet, since we don't y et factor in the 220 // FIXME: Does not do the right thing with columns yet, since we don't y et factor in the
221 // individual column boxes as overflow. 221 // individual column boxes as overflow.
222 222
223 // The LayoutView is special since its overflow clipping rect may be lar ger than its box rect (crbug.com/492871). 223 // The LayoutView is special since its overflow clipping rect may be lar ger than its box rect (crbug.com/492871).
224 LayoutRect layerBoundsWithVisualOverflow = layoutObject.isLayoutView() ? toLayoutView(layoutObject).viewRect() : toLayoutBox(layoutObject).visualOverflo wRect(); 224 LayoutRect layerBoundsWithVisualOverflow = layoutObject.isLayoutView() ? toLayoutView(layoutObject).viewRect() : toLayoutBox(layoutObject).visualOverflo wRect();
225 toLayoutBox(layoutObject).flipForWritingMode(layerBoundsWithVisualOverfl ow); // PaintLayer are in physical coordinates, so the overflow has to be flippe d. 225 toLayoutBox(layoutObject).flipForWritingMode(layerBoundsWithVisualOverfl ow); // PaintLayer are in physical coordinates, so the overflow has to be flippe d.
226 layerBoundsWithVisualOverflow.moveBy(offset); 226 layerBoundsWithVisualOverflow.moveBy(offset);
227 backgroundRect.intersect(layerBoundsWithVisualOverflow); 227 backgroundRect.intersect(layerBoundsWithVisualOverflow);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 325
326 ClipRects& PaintLayerClipper::paintingClipRects(const PaintLayer* rootLayer, Sho uldRespectOverflowClipType respectOverflowClip, const LayoutSize& subpixelAccumu lation) const 326 ClipRects& PaintLayerClipper::paintingClipRects(const PaintLayer* rootLayer, Sho uldRespectOverflowClipType respectOverflowClip, const LayoutSize& subpixelAccumu lation) const
327 { 327 {
328 ClipRectsContext context(rootLayer, PaintingClipRects, IgnoreOverlayScrollba rSize, subpixelAccumulation); 328 ClipRectsContext context(rootLayer, PaintingClipRects, IgnoreOverlayScrollba rSize, subpixelAccumulation);
329 if (respectOverflowClip == IgnoreOverflowClip) 329 if (respectOverflowClip == IgnoreOverflowClip)
330 context.setIgnoreOverflowClip(); 330 context.setIgnoreOverflowClip();
331 return getClipRects(context); 331 return getClipRects(context);
332 } 332 }
333 333
334 } // namespace blink 334 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698