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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/CompositorElementId.h

Issue 2890953002: [SPv1] Always set a CompositorElementId on main graphics layers; use PaintLayer id. (Closed)
Patch Set: none Created 3 years, 7 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
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 const int kCompositorNamespaceBitCount = 3; 16 const int kCompositorNamespaceBitCount = 3;
17 17
18 enum class CompositorElementIdNamespace { 18 enum class CompositorElementIdNamespace {
19 kPrimary, 19 kPrimary,
20 kRootScroll,
20 kScroll, 21 kScroll,
22 kScrollbar,
23 kScrollState,
21 kViewport, 24 kViewport,
22 kLinkHighlight, 25 kLinkHighlight,
23 kScrollbar,
24 // A sentinel to indicate the maximum representable namespace id 26 // A sentinel to indicate the maximum representable namespace id
25 // (the maximum is one less than this value). 27 // (the maximum is one less than this value).
26 kMaxRepresentableNamespaceId = 1 << kCompositorNamespaceBitCount 28 kMaxRepresentableNamespaceId = 1 << kCompositorNamespaceBitCount
27 }; 29 };
28 30
29 using CompositorElementId = cc::ElementId; 31 using CompositorElementId = cc::ElementId;
32 using PaintLayerId = uint64_t;
33 using ScrollbarId = uint64_t;
30 using DOMNodeId = uint64_t; 34 using DOMNodeId = uint64_t;
31 using ScrollbarId = uint64_t;
32 35
33 CompositorElementId PLATFORM_EXPORT 36 CompositorElementId PLATFORM_EXPORT
37 CompositorElementIdFromPaintLayerId(PaintLayerId,
38 CompositorElementIdNamespace);
39
40 // This method should only be used for "special" layers that are not allocated
41 // during the normal lifecycle. Examples include VisualViewport,
42 // root scrolling (when rootLayerScrollingEnabled is off), and LinkHighlight.
43 CompositorElementId PLATFORM_EXPORT
34 CompositorElementIdFromDOMNodeId(DOMNodeId, CompositorElementIdNamespace); 44 CompositorElementIdFromDOMNodeId(DOMNodeId, CompositorElementIdNamespace);
35 45
36 CompositorElementId PLATFORM_EXPORT 46 CompositorElementId PLATFORM_EXPORT
37 CompositorElementIdFromScrollbarId(ScrollbarId, 47 CompositorElementIdFromScrollbarId(ScrollbarId,
38 CompositorElementIdNamespace); 48 CompositorElementIdNamespace);
39 49
40 // Note cc::ElementId has a hash function already implemented via 50 // Note cc::ElementId has a hash function already implemented via
41 // ElementIdHash::operator(). However for consistency's sake we choose to use 51 // ElementIdHash::operator(). However for consistency's sake we choose to use
42 // Blink's hash functions with Blink specific data structures. 52 // Blink's hash functions with Blink specific data structures.
43 struct CompositorElementIdHash { 53 struct CompositorElementIdHash {
(...skipping 21 matching lines...) Expand all
65 } 75 }
66 }; 76 };
67 77
68 using CompositorElementIdSet = HashSet<CompositorElementId, 78 using CompositorElementIdSet = HashSet<CompositorElementId,
69 CompositorElementIdHash, 79 CompositorElementIdHash,
70 CompositorElementIdHashTraits>; 80 CompositorElementIdHashTraits>;
71 81
72 } // namespace blink 82 } // namespace blink
73 83
74 #endif // CompositorElementId_h 84 #endif // CompositorElementId_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698