Chromium Code Reviews| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 << "Root of the ViewAndroid can have at most one handler."; | 108 << "Root of the ViewAndroid can have at most one handler."; |
| 109 event_forwarder_.reset(new EventForwarder(this)); | 109 event_forwarder_.reset(new EventForwarder(this)); |
| 110 } | 110 } |
| 111 return event_forwarder_->GetJavaObject(); | 111 return event_forwarder_->GetJavaObject(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void ViewAndroid::AddChild(ViewAndroid* child) { | 114 void ViewAndroid::AddChild(ViewAndroid* child) { |
| 115 DCHECK(child); | 115 DCHECK(child); |
| 116 DCHECK(std::find(children_.begin(), children_.end(), child) == | 116 DCHECK(std::find(children_.begin(), children_.end(), child) == |
| 117 children_.end()); | 117 children_.end()); |
| 118 DCHECK(!SubtreeHasEventForwarder(child) || !ViewTreeHasEventForwarder(this)) | 118 DCHECK(GetWindowAndroid() == this || !SubtreeHasEventForwarder(child) || |
| 119 !ViewTreeHasEventForwarder(this)) | |
|
boliu
2017/05/08 16:54:55
the previous check is too strict. check should be
Jinsuk Kim
2017/05/10 01:42:10
Updated the DCHECK to do what's actually intended.
| |
| 119 << "Only one event handler is allowed."; | 120 << "Only one event handler is allowed."; |
| 120 | 121 |
| 121 // The new child goes to the top, which is the end of the list. | 122 // The new child goes to the top, which is the end of the list. |
| 122 children_.push_back(child); | 123 children_.push_back(child); |
| 123 if (child->parent_) | 124 if (child->parent_) |
| 124 child->RemoveFromParent(); | 125 child->RemoveFromParent(); |
| 125 child->parent_ = this; | 126 child->parent_ = this; |
| 126 } | 127 } |
| 127 | 128 |
| 128 // static | 129 // static |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 332 matched = bound.Contains(e->GetX(0), e->GetY(0)); | 333 matched = bound.Contains(e->GetX(0), e->GetY(0)); |
| 333 } | 334 } |
| 334 if (matched && child->HitTest(send_to_client, *e)) | 335 if (matched && child->HitTest(send_to_client, *e)) |
| 335 return true; | 336 return true; |
| 336 } | 337 } |
| 337 } | 338 } |
| 338 return false; | 339 return false; |
| 339 } | 340 } |
| 340 | 341 |
| 341 } // namespace ui | 342 } // namespace ui |
| OLD | NEW |