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..f6e8c8043359ae61dd7463ec40f552653d81c26a 100644 |
--- a/third_party/WebKit/Source/platform/graphics/CompositorElementId.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/CompositorElementId.cpp |
@@ -9,7 +9,15 @@ namespace blink { |
CompositorElementId CreateCompositorElementId( |
int 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<int>::max() / 4); |
suzyh_UTC10 (ex-contributor)
2017/05/05 04:27:31
Please make this 4 a named constant or similar rat
chrishtr
2017/05/05 05:34:52
Done.
|
+ int element_id = dom_node_id; |
suzyh_UTC10 (ex-contributor)
2017/05/05 04:27:31
Use one of the unsigned types rather than int?
chrishtr
2017/05/05 05:34:52
Done. Sorry for forgetting to update this file.
|
+ element_id = element_id << 2; // Shift to make room for enum bits. |
suzyh_UTC10 (ex-contributor)
2017/05/05 04:27:31
Nit: specify "sub_element_id enum bits"
chrishtr
2017/05/05 05:34:52
Done.
|
+ element_id += static_cast<int>(sub_element_id); |
+ return CompositorElementId(element_id); |
+} |
+ |
+int DomNodeIdFromCompositorElementId(CompositorElementId id) { |
+ return id >> 2; |
} |
} // namespace blink |