| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 5 * | 5 * |
| 6 * Other contributors: | 6 * Other contributors: |
| 7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
| 9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
| 10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 | 485 |
| 486 void PaintLayer::clearPaginationRecursive() | 486 void PaintLayer::clearPaginationRecursive() |
| 487 { | 487 { |
| 488 m_enclosingPaginationLayer = 0; | 488 m_enclosingPaginationLayer = 0; |
| 489 for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) | 489 for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) |
| 490 child->clearPaginationRecursive(); | 490 child->clearPaginationRecursive(); |
| 491 } | 491 } |
| 492 | 492 |
| 493 LayoutPoint PaintLayer::positionFromPaintInvalidationBacking(const LayoutObject*
layoutObject, const LayoutBoxModelObject* paintInvalidationContainer, const Pai
ntInvalidationState* paintInvalidationState) | 493 LayoutPoint PaintLayer::positionFromPaintInvalidationBacking(const LayoutObject*
layoutObject, const LayoutBoxModelObject* paintInvalidationContainer, const Pai
ntInvalidationState* paintInvalidationState) |
| 494 { | 494 { |
| 495 FloatPoint point = layoutObject->localToContainerPoint(FloatPoint(), paintIn
validationContainer, 0, 0, paintInvalidationState); | 495 FloatPoint point = layoutObject->localToAncestorPoint(FloatPoint(), paintInv
alidationContainer, 0, 0, paintInvalidationState); |
| 496 | 496 |
| 497 // FIXME: Eventually we are going to unify coordinates in GraphicsLayer spac
e. | 497 // FIXME: Eventually we are going to unify coordinates in GraphicsLayer spac
e. |
| 498 if (paintInvalidationContainer && paintInvalidationContainer->layer()->group
edMapping()) | 498 if (paintInvalidationContainer && paintInvalidationContainer->layer()->group
edMapping()) |
| 499 mapPointToPaintBackingCoordinates(paintInvalidationContainer, point); | 499 mapPointToPaintBackingCoordinates(paintInvalidationContainer, point); |
| 500 | 500 |
| 501 return LayoutPoint(point); | 501 return LayoutPoint(point); |
| 502 } | 502 } |
| 503 | 503 |
| 504 void PaintLayer::mapPointToPaintBackingCoordinates(const LayoutBoxModelObject* p
aintInvalidationContainer, FloatPoint& point) | 504 void PaintLayer::mapPointToPaintBackingCoordinates(const LayoutBoxModelObject* p
aintInvalidationContainer, FloatPoint& point) |
| 505 { | 505 { |
| 506 PaintLayer* paintInvalidationLayer = paintInvalidationContainer->layer(); | 506 PaintLayer* paintInvalidationLayer = paintInvalidationContainer->layer(); |
| 507 if (!paintInvalidationLayer->groupedMapping()) { | 507 if (!paintInvalidationLayer->groupedMapping()) { |
| 508 point.move(paintInvalidationLayer->compositedLayerMapping()->contentOffs
etInCompositingLayer()); | 508 point.move(paintInvalidationLayer->compositedLayerMapping()->contentOffs
etInCompositingLayer()); |
| 509 return; | 509 return; |
| 510 } | 510 } |
| 511 | 511 |
| 512 LayoutBoxModelObject* transformedAncestor = paintInvalidationLayer->enclosin
gTransformedAncestor()->layoutObject(); | 512 LayoutBoxModelObject* transformedAncestor = paintInvalidationLayer->enclosin
gTransformedAncestor()->layoutObject(); |
| 513 if (!transformedAncestor) | 513 if (!transformedAncestor) |
| 514 return; | 514 return; |
| 515 | 515 |
| 516 // |paintInvalidationContainer| may have a local 2D transform on it, so take
that into account when mapping into the space of the | 516 // |paintInvalidationContainer| may have a local 2D transform on it, so take
that into account when mapping into the space of the |
| 517 // transformed ancestor. | 517 // transformed ancestor. |
| 518 point = paintInvalidationContainer->localToContainerPoint(point, transformed
Ancestor); | 518 point = paintInvalidationContainer->localToAncestorPoint(point, transformedA
ncestor); |
| 519 | 519 |
| 520 point.moveBy(-paintInvalidationLayer->groupedMapping()->squashingOffsetFromT
ransformedAncestor()); | 520 point.moveBy(-paintInvalidationLayer->groupedMapping()->squashingOffsetFromT
ransformedAncestor()); |
| 521 } | 521 } |
| 522 | 522 |
| 523 void PaintLayer::mapRectToPaintBackingCoordinates(const LayoutBoxModelObject* pa
intInvalidationContainer, LayoutRect& rect) | 523 void PaintLayer::mapRectToPaintBackingCoordinates(const LayoutBoxModelObject* pa
intInvalidationContainer, LayoutRect& rect) |
| 524 { | 524 { |
| 525 PaintLayer* paintInvalidationLayer = paintInvalidationContainer->layer(); | 525 PaintLayer* paintInvalidationLayer = paintInvalidationContainer->layer(); |
| 526 if (!paintInvalidationLayer->groupedMapping()) { | 526 if (!paintInvalidationLayer->groupedMapping()) { |
| 527 rect.move(paintInvalidationLayer->compositedLayerMapping()->contentOffse
tInCompositingLayer()); | 527 rect.move(paintInvalidationLayer->compositedLayerMapping()->contentOffse
tInCompositingLayer()); |
| 528 return; | 528 return; |
| 529 } | 529 } |
| 530 | 530 |
| 531 LayoutBoxModelObject* transformedAncestor = paintInvalidationLayer->enclosin
gTransformedAncestor()->layoutObject(); | 531 LayoutBoxModelObject* transformedAncestor = paintInvalidationLayer->enclosin
gTransformedAncestor()->layoutObject(); |
| 532 if (!transformedAncestor) | 532 if (!transformedAncestor) |
| 533 return; | 533 return; |
| 534 | 534 |
| 535 // |paintInvalidationContainer| may have a local 2D transform on it, so take
that into account when mapping into the space of the | 535 // |paintInvalidationContainer| may have a local 2D transform on it, so take
that into account when mapping into the space of the |
| 536 // transformed ancestor. | 536 // transformed ancestor. |
| 537 rect = LayoutRect(paintInvalidationContainer->localToContainerQuad(FloatRect
(rect), transformedAncestor).boundingBox()); | 537 rect = LayoutRect(paintInvalidationContainer->localToAncestorQuad(FloatRect(
rect), transformedAncestor).boundingBox()); |
| 538 | 538 |
| 539 rect.moveBy(-paintInvalidationLayer->groupedMapping()->squashingOffsetFromTr
ansformedAncestor()); | 539 rect.moveBy(-paintInvalidationLayer->groupedMapping()->squashingOffsetFromTr
ansformedAncestor()); |
| 540 } | 540 } |
| 541 | 541 |
| 542 void PaintLayer::mapRectToPaintInvalidationBacking(const LayoutObject* layoutObj
ect, const LayoutBoxModelObject* paintInvalidationContainer, LayoutRect& rect, c
onst PaintInvalidationState* paintInvalidationState) | 542 void PaintLayer::mapRectToPaintInvalidationBacking(const LayoutObject* layoutObj
ect, const LayoutBoxModelObject* paintInvalidationContainer, LayoutRect& rect, c
onst PaintInvalidationState* paintInvalidationState) |
| 543 { | 543 { |
| 544 if (!paintInvalidationContainer->layer()->groupedMapping()) { | 544 if (!paintInvalidationContainer->layer()->groupedMapping()) { |
| 545 layoutObject->mapToVisibleRectInContainerSpace(paintInvalidationContaine
r, rect, paintInvalidationState); | 545 layoutObject->mapToVisibleRectInAncestorSpace(paintInvalidationContainer
, rect, paintInvalidationState); |
| 546 return; | 546 return; |
| 547 } | 547 } |
| 548 | 548 |
| 549 // This code adjusts the paint invalidation rectangle to be in the space of
the transformed ancestor of the grouped (i.e. squashed) | 549 // This code adjusts the paint invalidation rectangle to be in the space of
the transformed ancestor of the grouped (i.e. squashed) |
| 550 // layer. This is because all layers that squash together need to issue pain
t invalidations w.r.t. a single container that is | 550 // layer. This is because all layers that squash together need to issue pain
t invalidations w.r.t. a single container that is |
| 551 // an ancestor of all of them, in order to properly take into account any lo
cal transforms etc. | 551 // an ancestor of all of them, in order to properly take into account any lo
cal transforms etc. |
| 552 // FIXME: remove this special-case code that works around the paint invalida
tion code structure. | 552 // FIXME: remove this special-case code that works around the paint invalida
tion code structure. |
| 553 layoutObject->mapToVisibleRectInContainerSpace(paintInvalidationContainer, r
ect, paintInvalidationState); | 553 layoutObject->mapToVisibleRectInAncestorSpace(paintInvalidationContainer, re
ct, paintInvalidationState); |
| 554 | 554 |
| 555 mapRectToPaintBackingCoordinates(paintInvalidationContainer, rect); | 555 mapRectToPaintBackingCoordinates(paintInvalidationContainer, rect); |
| 556 } | 556 } |
| 557 | 557 |
| 558 LayoutRect PaintLayer::computePaintInvalidationRect(const LayoutObject& layoutOb
ject, const PaintLayer* paintInvalidationContainer, const PaintInvalidationState
* paintInvalidationState) | 558 LayoutRect PaintLayer::computePaintInvalidationRect(const LayoutObject& layoutOb
ject, const PaintLayer* paintInvalidationContainer, const PaintInvalidationState
* paintInvalidationState) |
| 559 { | 559 { |
| 560 if (!paintInvalidationContainer->groupedMapping()) | 560 if (!paintInvalidationContainer->groupedMapping()) |
| 561 return layoutObject.computePaintInvalidationRect(*paintInvalidationConta
iner->layoutObject(), paintInvalidationState); | 561 return layoutObject.computePaintInvalidationRect(*paintInvalidationConta
iner->layoutObject(), paintInvalidationState); |
| 562 | 562 |
| 563 LayoutRect rect = layoutObject.clippedOverflowRectForPaintInvalidation(paint
InvalidationContainer->layoutObject(), paintInvalidationState); | 563 LayoutRect rect = layoutObject.clippedOverflowRectForPaintInvalidation(paint
InvalidationContainer->layoutObject(), paintInvalidationState); |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 | 867 |
| 868 return curr; | 868 return curr; |
| 869 } | 869 } |
| 870 | 870 |
| 871 LayoutPoint PaintLayer::computeOffsetFromTransformedAncestor() const | 871 LayoutPoint PaintLayer::computeOffsetFromTransformedAncestor() const |
| 872 { | 872 { |
| 873 const AncestorDependentCompositingInputs& properties = ancestorDependentComp
ositingInputs(); | 873 const AncestorDependentCompositingInputs& properties = ancestorDependentComp
ositingInputs(); |
| 874 | 874 |
| 875 TransformState transformState(TransformState::ApplyTransformDirection, Float
Point()); | 875 TransformState transformState(TransformState::ApplyTransformDirection, Float
Point()); |
| 876 // FIXME: add a test that checks flipped writing mode and ApplyContainerFlip
are correct. | 876 // FIXME: add a test that checks flipped writing mode and ApplyContainerFlip
are correct. |
| 877 layoutObject()->mapLocalToContainer(properties.transformAncestor ? propertie
s.transformAncestor->layoutObject() : 0, transformState, ApplyContainerFlip); | 877 layoutObject()->mapLocalToAncestor(properties.transformAncestor ? properties
.transformAncestor->layoutObject() : 0, transformState, ApplyContainerFlip); |
| 878 transformState.flatten(); | 878 transformState.flatten(); |
| 879 return LayoutPoint(transformState.lastPlanarPoint()); | 879 return LayoutPoint(transformState.lastPlanarPoint()); |
| 880 } | 880 } |
| 881 | 881 |
| 882 PaintLayer* PaintLayer::compositingContainer() const | 882 PaintLayer* PaintLayer::compositingContainer() const |
| 883 { | 883 { |
| 884 if (!stackingNode()->isTreatedAsOrStackingContext()) | 884 if (!stackingNode()->isTreatedAsOrStackingContext()) |
| 885 return parent(); | 885 return parent(); |
| 886 if (PaintLayerStackingNode* ancestorStackingNode = stackingNode()->ancestorS
tackingContextNode()) | 886 if (PaintLayerStackingNode* ancestorStackingNode = stackingNode()->ancestorS
tackingContextNode()) |
| 887 return ancestorStackingNode->layer(); | 887 return ancestorStackingNode->layer(); |
| (...skipping 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2829 | 2829 |
| 2830 void showLayerTree(const blink::LayoutObject* layoutObject) | 2830 void showLayerTree(const blink::LayoutObject* layoutObject) |
| 2831 { | 2831 { |
| 2832 if (!layoutObject) { | 2832 if (!layoutObject) { |
| 2833 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); | 2833 fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n"); |
| 2834 return; | 2834 return; |
| 2835 } | 2835 } |
| 2836 showLayerTree(layoutObject->enclosingLayer()); | 2836 showLayerTree(layoutObject->enclosingLayer()); |
| 2837 } | 2837 } |
| 2838 #endif | 2838 #endif |
| OLD | NEW |