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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
414 // position of this layer's GraphicsLayer depends on the position of our compositing | 414 // position of this layer's GraphicsLayer depends on the position of our compositing |
415 // ancestor's GraphicsLayer. That cannot be determined until all the des cendant | 415 // ancestor's GraphicsLayer. That cannot be determined until all the des cendant |
416 // RenderLayers of that ancestor have been processed via updateLayerPosi tions(). | 416 // RenderLayers of that ancestor have been processed via updateLayerPosi tions(). |
417 // | 417 // |
418 // The solution is to update compositing children of this layer here, | 418 // The solution is to update compositing children of this layer here, |
419 // via updateCompositingChildrenGeometry(). | 419 // via updateCompositingChildrenGeometry(). |
420 updateCompositedBounds(); | 420 updateCompositedBounds(); |
421 layerCompositor->updateCompositingDescendantGeometry(m_owningLayer->stac kingNode(), m_owningLayer, flags & CompositingChildrenOnly); | 421 layerCompositor->updateCompositingDescendantGeometry(m_owningLayer->stac kingNode(), m_owningLayer, flags & CompositingChildrenOnly); |
422 | 422 |
423 if (flags & IsUpdateRoot) { | 423 if (flags & IsUpdateRoot) { |
424 updateGraphicsLayerGeometry(); | 424 updateGraphicsLayerGeometry(GraphicsLayerUpdater::ForceUpdate); |
ojan
2014/03/05 18:29:51
Should this have a FIXME to get rid of the ForceUp
abarth-chromium
2014/03/05 23:12:19
The idea is that this will go away once we fix the
| |
425 layerCompositor->updateRootLayerPosition(); | 425 layerCompositor->updateRootLayerPosition(); |
426 RenderLayerStackingNode* stackingContainer = m_owningLayer->stacking Node()->enclosingStackingContainerNode(); | 426 RenderLayerStackingNode* stackingContainer = m_owningLayer->stacking Node()->enclosingStackingContainerNode(); |
427 if (!layerCompositor->compositingLayersNeedRebuild() && stackingCont ainer && (stackingContainer != m_owningLayer->stackingNode())) | 427 if (!layerCompositor->compositingLayersNeedRebuild() && stackingCont ainer && (stackingContainer != m_owningLayer->stackingNode())) |
428 layerCompositor->updateCompositingDescendantGeometry(stackingCon tainer, stackingContainer->layer(), flags & CompositingChildrenOnly); | 428 layerCompositor->updateCompositingDescendantGeometry(stackingCon tainer, stackingContainer->layer(), flags & CompositingChildrenOnly); |
429 } | 429 } |
430 } | 430 } |
431 | 431 |
432 if (flags & NeedsFullRepaint && !paintsIntoCompositedAncestor()) | 432 if (flags & NeedsFullRepaint && !paintsIntoCompositedAncestor()) |
433 setContentsNeedDisplay(); | 433 setContentsNeedDisplay(); |
434 } | 434 } |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
610 for (size_t i = 0; i < m_squashedLayers.size(); ++i) { | 610 for (size_t i = 0; i < m_squashedLayers.size(); ++i) { |
611 m_squashedLayers[i].offsetFromRenderer = IntSize(-m_squashedLayers[i].of fsetFromSquashingCLM.width() + totalSquashBounds.x(), | 611 m_squashedLayers[i].offsetFromRenderer = IntSize(-m_squashedLayers[i].of fsetFromSquashingCLM.width() + totalSquashBounds.x(), |
612 -m_squashedLayers[i].offsetFromSquashingCLM.height() + totalSquashBo unds.y()); | 612 -m_squashedLayers[i].offsetFromSquashingCLM.height() + totalSquashBo unds.y()); |
613 | 613 |
614 // FIXME: find a better design to avoid this redundant value - most like ly it will make | 614 // FIXME: find a better design to avoid this redundant value - most like ly it will make |
615 // sense to move the paint task info into RenderLayer's m_compositingPro perties. | 615 // sense to move the paint task info into RenderLayer's m_compositingPro perties. |
616 m_squashedLayers[i].renderLayer->setOffsetFromSquashingLayerOrigin(m_squ ashedLayers[i].offsetFromRenderer); | 616 m_squashedLayers[i].renderLayer->setOffsetFromSquashingLayerOrigin(m_squ ashedLayers[i].offsetFromRenderer); |
617 } | 617 } |
618 } | 618 } |
619 | 619 |
620 void CompositedLayerMapping::updateGraphicsLayerGeometry() | 620 GraphicsLayerUpdater::UpdateType CompositedLayerMapping::updateGraphicsLayerGeom etry(GraphicsLayerUpdater::UpdateType updateType) |
621 { | 621 { |
622 // If we haven't built z-order lists yet, wait until later. | 622 // If we haven't built z-order lists yet, wait until later. |
623 if (m_owningLayer->stackingNode()->isStackingContainer() && m_owningLayer->s tackingNode()->zOrderListsDirty()) | 623 if (m_owningLayer->stackingNode()->isStackingContainer() && m_owningLayer->s tackingNode()->zOrderListsDirty()) |
624 return; | 624 return updateType; |
625 | |
626 if (!m_needToUpdateGeometry && updateType != GraphicsLayerUpdater::ForceUpda te) | |
627 return updateType; | |
628 m_needToUpdateGeometry = false; | |
629 if (m_needToUpdateGeometryOfAllDecendants) | |
630 updateType = GraphicsLayerUpdater::ForceUpdate; | |
625 | 631 |
626 // Set transform property, if it is not animating. We have to do this here b ecause the transform | 632 // Set transform property, if it is not animating. We have to do this here b ecause the transform |
627 // is affected by the layer dimensions. | 633 // is affected by the layer dimensions. |
628 if (!hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyWebkitTransform )) | 634 if (!hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyWebkitTransform )) |
629 updateTransform(renderer()->style()); | 635 updateTransform(renderer()->style()); |
630 | 636 |
631 // Set opacity, if it is not animating. | 637 // Set opacity, if it is not animating. |
632 if (!hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyOpacity)) | 638 if (!hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyOpacity)) |
633 updateOpacity(renderer()->style()); | 639 updateOpacity(renderer()->style()); |
634 | 640 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
776 m_backgroundLayer->setPosition(FloatPoint()); | 782 m_backgroundLayer->setPosition(FloatPoint()); |
777 if (backgroundSize != m_backgroundLayer->size()) { | 783 if (backgroundSize != m_backgroundLayer->size()) { |
778 m_backgroundLayer->setSize(backgroundSize); | 784 m_backgroundLayer->setSize(backgroundSize); |
779 m_backgroundLayer->setNeedsDisplay(); | 785 m_backgroundLayer->setNeedsDisplay(); |
780 } | 786 } |
781 m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRend erer()); | 787 m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRend erer()); |
782 } | 788 } |
783 | 789 |
784 if (m_owningLayer->reflectionInfo() && m_owningLayer->reflectionInfo()->refl ectionLayer()->hasCompositedLayerMapping()) { | 790 if (m_owningLayer->reflectionInfo() && m_owningLayer->reflectionInfo()->refl ectionLayer()->hasCompositedLayerMapping()) { |
785 CompositedLayerMappingPtr reflectionCompositedLayerMapping = m_owningLay er->reflectionInfo()->reflectionLayer()->compositedLayerMapping(); | 791 CompositedLayerMappingPtr reflectionCompositedLayerMapping = m_owningLay er->reflectionInfo()->reflectionLayer()->compositedLayerMapping(); |
786 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(); | 792 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(GraphicsLa yerUpdater::ForceUpdate); |
787 | 793 |
788 // The reflection layer has the bounds of m_owningLayer->reflectionLayer (), | 794 // The reflection layer has the bounds of m_owningLayer->reflectionLayer (), |
789 // but the reflected layer is the bounds of this layer, so we need to po sition it appropriately. | 795 // but the reflected layer is the bounds of this layer, so we need to po sition it appropriately. |
790 FloatRect layerBounds = compositedBounds(); | 796 FloatRect layerBounds = compositedBounds(); |
791 FloatRect reflectionLayerBounds = reflectionCompositedLayerMapping->comp ositedBounds(); | 797 FloatRect reflectionLayerBounds = reflectionCompositedLayerMapping->comp ositedBounds(); |
792 reflectionCompositedLayerMapping->mainGraphicsLayer()->setReplicatedLaye rPosition(FloatPoint(layerBounds.location() - reflectionLayerBounds.location())) ; | 798 reflectionCompositedLayerMapping->mainGraphicsLayer()->setReplicatedLaye rPosition(FloatPoint(layerBounds.location() - reflectionLayerBounds.location())) ; |
793 } | 799 } |
794 | 800 |
795 if (m_scrollingLayer) { | 801 if (m_scrollingLayer) { |
796 ASSERT(m_scrollingContentsLayer); | 802 ASSERT(m_scrollingContentsLayer); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
855 updateBackgroundColor(isSimpleContainer); | 861 updateBackgroundColor(isSimpleContainer); |
856 updateDrawsContent(isSimpleContainer); | 862 updateDrawsContent(isSimpleContainer); |
857 updateContentsOpaque(); | 863 updateContentsOpaque(); |
858 updateAfterWidgetResize(); | 864 updateAfterWidgetResize(); |
859 updateRenderingContext(); | 865 updateRenderingContext(); |
860 updateShouldFlattenTransform(); | 866 updateShouldFlattenTransform(); |
861 updateChildrenTransform(); | 867 updateChildrenTransform(); |
862 registerScrollingLayers(); | 868 registerScrollingLayers(); |
863 | 869 |
864 updateCompositingReasons(); | 870 updateCompositingReasons(); |
871 | |
872 return updateType; | |
865 } | 873 } |
866 | 874 |
867 void CompositedLayerMapping::registerScrollingLayers() | 875 void CompositedLayerMapping::registerScrollingLayers() |
868 { | 876 { |
869 // Register fixed position layers and their containers with the scrolling co ordinator. | 877 // Register fixed position layers and their containers with the scrolling co ordinator. |
870 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m _owningLayer); | 878 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m _owningLayer); |
871 if (!scrollingCoordinator) | 879 if (!scrollingCoordinator) |
872 return; | 880 return; |
873 | 881 |
874 compositor()->updateViewportConstraintStatus(m_owningLayer); | 882 compositor()->updateViewportConstraintStatus(m_owningLayer); |
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1842 void CompositedLayerMapping::setBlendMode(blink::WebBlendMode blendMode) | 1850 void CompositedLayerMapping::setBlendMode(blink::WebBlendMode blendMode) |
1843 { | 1851 { |
1844 if (m_ancestorClippingLayer) { | 1852 if (m_ancestorClippingLayer) { |
1845 m_ancestorClippingLayer->setBlendMode(blendMode); | 1853 m_ancestorClippingLayer->setBlendMode(blendMode); |
1846 m_graphicsLayer->setBlendMode(blink::WebBlendModeNormal); | 1854 m_graphicsLayer->setBlendMode(blink::WebBlendModeNormal); |
1847 } else { | 1855 } else { |
1848 m_graphicsLayer->setBlendMode(blendMode); | 1856 m_graphicsLayer->setBlendMode(blendMode); |
1849 } | 1857 } |
1850 } | 1858 } |
1851 | 1859 |
1860 void CompositedLayerMapping::setNeedsGeometryUpdate() | |
1861 { | |
1862 m_needToUpdateGeometryOfAllDecendants = true; | |
1863 | |
1864 for (RenderLayer* current = m_owningLayer; current; current = current->ances torCompositingLayer()) { | |
ojan
2014/03/05 18:57:00
This is n^2 if it doesn't early return if m_needTo
abarth-chromium
2014/03/05 23:12:19
Ok, I'll add a FIXME.
| |
1865 ASSERT(current->hasCompositedLayerMapping()); | |
1866 CompositedLayerMappingPtr mapping = current->compositedLayerMapping(); | |
1867 mapping->m_needToUpdateGeometry = true; | |
1868 } | |
1869 } | |
1870 | |
1871 void CompositedLayerMapping::willUpdateGeometryOfAllDecendants() | |
1872 { | |
1873 ASSERT(!m_needToUpdateGeometry); | |
1874 m_needToUpdateGeometryOfAllDecendants = false; | |
1875 } | |
1876 | |
1852 struct SetContentsNeedsDisplayFunctor { | 1877 struct SetContentsNeedsDisplayFunctor { |
1853 void operator() (GraphicsLayer* layer) const | 1878 void operator() (GraphicsLayer* layer) const |
1854 { | 1879 { |
1855 if (layer->drawsContent()) | 1880 if (layer->drawsContent()) |
1856 layer->setNeedsDisplay(); | 1881 layer->setNeedsDisplay(); |
1857 } | 1882 } |
1858 }; | 1883 }; |
1859 | 1884 |
1860 void CompositedLayerMapping::setContentsNeedDisplay() | 1885 void CompositedLayerMapping::setContentsNeedDisplay() |
1861 { | 1886 { |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2157 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2182 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
2158 name = "Scrolling Contents Layer"; | 2183 name = "Scrolling Contents Layer"; |
2159 } else { | 2184 } else { |
2160 ASSERT_NOT_REACHED(); | 2185 ASSERT_NOT_REACHED(); |
2161 } | 2186 } |
2162 | 2187 |
2163 return name; | 2188 return name; |
2164 } | 2189 } |
2165 | 2190 |
2166 } // namespace WebCore | 2191 } // namespace WebCore |
OLD | NEW |