OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * | 4 * |
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
6 * | 6 * |
7 * Other contributors: | 7 * Other contributors: |
8 * Robert O'Callahan <roc+@cs.cmu.edu> | 8 * Robert O'Callahan <roc+@cs.cmu.edu> |
9 * David Baron <dbaron@fas.harvard.edu> | 9 * David Baron <dbaron@fas.harvard.edu> |
10 * Christian Biesinger <cbiesinger@web.de> | 10 * Christian Biesinger <cbiesinger@web.de> |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
307 CHECK_RECTS_EQ(testLayerBounds, layerBounds); | 307 CHECK_RECTS_EQ(testLayerBounds, layerBounds); |
308 #endif | 308 #endif |
309 } | 309 } |
310 | 310 |
311 void PaintLayerClipper::calculateRects( | 311 void PaintLayerClipper::calculateRects( |
312 const ClipRectsContext& context, | 312 const ClipRectsContext& context, |
313 const LayoutRect& paintDirtyRect, | 313 const LayoutRect& paintDirtyRect, |
314 LayoutRect& layerBounds, | 314 LayoutRect& layerBounds, |
315 ClipRect& backgroundRect, | 315 ClipRect& backgroundRect, |
316 ClipRect& foregroundRect, | 316 ClipRect& foregroundRect, |
317 const LayoutPoint* offsetFromRoot) const { | 317 const LayoutPoint* offsetFromRoot, |
318 const bool addAncestorClips) const { | |
318 if (m_geometryMapper) { | 319 if (m_geometryMapper) { |
319 calculateRectsWithGeometryMapper(context, paintDirtyRect, layerBounds, | 320 calculateRectsWithGeometryMapper(context, paintDirtyRect, layerBounds, |
320 backgroundRect, foregroundRect, | 321 backgroundRect, foregroundRect, |
321 offsetFromRoot); | 322 offsetFromRoot); |
323 | |
324 // CSS clip (different than clipping due to overflow) can clip to any box, | |
325 // 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.
| |
326 LayoutBoxModelObject& layoutObject = *m_layer.layoutObject(); | |
327 LayoutPoint offset; | |
328 if (offsetFromRoot) | |
329 offset = *offsetFromRoot; | |
330 else | |
331 m_layer.convertToLayerCoords(context.rootLayer, offset); | |
332 if (layoutObject.hasClip()) { | |
333 // Clip applies to *us* as well, so go ahead and update the damageRect. | |
334 LayoutRect newPosClip = toLayoutBox(layoutObject).clipRect(offset); | |
335 backgroundRect.intersect(newPosClip); | |
336 backgroundRect.setIsClippedByClipCss(); | |
337 foregroundRect.intersect(newPosClip); | |
338 foregroundRect.setIsClippedByClipCss(); | |
339 } | |
322 return; | 340 return; |
323 } | 341 } |
324 | 342 |
325 bool isClippingRoot = &m_layer == context.rootLayer; | 343 bool isClippingRoot = &m_layer == context.rootLayer; |
326 LayoutBoxModelObject& layoutObject = *m_layer.layoutObject(); | 344 LayoutBoxModelObject& layoutObject = *m_layer.layoutObject(); |
327 | 345 |
328 if (!isClippingRoot && m_layer.parent()) { | 346 if (!isClippingRoot && m_layer.parent()) { |
329 backgroundRect = backgroundClipRect(context); | 347 backgroundRect = backgroundClipRect(context); |
330 backgroundRect.move(context.subPixelAccumulation); | 348 backgroundRect.move(context.subPixelAccumulation); |
331 backgroundRect.intersect(paintDirtyRect); | 349 backgroundRect.intersect(paintDirtyRect); |
332 } else { | 350 } else { |
333 backgroundRect = paintDirtyRect; | 351 backgroundRect = paintDirtyRect; |
334 } | 352 } |
335 | 353 |
336 foregroundRect = backgroundRect; | 354 foregroundRect = backgroundRect; |
337 | 355 |
338 LayoutPoint offset; | 356 LayoutPoint offset; |
339 if (offsetFromRoot) | 357 if (offsetFromRoot) |
340 offset = *offsetFromRoot; | 358 offset = *offsetFromRoot; |
341 else | 359 else |
342 m_layer.convertToLayerCoords(context.rootLayer, offset); | 360 m_layer.convertToLayerCoords(context.rootLayer, offset); |
343 layerBounds = LayoutRect(offset, LayoutSize(m_layer.size())); | 361 layerBounds = LayoutRect(offset, LayoutSize(m_layer.size())); |
344 | 362 |
345 // Update the clip rects that will be passed to child layers. | 363 // Update the clip rects that will be passed to child layers. |
346 if (shouldClipOverflow(context)) { | 364 if (addAncestorClips || shouldClipOverflow(context)) { |
Stephen Chennney
2016/11/08 21:42:52
Trying to get rid of this by having the layoutObje
| |
365 if (addAncestorClips) fprintf(stderr, "Preparing due to addAncestorClips\n") ; | |
347 foregroundRect.intersect( | 366 foregroundRect.intersect( |
348 toLayoutBox(layoutObject) | 367 toLayoutBox(layoutObject) |
349 .overflowClipRect(offset, context.overlayScrollbarClipBehavior)); | 368 .overflowClipRect(offset, context.overlayScrollbarClipBehavior)); |
350 if (layoutObject.styleRef().hasBorderRadius()) | 369 if (layoutObject.styleRef().hasBorderRadius() || addAncestorClips) |
351 foregroundRect.setHasRadius(true); | 370 foregroundRect.setHasRadius(true); |
352 | 371 |
353 // FIXME: Does not do the right thing with columns yet, since we don't yet | 372 // FIXME: Does not do the right thing with columns yet, since we don't yet |
354 // factor in the individual column boxes as overflow. | 373 // factor in the individual column boxes as overflow. |
355 | 374 |
356 // The LayoutView is special since its overflow clipping rect may be larger | 375 // The LayoutView is special since its overflow clipping rect may be larger |
357 // than its box rect (crbug.com/492871). | 376 // than its box rect (crbug.com/492871). |
358 LayoutRect layerBoundsWithVisualOverflow = | 377 LayoutRect layerBoundsWithVisualOverflow = |
359 layoutObject.isLayoutView() | 378 layoutObject.isLayoutView() |
360 ? toLayoutView(layoutObject).viewRect() | 379 ? toLayoutView(layoutObject).viewRect() |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
551 const LayoutSize& subpixelAccumulation) const { | 570 const LayoutSize& subpixelAccumulation) const { |
552 DCHECK(!m_geometryMapper); | 571 DCHECK(!m_geometryMapper); |
553 ClipRectsContext context(rootLayer, PaintingClipRects, | 572 ClipRectsContext context(rootLayer, PaintingClipRects, |
554 IgnoreOverlayScrollbarSize, subpixelAccumulation); | 573 IgnoreOverlayScrollbarSize, subpixelAccumulation); |
555 if (respectOverflowClip == IgnoreOverflowClip) | 574 if (respectOverflowClip == IgnoreOverflowClip) |
556 context.setIgnoreOverflowClip(); | 575 context.setIgnoreOverflowClip(); |
557 return getClipRects(context); | 576 return getClipRects(context); |
558 } | 577 } |
559 | 578 |
560 } // namespace blink | 579 } // namespace blink |
OLD | NEW |