summaryrefslogtreecommitdiffstats
path: root/views/view.cc
diff options
context:
space:
mode:
authorbacker@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-08 11:53:35 +0000
committerbacker@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-08 11:53:35 +0000
commit9ef00a5b0b51f5a60d925ed27979745d8240d700 (patch)
tree38864a823f25f8209430a0af55ca9c0fc0d1c65e /views/view.cc
parent9af487d4c521414c9f006ae342d3b9974f5a6bed (diff)
downloadchromium_src-9ef00a5b0b51f5a60d925ed27979745d8240d700.zip
chromium_src-9ef00a5b0b51f5a60d925ed27979745d8240d700.tar.gz
chromium_src-9ef00a5b0b51f5a60d925ed27979745d8240d700.tar.bz2
Reorder Layers with NativeWidgetViews.
The presence of NativeWidgetViews complicates the process of keeping the Layer tree in sync with the View tree. Specifically, when walking up the View tree to find a View with a Layer, we may have to walk up through a NativeWidgetViews to a NativeWidgetView in a different View tree. Similarly, when walking down the tree to find Views with Layers, we may have to walk down through a NativeWidgetView to a NativeWidgetViews. BUG=none TEST=none Review URL: http://codereview.chromium.org/8201008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104654 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/view.cc')
-rw-r--r--views/view.cc50
1 files changed, 27 insertions, 23 deletions
diff --git a/views/view.cc b/views/view.cc
index ce96853..b49fab6 100644
--- a/views/view.cc
+++ b/views/view.cc
@@ -1147,6 +1147,33 @@ void View::OnPaintLayer(gfx::Canvas* canvas) {
PaintCommon(canvas);
}
+void View::ReorderLayers() {
+ View* v = this;
+ while (v && !v->layer())
+ v = v->parent();
+
+ // Forward to widget in case we're in a NativeWidgetView.
+ if (!v) {
+ if (GetWidget())
+ GetWidget()->ReorderLayers();
+ } else {
+ for (Views::const_iterator i(v->children_.begin());
+ i != v->children_.end();
+ ++i)
+ (*i)->ReorderChildLayers(v->layer());
+ }
+}
+
+void View::ReorderChildLayers(ui::Layer* parent_layer) {
+ if (layer()) {
+ DCHECK_EQ(parent_layer, layer()->parent());
+ parent_layer->MoveToFront(layer());
+ } else {
+ for (Views::const_iterator i(children_.begin()); i != children_.end(); ++i)
+ (*i)->ReorderChildLayers(parent_layer);
+ }
+}
+
// Input -----------------------------------------------------------------------
bool View::HasHitTestMask() const {
@@ -1805,29 +1832,6 @@ void View::DestroyLayer() {
SchedulePaint();
}
-void View::ReorderLayers() {
- View* v = this;
- while (v && !v->layer())
- v = v->parent();
-
- if (v) {
- for (Views::const_iterator i(v->children_.begin());
- i != v->children_.end();
- ++i)
- (*i)->ReorderChildLayers(v->layer());
- }
-}
-
-void View::ReorderChildLayers(ui::Layer* parent_layer) {
- if (layer()) {
- DCHECK_EQ(parent_layer, layer()->parent());
- parent_layer->MoveToFront(layer());
- } else {
- for (Views::const_iterator i(children_.begin()); i != children_.end(); ++i)
- (*i)->ReorderChildLayers(parent_layer);
- }
-}
-
// Input -----------------------------------------------------------------------
bool View::ProcessMousePressed(const MouseEvent& event, DragInfo* drag_info) {