summaryrefslogtreecommitdiffstats
path: root/cc/layer_tree_host.cc
diff options
context:
space:
mode:
authortedchoc@chromium.org <tedchoc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-16 03:58:38 +0000
committertedchoc@chromium.org <tedchoc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-16 03:58:38 +0000
commit3ba4cae36f9c80067c103809fa3f65ad18c7f2d5 (patch)
treed62946f6f8e8a15cc76d37fe8f2c89117a6b35d8 /cc/layer_tree_host.cc
parentdc87a404f3c9f0d64df6fc208b9857e8d115eba3 (diff)
downloadchromium_src-3ba4cae36f9c80067c103809fa3f65ad18c7f2d5.zip
chromium_src-3ba4cae36f9c80067c103809fa3f65ad18c7f2d5.tar.gz
chromium_src-3ba4cae36f9c80067c103809fa3f65ad18c7f2d5.tar.bz2
Add support for calculating the position of the top controls in the cc layer.
Provides a means for keeping the top controls in sync with the currently renderered frame, which will allow us to move the top controls around the screen. BUG=161303 Review URL: https://chromiumcodereview.appspot.com/11552009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177081 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/layer_tree_host.cc')
-rw-r--r--cc/layer_tree_host.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc
index 008e251..b2f930a 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 {
@@ -298,6 +299,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++;
}
@@ -436,6 +440,8 @@ void LayerTreeHost::setRootLayer(scoped_refptr<Layer> rootLayer)
if (m_hudLayer)
m_hudLayer->removeFromParent();
+ if (m_topControlsContentLayer)
+ m_topControlsContentLayer->removeFromParent();
setNeedsFullTreeSync();
}
@@ -532,6 +538,22 @@ 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);
+ m_topControlsContentLayer->setDebugName("Top Controls Content");
+ }
+
+ // 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);
}