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..16affaa30f8f92dd92c9efe4c5c12c3fe3a68f11 100644 |
--- a/third_party/WebKit/Source/platform/graphics/CompositorElementId.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/CompositorElementId.cpp |
@@ -7,9 +7,27 @@ |
namespace blink { |
CompositorElementId CreateCompositorElementId( |
- int dom_node_id, |
+ DOMNodeId 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<DOMNodeId>::max() / kNumSubElementTypes); |
+ CompositorElementId element_id; |
+ element_id.id = dom_node_id; |
+ element_id.id = element_id.id |
suzyh_UTC10 (ex-contributor)
2017/05/08 01:04:15
Could you just write
element_id.id = dom_node_id <
chrishtr
2017/05/08 16:32:13
Done.
|
+ << 2; // Shift to make room for sub_element_id enum bits. |
+ element_id.id += static_cast<uint64_t>(sub_element_id); |
+ return element_id; |
+} |
+ |
+DOMNodeId DomNodeIdFromCompositorElementId(CompositorElementId element_id) { |
+ return element_id.id >> 2; |
+} |
+ |
+CompositorSubElementId SubElementIdFromCompositorElementId( |
suzyh_UTC10 (ex-contributor)
2017/05/08 01:04:15
Do these functions belong inside the definition of
chrishtr
2017/05/08 16:32:13
No, because that type is defined in cc and by desi
|
+ CompositorElementId element_id) { |
+ return static_cast<CompositorSubElementId>(element_id.id % |
+ kNumSubElementTypes); |
} |
} // namespace blink |