Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: components/viz/hit_test/query/hit_test_query.cc

Issue 2933493003: Add viz-host HitTestQuery. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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/hit_test/query/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 DCHECK(!display_hit_test_data_list_.empty());
16 Target confirmed_target_so_far;
17 Target tentative_target_so_far;
18 tentative_target_so_far.location_in_target = location_in_root;
19 for (uint32_t i = 0; i < display_hit_test_data_list_.size(); ++i) {
rjkroege 2017/06/12 17:17:24 there's a way to make a vector using a pre-defined
20 DisplayHitTestData data = display_hit_test_data_list_[i];
21 if (data.bounds.Contains(tentative_target_so_far.location_in_target)) {
22 if (!data.transform.IsIdentity()) {
23 DCHECK(data.transform.TransformPointReverse(
rjkroege 2017/06/12 17:17:24 the statement inside the DCHECK is going to not ex
riajiang 2017/06/13 18:42:29 Ah I see! I'll move the transform out of DCHECK an
24 &tentative_target_so_far.location_in_target));
25 }
26 tentative_target_so_far.id = data.id;
27 tentative_target_so_far.flags = data.flags;
28 // TODO(riajiang): Check properly once HitTestRegionFlags is well defined
29 // after https://codereview.chromium.org/2908783002/.
30 // HIT_TEST_MINE is set to be true, which means it can receive events.
31 if (data.flags)
32 confirmed_target_so_far = tentative_target_so_far;
33 if (!data.child_count)
34 break;
35 } else {
36 i += data.child_count;
37 }
38 }
39 return confirmed_target_so_far;
40 }
41
42 } // namespace hit_test
43 } // namespace viz
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698