1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:17:45 +00:00

Ladybird/AppKit: Implement pasting Web data to the clipboard

This commit is contained in:
Timothy Flynn 2023-11-10 14:15:46 -05:00 committed by Andreas Kling
parent 6732a38cf8
commit 9e637de58a
3 changed files with 34 additions and 13 deletions

View file

@ -20,6 +20,8 @@ namespace Ladybird {
String ns_string_to_string(NSString*);
NSString* string_to_ns_string(StringView);
NSData* string_to_ns_data(StringView);
NSDictionary* deserialize_json_to_dictionary(StringView);
Gfx::IntRect ns_rect_to_gfx_rect(NSRect);

View file

@ -16,8 +16,12 @@ String ns_string_to_string(NSString* string)
NSString* string_to_ns_string(StringView string)
{
auto* data = [NSData dataWithBytes:string.characters_without_null_termination() length:string.length()];
return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
return [[NSString alloc] initWithData:string_to_ns_data(string) encoding:NSUTF8StringEncoding];
}
NSData* string_to_ns_data(StringView string)
{
return [NSData dataWithBytes:string.characters_without_null_termination() length:string.length()];
}
NSDictionary* deserialize_json_to_dictionary(StringView json)