| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 for (const PaintLayer* layer = currentLayer->firstChild(); layer; | 199 for (const PaintLayer* layer = currentLayer->firstChild(); layer; |
| 200 layer = layer->nextSibling()) | 200 layer = layer->nextSibling()) |
| 201 layers.push(layer); | 201 layers.push(layer); |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 | 204 |
| 205 LayoutRect PaintLayerClipper::localClipRect( | 205 LayoutRect PaintLayerClipper::localClipRect( |
| 206 const PaintLayer& clippingRootLayer) const { | 206 const PaintLayer& clippingRootLayer) const { |
| 207 ClipRectsContext context(&clippingRootLayer, PaintingClipRects); | 207 ClipRectsContext context(&clippingRootLayer, PaintingClipRects); |
| 208 if (m_geometryMapper) { | 208 if (m_geometryMapper) { |
| 209 LayoutRect premappedRect = | 209 ClipRect clipRect = clipRectWithGeometryMapper(context, false); |
| 210 applyOverflowClipToBackgroundRectWithGeometryMapper( | 210 applyOverflowClipToBackgroundRectWithGeometryMapper(context, clipRect); |
| 211 context, clipRectWithGeometryMapper(context, false)) | 211 LayoutRect premappedRect = clipRect.rect(); |
| 212 .rect(); | |
| 213 | 212 |
| 214 // The rect now needs to be transformed to the local space of this | 213 // The rect now needs to be transformed to the local space of this |
| 215 // PaintLayer. | 214 // PaintLayer. |
| 216 premappedRect.moveBy(context.rootLayer->layoutObject()->paintOffset()); | 215 premappedRect.moveBy(context.rootLayer->layoutObject()->paintOffset()); |
| 217 | 216 |
| 218 const auto* clipRootLayerTransform = clippingRootLayer.layoutObject() | 217 const auto* clipRootLayerTransform = clippingRootLayer.layoutObject() |
| 219 ->paintProperties() | 218 ->paintProperties() |
| 220 ->localBorderBoxProperties() | 219 ->localBorderBoxProperties() |
| 221 ->transform(); | 220 ->transform(); |
| 222 const auto* layerTransform = m_layer.layoutObject() | 221 const auto* layerTransform = m_layer.layoutObject() |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 rectToMap.moveBy(-context.rootLayer->layoutObject()->paintOffset()); | 275 rectToMap.moveBy(-context.rootLayer->layoutObject()->paintOffset()); |
| 277 } | 276 } |
| 278 | 277 |
| 279 void PaintLayerClipper::calculateRectsWithGeometryMapper( | 278 void PaintLayerClipper::calculateRectsWithGeometryMapper( |
| 280 const ClipRectsContext& context, | 279 const ClipRectsContext& context, |
| 281 const LayoutRect& paintDirtyRect, | 280 const LayoutRect& paintDirtyRect, |
| 282 LayoutRect& layerBounds, | 281 LayoutRect& layerBounds, |
| 283 ClipRect& backgroundRect, | 282 ClipRect& backgroundRect, |
| 284 ClipRect& foregroundRect, | 283 ClipRect& foregroundRect, |
| 285 const LayoutPoint* offsetFromRoot) const { | 284 const LayoutPoint* offsetFromRoot) const { |
| 286 backgroundRect = applyOverflowClipToBackgroundRectWithGeometryMapper( | 285 backgroundRect = clipRectWithGeometryMapper(context, false); |
| 287 context, clipRectWithGeometryMapper(context, false)); | 286 applyOverflowClipToBackgroundRectWithGeometryMapper(context, backgroundRect); |
| 287 |
| 288 backgroundRect.move( | 288 backgroundRect.move( |
| 289 context.subPixelAccumulation); // TODO(chrishtr): is this needed? | 289 context.subPixelAccumulation); // TODO(chrishtr): is this needed? |
| 290 backgroundRect.intersect(paintDirtyRect); | 290 backgroundRect.intersect(paintDirtyRect); |
| 291 | 291 |
| 292 foregroundRect.move( | 292 foregroundRect.move( |
| 293 context.subPixelAccumulation); // TODO(chrishtr): is this needed? | 293 context.subPixelAccumulation); // TODO(chrishtr): is this needed? |
| 294 foregroundRect = clipRectWithGeometryMapper(context, true); | 294 foregroundRect = clipRectWithGeometryMapper(context, true); |
| 295 foregroundRect.intersect(paintDirtyRect); | 295 foregroundRect.intersect(paintDirtyRect); |
| 296 LayoutPoint offset; | 296 LayoutPoint offset; |
| 297 if (offsetFromRoot) | 297 if (offsetFromRoot) |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 if (context.respectOverflowClip == IgnoreOverflowClip && | 459 if (context.respectOverflowClip == IgnoreOverflowClip && |
| 460 ancestorProperties->overflowClip()) | 460 ancestorProperties->overflowClip()) |
| 461 destinationPropertyTreeState.setClip(ancestorProperties->overflowClip()); | 461 destinationPropertyTreeState.setClip(ancestorProperties->overflowClip()); |
| 462 | 462 |
| 463 // Set the overflow clip for |propertyTreeState| so that it differs from | 463 // Set the overflow clip for |propertyTreeState| so that it differs from |
| 464 // destinationPropertyTreeState| in its clip. | 464 // destinationPropertyTreeState| in its clip. |
| 465 if (isForeground && properties->overflowClip()) | 465 if (isForeground && properties->overflowClip()) |
| 466 propertyTreeState.setClip(properties->overflowClip()); | 466 propertyTreeState.setClip(properties->overflowClip()); |
| 467 } | 467 } |
| 468 | 468 |
| 469 FloatRect clippedRectInRootLayerSpace = | 469 FloatClipRect clippedRectInRootLayerSpace = |
| 470 m_geometryMapper->sourceToDestinationVisualRect( | 470 m_geometryMapper->sourceToDestinationVisualRect( |
| 471 FloatRect(source), propertyTreeState, destinationPropertyTreeState); | 471 FloatRect(source), propertyTreeState, destinationPropertyTreeState); |
| 472 clippedRectInRootLayerSpace.moveBy( | 472 ClipRect clipRect(LayoutRect(clippedRectInRootLayerSpace.rect())); |
| 473 -FloatPoint(context.rootLayer->layoutObject()->paintOffset())); | 473 if (clippedRectInRootLayerSpace.hasRadius()) |
| 474 return ClipRect(LayoutRect(clippedRectInRootLayerSpace)); | 474 clipRect.setHasRadius(true); |
| 475 |
| 476 clipRect.moveBy(-context.rootLayer->layoutObject()->paintOffset()); |
| 477 return clipRect; |
| 475 } | 478 } |
| 476 | 479 |
| 477 ClipRect PaintLayerClipper::applyOverflowClipToBackgroundRectWithGeometryMapper( | 480 void PaintLayerClipper::applyOverflowClipToBackgroundRectWithGeometryMapper( |
| 478 const ClipRectsContext& context, | 481 const ClipRectsContext& context, |
| 479 const ClipRect& clip) const { | 482 ClipRect& clip) const { |
| 480 const LayoutObject& layoutObject = *m_layer.layoutObject(); | 483 const LayoutObject& layoutObject = *m_layer.layoutObject(); |
| 481 FloatRect clipRect(clip.rect()); | 484 if (!shouldClipOverflow(context)) |
| 482 if (shouldClipOverflow(context)) { | 485 return; |
| 483 LayoutRect layerBoundsWithVisualOverflow = | 486 LayoutRect layerBoundsWithVisualOverflow = |
| 484 layoutObject.isLayoutView() | 487 layoutObject.isLayoutView() |
| 485 ? toLayoutView(layoutObject).viewRect() | 488 ? toLayoutView(layoutObject).viewRect() |
| 486 : toLayoutBox(layoutObject).visualOverflowRect(); | 489 : toLayoutBox(layoutObject).visualOverflowRect(); |
| 487 toLayoutBox(layoutObject) | 490 toLayoutBox(layoutObject) |
| 488 .flipForWritingMode( | 491 .flipForWritingMode( |
| 489 // PaintLayer are in physical coordinates, so the overflow has to be | 492 // PaintLayer are in physical coordinates, so the overflow has to be |
| 490 // flipped. | 493 // flipped. |
| 491 layerBoundsWithVisualOverflow); | 494 layerBoundsWithVisualOverflow); |
| 492 mapLocalToRootWithGeometryMapper(context, layerBoundsWithVisualOverflow); | 495 mapLocalToRootWithGeometryMapper(context, layerBoundsWithVisualOverflow); |
| 493 clipRect.intersect(FloatRect(layerBoundsWithVisualOverflow)); | 496 clip.intersect(layerBoundsWithVisualOverflow); |
| 494 } | |
| 495 | |
| 496 return ClipRect(LayoutRect(clipRect)); | |
| 497 } | 497 } |
| 498 | 498 |
| 499 ClipRect PaintLayerClipper::backgroundClipRect( | 499 ClipRect PaintLayerClipper::backgroundClipRect( |
| 500 const ClipRectsContext& context) const { | 500 const ClipRectsContext& context) const { |
| 501 if (m_geometryMapper) { | 501 if (m_geometryMapper) { |
| 502 ClipRect backgroundClipRect = clipRectWithGeometryMapper(context, false); | 502 ClipRect backgroundClipRect = clipRectWithGeometryMapper(context, false); |
| 503 #ifdef CHECK_CLIP_RECTS | 503 #ifdef CHECK_CLIP_RECTS |
| 504 ClipRect testBackgroundClipRect = | 504 ClipRect testBackgroundClipRect = |
| 505 PaintLayerClipper(m_layer, false).backgroundClipRect(context); | 505 PaintLayerClipper(m_layer, false).backgroundClipRect(context); |
| 506 CHECK_RECTS_EQ(testBackgroundClipRect, backgroundClipRect); | 506 CHECK_RECTS_EQ(testBackgroundClipRect, backgroundClipRect); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 const LayoutSize& subpixelAccumulation) const { | 572 const LayoutSize& subpixelAccumulation) const { |
| 573 DCHECK(!m_geometryMapper); | 573 DCHECK(!m_geometryMapper); |
| 574 ClipRectsContext context(rootLayer, PaintingClipRects, | 574 ClipRectsContext context(rootLayer, PaintingClipRects, |
| 575 IgnoreOverlayScrollbarSize, subpixelAccumulation); | 575 IgnoreOverlayScrollbarSize, subpixelAccumulation); |
| 576 if (respectOverflowClip == IgnoreOverflowClip) | 576 if (respectOverflowClip == IgnoreOverflowClip) |
| 577 context.setIgnoreOverflowClip(); | 577 context.setIgnoreOverflowClip(); |
| 578 return getClipRects(context); | 578 return getClipRects(context); |
| 579 } | 579 } |
| 580 | 580 |
| 581 } // namespace blink | 581 } // namespace blink |
| OLD | NEW |