summaryrefslogtreecommitdiffstats
path: root/views/view.cc
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-10 14:36:42 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-10 14:36:42 +0000
commit3a1a0ccc4cbb1d18a3442a02413b6d43f51dd8cb (patch)
treec9eb3a2776612d1683bfab4cb40b730f9e99d16e /views/view.cc
parent199ae2000bcf35bb5002559a61e3b2780714b14b (diff)
downloadchromium_src-3a1a0ccc4cbb1d18a3442a02413b6d43f51dd8cb.zip
chromium_src-3a1a0ccc4cbb1d18a3442a02413b6d43f51dd8cb.tar.gz
chromium_src-3a1a0ccc4cbb1d18a3442a02413b6d43f51dd8cb.tar.bz2
views: Force child views to paint into their own texture when the parent has an external texture.
BUG=none TEST=none Review URL: http://codereview.chromium.org/7605024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96177 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/view.cc')
-rw-r--r--views/view.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/views/view.cc b/views/view.cc
index 480d944..136f52a 100644
--- a/views/view.cc
+++ b/views/view.cc
@@ -1216,10 +1216,6 @@ void View::SetFillsBoundsOpaquely(bool fills_bounds_opaquely) {
}
bool View::SetExternalTexture(ui::Texture* texture) {
- // A little heavy-handed -- it should be that each child has it's own layer.
- // The desired use case is where there are no children.
- DCHECK_EQ(child_count(), 0);
-
if (!texture && !layer_helper_.get())
return true;
@@ -1234,6 +1230,13 @@ bool View::SetExternalTexture(ui::Texture* texture) {
if (use_external && !layer())
return false;
+ // Child views must not paint into the external texture. So make sure each
+ // child view has its own layer to paint into.
+ if (use_external) {
+ for (Views::iterator i = children_.begin(); i != children_.end(); ++i)
+ (*i)->SetPaintToLayer(true);
+ }
+
layer_helper_->set_layer_updated_externally(use_external);
layer_helper_->set_bitmap_needs_updating(!use_external);
if (layer())
@@ -1720,7 +1723,9 @@ bool View::ConvertPointFromAncestor(const View* ancestor,
bool View::ShouldPaintToLayer() const {
return use_acceleration_when_possible &&
- layer_helper_.get() && layer_helper_->ShouldPaintToLayer();
+ ((layer_helper_.get() && layer_helper_->ShouldPaintToLayer()) ||
+ (parent_ && parent_->layer_helper_.get() &&
+ parent_->layer_helper_->layer_updated_externally()));
}
void View::CreateLayer() {