LibWeb: Don't load fallback icon for SVG documents

Skip loading a fallback favicon if Document represents a decoded SVG.

Issue: #23405
This commit is contained in:
mobounya 2024-02-29 18:13:24 +01:00 committed by Andrew Kaster
commit bdb8af94ee
Notes: sideshowbarker 2024-07-17 20:19:08 +09:00
4 changed files with 47 additions and 34 deletions

View file

@ -107,6 +107,7 @@
#include <LibWeb/PermissionsPolicy/AutoplayAllowlist.h>
#include <LibWeb/ResizeObserver/ResizeObserver.h>
#include <LibWeb/ResizeObserver/ResizeObserverEntry.h>
#include <LibWeb/SVG/SVGDecodedImageData.h>
#include <LibWeb/SVG/SVGElement.h>
#include <LibWeb/SVG/SVGTitleElement.h>
#include <LibWeb/SVG/TagNames.h>
@ -2154,6 +2155,9 @@ void Document::update_readiness(HTML::DocumentReadyState readiness_value)
if (readiness_value == HTML::DocumentReadyState::Complete) {
auto navigable = this->navigable();
if (navigable && navigable->is_traversable()) {
if (!is_decoded_svg()) {
HTML::HTMLLinkElement::load_fallback_favicon_if_needed(*this).release_value_but_fixme_should_propagate_errors();
}
HTML::HTMLLinkElement::load_fallback_favicon_if_needed(*this).release_value_but_fixme_should_propagate_errors();
navigable->traversable_navigable()->page().client().page_did_finish_loading(url());
} else {
@ -4803,6 +4807,11 @@ void Document::for_each_shadow_root(Function<void(DOM::ShadowRoot&)>&& callback)
callback(shadow_root);
}
bool Document::is_decoded_svg() const
{
return is<Web::SVG::SVGDecodedImageData::SVGPageClient>(page().client());
}
// https://drafts.csswg.org/css-position-4/#add-an-element-to-the-top-layer
void Document::add_an_element_to_the_top_layer(JS::NonnullGCPtr<Element> element)
{