mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:48:12 +00:00
LibWeb+Browser: Decode non-animated images out-of-process :^)
We now use the ImageDecoder service in LibWeb for everything except GIF images (we'll have to deal with them later, ofc.) This has a little bit of overhead but we should be able to optimize it until it becomes negligible.
This commit is contained in:
parent
b273b31c7d
commit
10255bc5c6
10 changed files with 96 additions and 25 deletions
|
@ -107,15 +107,21 @@ void Resource::did_load(Badge<ResourceLoader>, const ByteBuffer& data, const Has
|
|||
|
||||
auto content_type = headers.get("Content-Type");
|
||||
if (content_type.has_value()) {
|
||||
#ifdef RESOURCE_DEBUG
|
||||
dbg() << "Content-Type header: _" << content_type.value() << "_";
|
||||
#endif
|
||||
m_encoding = encoding_from_content_type(content_type.value());
|
||||
m_mime_type = mime_type_from_content_type(content_type.value());
|
||||
} else if (url().protocol() == "data" && !url().data_mime_type().is_empty()) {
|
||||
#ifdef RESOURCE_DEBUG
|
||||
dbg() << "This is a data URL with mime-type _" << url().data_mime_type() << "_";
|
||||
#endif
|
||||
m_encoding = "utf-8"; // FIXME: This doesn't seem nice.
|
||||
m_mime_type = url().data_mime_type();
|
||||
} else {
|
||||
#ifdef RESOURCE_DEBUG
|
||||
dbg() << "No Content-Type header to go on! Guessing based on filename...";
|
||||
#endif
|
||||
m_encoding = "utf-8"; // FIXME: This doesn't seem nice.
|
||||
m_mime_type = guess_mime_type_based_on_filename(url());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue