LibWeb: Consolidate serialization of integral and floating point types

This consolidates serialization and deserialization of integral and
floating point types into two templated functions.
This commit is contained in:
Kenneth Myhra 2024-03-09 21:49:15 +01:00 committed by Andreas Kling
commit 57e7d6e989
Notes: sideshowbarker 2024-07-17 01:53:23 +09:00
3 changed files with 54 additions and 86 deletions

View file

@ -104,7 +104,7 @@ WebIDL::ExceptionOr<void> File::serialization_steps(HTML::SerializationRecord& r
TRY(HTML::serialize_string(vm, record, m_name));
// 4. Set serialized.[[LastModified]] to the value of values lastModified attribute.
HTML::serialize_i64(record, m_last_modified);
HTML::serialize_primitive_type(record, m_last_modified);
return {};
}
@ -126,7 +126,7 @@ WebIDL::ExceptionOr<void> File::deserialization_steps(ReadonlySpan<u32> const& r
m_name = TRY(HTML::deserialize_string(vm, record, position));
// 4. Initialize the value of values lastModified attribute to serialized.[[LastModified]].
m_last_modified = HTML::deserialize_i64(record, position);
m_last_modified = HTML::deserialize_primitive_type<i64>(record, position);
return {};
}