| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 | 518 |
| 519 // Move the bounds by the subpixel accumulation so that it pixel-snaps relat
ive to absolute pixels instead of local coordinates. | 519 // Move the bounds by the subpixel accumulation so that it pixel-snaps relat
ive to absolute pixels instead of local coordinates. |
| 520 localRawCompositingBounds.move(subpixelAccumulation); | 520 localRawCompositingBounds.move(subpixelAccumulation); |
| 521 localBounds = pixelSnappedIntRect(localRawCompositingBounds); | 521 localBounds = pixelSnappedIntRect(localRawCompositingBounds); |
| 522 | 522 |
| 523 compositingBoundsRelativeToCompositedAncestor = localBounds; | 523 compositingBoundsRelativeToCompositedAncestor = localBounds; |
| 524 compositingBoundsRelativeToCompositedAncestor.moveBy(snappedOffsetFromCompos
itedAncestor); | 524 compositingBoundsRelativeToCompositedAncestor.moveBy(snappedOffsetFromCompos
itedAncestor); |
| 525 } | 525 } |
| 526 | 526 |
| 527 void CompositedLayerMapping::updateSquashingLayerGeometry(const LayoutPoint& off
setFromCompositedAncestor, const IntPoint& graphicsLayerParentLocation, const Re
nderLayer& referenceLayer, | 527 void CompositedLayerMapping::updateSquashingLayerGeometry(const LayoutPoint& off
setFromCompositedAncestor, const IntPoint& graphicsLayerParentLocation, const Re
nderLayer& referenceLayer, |
| 528 Vector<GraphicsLayerPaintInfo>& layers, GraphicsLayer* squashingLayer, Layou
tPoint* offsetFromTransformedAncestor) | 528 Vector<GraphicsLayerPaintInfo>& layers, GraphicsLayer* squashingLayer, Layou
tPoint* offsetFromTransformedAncestor, Vector<RenderLayer*>& layersNeedingPaintI
nvalidation) |
| 529 { | 529 { |
| 530 if (!squashingLayer) | 530 if (!squashingLayer) |
| 531 return; | 531 return; |
| 532 ASSERT(compositor()->layerSquashingEnabled()); | 532 ASSERT(compositor()->layerSquashingEnabled()); |
| 533 | 533 |
| 534 LayoutPoint offsetFromReferenceLayerToParentGraphicsLayer(offsetFromComposit
edAncestor); | 534 LayoutPoint offsetFromReferenceLayerToParentGraphicsLayer(offsetFromComposit
edAncestor); |
| 535 offsetFromReferenceLayerToParentGraphicsLayer.moveBy(-graphicsLayerParentLoc
ation); | 535 offsetFromReferenceLayerToParentGraphicsLayer.moveBy(-graphicsLayerParentLoc
ation); |
| 536 | 536 |
| 537 // FIXME: Cache these offsets. | 537 // FIXME: Cache these offsets. |
| 538 LayoutPoint referenceOffsetFromTransformedAncestor = referenceLayer.computeO
ffsetFromTransformedAncestor(); | 538 LayoutPoint referenceOffsetFromTransformedAncestor = referenceLayer.computeO
ffsetFromTransformedAncestor(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 553 | 553 |
| 554 // The totalSquashBounds is positioned with respect to referenceLayer of thi
s CompositedLayerMapping. | 554 // The totalSquashBounds is positioned with respect to referenceLayer of thi
s CompositedLayerMapping. |
| 555 // But the squashingLayer needs to be positioned with respect to the ancesto
r CompositedLayerMapping. | 555 // But the squashingLayer needs to be positioned with respect to the ancesto
r CompositedLayerMapping. |
| 556 // The conversion between referenceLayer and the ancestor CLM is already com
puted as | 556 // The conversion between referenceLayer and the ancestor CLM is already com
puted as |
| 557 // offsetFromReferenceLayerToParentGraphicsLayer. | 557 // offsetFromReferenceLayerToParentGraphicsLayer. |
| 558 totalSquashBounds.moveBy(offsetFromReferenceLayerToParentGraphicsLayer); | 558 totalSquashBounds.moveBy(offsetFromReferenceLayerToParentGraphicsLayer); |
| 559 IntRect squashLayerBounds = enclosingIntRect(totalSquashBounds); | 559 IntRect squashLayerBounds = enclosingIntRect(totalSquashBounds); |
| 560 IntPoint squashLayerOrigin = squashLayerBounds.location(); | 560 IntPoint squashLayerOrigin = squashLayerBounds.location(); |
| 561 LayoutSize squashLayerOriginInOwningLayerSpace = squashLayerOrigin - offsetF
romReferenceLayerToParentGraphicsLayer; | 561 LayoutSize squashLayerOriginInOwningLayerSpace = squashLayerOrigin - offsetF
romReferenceLayerToParentGraphicsLayer; |
| 562 | 562 |
| 563 squashingLayer->setPosition(squashLayerBounds.location()); | |
| 564 squashingLayer->setSize(squashLayerBounds.size()); | |
| 565 | |
| 566 *offsetFromTransformedAncestor = referenceOffsetFromTransformedAncestor; | |
| 567 offsetFromTransformedAncestor->move(squashLayerOriginInOwningLayerSpace); | |
| 568 | |
| 569 // Now that the squashing bounds are known, we can convert the RenderLayer p
ainting offsets | 563 // Now that the squashing bounds are known, we can convert the RenderLayer p
ainting offsets |
| 570 // from CLM owning layer space to the squashing layer space. | 564 // from CLM owning layer space to the squashing layer space. |
| 571 // | 565 // |
| 572 // The painting offset we want to compute for each squashed RenderLayer is e
ssentially the position of | 566 // The painting offset we want to compute for each squashed RenderLayer is e
ssentially the position of |
| 573 // the squashed RenderLayer described w.r.t. referenceLayer's origin. For th
is purpose we already cached | 567 // the squashed RenderLayer described w.r.t. referenceLayer's origin. For th
is purpose we already cached |
| 574 // offsetFromSquashingCLM before, which describes where the squashed RenderL
ayer is located w.r.t. | 568 // offsetFromSquashingCLM before, which describes where the squashed RenderL
ayer is located w.r.t. |
| 575 // referenceLayer. So we just need to convert that point from referenceLayer
space to referenceLayer | 569 // referenceLayer. So we just need to convert that point from referenceLayer
space to referenceLayer |
| 576 // space. This is simply done by subtracing squashLayerOriginInOwningLayerSp
ace, but then the offset | 570 // space. This is simply done by subtracing squashLayerOriginInOwningLayerSp
ace, but then the offset |
| 577 // overall needs to be negated because that's the direction that the paintin
g code expects the | 571 // overall needs to be negated because that's the direction that the paintin
g code expects the |
| 578 // offset to be. | 572 // offset to be. |
| 579 for (size_t i = 0; i < layers.size(); ++i) { | 573 for (size_t i = 0; i < layers.size(); ++i) { |
| 580 LayoutPoint offsetFromTransformedAncestorForSquashedLayer = layers[i].re
nderLayer->computeOffsetFromTransformedAncestor(); | 574 LayoutPoint offsetFromTransformedAncestorForSquashedLayer = layers[i].re
nderLayer->computeOffsetFromTransformedAncestor(); |
| 581 LayoutSize offsetFromSquashLayerOrigin = (offsetFromTransformedAncestorF
orSquashedLayer - referenceOffsetFromTransformedAncestor) - squashLayerOriginInO
wningLayerSpace; | 575 LayoutSize offsetFromSquashLayerOrigin = (offsetFromTransformedAncestorF
orSquashedLayer - referenceOffsetFromTransformedAncestor) - squashLayerOriginInO
wningLayerSpace; |
| 582 | 576 |
| 583 // It is ok to repaint here, because all of the geometry needed to corre
ctly repaint is computed by this point. | 577 // It is ok to repaint here, because all of the geometry needed to corre
ctly repaint is computed by this point. |
| 584 IntSize newOffsetFromRenderer = -IntSize(offsetFromSquashLayerOrigin.wid
th().round(), offsetFromSquashLayerOrigin.height().round()); | 578 IntSize newOffsetFromRenderer = -IntSize(offsetFromSquashLayerOrigin.wid
th().round(), offsetFromSquashLayerOrigin.height().round()); |
| 585 LayoutSize subpixelAccumulation = offsetFromSquashLayerOrigin + newOffse
tFromRenderer; | 579 LayoutSize subpixelAccumulation = offsetFromSquashLayerOrigin + newOffse
tFromRenderer; |
| 586 if (layers[i].offsetFromRendererSet && layers[i].offsetFromRenderer != n
ewOffsetFromRenderer) | 580 if (layers[i].offsetFromRendererSet && layers[i].offsetFromRenderer != n
ewOffsetFromRenderer) { |
| 587 layers[i].renderLayer->repainter().repaintIncludingNonCompositingDes
cendants(); | 581 layers[i].renderLayer->repainter().repaintIncludingNonCompositingDes
cendants(); |
| 582 layersNeedingPaintInvalidation.append(layers[i].renderLayer); |
| 583 } |
| 588 layers[i].offsetFromRenderer = newOffsetFromRenderer; | 584 layers[i].offsetFromRenderer = newOffsetFromRenderer; |
| 589 layers[i].offsetFromRendererSet = true; | 585 layers[i].offsetFromRendererSet = true; |
| 590 | 586 |
| 591 layers[i].renderLayer->setSubpixelAccumulation(subpixelAccumulation); | 587 layers[i].renderLayer->setSubpixelAccumulation(subpixelAccumulation); |
| 592 | 588 |
| 593 // FIXME: find a better design to avoid this redundant value - most like
ly it will make | 589 // FIXME: find a better design to avoid this redundant value - most like
ly it will make |
| 594 // sense to move the paint task info into RenderLayer's m_compositingPro
perties. | 590 // sense to move the paint task info into RenderLayer's m_compositingPro
perties. |
| 595 layers[i].renderLayer->setOffsetFromSquashingLayerOrigin(layers[i].offse
tFromRenderer); | 591 layers[i].renderLayer->setOffsetFromSquashingLayerOrigin(layers[i].offse
tFromRenderer); |
| 596 } | 592 } |
| 597 | 593 |
| 594 squashingLayer->setPosition(squashLayerBounds.location()); |
| 595 squashingLayer->setSize(squashLayerBounds.size()); |
| 596 |
| 597 *offsetFromTransformedAncestor = referenceOffsetFromTransformedAncestor; |
| 598 offsetFromTransformedAncestor->move(squashLayerOriginInOwningLayerSpace); |
| 599 |
| 598 for (size_t i = 0; i < layers.size(); ++i) | 600 for (size_t i = 0; i < layers.size(); ++i) |
| 599 layers[i].localClipRectForSquashedLayer = localClipRectForSquashedLayer(
referenceLayer, layers[i], layers); | 601 layers[i].localClipRectForSquashedLayer = localClipRectForSquashedLayer(
referenceLayer, layers[i], layers); |
| 600 } | 602 } |
| 601 | 603 |
| 602 void CompositedLayerMapping::updateGraphicsLayerGeometry(GraphicsLayerUpdater::U
pdateType updateType, const RenderLayer* compositingContainer) | 604 void CompositedLayerMapping::updateGraphicsLayerGeometry(GraphicsLayerUpdater::U
pdateType updateType, const RenderLayer* compositingContainer, Vector<RenderLaye
r*>& layersNeedingPaintInvalidation) |
| 603 { | 605 { |
| 604 if (!shouldUpdateGraphicsLayer(updateType)) | 606 if (!shouldUpdateGraphicsLayer(updateType)) |
| 605 return; | 607 return; |
| 606 | 608 |
| 607 // Set transform property, if it is not animating. We have to do this here b
ecause the transform | 609 // Set transform property, if it is not animating. We have to do this here b
ecause the transform |
| 608 // is affected by the layer dimensions. | 610 // is affected by the layer dimensions. |
| 609 if (!renderer()->style()->isRunningTransformAnimationOnCompositor()) | 611 if (!renderer()->style()->isRunningTransformAnimationOnCompositor()) |
| 610 updateTransform(renderer()->style()); | 612 updateTransform(renderer()->style()); |
| 611 | 613 |
| 612 // Set opacity, if it is not animating. | 614 // Set opacity, if it is not animating. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 630 | 632 |
| 631 IntPoint graphicsLayerParentLocation; | 633 IntPoint graphicsLayerParentLocation; |
| 632 computeGraphicsLayerParentLocation(compositingContainer, ancestorCompositing
Bounds, graphicsLayerParentLocation); | 634 computeGraphicsLayerParentLocation(compositingContainer, ancestorCompositing
Bounds, graphicsLayerParentLocation); |
| 633 | 635 |
| 634 // Might update graphicsLayerParentLocation. | 636 // Might update graphicsLayerParentLocation. |
| 635 updateAncestorClippingLayerGeometry(compositingContainer, snappedOffsetFromC
ompositedAncestor, graphicsLayerParentLocation); | 637 updateAncestorClippingLayerGeometry(compositingContainer, snappedOffsetFromC
ompositedAncestor, graphicsLayerParentLocation); |
| 636 | 638 |
| 637 FloatSize contentsSize = relativeCompositingBounds.size(); | 639 FloatSize contentsSize = relativeCompositingBounds.size(); |
| 638 | 640 |
| 639 updateMainGraphicsLayerGeometry(relativeCompositingBounds, localCompositingB
ounds, graphicsLayerParentLocation); | 641 updateMainGraphicsLayerGeometry(relativeCompositingBounds, localCompositingB
ounds, graphicsLayerParentLocation); |
| 640 updateSquashingLayerGeometry(offsetFromCompositedAncestor, graphicsLayerPare
ntLocation, m_owningLayer, m_squashedLayers, m_squashingLayer.get(), &m_squashin
gLayerOffsetFromTransformedAncestor); | 642 updateSquashingLayerGeometry(offsetFromCompositedAncestor, graphicsLayerPare
ntLocation, m_owningLayer, m_squashedLayers, m_squashingLayer.get(), &m_squashin
gLayerOffsetFromTransformedAncestor, layersNeedingPaintInvalidation); |
| 641 | 643 |
| 642 // If we have a layer that clips children, position it. | 644 // If we have a layer that clips children, position it. |
| 643 IntRect clippingBox; | 645 IntRect clippingBox; |
| 644 if (m_childContainmentLayer) | 646 if (m_childContainmentLayer) |
| 645 clippingBox = clipBox(toRenderBox(renderer())); | 647 clippingBox = clipBox(toRenderBox(renderer())); |
| 646 | 648 |
| 647 updateChildContainmentLayerGeometry(clippingBox, localCompositingBounds); | 649 updateChildContainmentLayerGeometry(clippingBox, localCompositingBounds); |
| 648 updateChildTransformLayerGeometry(); | 650 updateChildTransformLayerGeometry(); |
| 649 | 651 |
| 650 updateMaskLayerGeometry(); | 652 updateMaskLayerGeometry(); |
| 651 updateTransformGeometry(snappedOffsetFromCompositedAncestor, relativeComposi
tingBounds); | 653 updateTransformGeometry(snappedOffsetFromCompositedAncestor, relativeComposi
tingBounds); |
| 652 updateForegroundLayerGeometry(contentsSize, clippingBox); | 654 updateForegroundLayerGeometry(contentsSize, clippingBox); |
| 653 updateBackgroundLayerGeometry(contentsSize); | 655 updateBackgroundLayerGeometry(contentsSize); |
| 654 updateReflectionLayerGeometry(); | 656 updateReflectionLayerGeometry(layersNeedingPaintInvalidation); |
| 655 updateScrollingLayerGeometry(localCompositingBounds); | 657 updateScrollingLayerGeometry(localCompositingBounds); |
| 656 updateChildClippingMaskLayerGeometry(); | 658 updateChildClippingMaskLayerGeometry(); |
| 657 | 659 |
| 658 if (m_owningLayer.scrollableArea() && m_owningLayer.scrollableArea()->scroll
sOverflow()) | 660 if (m_owningLayer.scrollableArea() && m_owningLayer.scrollableArea()->scroll
sOverflow()) |
| 659 m_owningLayer.scrollableArea()->positionOverflowControls(IntSize()); | 661 m_owningLayer.scrollableArea()->positionOverflowControls(IntSize()); |
| 660 | 662 |
| 661 if (RuntimeEnabledFeatures::cssCompositingEnabled()) { | 663 if (RuntimeEnabledFeatures::cssCompositingEnabled()) { |
| 662 updateLayerBlendMode(renderer()->style()); | 664 updateLayerBlendMode(renderer()->style()); |
| 663 updateIsRootForIsolatedGroup(); | 665 updateIsRootForIsolatedGroup(); |
| 664 } | 666 } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin); | 806 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin); |
| 805 } else { | 807 } else { |
| 806 FloatPoint3D compositedTransformOrigin( | 808 FloatPoint3D compositedTransformOrigin( |
| 807 relativeCompositingBounds.width() * 0.5f, | 809 relativeCompositingBounds.width() * 0.5f, |
| 808 relativeCompositingBounds.height() * 0.5f, | 810 relativeCompositingBounds.height() * 0.5f, |
| 809 0.f); | 811 0.f); |
| 810 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin); | 812 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin); |
| 811 } | 813 } |
| 812 } | 814 } |
| 813 | 815 |
| 814 void CompositedLayerMapping::updateReflectionLayerGeometry() | 816 void CompositedLayerMapping::updateReflectionLayerGeometry(Vector<RenderLayer*>&
layersNeedingPaintInvalidation) |
| 815 { | 817 { |
| 816 if (!m_owningLayer.reflectionInfo() || !m_owningLayer.reflectionInfo()->refl
ectionLayer()->hasCompositedLayerMapping()) | 818 if (!m_owningLayer.reflectionInfo() || !m_owningLayer.reflectionInfo()->refl
ectionLayer()->hasCompositedLayerMapping()) |
| 817 return; | 819 return; |
| 818 | 820 |
| 819 CompositedLayerMappingPtr reflectionCompositedLayerMapping = m_owningLayer.r
eflectionInfo()->reflectionLayer()->compositedLayerMapping(); | 821 CompositedLayerMappingPtr reflectionCompositedLayerMapping = m_owningLayer.r
eflectionInfo()->reflectionLayer()->compositedLayerMapping(); |
| 820 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(GraphicsLayerU
pdater::ForceUpdate, &m_owningLayer); | 822 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(GraphicsLayerU
pdater::ForceUpdate, &m_owningLayer, layersNeedingPaintInvalidation); |
| 821 } | 823 } |
| 822 | 824 |
| 823 void CompositedLayerMapping::updateScrollingLayerGeometry(const IntRect& localCo
mpositingBounds) | 825 void CompositedLayerMapping::updateScrollingLayerGeometry(const IntRect& localCo
mpositingBounds) |
| 824 { | 826 { |
| 825 if (!m_scrollingLayer) | 827 if (!m_scrollingLayer) |
| 826 return; | 828 return; |
| 827 | 829 |
| 828 ASSERT(m_scrollingContentsLayer); | 830 ASSERT(m_scrollingContentsLayer); |
| 829 RenderBox* renderBox = toRenderBox(renderer()); | 831 RenderBox* renderBox = toRenderBox(renderer()); |
| 830 IntRect clientBox = enclosingIntRect(renderBox->clientBoxRect()); | 832 IntRect clientBox = enclosingIntRect(renderBox->clientBoxRect()); |
| (...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2265 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2267 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
| 2266 name = "Scrolling Block Selection Layer"; | 2268 name = "Scrolling Block Selection Layer"; |
| 2267 } else { | 2269 } else { |
| 2268 ASSERT_NOT_REACHED(); | 2270 ASSERT_NOT_REACHED(); |
| 2269 } | 2271 } |
| 2270 | 2272 |
| 2271 return name; | 2273 return name; |
| 2272 } | 2274 } |
| 2273 | 2275 |
| 2274 } // namespace WebCore | 2276 } // namespace WebCore |
| OLD | NEW |