summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorKenneth Myhra <kennethmyhra@gmail.com>2022-08-01 19:33:27 +0200
committerLinus Groh <mail@linusgroh.de>2022-08-02 08:20:40 +0100
commit73aec263b16994df4d2dc49ec41392629d519625 (patch)
tree71445bd580c6af38a891a8f51e43cd8686ee3f4c /Userland
parentad060befad8dbdfaec4bb5af35d6b4c6a06bc42d (diff)
downloadserenity-73aec263b16994df4d2dc49ec41392629d519625.zip
LibWeb: Move is_basic_latin() to Blob.{cpp,h}
This method needs to be accessible from both Blob and File.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/FileAPI/Blob.cpp9
-rw-r--r--Userland/Libraries/LibWeb/FileAPI/Blob.h1
-rw-r--r--Userland/Libraries/LibWeb/FileAPI/File.cpp9
3 files changed, 10 insertions, 9 deletions
diff --git a/Userland/Libraries/LibWeb/FileAPI/Blob.cpp b/Userland/Libraries/LibWeb/FileAPI/Blob.cpp
index d8ba575232..c6887f89bd 100644
--- a/Userland/Libraries/LibWeb/FileAPI/Blob.cpp
+++ b/Userland/Libraries/LibWeb/FileAPI/Blob.cpp
@@ -96,6 +96,15 @@ ErrorOr<ByteBuffer> process_blob_parts(Vector<BlobPart> const& blob_parts, Optio
return bytes;
}
+bool is_basic_latin(StringView view)
+{
+ for (auto code_point : view) {
+ if (code_point < 0x0020 || code_point > 0x007E)
+ return false;
+ }
+ return true;
+}
+
Blob::Blob(ByteBuffer byte_buffer, String type)
: m_byte_buffer(move(byte_buffer))
, m_type(move(type))
diff --git a/Userland/Libraries/LibWeb/FileAPI/Blob.h b/Userland/Libraries/LibWeb/FileAPI/Blob.h
index 4bd8a56864..b9ff185a54 100644
--- a/Userland/Libraries/LibWeb/FileAPI/Blob.h
+++ b/Userland/Libraries/LibWeb/FileAPI/Blob.h
@@ -28,6 +28,7 @@ struct BlobPropertyBag {
[[nodiscard]] ErrorOr<String> convert_line_endings_to_native(String const& string);
[[nodiscard]] ErrorOr<ByteBuffer> process_blob_parts(Vector<BlobPart> const& blob_parts, Optional<BlobPropertyBag> const& options = {});
+[[nodiscard]] bool is_basic_latin(StringView view);
class Blob
: public RefCounted<Blob>
diff --git a/Userland/Libraries/LibWeb/FileAPI/File.cpp b/Userland/Libraries/LibWeb/FileAPI/File.cpp
index 9548f3f7a7..4498789aef 100644
--- a/Userland/Libraries/LibWeb/FileAPI/File.cpp
+++ b/Userland/Libraries/LibWeb/FileAPI/File.cpp
@@ -8,15 +8,6 @@
namespace Web::FileAPI {
-static bool is_basic_latin(StringView view)
-{
- for (auto code_point : view) {
- if (code_point < 0x0020 || code_point > 0x007E)
- return false;
- }
- return true;
-}
-
File::File(ByteBuffer byte_buffer, String file_name, String type, i64 last_modified)
: Blob(move(byte_buffer), move(type))
, m_name(move(file_name))