Chromium Code Reviews| Index: components/viz/hittest/display_hittest_data.cc |
| diff --git a/components/viz/hittest/display_hittest_data.cc b/components/viz/hittest/display_hittest_data.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d5ff5a4d537009918f60aa650bdb06826121b345 |
| --- /dev/null |
| +++ b/components/viz/hittest/display_hittest_data.cc |
| @@ -0,0 +1,63 @@ |
| +// 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. |
| + |
| +#include "base/logging.h" |
| +#include "components/viz/hittest/hittest_aggregator.h" |
| + |
| +namespace viz { |
| + |
| +namespace { |
| + |
| +#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.
|
| +} |
| + |
| +DisplayHittestData::DisplayHittestData() {} |
| +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.
|
| + |
| +void DisplayHittestData::build(HittestDataMap map, |
| + cc::SurfaceId root_surface_id) { |
| + count_ = 0; |
| + append(map, root_surface_id); |
| +} |
| + |
| +void DisplayHittestData::append(HittestDataMap map, cc::SurfaceId surface_id) { |
| + 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.
|
| + if (hittest_data == NULL) { |
| + // referenced surface not found! |
| + return; |
| + } |
| + |
| + int index = count_++; |
| + |
| + regions[index].region_.surface_id_ = hittest_data.surface_id_; |
| + regions[index].region_.flags_ = hittest_data.flags_; |
| + regions[index].region_.rect_ = hittest_data.rect_; |
| + regions[index].region_.transform_ = hittest_data.transform_; |
| + |
| + for (auto& region : hittest_data.regions_) { |
| + append(region); |
| + 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
|
| + append(map, region.surface_id_); |
| + } |
| + } |
| + |
| + regions[index].child_count_ = count_ - index; |
| +} |
| + |
| +void DisplayHittestData::append(hittest::mojom::HittestRegion region) { |
| + int index = count_++; |
| + |
| + regions[index].region_.surface_id_ = region.surface_id_; |
| + regions[index].region_.flags_ = region.flags_; |
| + regions[index].region_.rect_ = region.rect_; |
| + regions[index].region_.transform_ = region.transform_; |
| + |
| + if (region.flags_ == HITTEST_SURFACE) { |
| + append(map, region.surface_id_); |
| + } |
| + |
| + regions[index].child_count_ = count_ - index; |
| +} |
| + |
| +} // namespace viz |