Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "components/viz/host/hit_test/hit_test_query.h" | |
| 6 | |
| 7 namespace viz { | |
| 8 namespace hit_test { | |
| 9 | |
| 10 HitTestQuery::HitTestQuery() {} | |
| 11 | |
| 12 HitTestQuery::~HitTestQuery() {} | |
| 13 | |
| 14 Target HitTestQuery::FindTargetForLocation(const gfx::Point& location_in_root) { | |
| 15 // TODO(riajiang): Assumptions I'm making about the list of DisplayHitTestData | |
| 16 // 1. The list is in descending z-order. | |
|
rjkroege
2017/06/15 19:58:35
so: larger indicies mean closer to the eyepoint?
riajiang
2017/06/16 02:56:54
Yes, I'm assuming that for now for the correct tra
| |
| 17 // 2. Children entries have their own FrameSinkId, but those that are just | |
|
rjkroege
2017/06/15 19:58:35
entries here mean "region"?
riajiang
2017/06/16 02:56:54
Yes. Updated.
| |
| 18 // bounding boxes have the FrameSinkId of their parent. | |
| 19 // 3. Children count includes children of children. | |
| 20 // 4. After applying transform to the incoming point, point is in the same | |
|
rjkroege
2017/06/15 19:58:35
you need ascii art. Or an associated .md file wit
riajiang
2017/06/16 02:56:54
Added ascii art example for now. Maybe will move a
| |
| 21 // coordinate system as the bounds it is comparing against. | |
| 22 // 5. Transform contains transform for the position. | |
| 23 // 6. HIT_TEST_MINE means the region can receive events, i.e., not just a | |
| 24 // bounding box. | |
| 25 DCHECK(!display_hit_test_data_list_.empty()); | |
| 26 Target confirmed_target_so_far; | |
|
rjkroege
2017/06/15 19:58:35
You should use Target* instead of copying whole Ta
riajiang
2017/06/16 02:56:54
Do you mean confirmed_target_so_far is copying the
| |
| 27 Target tentative_target_so_far; | |
| 28 tentative_target_so_far.location_in_target = location_in_root; | |
|
rjkroege
2017/06/15 19:58:35
I'd put a blank line here.
riajiang
2017/06/16 02:56:54
Done.
| |
| 29 for (uint32_t i = 0; i < display_hit_test_data_list_.size(); ++i) { | |
|
rjkroege
2017/06/15 19:58:35
use an iterator
riajiang
2017/06/16 02:56:54
Done.
| |
| 30 DisplayHitTestData data = display_hit_test_data_list_[i]; | |
| 31 gfx::Point location(tentative_target_so_far.location_in_target); | |
|
gklassen
2017/06/15 19:51:20
What happens if we transform a point for a child r
riajiang
2017/06/16 02:56:54
Do you maybe mean that the point P does not match
| |
| 32 if (!data.transform.IsIdentity()) | |
| 33 data.transform.TransformPoint(&location); | |
| 34 if (data.bounds.Contains(location)) { | |
| 35 tentative_target_so_far.id = data.id; | |
| 36 tentative_target_so_far.location_in_target = location; | |
|
rjkroege
2017/06/15 19:58:36
I think it's safe to begin by thinking about this
| |
| 37 tentative_target_so_far.flags = data.flags; | |
| 38 // TODO(riajiang): Check properly once HitTestRegionFlags is well defined | |
| 39 // after https://codereview.chromium.org/2908783002/. | |
| 40 // HIT_TEST_MINE is set to be true, which means it can receive events. | |
|
rjkroege
2017/06/15 19:58:35
if you encounter a region with hit_test_mine set,
riajiang
2017/06/16 02:56:54
We should also check child_count? If a region has
| |
| 41 if (data.flags) | |
| 42 confirmed_target_so_far = tentative_target_so_far; | |
| 43 if (!data.child_count) | |
| 44 break; | |
| 45 } else { | |
| 46 i += data.child_count; | |
| 47 } | |
| 48 } | |
| 49 return confirmed_target_so_far; | |
| 50 } | |
| 51 | |
| 52 } // namespace hit_test | |
| 53 } // namespace viz | |
| OLD | NEW |