Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: Source/core/rendering/compositing/CompositedLayerMapping.cpp

Issue 183763016: Reduce compositing update in Silk's toggle_drawer by 20% (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix win build Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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);
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
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
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
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
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()) {
1865 // FIXME: We should be able to return early from this function once we
1866 // find a CompositedLayerMapping that has m_needToUpdateGeometry set.
1867 // However, we can't do that until we remove the incremental compositing
1868 // updates because they can clear m_needToUpdateGeometry without walking
1869 // the whole tree.
1870 ASSERT(current->hasCompositedLayerMapping());
1871 CompositedLayerMappingPtr mapping = current->compositedLayerMapping();
1872 mapping->m_needToUpdateGeometry = true;
1873 }
1874 }
1875
1876 void CompositedLayerMapping::clearNeedsGeometryUpdate()
1877 {
1878 m_needToUpdateGeometry = false;
1879 m_needToUpdateGeometryOfAllDecendants = false;
1880 }
1881
1852 struct SetContentsNeedsDisplayFunctor { 1882 struct SetContentsNeedsDisplayFunctor {
1853 void operator() (GraphicsLayer* layer) const 1883 void operator() (GraphicsLayer* layer) const
1854 { 1884 {
1855 if (layer->drawsContent()) 1885 if (layer->drawsContent())
1856 layer->setNeedsDisplay(); 1886 layer->setNeedsDisplay();
1857 } 1887 }
1858 }; 1888 };
1859 1889
1860 void CompositedLayerMapping::setContentsNeedDisplay() 1890 void CompositedLayerMapping::setContentsNeedDisplay()
1861 { 1891 {
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
2157 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2187 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2158 name = "Scrolling Contents Layer"; 2188 name = "Scrolling Contents Layer";
2159 } else { 2189 } else {
2160 ASSERT_NOT_REACHED(); 2190 ASSERT_NOT_REACHED();
2161 } 2191 }
2162 2192
2163 return name; 2193 return name;
2164 } 2194 }
2165 2195
2166 } // namespace WebCore 2196 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/compositing/CompositedLayerMapping.h ('k') | Source/core/rendering/compositing/GraphicsLayerUpdater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698