| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 ClipRectsContext context(clippingRootLayer, PaintingClipRects); | 207 ClipRectsContext context(clippingRootLayer, PaintingClipRects); |
| 208 if (m_geometryMapper) { | 208 if (m_geometryMapper) { |
| 209 ClipRect clipRect = applyOverflowClipToBackgroundRectWithGeometryMapper( | 209 ClipRect clipRect = applyOverflowClipToBackgroundRectWithGeometryMapper( |
| 210 context, clipRectWithGeometryMapper(context, false)); | 210 context, clipRectWithGeometryMapper(context, false)); |
| 211 | 211 |
| 212 // The rect now needs to be transformed to the local space of this | 212 // The rect now needs to be transformed to the local space of this |
| 213 // PaintLayer. | 213 // PaintLayer. |
| 214 bool success = false; | 214 bool success = false; |
| 215 FloatRect clippedRectInLocalSpace = | 215 FloatRect clippedRectInLocalSpace = |
| 216 m_geometryMapper->mapRectToDestinationSpace( | 216 m_geometryMapper->mapRectToDestinationSpace( |
| 217 FloatRect(clipRect.rect()), clippingRootLayer->layoutObject() | 217 FloatRect(clipRect.rect()), *clippingRootLayer->layoutObject() |
| 218 ->paintProperties() | 218 ->paintProperties() |
| 219 ->localBorderBoxProperties() | 219 ->localBorderBoxProperties(), |
| 220 ->propertyTreeState, | 220 *m_layer.layoutObject() |
| 221 m_layer.layoutObject() | 221 ->paintProperties() |
| 222 ->paintProperties() | 222 ->localBorderBoxProperties(), |
| 223 ->localBorderBoxProperties() | |
| 224 ->propertyTreeState, | |
| 225 success); | 223 success); |
| 226 DCHECK(success); | 224 DCHECK(success); |
| 227 | 225 |
| 228 return LayoutRect(clippedRectInLocalSpace); | 226 return LayoutRect(clippedRectInLocalSpace); |
| 229 } | 227 } |
| 230 | 228 |
| 231 LayoutRect layerBounds; | 229 LayoutRect layerBounds; |
| 232 ClipRect backgroundRect, foregroundRect; | 230 ClipRect backgroundRect, foregroundRect; |
| 233 calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()), | 231 calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()), |
| 234 layerBounds, backgroundRect, foregroundRect); | 232 layerBounds, backgroundRect, foregroundRect); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 250 CHECK((expected.isEmpty() && actual.isEmpty()) || expected == actual) \ | 248 CHECK((expected.isEmpty() && actual.isEmpty()) || expected == actual) \ |
| 251 << "expected=" << expected.toString() << " actual=" << actual.toString() | 249 << "expected=" << expected.toString() << " actual=" << actual.toString() |
| 252 #endif | 250 #endif |
| 253 | 251 |
| 254 void PaintLayerClipper::mapLocalToRootWithGeometryMapper( | 252 void PaintLayerClipper::mapLocalToRootWithGeometryMapper( |
| 255 const ClipRectsContext& context, | 253 const ClipRectsContext& context, |
| 256 LayoutRect& layoutRect) const { | 254 LayoutRect& layoutRect) const { |
| 257 DCHECK(m_geometryMapper); | 255 DCHECK(m_geometryMapper); |
| 258 bool success; | 256 bool success; |
| 259 | 257 |
| 260 const ObjectPaintProperties::PropertyTreeStateWithOffset* | 258 const auto* layerBorderBoxProperties = |
| 261 layerBorderBoxProperties = | 259 m_layer.layoutObject()->paintProperties()->localBorderBoxProperties(); |
| 262 m_layer.layoutObject()->paintProperties()->localBorderBoxProperties(); | |
| 263 FloatRect localRect(layoutRect); | 260 FloatRect localRect(layoutRect); |
| 264 localRect.moveBy(FloatPoint(layerBorderBoxProperties->paintOffset)); | 261 localRect.moveBy(FloatPoint(m_layer.layoutObject()->paintOffset())); |
| 265 | 262 |
| 266 layoutRect = LayoutRect(m_geometryMapper->mapRectToDestinationSpace( | 263 layoutRect = LayoutRect(m_geometryMapper->mapRectToDestinationSpace( |
| 267 localRect, layerBorderBoxProperties->propertyTreeState, | 264 localRect, *layerBorderBoxProperties, *context.rootLayer->layoutObject() |
| 268 context.rootLayer->layoutObject() | 265 ->paintProperties() |
| 269 ->paintProperties() | 266 ->localBorderBoxProperties(), |
| 270 ->localBorderBoxProperties() | |
| 271 ->propertyTreeState, | |
| 272 success)); | 267 success)); |
| 273 DCHECK(success); | 268 DCHECK(success); |
| 274 } | 269 } |
| 275 | 270 |
| 276 void PaintLayerClipper::calculateRectsWithGeometryMapper( | 271 void PaintLayerClipper::calculateRectsWithGeometryMapper( |
| 277 const ClipRectsContext& context, | 272 const ClipRectsContext& context, |
| 278 const LayoutRect& paintDirtyRect, | 273 const LayoutRect& paintDirtyRect, |
| 279 LayoutRect& layerBounds, | 274 LayoutRect& layerBounds, |
| 280 ClipRect& backgroundRect, | 275 ClipRect& backgroundRect, |
| 281 ClipRect& foregroundRect, | 276 ClipRect& foregroundRect, |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 } | 426 } |
| 432 | 427 |
| 433 ClipRect PaintLayerClipper::clipRectWithGeometryMapper( | 428 ClipRect PaintLayerClipper::clipRectWithGeometryMapper( |
| 434 const ClipRectsContext& context, | 429 const ClipRectsContext& context, |
| 435 bool isForeground) const { | 430 bool isForeground) const { |
| 436 DCHECK(m_geometryMapper); | 431 DCHECK(m_geometryMapper); |
| 437 LayoutRect source(LayoutRect::infiniteIntRect()); | 432 LayoutRect source(LayoutRect::infiniteIntRect()); |
| 438 bool success = false; | 433 bool success = false; |
| 439 const auto* properties = m_layer.layoutObject()->paintProperties(); | 434 const auto* properties = m_layer.layoutObject()->paintProperties(); |
| 440 DCHECK(properties && properties->localBorderBoxProperties()); | 435 DCHECK(properties && properties->localBorderBoxProperties()); |
| 441 PropertyTreeState propertyTreeState = | 436 PropertyTreeState propertyTreeState = *properties->localBorderBoxProperties(); |
| 442 properties->localBorderBoxProperties()->propertyTreeState; | |
| 443 | 437 |
| 444 if (isForeground && shouldClipOverflow(context) && properties->overflowClip()) | 438 if (isForeground && shouldClipOverflow(context) && properties->overflowClip()) |
| 445 propertyTreeState.setClip(properties->overflowClip()); | 439 propertyTreeState.setClip(properties->overflowClip()); |
| 446 | 440 |
| 447 const auto* ancestorProperties = | 441 const auto* ancestorProperties = |
| 448 context.rootLayer->layoutObject()->paintProperties(); | 442 context.rootLayer->layoutObject()->paintProperties(); |
| 449 DCHECK(ancestorProperties && ancestorProperties->localBorderBoxProperties()); | 443 DCHECK(ancestorProperties && ancestorProperties->localBorderBoxProperties()); |
| 450 PropertyTreeState destinationPropertyTreeState = | 444 PropertyTreeState destinationPropertyTreeState = |
| 451 ancestorProperties->localBorderBoxProperties()->propertyTreeState; | 445 *ancestorProperties->localBorderBoxProperties(); |
| 452 if (!context.rootLayer->clipper().shouldRespectOverflowClip(context)) { | 446 if (!context.rootLayer->clipper().shouldRespectOverflowClip(context)) { |
| 453 if (ancestorProperties->overflowClip()) | 447 if (ancestorProperties->overflowClip()) |
| 454 destinationPropertyTreeState.setClip(ancestorProperties->overflowClip()); | 448 destinationPropertyTreeState.setClip(ancestorProperties->overflowClip()); |
| 455 } | 449 } |
| 456 FloatRect clippedRectInRootLayerSpace = | 450 FloatRect clippedRectInRootLayerSpace = |
| 457 m_geometryMapper->mapToVisualRectInDestinationSpace( | 451 m_geometryMapper->mapToVisualRectInDestinationSpace( |
| 458 FloatRect(source), propertyTreeState, destinationPropertyTreeState, | 452 FloatRect(source), propertyTreeState, destinationPropertyTreeState, |
| 459 success); | 453 success); |
| 460 DCHECK(success); | 454 DCHECK(success); |
| 461 return ClipRect(LayoutRect(clippedRectInRootLayerSpace)); | 455 return ClipRect(LayoutRect(clippedRectInRootLayerSpace)); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 const LayoutSize& subpixelAccumulation) const { | 548 const LayoutSize& subpixelAccumulation) const { |
| 555 DCHECK(!m_geometryMapper); | 549 DCHECK(!m_geometryMapper); |
| 556 ClipRectsContext context(rootLayer, PaintingClipRects, | 550 ClipRectsContext context(rootLayer, PaintingClipRects, |
| 557 IgnoreOverlayScrollbarSize, subpixelAccumulation); | 551 IgnoreOverlayScrollbarSize, subpixelAccumulation); |
| 558 if (respectOverflowClip == IgnoreOverflowClip) | 552 if (respectOverflowClip == IgnoreOverflowClip) |
| 559 context.setIgnoreOverflowClip(); | 553 context.setIgnoreOverflowClip(); |
| 560 return getClipRects(context); | 554 return getClipRects(context); |
| 561 } | 555 } |
| 562 | 556 |
| 563 } // namespace blink | 557 } // namespace blink |
| OLD | NEW |