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

Side by Side Diff: components/viz/host/hit_test/hit_test_query.h

Issue 2933493003: Add viz-host HitTestQuery. (Closed)
Patch Set: recursion; comment#10 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 #ifndef COMPONENTS_VIZ_HOST_HIT_TEST_HIT_TEST_QUERY_H_
6 #define COMPONENTS_VIZ_HOST_HIT_TEST_HIT_TEST_QUERY_H_
7
8 #include <vector>
9
10 #include "base/macros.h"
11 #include "components/viz/common/hit_test/display_hit_test_data.h"
12 #include "ui/gfx/geometry/point.h"
13
14 namespace viz {
15 namespace hit_test {
16
17 struct Target {
18 cc::FrameSinkId id;
varkha 2017/06/26 19:25:30 nit: whitespace after.
riajiang 2017/06/27 15:51:45 Hmm I tried adding whitespace but git cl format wo
19 // |location_in_target| is in the coordinate system of the target FrameSinkId.
varkha 2017/06/26 19:25:30 nit: maybe just "Coordinates in the coordinate sys
riajiang 2017/06/27 15:51:45 Done.
20 gfx::Point location_in_target;
varkha 2017/06/26 19:25:30 nit: whitespace after.
sadrul 2017/06/27 03:37:54 Might make sense to make this a gfx::PointF.
riajiang 2017/06/27 15:51:45 Transform::TransformPoint only supports Point and
21 // Different flags are defined in services/viz/public/interfaces/
22 // hit_test_data.mojom.
varkha 2017/06/26 19:25:30 Is this in services/viz/hit_test/public/interfaces
riajiang 2017/06/27 15:51:45 Yes, it's in that CL.
23 uint32_t flags;
24 };
25
26 // Finds the target for a given location based on DisplayHitTestData aggreated
sadrul 2017/06/27 03:37:55 *aggregated
riajiang 2017/06/27 15:51:45 Done.
27 // by HitTestComponent.
28 // TODO(riajiang): Handle 3d space cases correctly.
29 class HitTestQuery {
30 public:
31 HitTestQuery();
32 ~HitTestQuery();
33
34 // TODO(riajiang): Read from shmem directly once it's set up and delete this
35 // function. For now, use fake data.
36 void set_display_hit_test_data_list(
37 DisplayHitTestData display_hit_test_data_list) {
38 display_hit_test_data_list_ = std::move(display_hit_test_data_list);
39 }
40
41 // Find Target for |location_in_root|, including the FrameSinkId of the
varkha 2017/06/26 19:25:30 nit: Finds
riajiang 2017/06/27 15:51:45 Done.
42 // target, updated location in the coordinate system of the target and
43 // hit-test flags for the target.
44 Target FindTargetForLocation(const gfx::Point& location_in_root);
45
46 private:
47 // Helper function to find |target| for |location_in_region| in the |region|,
48 // returns true if a target is found and false otherwise.
49 bool FindTargetForLocationInRegion(const gfx::Point& location_in_region,
50 DisplayHitTestDataRegion* region,
51 Target* target);
sadrul 2017/06/27 03:37:55 Should this be a const method?
riajiang 2017/06/27 15:51:45 Done.
52
53 DisplayHitTestData display_hit_test_data_list_;
54
55 DISALLOW_COPY_AND_ASSIGN(HitTestQuery);
56 };
57
58 } // namespace hit_test
59 } // namespace viz
60
61 #endif // COMPONENTS_VIZ_HOST_HIT_TEST_HIT_TEST_QUERY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698