OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "platform/graphics/CompositorElementId.h" | 5 #include "platform/graphics/CompositorElementId.h" |
6 | 6 |
7 namespace blink { | 7 namespace blink { |
8 | 8 |
9 static CompositorElementId CreateCompositorElementId( | 9 static CompositorElementId CreateCompositorElementId( |
10 uint64_t blink_id, | 10 uint64_t blink_id, |
(...skipping 15 matching lines...) Expand all Loading... |
26 CompositorElementIdNamespace namespace_id) { | 26 CompositorElementIdNamespace namespace_id) { |
27 return CreateCompositorElementId(id, namespace_id); | 27 return CreateCompositorElementId(id, namespace_id); |
28 } | 28 } |
29 | 29 |
30 CompositorElementId PLATFORM_EXPORT | 30 CompositorElementId PLATFORM_EXPORT |
31 CompositorElementIdFromScrollbarId(ScrollbarId id, | 31 CompositorElementIdFromScrollbarId(ScrollbarId id, |
32 CompositorElementIdNamespace namespace_id) { | 32 CompositorElementIdNamespace namespace_id) { |
33 return CreateCompositorElementId(id, namespace_id); | 33 return CreateCompositorElementId(id, namespace_id); |
34 } | 34 } |
35 | 35 |
36 uint64_t IdFromCompositorElementId(CompositorElementId element_id) { | |
37 return element_id.id_ >> kCompositorNamespaceBitCount; | |
38 } | |
39 | |
40 CompositorElementIdNamespace NamespaceFromCompositorElementId( | 36 CompositorElementIdNamespace NamespaceFromCompositorElementId( |
41 CompositorElementId element_id) { | 37 CompositorElementId element_id) { |
42 return static_cast<CompositorElementIdNamespace>( | 38 return static_cast<CompositorElementIdNamespace>( |
43 element_id.id_ % | 39 element_id.id_ % |
44 static_cast<uint64_t>( | 40 static_cast<uint64_t>( |
45 CompositorElementIdNamespace::kMaxRepresentableNamespaceId)); | 41 CompositorElementIdNamespace::kMaxRepresentableNamespaceId)); |
46 } | 42 } |
47 | 43 |
48 } // namespace blink | 44 } // namespace blink |
OLD | NEW |