@@ -22,7 +22,7 @@ namespace Microsoft.AspNetCore.Components.RenderTree
22
22
//
23
23
// Represents an entry in a tree of user interface (UI) items.
24
24
[ StructLayout ( LayoutKind . Explicit , Pack = 4 ) ]
25
- public readonly struct RenderTreeFrame
25
+ public struct RenderTreeFrame
26
26
{
27
27
// Note that the struct layout has to be valid in both 32-bit and 64-bit runtime platforms,
28
28
// which means that all reference-type fields need to take up 8 bytes (except for the last
@@ -53,12 +53,12 @@ public readonly struct RenderTreeFrame
53
53
/// positions of the instructions that inserted the frames. Sequence numbers are only
54
54
/// comparable within the same sequence (typically, the same source method).
55
55
/// </summary>
56
- [ FieldOffset ( 0 ) ] public readonly int Sequence ;
56
+ [ FieldOffset ( 0 ) ] public int Sequence ;
57
57
58
58
/// <summary>
59
59
/// Describes the type of this frame.
60
60
/// </summary>
61
- [ FieldOffset ( 4 ) ] public readonly RenderTreeFrameType FrameType ;
61
+ [ FieldOffset ( 4 ) ] public RenderTreeFrameType FrameType ;
62
62
63
63
// --------------------------------------------------------------------------------
64
64
// RenderTreeFrameType.Element
@@ -69,19 +69,19 @@ public readonly struct RenderTreeFrame
69
69
/// gets the number of frames in the subtree for which this frame is the root.
70
70
/// The value is zero if the frame has not yet been closed.
71
71
/// </summary>
72
- [ FieldOffset ( 8 ) ] public readonly int ElementSubtreeLength ;
72
+ [ FieldOffset ( 8 ) ] public int ElementSubtreeLength ;
73
73
74
74
/// <summary>
75
75
/// If the <see cref="FrameType"/> property equals <see cref="RenderTreeFrameType.Element"/>,
76
76
/// gets a name representing the type of the element. Otherwise, the value is undefined.
77
77
/// </summary>
78
- [ FieldOffset ( 16 ) ] public readonly string ElementName ;
78
+ [ FieldOffset ( 16 ) ] public string ElementName ;
79
79
80
80
/// <summary>
81
81
/// If the <see cref="FrameType"/> property equals <see cref="RenderTreeFrameType.Element"/>,
82
82
/// gets the element's diffing key, or null if none was specified.
83
83
/// </summary>
84
- [ FieldOffset ( 24 ) ] public readonly object ElementKey ;
84
+ [ FieldOffset ( 24 ) ] public object ElementKey ;
85
85
86
86
// --------------------------------------------------------------------------------
87
87
// RenderTreeFrameType.Text
@@ -91,7 +91,7 @@ public readonly struct RenderTreeFrame
91
91
/// If the <see cref="FrameType"/> property equals <see cref="RenderTreeFrameType.Text"/>,
92
92
/// gets the content of the text frame. Otherwise, the value is undefined.
93
93
/// </summary>
94
- [ FieldOffset ( 16 ) ] public readonly string TextContent ;
94
+ [ FieldOffset ( 16 ) ] public string TextContent ;
95
95
96
96
// --------------------------------------------------------------------------------
97
97
// RenderTreeFrameType.Attribute
@@ -101,27 +101,27 @@ public readonly struct RenderTreeFrame
101
101
/// If the <see cref="FrameType"/> property equals <see cref="RenderTreeFrameType.Attribute"/>
102
102
/// gets the ID of the corresponding event handler, if any.
103
103
/// </summary>
104
- [ FieldOffset ( 8 ) ] public readonly ulong AttributeEventHandlerId ;
104
+ [ FieldOffset ( 8 ) ] public ulong AttributeEventHandlerId ;
105
105
106
106
/// <summary>
107
107
/// If the <see cref="FrameType"/> property equals <see cref="RenderTreeFrameType.Attribute"/>,
108
108
/// gets the attribute name. Otherwise, the value is undefined.
109
109
/// </summary>
110
- [ FieldOffset ( 16 ) ] public readonly string AttributeName ;
110
+ [ FieldOffset ( 16 ) ] public string AttributeName ;
111
111
112
112
/// <summary>
113
113
/// If the <see cref="FrameType"/> property equals <see cref="RenderTreeFrameType.Attribute"/>,
114
114
/// gets the attribute value. Otherwise, the value is undefined.
115
115
/// </summary>
116
- [ FieldOffset ( 24 ) ] public readonly object AttributeValue ;
116
+ [ FieldOffset ( 24 ) ] public object AttributeValue ;
117
117
118
118
/// <summary>
119
119
/// If the <see cref="FrameType"/> property equals <see cref="RenderTreeFrameType.Attribute"/>,
120
120
/// and the attribute represents an event handler, gets the name of another attribute whose value
121
121
/// can be updated to represent the UI state prior to executing the event handler. This is
122
122
/// primarily used in two-way bindings.
123
123
/// </summary>
124
- [ FieldOffset ( 32 ) ] public readonly string AttributeEventUpdatesAttributeName ;
124
+ [ FieldOffset ( 32 ) ] public string AttributeEventUpdatesAttributeName ;
125
125
126
126
// --------------------------------------------------------------------------------
127
127
// RenderTreeFrameType.Component
@@ -132,31 +132,31 @@ public readonly struct RenderTreeFrame
132
132
/// gets the number of frames in the subtree for which this frame is the root.
133
133
/// The value is zero if the frame has not yet been closed.
134
134
/// </summary>
135
- [ FieldOffset ( 8 ) ] public readonly int ComponentSubtreeLength ;
135
+ [ FieldOffset ( 8 ) ] public int ComponentSubtreeLength ;
136
136
137
137
/// <summary>
138
138
/// If the <see cref="FrameType"/> property equals <see cref="RenderTreeFrameType.Component"/>,
139
139
/// gets the child component instance identifier.
140
140
/// </summary>
141
- [ FieldOffset ( 12 ) ] public readonly int ComponentId ;
141
+ [ FieldOffset ( 12 ) ] public int ComponentId ;
142
142
143
143
/// <summary>
144
144
/// If the <see cref="FrameType"/> property equals <see cref="RenderTreeFrameType.Component"/>,
145
145
/// gets the type of the child component.
146
146
/// </summary>
147
- [ FieldOffset ( 16 ) ] public readonly Type ComponentType ;
147
+ [ FieldOffset ( 16 ) ] public Type ComponentType ;
148
148
149
149
/// <summary>
150
150
/// If the <see cref="FrameType"/> property equals <see cref="RenderTreeFrameType.Component"/>,
151
151
/// gets the child component state object. Otherwise, the value is undefined.
152
152
/// </summary>
153
- [ FieldOffset ( 24 ) ] internal readonly ComponentState ComponentState ;
153
+ [ FieldOffset ( 24 ) ] internal ComponentState ComponentState ;
154
154
155
155
/// <summary>
156
156
/// If the <see cref="FrameType"/> property equals <see cref="RenderTreeFrameType.Component"/>,
157
157
/// gets the component's diffing key, or null if none was specified.
158
158
/// </summary>
159
- [ FieldOffset ( 32 ) ] public readonly object ComponentKey ;
159
+ [ FieldOffset ( 32 ) ] public object ComponentKey ;
160
160
161
161
/// <summary>
162
162
/// If the <see cref="FrameType"/> property equals <see cref="RenderTreeFrameType.Component"/>,
@@ -173,7 +173,7 @@ public readonly struct RenderTreeFrame
173
173
/// gets the number of frames in the subtree for which this frame is the root.
174
174
/// The value is zero if the frame has not yet been closed.
175
175
/// </summary>
176
- [ FieldOffset ( 8 ) ] public readonly int RegionSubtreeLength ;
176
+ [ FieldOffset ( 8 ) ] public int RegionSubtreeLength ;
177
177
178
178
// --------------------------------------------------------------------------------
179
179
// RenderTreeFrameType.ElementReferenceCapture
@@ -183,13 +183,13 @@ public readonly struct RenderTreeFrame
183
183
/// If the <see cref="FrameType"/> property equals <see cref="RenderTreeFrameType.ElementReferenceCapture"/>,
184
184
/// gets the ID of the reference capture. Otherwise, the value is undefined.
185
185
/// </summary>
186
- [ FieldOffset ( 16 ) ] public readonly string ElementReferenceCaptureId ;
186
+ [ FieldOffset ( 16 ) ] public string ElementReferenceCaptureId ;
187
187
188
188
/// <summary>
189
189
/// If the <see cref="FrameType"/> property equals <see cref="RenderTreeFrameType.ElementReferenceCapture"/>,
190
190
/// gets the action that writes the reference to its target. Otherwise, the value is undefined.
191
191
/// </summary>
192
- [ FieldOffset ( 24 ) ] public readonly Action < ElementReference > ElementReferenceCaptureAction ;
192
+ [ FieldOffset ( 24 ) ] public Action < ElementReference > ElementReferenceCaptureAction ;
193
193
194
194
// --------------------------------------------------------------------------------
195
195
// RenderTreeFrameType.ComponentReferenceCapture
@@ -205,13 +205,13 @@ public readonly struct RenderTreeFrame
205
205
/// initialization logic in RenderTreeDiffBuilder to walk the frames hierarchically, then it would know
206
206
/// the parent index at the point where it wants to initialize the ComponentReferenceCapture frame.
207
207
/// </summary>
208
- [ FieldOffset ( 8 ) ] public readonly int ComponentReferenceCaptureParentFrameIndex ;
208
+ [ FieldOffset ( 8 ) ] public int ComponentReferenceCaptureParentFrameIndex ;
209
209
210
210
/// <summary>
211
211
/// If the <see cref="FrameType"/> property equals <see cref="RenderTreeFrameType.ComponentReferenceCapture"/>,
212
212
/// gets the action that writes the reference to its target. Otherwise, the value is undefined.
213
213
/// </summary>
214
- [ FieldOffset ( 16 ) ] public readonly Action < object > ComponentReferenceCaptureAction ;
214
+ [ FieldOffset ( 16 ) ] public Action < object > ComponentReferenceCaptureAction ;
215
215
216
216
// --------------------------------------------------------------------------------
217
217
// RenderTreeFrameType.Markup
@@ -221,7 +221,7 @@ public readonly struct RenderTreeFrame
221
221
/// If the <see cref="FrameType"/> property equals <see cref="RenderTreeFrameType.Markup"/>,
222
222
/// gets the content of the markup frame. Otherwise, the value is undefined.
223
223
/// </summary>
224
- [ FieldOffset ( 16 ) ] public readonly string MarkupContent ;
224
+ [ FieldOffset ( 16 ) ] public string MarkupContent ;
225
225
226
226
// Element constructor
227
227
private RenderTreeFrame ( int sequence , int elementSubtreeLength , string elementName , object elementKey )
@@ -336,12 +336,13 @@ internal static RenderTreeFrame ElementReferenceCapture(int sequence, Action<Ele
336
336
internal static RenderTreeFrame ComponentReferenceCapture ( int sequence , Action < object > componentReferenceCaptureAction , int parentFrameIndex )
337
337
=> new RenderTreeFrame ( sequence , componentReferenceCaptureAction : componentReferenceCaptureAction , parentFrameIndex : parentFrameIndex ) ;
338
338
339
+ /*
339
340
internal RenderTreeFrame WithElementSubtreeLength(int elementSubtreeLength)
340
341
=> new RenderTreeFrame(Sequence, elementSubtreeLength: elementSubtreeLength, ElementName, ElementKey);
341
342
342
343
internal RenderTreeFrame WithComponentSubtreeLength(int componentSubtreeLength)
343
344
=> new RenderTreeFrame(Sequence, componentSubtreeLength: componentSubtreeLength, ComponentType, ComponentState, ComponentKey);
344
-
345
+ */
345
346
internal RenderTreeFrame WithAttributeSequence ( int sequence )
346
347
=> new RenderTreeFrame ( sequence , attributeName : AttributeName , AttributeValue , AttributeEventHandlerId , AttributeEventUpdatesAttributeName ) ;
347
348
0 commit comments