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

Side by Side Diff: components/viz/hittest/display_hittest_data.cc

Issue 2908783002: WIP Hittest Component.
Patch Set: surface observer and test setup 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 "base/logging.h"
6 #include "components/viz/hittest/hittest_aggregator.h"
7
8 namespace viz {
9
10 namespace {
11
12 #define INITIAL_COUNT 128
rjkroege 2017/06/02 22:45:44 follow the chrome constant style: const kFoo = ...
gklassen 2017/06/05 21:32:13 Done.
13 }
14
15 DisplayHittestData::DisplayHittestData() {}
16 DisplayHittestData::~DisplayHittestData() {}
rjkroege 2017/06/02 22:45:44 this class is getting build in shared memory and w
gklassen 2017/06/05 21:32:13 Agreed. Will look at changing to a struct.
17
18 void DisplayHittestData::build(HittestDataMap map,
19 cc::SurfaceId root_surface_id) {
20 count_ = 0;
21 append(map, root_surface_id);
22 }
23
24 void DisplayHittestData::append(HittestDataMap map, cc::SurfaceId surface_id) {
25 hittest::mojom::HittestData hittest_data = map[root_surface_id];
rjkroege 2017/06/02 22:45:44 this doesn't look like C++
gklassen 2017/06/05 21:32:13 Done.
26 if (hittest_data == NULL) {
27 // referenced surface not found!
28 return;
29 }
30
31 int index = count_++;
32
33 regions[index].region_.surface_id_ = hittest_data.surface_id_;
34 regions[index].region_.flags_ = hittest_data.flags_;
35 regions[index].region_.rect_ = hittest_data.rect_;
36 regions[index].region_.transform_ = hittest_data.transform_;
37
38 for (auto& region : hittest_data.regions_) {
39 append(region);
40 if (region.flags_ == HITTEST_SURFACE) {
rjkroege 2017/06/02 22:45:44 you need to & test
gklassen 2017/06/05 21:32:13 any more detail here? Just want to ensure I under
41 append(map, region.surface_id_);
42 }
43 }
44
45 regions[index].child_count_ = count_ - index;
46 }
47
48 void DisplayHittestData::append(hittest::mojom::HittestRegion region) {
49 int index = count_++;
50
51 regions[index].region_.surface_id_ = region.surface_id_;
52 regions[index].region_.flags_ = region.flags_;
53 regions[index].region_.rect_ = region.rect_;
54 regions[index].region_.transform_ = region.transform_;
55
56 if (region.flags_ == HITTEST_SURFACE) {
57 append(map, region.surface_id_);
58 }
59
60 regions[index].child_count_ = count_ - index;
61 }
62
63 } // namespace viz
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698