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

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: 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 m_backgroundLayer->setPosition(FloatPoint()); 780 m_backgroundLayer->setPosition(FloatPoint());
775 if (backgroundSize != m_backgroundLayer->size()) { 781 if (backgroundSize != m_backgroundLayer->size()) {
776 m_backgroundLayer->setSize(backgroundSize); 782 m_backgroundLayer->setSize(backgroundSize);
777 m_backgroundLayer->setNeedsDisplay(); 783 m_backgroundLayer->setNeedsDisplay();
778 } 784 }
779 m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRend erer()); 785 m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRend erer());
780 } 786 }
781 787
782 if (m_owningLayer->reflectionInfo() && m_owningLayer->reflectionInfo()->refl ectionLayer()->hasCompositedLayerMapping()) { 788 if (m_owningLayer->reflectionInfo() && m_owningLayer->reflectionInfo()->refl ectionLayer()->hasCompositedLayerMapping()) {
783 CompositedLayerMappingPtr reflectionCompositedLayerMapping = m_owningLay er->reflectionInfo()->reflectionLayer()->compositedLayerMapping(); 789 CompositedLayerMappingPtr reflectionCompositedLayerMapping = m_owningLay er->reflectionInfo()->reflectionLayer()->compositedLayerMapping();
784 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(); 790 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(GraphicsLa yerUpdater::ForceUpdate);
785 791
786 // The reflection layer has the bounds of m_owningLayer->reflectionLayer (), 792 // The reflection layer has the bounds of m_owningLayer->reflectionLayer (),
787 // but the reflected layer is the bounds of this layer, so we need to po sition it appropriately. 793 // but the reflected layer is the bounds of this layer, so we need to po sition it appropriately.
788 FloatRect layerBounds = compositedBounds(); 794 FloatRect layerBounds = compositedBounds();
789 FloatRect reflectionLayerBounds = reflectionCompositedLayerMapping->comp ositedBounds(); 795 FloatRect reflectionLayerBounds = reflectionCompositedLayerMapping->comp ositedBounds();
790 reflectionCompositedLayerMapping->mainGraphicsLayer()->setReplicatedLaye rPosition(FloatPoint(layerBounds.location() - reflectionLayerBounds.location())) ; 796 reflectionCompositedLayerMapping->mainGraphicsLayer()->setReplicatedLaye rPosition(FloatPoint(layerBounds.location() - reflectionLayerBounds.location())) ;
791 } 797 }
792 798
793 if (m_scrollingLayer) { 799 if (m_scrollingLayer) {
794 ASSERT(m_scrollingContentsLayer); 800 ASSERT(m_scrollingContentsLayer);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 updateBackgroundColor(); 859 updateBackgroundColor();
854 updateDrawsContent(); 860 updateDrawsContent();
855 updateContentsOpaque(); 861 updateContentsOpaque();
856 updateAfterWidgetResize(); 862 updateAfterWidgetResize();
857 updateRenderingContext(); 863 updateRenderingContext();
858 updateShouldFlattenTransform(); 864 updateShouldFlattenTransform();
859 updateChildrenTransform(); 865 updateChildrenTransform();
860 registerScrollingLayers(); 866 registerScrollingLayers();
861 867
862 updateCompositingReasons(); 868 updateCompositingReasons();
869
870 return updateType;
863 } 871 }
864 872
865 void CompositedLayerMapping::registerScrollingLayers() 873 void CompositedLayerMapping::registerScrollingLayers()
866 { 874 {
867 // Register fixed position layers and their containers with the scrolling co ordinator. 875 // Register fixed position layers and their containers with the scrolling co ordinator.
868 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m _owningLayer); 876 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m _owningLayer);
869 if (!scrollingCoordinator) 877 if (!scrollingCoordinator)
870 return; 878 return;
871 879
872 compositor()->updateViewportConstraintStatus(m_owningLayer); 880 compositor()->updateViewportConstraintStatus(m_owningLayer);
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 void CompositedLayerMapping::setBlendMode(blink::WebBlendMode blendMode) 1793 void CompositedLayerMapping::setBlendMode(blink::WebBlendMode blendMode)
1786 { 1794 {
1787 if (m_ancestorClippingLayer) { 1795 if (m_ancestorClippingLayer) {
1788 m_ancestorClippingLayer->setBlendMode(blendMode); 1796 m_ancestorClippingLayer->setBlendMode(blendMode);
1789 m_graphicsLayer->setBlendMode(blink::WebBlendModeNormal); 1797 m_graphicsLayer->setBlendMode(blink::WebBlendModeNormal);
1790 } else { 1798 } else {
1791 m_graphicsLayer->setBlendMode(blendMode); 1799 m_graphicsLayer->setBlendMode(blendMode);
1792 } 1800 }
1793 } 1801 }
1794 1802
1803 void CompositedLayerMapping::setNeedsGeometryUpdate()
1804 {
1805 m_needToUpdateGeometryOfAllDecendants = true;
1806
1807 for (RenderLayer* current = m_owningLayer; current; current = current->ances torCompositingLayer()) {
1808 ASSERT(current->hasCompositedLayerMapping());
1809 CompositedLayerMappingPtr mapping = current->compositedLayerMapping();
1810 mapping->m_needToUpdateGeometry = true;
1811 }
1812 }
1813
1814 void CompositedLayerMapping::willUpdateGeometryOfAllDecendants()
1815 {
1816 ASSERT(!m_needToUpdateGeometry);
1817 m_needToUpdateGeometryOfAllDecendants = false;
1818 }
1819
1795 struct SetContentsNeedsDisplayFunctor { 1820 struct SetContentsNeedsDisplayFunctor {
1796 void operator() (GraphicsLayer* layer) const 1821 void operator() (GraphicsLayer* layer) const
1797 { 1822 {
1798 if (layer->drawsContent()) 1823 if (layer->drawsContent())
1799 layer->setNeedsDisplay(); 1824 layer->setNeedsDisplay();
1800 } 1825 }
1801 }; 1826 };
1802 1827
1803 void CompositedLayerMapping::setContentsNeedDisplay() 1828 void CompositedLayerMapping::setContentsNeedDisplay()
1804 { 1829 {
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
2100 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2125 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2101 name = "Scrolling Contents Layer"; 2126 name = "Scrolling Contents Layer";
2102 } else { 2127 } else {
2103 ASSERT_NOT_REACHED(); 2128 ASSERT_NOT_REACHED();
2104 } 2129 }
2105 2130
2106 return name; 2131 return name;
2107 } 2132 }
2108 2133
2109 } // namespace WebCore 2134 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698