Index: third_party/WebKit/Source/platform/graphics/CompositorElementId.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/CompositorElementId.cpp b/third_party/WebKit/Source/platform/graphics/CompositorElementId.cpp |
index eeb495fbacd4780e0671a07ae53022b945c3aa39..69f2588009ca93dbc9b93413cefa11580cdf8480 100644 |
--- a/third_party/WebKit/Source/platform/graphics/CompositorElementId.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/CompositorElementId.cpp |
@@ -7,9 +7,24 @@ |
namespace blink { |
CompositorElementId CreateCompositorElementId( |
- int dom_node_id, |
+ uint64_t dom_node_id, |
CompositorSubElementId sub_element_id) { |
- return CompositorElementId(dom_node_id, static_cast<int>(sub_element_id)); |
+ DCHECK(dom_node_id > 0 && dom_node_id < std::numeric_limits<uint64_t>::max() / |
+ kNumSubElementTypes); |
+ uint64_t element_id = dom_node_id; |
+ element_id = |
+ element_id << 2; // Shift to make room for sub_element_id enum bits. |
+ element_id += static_cast<uint64_t>(sub_element_id); |
+ return CompositorElementId(element_id); |
+} |
+ |
+uint64_t DomNodeIdFromCompositorElementId(CompositorElementId id) { |
wkorman
2017/05/05 20:06:10
Naming style question -- feel like usually we see
chrishtr
2017/05/05 20:46:09
Not sure. Happy to change if you want.
|
+ return id >> 2; |
+} |
+ |
+CompositorSubElementId SubElementIdFromCompositorElementId( |
+ CompositorElementId id) { |
+ return static_cast<CompositorSubElementId>(id % kNumSubElementTypes); |
} |
} // namespace blink |