| 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 #ifndef CompositorElementId_h | 5 #ifndef CompositorElementId_h |
| 6 #define CompositorElementId_h | 6 #define CompositorElementId_h |
| 7 | 7 |
| 8 #include "cc/trees/element_id.h" | 8 #include "cc/trees/element_id.h" |
| 9 #include "platform/PlatformExport.h" | 9 #include "platform/PlatformExport.h" |
| 10 #include "platform/wtf/HashFunctions.h" | 10 #include "platform/wtf/HashFunctions.h" |
| 11 #include "platform/wtf/HashSet.h" | 11 #include "platform/wtf/HashSet.h" |
| 12 #include "platform/wtf/HashTraits.h" | 12 #include "platform/wtf/HashTraits.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 enum class CompositorSubElementId { | 16 enum class CompositorSubElementId { |
| 17 kPrimary, | 17 kPrimary, |
| 18 kScroll, | 18 kScroll, |
| 19 kViewport, | 19 kViewport, |
| 20 kLinkHighlight | 20 kLinkHighlight, |
| 21 kScrollbar |
| 21 }; | 22 }; |
| 22 | 23 |
| 23 using CompositorElementId = cc::ElementId; | 24 using CompositorElementId = cc::ElementId; |
| 24 | 25 |
| 25 CompositorElementId PLATFORM_EXPORT | 26 CompositorElementId PLATFORM_EXPORT |
| 26 CreateCompositorElementId(int dom_node_id, CompositorSubElementId); | 27 CreateCompositorElementId(int blink_id, CompositorSubElementId); |
| 27 | 28 |
| 28 // Note cc::ElementId has a hash function already implemented via | 29 // Note cc::ElementId has a hash function already implemented via |
| 29 // ElementIdHash::operator(). However for consistency's sake we choose to use | 30 // ElementIdHash::operator(). However for consistency's sake we choose to use |
| 30 // Blink's hash functions with Blink specific data structures. | 31 // Blink's hash functions with Blink specific data structures. |
| 31 struct CompositorElementIdHash { | 32 struct CompositorElementIdHash { |
| 32 static unsigned GetHash(const CompositorElementId& p) { | 33 static unsigned GetHash(const CompositorElementId& p) { |
| 33 return WTF::HashInts(p.primaryId, p.secondaryId); | 34 return WTF::HashInts(p.primaryId, p.secondaryId); |
| 34 } | 35 } |
| 35 static bool Equal(const CompositorElementId& a, | 36 static bool Equal(const CompositorElementId& a, |
| 36 const CompositorElementId& b) { | 37 const CompositorElementId& b) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 50 } | 51 } |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 using CompositorElementIdSet = HashSet<CompositorElementId, | 54 using CompositorElementIdSet = HashSet<CompositorElementId, |
| 54 CompositorElementIdHash, | 55 CompositorElementIdHash, |
| 55 CompositorElementIdHashTraits>; | 56 CompositorElementIdHashTraits>; |
| 56 | 57 |
| 57 } // namespace blink | 58 } // namespace blink |
| 58 | 59 |
| 59 #endif // CompositorElementId_h | 60 #endif // CompositorElementId_h |
| OLD | NEW |