Truly independent web browser
LibWeb: Show an image opened on its own over a light gray backdrop
sideshowbarker9344a9b90ae7
diff --git a/Libraries/LibWeb/DOM/DocumentLoading.cpp b/Libraries/LibWeb/DOM/DocumentLoading.cppindex 756320dd6cc..3e9f8e2d21f 100644--- a/Libraries/LibWeb/DOM/DocumentLoading.cpp+++ b/Libraries/LibWeb/DOM/DocumentLoading.cpp@@ -391,7 +391,7 @@ static WebIDL::ExceptionOr<GC::Ref<DOM::Document>> load_media_document(HTML::Navimage_element = as<HTML::HTMLImageElement>(*img_element);// Auto margins center an image that fits and keep overflow reachable from the top-left corner.set_host_element_style(*document->body(), u"display: flex; min-height: 100vh; margin: 0;"sv);- set_host_element_style(img_element, u"flex: none; max-width: 100vw; max-height: 100vh; margin: auto; background-color: #fff;"sv);+ set_host_element_style(img_element, u"flex: none; max-width: 100vw; max-height: 100vh; margin: auto; background-color: hsl(0, 0%, 90%);"sv);img_element->set_attribute_value(HTML::AttributeNames::src, url_utf16);TRY(document->body()->append_child(img_element));TRY(insert_title(document, url_string));diff --git a/Tests/LibWeb/Text/expected/HTML/image-document-content-security-policy.txt b/Tests/LibWeb/Text/expected/HTML/image-document-content-security-policy.txtindex 07e7bc460fb..16ae4ce332a 100644--- a/Tests/LibWeb/Text/expected/HTML/image-document-content-security-policy.txt+++ b/Tests/LibWeb/Text/expected/HTML/image-document-content-security-policy.txt@@ -1,5 +1,6 @@Image size: 120x120Root background: rgb(34, 34, 34)Image position: static+Image background: rgb(230, 230, 230)Other image: blocked by img-srcSame image: blocked by img-srcdiff --git a/Tests/LibWeb/Text/input/HTML/image-document-content-security-policy.html b/Tests/LibWeb/Text/input/HTML/image-document-content-security-policy.htmlindex 9d793a6e950..a6b8da8073c 100644--- a/Tests/LibWeb/Text/input/HTML/image-document-content-security-policy.html+++ b/Tests/LibWeb/Text/input/HTML/image-document-content-security-policy.html@@ -14,6 +14,7 @@println(`Image size: ${image.naturalWidth}x${image.naturalHeight}`);println(`Root background: ${getComputedStyle(imageDocument.documentElement).backgroundColor}`);println(`Image position: ${getComputedStyle(image).position}`);+ println(`Image background: ${getComputedStyle(image).backgroundColor}`);const loadImage = url => new Promise(resolve => {imageDocument.addEventListener("securitypolicyviolation", event => resolve(`blocked by ${event.effectiveDirective}`), { once: true });