| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 LayoutRect PaintLayerClipper::localClipRect( | 209 LayoutRect PaintLayerClipper::localClipRect( |
| 210 const PaintLayer* clippingRootLayer) const { | 210 const PaintLayer* clippingRootLayer) const { |
| 211 ClipRectsContext context(clippingRootLayer, PaintingClipRects); | 211 ClipRectsContext context(clippingRootLayer, PaintingClipRects); |
| 212 if (m_geometryMapper) { | 212 if (m_geometryMapper) { |
| 213 ClipRect clipRect = applyOverflowClipToBackgroundRectWithGeometryMapper( | 213 ClipRect clipRect = applyOverflowClipToBackgroundRectWithGeometryMapper( |
| 214 context, clipRectWithGeometryMapper(context, false)); | 214 context, clipRectWithGeometryMapper(context, false)); |
| 215 | 215 |
| 216 // The rect now needs to be transformed to the local space of this | 216 // The rect now needs to be transformed to the local space of this |
| 217 // PaintLayer. | 217 // PaintLayer. |
| 218 bool success = false; | 218 bool success = false; |
| 219 const auto* clipRootLayerTransform = clippingRootLayer->layoutObject() |
| 220 ->paintProperties() |
| 221 ->localBorderBoxProperties() |
| 222 ->transform(); |
| 223 const auto* layerTransform = m_layer.layoutObject() |
| 224 ->paintProperties() |
| 225 ->localBorderBoxProperties() |
| 226 ->transform(); |
| 219 FloatRect clippedRectInLocalSpace = | 227 FloatRect clippedRectInLocalSpace = |
| 220 m_geometryMapper->mapRectToDestinationSpace( | 228 m_geometryMapper->sourceToDestinationRect(FloatRect(clipRect.rect()), |
| 221 FloatRect(clipRect.rect()), *clippingRootLayer->layoutObject() | 229 clipRootLayerTransform, |
| 222 ->paintProperties() | 230 layerTransform, success); |
| 223 ->localBorderBoxProperties(), | |
| 224 *m_layer.layoutObject() | |
| 225 ->paintProperties() | |
| 226 ->localBorderBoxProperties(), | |
| 227 success); | |
| 228 DCHECK(success); | 231 DCHECK(success); |
| 229 | 232 |
| 230 return LayoutRect(clippedRectInLocalSpace); | 233 return LayoutRect(clippedRectInLocalSpace); |
| 231 } | 234 } |
| 232 | 235 |
| 233 LayoutRect layerBounds; | 236 LayoutRect layerBounds; |
| 234 ClipRect backgroundRect, foregroundRect; | 237 ClipRect backgroundRect, foregroundRect; |
| 235 calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()), | 238 calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()), |
| 236 layerBounds, backgroundRect, foregroundRect); | 239 layerBounds, backgroundRect, foregroundRect); |
| 237 | 240 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 252 CHECK((expected.isEmpty() && actual.isEmpty()) || expected == actual) \ | 255 CHECK((expected.isEmpty() && actual.isEmpty()) || expected == actual) \ |
| 253 << "expected=" << expected.toString() << " actual=" << actual.toString() | 256 << "expected=" << expected.toString() << " actual=" << actual.toString() |
| 254 #endif | 257 #endif |
| 255 | 258 |
| 256 void PaintLayerClipper::mapLocalToRootWithGeometryMapper( | 259 void PaintLayerClipper::mapLocalToRootWithGeometryMapper( |
| 257 const ClipRectsContext& context, | 260 const ClipRectsContext& context, |
| 258 LayoutRect& layoutRect) const { | 261 LayoutRect& layoutRect) const { |
| 259 DCHECK(m_geometryMapper); | 262 DCHECK(m_geometryMapper); |
| 260 bool success; | 263 bool success; |
| 261 | 264 |
| 262 const auto* layerBorderBoxProperties = | 265 const auto* layerTransform = m_layer.layoutObject() |
| 263 m_layer.layoutObject()->paintProperties()->localBorderBoxProperties(); | 266 ->paintProperties() |
| 267 ->localBorderBoxProperties() |
| 268 ->transform(); |
| 269 const auto* rootTransform = context.rootLayer->layoutObject() |
| 270 ->paintProperties() |
| 271 ->localBorderBoxProperties() |
| 272 ->transform(); |
| 273 |
| 264 FloatRect localRect(layoutRect); | 274 FloatRect localRect(layoutRect); |
| 265 localRect.moveBy(FloatPoint(m_layer.layoutObject()->paintOffset())); | 275 localRect.moveBy(FloatPoint(m_layer.layoutObject()->paintOffset())); |
| 266 | 276 layoutRect = LayoutRect(m_geometryMapper->sourceToDestinationRect( |
| 267 layoutRect = LayoutRect(m_geometryMapper->mapRectToDestinationSpace( | 277 localRect, layerTransform, rootTransform, success)); |
| 268 localRect, *layerBorderBoxProperties, *context.rootLayer->layoutObject() | |
| 269 ->paintProperties() | |
| 270 ->localBorderBoxProperties(), | |
| 271 success)); | |
| 272 DCHECK(success); | 278 DCHECK(success); |
| 273 } | 279 } |
| 274 | 280 |
| 275 void PaintLayerClipper::calculateRectsWithGeometryMapper( | 281 void PaintLayerClipper::calculateRectsWithGeometryMapper( |
| 276 const ClipRectsContext& context, | 282 const ClipRectsContext& context, |
| 277 const LayoutRect& paintDirtyRect, | 283 const LayoutRect& paintDirtyRect, |
| 278 LayoutRect& layerBounds, | 284 LayoutRect& layerBounds, |
| 279 ClipRect& backgroundRect, | 285 ClipRect& backgroundRect, |
| 280 ClipRect& foregroundRect, | 286 ClipRect& foregroundRect, |
| 281 const LayoutPoint* offsetFromRoot) const { | 287 const LayoutPoint* offsetFromRoot) const { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 const auto* ancestorProperties = | 451 const auto* ancestorProperties = |
| 446 context.rootLayer->layoutObject()->paintProperties(); | 452 context.rootLayer->layoutObject()->paintProperties(); |
| 447 DCHECK(ancestorProperties && ancestorProperties->localBorderBoxProperties()); | 453 DCHECK(ancestorProperties && ancestorProperties->localBorderBoxProperties()); |
| 448 PropertyTreeState destinationPropertyTreeState = | 454 PropertyTreeState destinationPropertyTreeState = |
| 449 *ancestorProperties->localBorderBoxProperties(); | 455 *ancestorProperties->localBorderBoxProperties(); |
| 450 if (!context.rootLayer->clipper().shouldRespectOverflowClip(context)) { | 456 if (!context.rootLayer->clipper().shouldRespectOverflowClip(context)) { |
| 451 if (ancestorProperties->overflowClip()) | 457 if (ancestorProperties->overflowClip()) |
| 452 destinationPropertyTreeState.setClip(ancestorProperties->overflowClip()); | 458 destinationPropertyTreeState.setClip(ancestorProperties->overflowClip()); |
| 453 } | 459 } |
| 454 FloatRect clippedRectInRootLayerSpace = | 460 FloatRect clippedRectInRootLayerSpace = |
| 455 m_geometryMapper->mapToVisualRectInDestinationSpace( | 461 m_geometryMapper->sourceToDestinationVisualRect( |
| 456 FloatRect(source), propertyTreeState, destinationPropertyTreeState, | 462 FloatRect(source), propertyTreeState, destinationPropertyTreeState, |
| 457 success); | 463 success); |
| 458 DCHECK(success); | 464 DCHECK(success); |
| 459 return ClipRect(LayoutRect(clippedRectInRootLayerSpace)); | 465 return ClipRect(LayoutRect(clippedRectInRootLayerSpace)); |
| 460 } | 466 } |
| 461 | 467 |
| 462 ClipRect PaintLayerClipper::applyOverflowClipToBackgroundRectWithGeometryMapper( | 468 ClipRect PaintLayerClipper::applyOverflowClipToBackgroundRectWithGeometryMapper( |
| 463 const ClipRectsContext& context, | 469 const ClipRectsContext& context, |
| 464 const ClipRect& clip) const { | 470 const ClipRect& clip) const { |
| 465 const LayoutObject& layoutObject = *m_layer.layoutObject(); | 471 const LayoutObject& layoutObject = *m_layer.layoutObject(); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 const LayoutSize& subpixelAccumulation) const { | 558 const LayoutSize& subpixelAccumulation) const { |
| 553 DCHECK(!m_geometryMapper); | 559 DCHECK(!m_geometryMapper); |
| 554 ClipRectsContext context(rootLayer, PaintingClipRects, | 560 ClipRectsContext context(rootLayer, PaintingClipRects, |
| 555 IgnoreOverlayScrollbarSize, subpixelAccumulation); | 561 IgnoreOverlayScrollbarSize, subpixelAccumulation); |
| 556 if (respectOverflowClip == IgnoreOverflowClip) | 562 if (respectOverflowClip == IgnoreOverflowClip) |
| 557 context.setIgnoreOverflowClip(); | 563 context.setIgnoreOverflowClip(); |
| 558 return getClipRects(context); | 564 return getClipRects(context); |
| 559 } | 565 } |
| 560 | 566 |
| 561 } // namespace blink | 567 } // namespace blink |
| OLD | NEW |