| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/android/view_android.h" | 5 #include "ui/android/view_android.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 children_.end()); | 119 children_.end()); |
| 120 DCHECK(!RootPathHasEventForwarder(this) || !SubtreeHasEventForwarder(child)) | 120 DCHECK(!RootPathHasEventForwarder(this) || !SubtreeHasEventForwarder(child)) |
| 121 << "Some view tree path will have more than one event forwarder " | 121 << "Some view tree path will have more than one event forwarder " |
| 122 "if the child is added."; | 122 "if the child is added."; |
| 123 | 123 |
| 124 // The new child goes to the top, which is the end of the list. | 124 // The new child goes to the top, which is the end of the list. |
| 125 children_.push_back(child); | 125 children_.push_back(child); |
| 126 if (child->parent_) | 126 if (child->parent_) |
| 127 child->RemoveFromParent(); | 127 child->RemoveFromParent(); |
| 128 child->parent_ = this; | 128 child->parent_ = this; |
| 129 child->OnPhysicalBackingSizeChanged(physical_size_); | 129 |
| 130 // Empty physical backing size need not propagating down since it can |
| 131 // accidentally overwrite the valid ones in the children. |
| 132 if (!physical_size_.IsEmpty()) |
| 133 child->OnPhysicalBackingSizeChanged(physical_size_); |
| 130 } | 134 } |
| 131 | 135 |
| 132 // static | 136 // static |
| 133 bool ViewAndroid::RootPathHasEventForwarder(ViewAndroid* view) { | 137 bool ViewAndroid::RootPathHasEventForwarder(ViewAndroid* view) { |
| 134 while (view) { | 138 while (view) { |
| 135 if (view->has_event_forwarder()) | 139 if (view->has_event_forwarder()) |
| 136 return true; | 140 return true; |
| 137 view = view->parent_; | 141 view = view->parent_; |
| 138 } | 142 } |
| 139 | 143 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 matched = bound.Contains(e->GetX(0), e->GetY(0)); | 355 matched = bound.Contains(e->GetX(0), e->GetY(0)); |
| 352 } | 356 } |
| 353 if (matched && child->HitTest(send_to_client, *e)) | 357 if (matched && child->HitTest(send_to_client, *e)) |
| 354 return true; | 358 return true; |
| 355 } | 359 } |
| 356 } | 360 } |
| 357 return false; | 361 return false; |
| 358 } | 362 } |
| 359 | 363 |
| 360 } // namespace ui | 364 } // namespace ui |
| OLD | NEW |