Chromium Code Reviews| 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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) const { |
| 318 if (m_geometryMapper) { | 318 if (m_geometryMapper) { |
| 319 calculateRectsWithGeometryMapper(context, paintDirtyRect, layerBounds, | 319 calculateRectsWithGeometryMapper(context, paintDirtyRect, layerBounds, |
| 320 backgroundRect, foregroundRect, | 320 backgroundRect, foregroundRect, |
| 321 offsetFromRoot); | 321 offsetFromRoot); |
| 322 | |
| 323 // CSS clip (different than clipping due to overflow) can clip to any box, | |
|
chrishtr
2016/11/16 23:56:32
The code you are inserting here is SPv2-specific.
Stephen Chennney
2016/11/17 18:05:48
I shouldn't be; I think I was being over-zealous.
| |
| 324 // even if it falls outside of the border box. | |
| 325 LayoutBoxModelObject& layoutObject = *m_layer.layoutObject(); | |
| 326 LayoutPoint offset; | |
| 327 if (offsetFromRoot) | |
| 328 offset = *offsetFromRoot; | |
| 329 else | |
| 330 m_layer.convertToLayerCoords(context.rootLayer, offset); | |
| 331 if (layoutObject.hasClip()) { | |
| 332 // Clip applies to *us* as well, so go ahead and update the damageRect. | |
| 333 LayoutRect newPosClip = toLayoutBox(layoutObject).clipRect(offset); | |
| 334 backgroundRect.intersect(newPosClip); | |
| 335 backgroundRect.setIsClippedByClipCss(); | |
| 336 foregroundRect.intersect(newPosClip); | |
| 337 foregroundRect.setIsClippedByClipCss(); | |
| 338 } | |
| 322 return; | 339 return; |
| 323 } | 340 } |
| 324 | 341 |
| 325 bool isClippingRoot = &m_layer == context.rootLayer; | 342 bool isClippingRoot = &m_layer == context.rootLayer; |
| 326 LayoutBoxModelObject& layoutObject = *m_layer.layoutObject(); | 343 LayoutBoxModelObject& layoutObject = *m_layer.layoutObject(); |
| 327 | 344 |
| 328 if (!isClippingRoot && m_layer.parent()) { | 345 if (!isClippingRoot && m_layer.parent()) { |
| 329 backgroundRect = backgroundClipRect(context); | 346 backgroundRect = backgroundClipRect(context); |
| 330 backgroundRect.move(context.subPixelAccumulation); | 347 backgroundRect.move(context.subPixelAccumulation); |
| 331 backgroundRect.intersect(paintDirtyRect); | 348 backgroundRect.intersect(paintDirtyRect); |
| 332 } else { | 349 } else { |
| 333 backgroundRect = paintDirtyRect; | 350 backgroundRect = paintDirtyRect; |
| 334 } | 351 } |
| 335 | 352 |
| 336 foregroundRect = backgroundRect; | 353 foregroundRect = backgroundRect; |
| 337 | 354 |
| 338 LayoutPoint offset; | 355 LayoutPoint offset; |
| 339 if (offsetFromRoot) | 356 if (offsetFromRoot) |
| 340 offset = *offsetFromRoot; | 357 offset = *offsetFromRoot; |
| 341 else | 358 else |
| 342 m_layer.convertToLayerCoords(context.rootLayer, offset); | 359 m_layer.convertToLayerCoords(context.rootLayer, offset); |
| 343 layerBounds = LayoutRect(offset, LayoutSize(m_layer.size())); | 360 layerBounds = LayoutRect(offset, LayoutSize(m_layer.size())); |
| 344 | 361 |
| 345 // Update the clip rects that will be passed to child layers. | 362 // Update the clip rects that will be passed to child layers. |
| 346 if (shouldClipOverflow(context)) { | 363 if (shouldClipOverflow(context)) { |
| 347 foregroundRect.intersect( | 364 LayoutRect offsetOverflowClipRect = |
| 348 toLayoutBox(layoutObject) | 365 toLayoutBox(layoutObject) |
| 349 .overflowClipRect(offset, context.overlayScrollbarClipBehavior)); | 366 .overflowClipRect(offset, context.overlayScrollbarClipBehavior); |
| 367 foregroundRect.intersect(offsetOverflowClipRect); | |
| 350 if (layoutObject.styleRef().hasBorderRadius()) | 368 if (layoutObject.styleRef().hasBorderRadius()) |
| 351 foregroundRect.setHasRadius(true); | 369 foregroundRect.setHasRadius(true); |
| 352 | 370 |
| 353 // FIXME: Does not do the right thing with columns yet, since we don't yet | 371 // FIXME: Does not do the right thing with columns yet, since we don't yet |
| 354 // factor in the individual column boxes as overflow. | 372 // factor in the individual column boxes as overflow. |
| 355 | 373 |
| 356 // The LayoutView is special since its overflow clipping rect may be larger | 374 // The LayoutView is special since its overflow clipping rect may be larger |
| 357 // than its box rect (crbug.com/492871). | 375 // than its box rect (crbug.com/492871). |
| 358 LayoutRect layerBoundsWithVisualOverflow = | 376 LayoutRect layerBoundsWithVisualOverflow = |
| 359 layoutObject.isLayoutView() | 377 layoutObject.isLayoutView() |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 551 const LayoutSize& subpixelAccumulation) const { | 569 const LayoutSize& subpixelAccumulation) const { |
| 552 DCHECK(!m_geometryMapper); | 570 DCHECK(!m_geometryMapper); |
| 553 ClipRectsContext context(rootLayer, PaintingClipRects, | 571 ClipRectsContext context(rootLayer, PaintingClipRects, |
| 554 IgnoreOverlayScrollbarSize, subpixelAccumulation); | 572 IgnoreOverlayScrollbarSize, subpixelAccumulation); |
| 555 if (respectOverflowClip == IgnoreOverflowClip) | 573 if (respectOverflowClip == IgnoreOverflowClip) |
| 556 context.setIgnoreOverflowClip(); | 574 context.setIgnoreOverflowClip(); |
| 557 return getClipRects(context); | 575 return getClipRects(context); |
| 558 } | 576 } |
| 559 | 577 |
| 560 } // namespace blink | 578 } // namespace blink |
| OLD | NEW |