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

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

Issue 180953009: Revert 168554 "Reduce compositing update in Silk's toggle_drawer..." (Closed) Base URL: svn://svn.chromium.org/blink/
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(GraphicsLayerUpdater::ForceUpdate); 424 updateGraphicsLayerGeometry();
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 GraphicsLayerUpdater::UpdateType CompositedLayerMapping::updateGraphicsLayerGeom etry(GraphicsLayerUpdater::UpdateType updateType) 620 void CompositedLayerMapping::updateGraphicsLayerGeometry()
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 updateType; 624 return;
625
626 if (!m_needToUpdateGeometry && updateType != GraphicsLayerUpdater::ForceUpda te)
627 return updateType;
628 m_needToUpdateGeometry = false;
629 if (m_needToUpdateGeometryOfAllDecendants)
630 updateType = GraphicsLayerUpdater::ForceUpdate;
631 625
632 // Set transform property, if it is not animating. We have to do this here b ecause the transform 626 // Set transform property, if it is not animating. We have to do this here b ecause the transform
633 // is affected by the layer dimensions. 627 // is affected by the layer dimensions.
634 if (!hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyWebkitTransform )) 628 if (!hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyWebkitTransform ))
635 updateTransform(renderer()->style()); 629 updateTransform(renderer()->style());
636 630
637 // Set opacity, if it is not animating. 631 // Set opacity, if it is not animating.
638 if (!hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyOpacity)) 632 if (!hasActiveAnimationsOnCompositor(*renderer(), CSSPropertyOpacity))
639 updateOpacity(renderer()->style()); 633 updateOpacity(renderer()->style());
640 634
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 m_backgroundLayer->setPosition(FloatPoint()); 776 m_backgroundLayer->setPosition(FloatPoint());
783 if (backgroundSize != m_backgroundLayer->size()) { 777 if (backgroundSize != m_backgroundLayer->size()) {
784 m_backgroundLayer->setSize(backgroundSize); 778 m_backgroundLayer->setSize(backgroundSize);
785 m_backgroundLayer->setNeedsDisplay(); 779 m_backgroundLayer->setNeedsDisplay();
786 } 780 }
787 m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRend erer()); 781 m_backgroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRend erer());
788 } 782 }
789 783
790 if (m_owningLayer->reflectionInfo() && m_owningLayer->reflectionInfo()->refl ectionLayer()->hasCompositedLayerMapping()) { 784 if (m_owningLayer->reflectionInfo() && m_owningLayer->reflectionInfo()->refl ectionLayer()->hasCompositedLayerMapping()) {
791 CompositedLayerMappingPtr reflectionCompositedLayerMapping = m_owningLay er->reflectionInfo()->reflectionLayer()->compositedLayerMapping(); 785 CompositedLayerMappingPtr reflectionCompositedLayerMapping = m_owningLay er->reflectionInfo()->reflectionLayer()->compositedLayerMapping();
792 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(GraphicsLa yerUpdater::ForceUpdate); 786 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry();
793 787
794 // The reflection layer has the bounds of m_owningLayer->reflectionLayer (), 788 // The reflection layer has the bounds of m_owningLayer->reflectionLayer (),
795 // but the reflected layer is the bounds of this layer, so we need to po sition it appropriately. 789 // but the reflected layer is the bounds of this layer, so we need to po sition it appropriately.
796 FloatRect layerBounds = compositedBounds(); 790 FloatRect layerBounds = compositedBounds();
797 FloatRect reflectionLayerBounds = reflectionCompositedLayerMapping->comp ositedBounds(); 791 FloatRect reflectionLayerBounds = reflectionCompositedLayerMapping->comp ositedBounds();
798 reflectionCompositedLayerMapping->mainGraphicsLayer()->setReplicatedLaye rPosition(FloatPoint(layerBounds.location() - reflectionLayerBounds.location())) ; 792 reflectionCompositedLayerMapping->mainGraphicsLayer()->setReplicatedLaye rPosition(FloatPoint(layerBounds.location() - reflectionLayerBounds.location())) ;
799 } 793 }
800 794
801 if (m_scrollingLayer) { 795 if (m_scrollingLayer) {
802 ASSERT(m_scrollingContentsLayer); 796 ASSERT(m_scrollingContentsLayer);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 updateBackgroundColor(isSimpleContainer); 855 updateBackgroundColor(isSimpleContainer);
862 updateDrawsContent(isSimpleContainer); 856 updateDrawsContent(isSimpleContainer);
863 updateContentsOpaque(); 857 updateContentsOpaque();
864 updateAfterWidgetResize(); 858 updateAfterWidgetResize();
865 updateRenderingContext(); 859 updateRenderingContext();
866 updateShouldFlattenTransform(); 860 updateShouldFlattenTransform();
867 updateChildrenTransform(); 861 updateChildrenTransform();
868 registerScrollingLayers(); 862 registerScrollingLayers();
869 863
870 updateCompositingReasons(); 864 updateCompositingReasons();
871
872 return updateType;
873 } 865 }
874 866
875 void CompositedLayerMapping::registerScrollingLayers() 867 void CompositedLayerMapping::registerScrollingLayers()
876 { 868 {
877 // Register fixed position layers and their containers with the scrolling co ordinator. 869 // Register fixed position layers and their containers with the scrolling co ordinator.
878 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m _owningLayer); 870 ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m _owningLayer);
879 if (!scrollingCoordinator) 871 if (!scrollingCoordinator)
880 return; 872 return;
881 873
882 compositor()->updateViewportConstraintStatus(m_owningLayer); 874 compositor()->updateViewportConstraintStatus(m_owningLayer);
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
1850 void CompositedLayerMapping::setBlendMode(blink::WebBlendMode blendMode) 1842 void CompositedLayerMapping::setBlendMode(blink::WebBlendMode blendMode)
1851 { 1843 {
1852 if (m_ancestorClippingLayer) { 1844 if (m_ancestorClippingLayer) {
1853 m_ancestorClippingLayer->setBlendMode(blendMode); 1845 m_ancestorClippingLayer->setBlendMode(blendMode);
1854 m_graphicsLayer->setBlendMode(blink::WebBlendModeNormal); 1846 m_graphicsLayer->setBlendMode(blink::WebBlendModeNormal);
1855 } else { 1847 } else {
1856 m_graphicsLayer->setBlendMode(blendMode); 1848 m_graphicsLayer->setBlendMode(blendMode);
1857 } 1849 }
1858 } 1850 }
1859 1851
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
1882 struct SetContentsNeedsDisplayFunctor { 1852 struct SetContentsNeedsDisplayFunctor {
1883 void operator() (GraphicsLayer* layer) const 1853 void operator() (GraphicsLayer* layer) const
1884 { 1854 {
1885 if (layer->drawsContent()) 1855 if (layer->drawsContent())
1886 layer->setNeedsDisplay(); 1856 layer->setNeedsDisplay();
1887 } 1857 }
1888 }; 1858 };
1889 1859
1890 void CompositedLayerMapping::setContentsNeedDisplay() 1860 void CompositedLayerMapping::setContentsNeedDisplay()
1891 { 1861 {
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
2187 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { 2157 } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
2188 name = "Scrolling Contents Layer"; 2158 name = "Scrolling Contents Layer";
2189 } else { 2159 } else {
2190 ASSERT_NOT_REACHED(); 2160 ASSERT_NOT_REACHED();
2191 } 2161 }
2192 2162
2193 return name; 2163 return name;
2194 } 2164 }
2195 2165
2196 } // namespace WebCore 2166 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698