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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 | 547 |
548 // Move the bounds by the subpixel accumulation so that it pixel-snaps relat
ive to absolute pixels instead of local coordinates. | 548 // Move the bounds by the subpixel accumulation so that it pixel-snaps relat
ive to absolute pixels instead of local coordinates. |
549 localRawCompositingBounds.move(subpixelAccumulation); | 549 localRawCompositingBounds.move(subpixelAccumulation); |
550 localBounds = pixelSnappedIntRect(localRawCompositingBounds); | 550 localBounds = pixelSnappedIntRect(localRawCompositingBounds); |
551 | 551 |
552 compositingBoundsRelativeToCompositedAncestor = localBounds; | 552 compositingBoundsRelativeToCompositedAncestor = localBounds; |
553 compositingBoundsRelativeToCompositedAncestor.moveBy(snappedOffsetFromCompos
itedAncestor); | 553 compositingBoundsRelativeToCompositedAncestor.moveBy(snappedOffsetFromCompos
itedAncestor); |
554 } | 554 } |
555 | 555 |
556 void CompositedLayerMapping::updateSquashingLayerGeometry(const LayoutPoint& off
setFromCompositedAncestor, const IntPoint& graphicsLayerParentLocation, const Re
nderLayer& referenceLayer, | 556 void CompositedLayerMapping::updateSquashingLayerGeometry(const LayoutPoint& off
setFromCompositedAncestor, const IntPoint& graphicsLayerParentLocation, const Re
nderLayer& referenceLayer, |
557 Vector<GraphicsLayerPaintInfo>& layers, GraphicsLayer* squashingLayer, Layou
tPoint* offsetFromTransformedAncestor, Vector<RenderLayer*>& layersNeedingPaintI
nvalidation) | 557 Vector<GraphicsLayerPaintInfo>& layers, GraphicsLayer* squashingLayer, Layou
tPoint* offsetFromTransformedAncestor, LayersNeedingPaintInvalidation& layersNee
dingPaintInvalidation) |
558 { | 558 { |
559 if (!squashingLayer) | 559 if (!squashingLayer) |
560 return; | 560 return; |
561 ASSERT(compositor()->layerSquashingEnabled()); | 561 ASSERT(compositor()->layerSquashingEnabled()); |
562 | 562 |
563 LayoutPoint offsetFromReferenceLayerToParentGraphicsLayer(offsetFromComposit
edAncestor); | 563 LayoutPoint offsetFromReferenceLayerToParentGraphicsLayer(offsetFromComposit
edAncestor); |
564 offsetFromReferenceLayerToParentGraphicsLayer.moveBy(-graphicsLayerParentLoc
ation); | 564 offsetFromReferenceLayerToParentGraphicsLayer.moveBy(-graphicsLayerParentLoc
ation); |
565 | 565 |
566 // FIXME: Cache these offsets. | 566 // FIXME: Cache these offsets. |
567 LayoutPoint referenceOffsetFromTransformedAncestor = referenceLayer.computeO
ffsetFromTransformedAncestor(); | 567 LayoutPoint referenceOffsetFromTransformedAncestor = referenceLayer.computeO
ffsetFromTransformedAncestor(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 // offset to be. | 601 // offset to be. |
602 for (size_t i = 0; i < layers.size(); ++i) { | 602 for (size_t i = 0; i < layers.size(); ++i) { |
603 LayoutPoint offsetFromTransformedAncestorForSquashedLayer = layers[i].re
nderLayer->computeOffsetFromTransformedAncestor(); | 603 LayoutPoint offsetFromTransformedAncestorForSquashedLayer = layers[i].re
nderLayer->computeOffsetFromTransformedAncestor(); |
604 LayoutSize offsetFromSquashLayerOrigin = (offsetFromTransformedAncestorF
orSquashedLayer - referenceOffsetFromTransformedAncestor) - squashLayerOriginInO
wningLayerSpace; | 604 LayoutSize offsetFromSquashLayerOrigin = (offsetFromTransformedAncestorF
orSquashedLayer - referenceOffsetFromTransformedAncestor) - squashLayerOriginInO
wningLayerSpace; |
605 | 605 |
606 // It is ok to issue paint invalidation here, because all of the geometr
y needed to correctly invalidate paint is computed by this point. | 606 // It is ok to issue paint invalidation here, because all of the geometr
y needed to correctly invalidate paint is computed by this point. |
607 IntSize newOffsetFromRenderer = -IntSize(offsetFromSquashLayerOrigin.wid
th().round(), offsetFromSquashLayerOrigin.height().round()); | 607 IntSize newOffsetFromRenderer = -IntSize(offsetFromSquashLayerOrigin.wid
th().round(), offsetFromSquashLayerOrigin.height().round()); |
608 LayoutSize subpixelAccumulation = offsetFromSquashLayerOrigin + newOffse
tFromRenderer; | 608 LayoutSize subpixelAccumulation = offsetFromSquashLayerOrigin + newOffse
tFromRenderer; |
609 if (layers[i].offsetFromRendererSet && layers[i].offsetFromRenderer != n
ewOffsetFromRenderer) { | 609 if (layers[i].offsetFromRendererSet && layers[i].offsetFromRenderer != n
ewOffsetFromRenderer) { |
610 layers[i].renderLayer->paintInvalidator().paintInvalidationIncluding
NonCompositingDescendants(); | 610 layers[i].renderLayer->paintInvalidator().paintInvalidationIncluding
NonCompositingDescendants(); |
611 layersNeedingPaintInvalidation.append(layers[i].renderLayer); | 611 |
| 612 layersNeedingPaintInvalidation.append(std::make_pair(layers[i].rende
rLayer, InspectorLayerInvalidationTrackingEvent::SquashingLayerGeometryWasUpdate
d)); |
612 } | 613 } |
613 layers[i].offsetFromRenderer = newOffsetFromRenderer; | 614 layers[i].offsetFromRenderer = newOffsetFromRenderer; |
614 layers[i].offsetFromRendererSet = true; | 615 layers[i].offsetFromRendererSet = true; |
615 | 616 |
616 layers[i].renderLayer->setSubpixelAccumulation(subpixelAccumulation); | 617 layers[i].renderLayer->setSubpixelAccumulation(subpixelAccumulation); |
617 } | 618 } |
618 | 619 |
619 squashingLayer->setPosition(squashLayerBounds.location()); | 620 squashingLayer->setPosition(squashLayerBounds.location()); |
620 squashingLayer->setSize(squashLayerBounds.size()); | 621 squashingLayer->setSize(squashLayerBounds.size()); |
621 | 622 |
622 *offsetFromTransformedAncestor = referenceOffsetFromTransformedAncestor; | 623 *offsetFromTransformedAncestor = referenceOffsetFromTransformedAncestor; |
623 offsetFromTransformedAncestor->move(squashLayerOriginInOwningLayerSpace); | 624 offsetFromTransformedAncestor->move(squashLayerOriginInOwningLayerSpace); |
624 | 625 |
625 for (size_t i = 0; i < layers.size(); ++i) | 626 for (size_t i = 0; i < layers.size(); ++i) |
626 layers[i].localClipRectForSquashedLayer = localClipRectForSquashedLayer(
referenceLayer, layers[i], layers); | 627 layers[i].localClipRectForSquashedLayer = localClipRectForSquashedLayer(
referenceLayer, layers[i], layers); |
627 } | 628 } |
628 | 629 |
629 void CompositedLayerMapping::updateGraphicsLayerGeometry(const RenderLayer* comp
ositingContainer, const RenderLayer* compositingStackingContext, Vector<RenderLa
yer*>& layersNeedingPaintInvalidation) | 630 void CompositedLayerMapping::updateGraphicsLayerGeometry(const RenderLayer* comp
ositingContainer, const RenderLayer* compositingStackingContext, LayersNeedingPa
intInvalidation& layersNeedingPaintInvalidation) |
630 { | 631 { |
631 ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle:
:InCompositingUpdate); | 632 ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle:
:InCompositingUpdate); |
632 | 633 |
633 // Set transform property, if it is not animating. We have to do this here b
ecause the transform | 634 // Set transform property, if it is not animating. We have to do this here b
ecause the transform |
634 // is affected by the layer dimensions. | 635 // is affected by the layer dimensions. |
635 if (!renderer()->style()->isRunningTransformAnimationOnCompositor()) | 636 if (!renderer()->style()->isRunningTransformAnimationOnCompositor()) |
636 updateTransform(renderer()->style()); | 637 updateTransform(renderer()->style()); |
637 | 638 |
638 // Set opacity, if it is not animating. | 639 // Set opacity, if it is not animating. |
639 if (!renderer()->style()->isRunningOpacityAnimationOnCompositor()) | 640 if (!renderer()->style()->isRunningOpacityAnimationOnCompositor()) |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin); | 858 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin); |
858 } else { | 859 } else { |
859 FloatPoint3D compositedTransformOrigin( | 860 FloatPoint3D compositedTransformOrigin( |
860 relativeCompositingBounds.width() * 0.5f, | 861 relativeCompositingBounds.width() * 0.5f, |
861 relativeCompositingBounds.height() * 0.5f, | 862 relativeCompositingBounds.height() * 0.5f, |
862 0.f); | 863 0.f); |
863 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin); | 864 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin); |
864 } | 865 } |
865 } | 866 } |
866 | 867 |
867 void CompositedLayerMapping::updateReflectionLayerGeometry(Vector<RenderLayer*>&
layersNeedingPaintInvalidation) | 868 void CompositedLayerMapping::updateReflectionLayerGeometry(LayersNeedingPaintInv
alidation& layersNeedingPaintInvalidation) |
868 { | 869 { |
869 if (!m_owningLayer.reflectionInfo() || !m_owningLayer.reflectionInfo()->refl
ectionLayer()->hasCompositedLayerMapping()) | 870 if (!m_owningLayer.reflectionInfo() || !m_owningLayer.reflectionInfo()->refl
ectionLayer()->hasCompositedLayerMapping()) |
870 return; | 871 return; |
871 | 872 |
872 CompositedLayerMapping* reflectionCompositedLayerMapping = m_owningLayer.ref
lectionInfo()->reflectionLayer()->compositedLayerMapping(); | 873 CompositedLayerMapping* reflectionCompositedLayerMapping = m_owningLayer.ref
lectionInfo()->reflectionLayer()->compositedLayerMapping(); |
873 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(&m_owningLayer
, &m_owningLayer, layersNeedingPaintInvalidation); | 874 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(&m_owningLayer
, &m_owningLayer, layersNeedingPaintInvalidation); |
874 } | 875 } |
875 | 876 |
876 void CompositedLayerMapping::updateScrollingLayerGeometry(const IntRect& localCo
mpositingBounds) | 877 void CompositedLayerMapping::updateScrollingLayerGeometry(const IntRect& localCo
mpositingBounds) |
877 { | 878 { |
(...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2351 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { | 2352 } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) { |
2352 name = "Scrolling Block Selection Layer"; | 2353 name = "Scrolling Block Selection Layer"; |
2353 } else { | 2354 } else { |
2354 ASSERT_NOT_REACHED(); | 2355 ASSERT_NOT_REACHED(); |
2355 } | 2356 } |
2356 | 2357 |
2357 return name; | 2358 return name; |
2358 } | 2359 } |
2359 | 2360 |
2360 } // namespace blink | 2361 } // namespace blink |
OLD | NEW |