Index: components/viz/host/hit_test/hit_test_query.h |
diff --git a/components/viz/host/hit_test/hit_test_query.h b/components/viz/host/hit_test/hit_test_query.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b660f3b6a99eab6865f0fc98e391a95f141c6e01 |
--- /dev/null |
+++ b/components/viz/host/hit_test/hit_test_query.h |
@@ -0,0 +1,61 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_VIZ_HOST_HIT_TEST_HIT_TEST_QUERY_H_ |
+#define COMPONENTS_VIZ_HOST_HIT_TEST_HIT_TEST_QUERY_H_ |
+ |
+#include <vector> |
+ |
+#include "base/macros.h" |
+#include "components/viz/common/hit_test/display_hit_test_data.h" |
+#include "ui/gfx/geometry/point.h" |
+ |
+namespace viz { |
+namespace hit_test { |
+ |
+struct Target { |
+ 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
|
+ // |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.
|
+ 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
|
+ // Different flags are defined in services/viz/public/interfaces/ |
+ // 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.
|
+ uint32_t flags; |
+}; |
+ |
+// 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.
|
+// by HitTestComponent. |
+// TODO(riajiang): Handle 3d space cases correctly. |
+class HitTestQuery { |
+ public: |
+ HitTestQuery(); |
+ ~HitTestQuery(); |
+ |
+ // TODO(riajiang): Read from shmem directly once it's set up and delete this |
+ // function. For now, use fake data. |
+ void set_display_hit_test_data_list( |
+ DisplayHitTestData display_hit_test_data_list) { |
+ display_hit_test_data_list_ = std::move(display_hit_test_data_list); |
+ } |
+ |
+ // 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.
|
+ // target, updated location in the coordinate system of the target and |
+ // hit-test flags for the target. |
+ Target FindTargetForLocation(const gfx::Point& location_in_root); |
+ |
+ private: |
+ // Helper function to find |target| for |location_in_region| in the |region|, |
+ // returns true if a target is found and false otherwise. |
+ bool FindTargetForLocationInRegion(const gfx::Point& location_in_region, |
+ DisplayHitTestDataRegion* region, |
+ Target* target); |
sadrul
2017/06/27 03:37:55
Should this be a const method?
riajiang
2017/06/27 15:51:45
Done.
|
+ |
+ DisplayHitTestData display_hit_test_data_list_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(HitTestQuery); |
+}; |
+ |
+} // namespace hit_test |
+} // namespace viz |
+ |
+#endif // COMPONENTS_VIZ_HOST_HIT_TEST_HIT_TEST_QUERY_H_ |