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

Side by Side Diff: Source/core/paint/DeprecatedPaintLayerClipper.cpp

Issue 1278113003: Calculate correct clip foregroundBound and backgroundBound (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add layout test and fix background Created 5 years, 4 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 return clipRect; 210 return clipRect;
211 } 211 }
212 212
213 void DeprecatedPaintLayerClipper::calculateRects(const ClipRectsContext& context , const LayoutRect& paintDirtyRect, LayoutRect& layerBounds, 213 void DeprecatedPaintLayerClipper::calculateRects(const ClipRectsContext& context , const LayoutRect& paintDirtyRect, LayoutRect& layerBounds,
214 ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, c onst LayoutPoint* offsetFromRoot) const 214 ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, c onst LayoutPoint* offsetFromRoot) const
215 { 215 {
216 bool isClippingRoot = m_layoutObject.layer() == context.rootLayer; 216 bool isClippingRoot = m_layoutObject.layer() == context.rootLayer;
217 217
218 if (!isClippingRoot && m_layoutObject.layer()->parent()) { 218 if (!isClippingRoot && m_layoutObject.layer()->parent()) {
219 backgroundRect = backgroundClipRect(context); 219 backgroundRect = backgroundClipRect(context);
220 backgroundRect.move(roundedIntSize(context.subPixelAccumulation));
pdr. 2015/08/17 21:17:53 We used roundedIntSize before, but don't now. Was
qiankun 2015/08/19 09:14:19 It's intentional. The layout test which was added
221 backgroundRect.intersect(paintDirtyRect); 220 backgroundRect.intersect(paintDirtyRect);
pdr. 2015/08/17 21:17:53 This seems wrong... we're intersecting with the pa
qiankun 2015/08/19 09:14:19 Both backgroundRect and paintDirtyRect should move
pdr. 2015/08/20 05:55:13 I'm just worried about the order these are being d
qiankun 2015/08/20 06:08:43 Current implementation is wrong here. I think we s
222 } else { 221 } else {
223 backgroundRect = paintDirtyRect; 222 backgroundRect = paintDirtyRect;
224 } 223 }
225 224
225 LayoutPoint offset;
226 if (offsetFromRoot) {
227 offset = *offsetFromRoot;
228 backgroundRect.move(context.subPixelAccumulation);
229 } else {
230 m_layoutObject.layer()->convertToLayerCoords(context.rootLayer, offset);
231 }
232 layerBounds = LayoutRect(offset, LayoutSize(m_layoutObject.layer()->size())) ;
233
226 foregroundRect = backgroundRect; 234 foregroundRect = backgroundRect;
227 outlineRect = backgroundRect; 235 outlineRect = backgroundRect;
228 236
229 LayoutPoint offset;
230 if (offsetFromRoot)
231 offset = *offsetFromRoot;
232 else
233 m_layoutObject.layer()->convertToLayerCoords(context.rootLayer, offset);
234 layerBounds = LayoutRect(offset, LayoutSize(m_layoutObject.layer()->size())) ;
235
236 // Update the clip rects that will be passed to child layers. 237 // Update the clip rects that will be passed to child layers.
237 if (m_layoutObject.hasOverflowClip()) { 238 if (m_layoutObject.hasOverflowClip()) {
238 // This layer establishes a clip of some kind. 239 // This layer establishes a clip of some kind.
239 if (shouldRespectOverflowClip(context)) { 240 if (shouldRespectOverflowClip(context)) {
240 foregroundRect.intersect(toLayoutBox(m_layoutObject).overflowClipRec t(offset, context.scrollbarRelevancy)); 241 foregroundRect.intersect(toLayoutBox(m_layoutObject).overflowClipRec t(offset, context.scrollbarRelevancy));
241 if (m_layoutObject.style()->hasBorderRadius()) 242 if (m_layoutObject.style()->hasBorderRadius())
242 foregroundRect.setHasRadius(true); 243 foregroundRect.setHasRadius(true);
243 } 244 }
244 245
245 // If we establish an overflow clip at all, then go ahead and make sure our background 246 // If we establish an overflow clip at all, then go ahead and make sure our background
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 if (context.respectOverflowClip == IgnoreOverflowClip) 384 if (context.respectOverflowClip == IgnoreOverflowClip)
384 return false; 385 return false;
385 386
386 if (layer->isRootLayer() && context.respectOverflowClipForViewport == Ignore OverflowClip) 387 if (layer->isRootLayer() && context.respectOverflowClipForViewport == Ignore OverflowClip)
387 return false; 388 return false;
388 389
389 return true; 390 return true;
390 } 391 }
391 392
392 } // namespace blink 393 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayer.cpp ('k') | Source/core/paint/DeprecatedPaintLayerPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698