Chromium Code Reviews| Index: chrome/browser/android/tab_android.cc |
| diff --git a/chrome/browser/android/tab_android.cc b/chrome/browser/android/tab_android.cc |
| index 63cbe9f53e5679bef3c7a9846e7ef3c0b89e8e5a..2fc6175c99297bd3948fecf60fcc9b732e058f38 100644 |
| --- a/chrome/browser/android/tab_android.cc |
| +++ b/chrome/browser/android/tab_android.cc |
| @@ -416,7 +416,8 @@ void TabAndroid::InitWebContents( |
| if (instant_service) |
| instant_service->AddObserver(this); |
| - content_layer_->InsertChild(web_contents_->GetNativeView()->GetLayer(), 0); |
| + if (!blimp_contents_) |
| + content_layer_->InsertChild(web_contents_->GetNativeView()->GetLayer(), 0); |
| } |
| base::android::ScopedJavaLocalRef<jobject> TabAndroid::InitBlimpContents( |
| @@ -430,6 +431,15 @@ base::android::ScopedJavaLocalRef<jobject> TabAndroid::InitBlimpContents( |
| DCHECK(context); |
| blimp_contents_ = context->CreateBlimpContents(); |
| DCHECK(blimp_contents_); |
| + |
| + // Let's detach the layer from WebContents first, just to be sure. |
| + cc::Layer* web_contents_layer = web_contents_->GetNativeView()->GetLayer(); |
|
nyquist
2016/08/29 23:09:45
Are you sure web_contents_ is never nullptr here?
Khushal
2016/08/30 00:51:10
Thanks for catching it. Done.
|
| + if (web_contents_layer->parent() == content_layer_.get()) |
| + web_contents_layer->RemoveFromParent(); |
| + |
| + // Attach the layer holding the tab contents to the |content_layer_|. |
| + content_layer_->InsertChild(blimp_contents_->GetNativeView()->GetLayer(), 0); |
| + |
| return blimp_contents_->GetJavaObject(); |
| } |