Chromium Code Reviews| Index: cc/layer_tree_host.cc |
| diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc |
| index 862cccd5f084b45ee9bd25b4bb9da964a53a68ce..9a5968faec99b62c5f46f9c9bbd31c4a7ffb7c11 100644 |
| --- a/cc/layer_tree_host.cc |
| +++ b/cc/layer_tree_host.cc |
| @@ -28,6 +28,7 @@ |
| #include "cc/switches.h" |
| #include "cc/thread.h" |
| #include "cc/thread_proxy.h" |
| +#include "cc/top_controls_manager.h" |
| #include "cc/tree_synchronizer.h" |
| namespace { |
| @@ -335,6 +336,9 @@ void LayerTreeHost::finishCommitOnImplThread(LayerTreeHostImpl* hostImpl) |
| hostImpl->setPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFactor, m_maxPageScaleFactor); |
| hostImpl->setDebugState(m_debugState); |
| + if (m_settings.calculateTopControlsPosition && m_topControlsContentLayer && hostImpl->topControlsManager()) |
| + hostImpl->topControlsManager()->set_content_layer_id(m_topControlsContentLayer->id()); |
| + |
| m_commitNumber++; |
| } |
| @@ -473,6 +477,8 @@ void LayerTreeHost::setRootLayer(scoped_refptr<Layer> rootLayer) |
| if (m_hudLayer) |
| m_hudLayer->removeFromParent(); |
| + if (m_topControlsContentLayer) |
| + m_topControlsContentLayer->removeFromParent(); |
| setNeedsFullTreeSync(); |
| } |
| @@ -569,6 +575,21 @@ void LayerTreeHost::updateLayers(ResourceUpdateQueue& queue, size_t memoryAlloca |
| if (memoryAllocationLimitBytes) |
| m_contentsTextureManager->setMaxMemoryLimitBytes(memoryAllocationLimitBytes); |
| + if (m_settings.calculateTopControlsPosition) { |
| + if (!m_topControlsContentLayer) { |
| + m_topControlsContentLayer = Layer::create(); |
| + m_topControlsContentLayer->setIsDrawable(false); |
|
enne (OOO)
2013/01/12 00:15:00
Can you add a setDebugName("Top Controls Content")
Ted C
2013/01/12 01:23:05
Done.
|
| + } |
| + |
| + // Insert a layer that allows the top controls manager to move around |
| + // the content without clobbering/being clobbered by other transforms. |
| + if (!LayerTreeHostCommon::findLayerInSubtree(m_rootLayer.get(), m_topControlsContentLayer->id())) { |
| + m_topControlsContentLayer->setLayerTreeHost(m_rootLayer->layerTreeHost()); |
| + m_topControlsContentLayer->setChildren(m_rootLayer->children()); |
| + m_rootLayer->addChild(m_topControlsContentLayer); |
| + } |
| + } |
| + |
| updateLayers(rootLayer(), queue); |
| } |