Chromium Code Reviews| Index: ui/android/view_android.cc |
| diff --git a/ui/android/view_android.cc b/ui/android/view_android.cc |
| index 15e51a0042ca48b6eb5c29d0bbbc6cafdb9541a3..fbaf2e74d6316ffe5f6328833952fc93adcd3835 100644 |
| --- a/ui/android/view_android.cc |
| +++ b/ui/android/view_android.cc |
| @@ -123,6 +123,7 @@ void ViewAndroid::AddChild(ViewAndroid* child) { |
| if (child->parent_) |
| child->RemoveFromParent(); |
| child->parent_ = this; |
| + child->OnPhysicalBackingSizeChanged(physical_size_); |
| } |
| // static |
| @@ -229,6 +230,11 @@ void ViewAndroid::SetLayer(scoped_refptr<cc::Layer> layer) { |
| layer_ = layer; |
| } |
| +void ViewAndroid::UpdateLayerBounds() { |
| + if (layer_) |
| + layer_->SetBounds(physical_size_); |
| +} |
| + |
| void ViewAndroid::SetLayout(ViewAndroid::LayoutParams params) { |
| layout_params_ = params; |
| } |
| @@ -279,6 +285,22 @@ int ViewAndroid::GetSystemWindowInsetBottom() { |
| return Java_ViewAndroidDelegate_getSystemWindowInsetBottom(env, delegate); |
| } |
| +void ViewAndroid::OnPhysicalBackingSizeChanged(const gfx::Size& size) { |
| + if (physical_size_ == size) |
| + return; |
| + physical_size_ = size; |
| + UpdateLayerBounds(); |
| + if (client_ && client_->OnPhysicalBackingSizeChanged()) |
|
boliu
2017/04/29 00:18:40
this makes no sense, why would client ever want to
Jinsuk Kim
2017/04/30 00:23:50
Can do without bool return type. Changed to void.
|
| + return; |
| + |
| + for (auto* child : children_) |
| + child->OnPhysicalBackingSizeChanged(size); |
| +} |
| + |
| +gfx::Size ViewAndroid::GetPhysicalBackingSize() { |
| + return physical_size_; |
| +} |
| + |
| bool ViewAndroid::OnTouchEvent(const MotionEventAndroid& event, |
| bool for_touch_handle) { |
| return HitTest( |