From 473f3a0931c4cb47010454e47c4cf599f80eb54b Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 28 Dec 2023 10:18:00 +0100 Subject: [PATCH] LibWeb: Stop rendering the src (URL) as image alt attribute fallback If an image element has no alt attribute, other browsers don't fall back to using the src attribute like we did. This gave us a janky look while loading pages that other browsers don't have, and it's not like seeing a partial URL is really helpful to the user anyway. --- Userland/Libraries/LibWeb/Painting/ImagePaintable.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/Painting/ImagePaintable.cpp b/Userland/Libraries/LibWeb/Painting/ImagePaintable.cpp index 1b75d56d5e..4fd523a3c0 100644 --- a/Userland/Libraries/LibWeb/Painting/ImagePaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/ImagePaintable.cpp @@ -58,8 +58,6 @@ void ImagePaintable::paint(PaintContext& context, PaintPhase phase) const context.recording_painter().set_font(Platform::FontPlugin::the().default_font()); context.recording_painter().paint_frame(enclosing_rect, context.palette(), Gfx::FrameStyle::SunkenContainer); auto alt = image_element.get_attribute_value(HTML::AttributeNames::alt); - if (alt.is_empty()) - alt = image_element.get_attribute_value(HTML::AttributeNames::src); context.recording_painter().draw_text(enclosing_rect, alt, Gfx::TextAlignment::Center, computed_values().color(), Gfx::TextElision::Right); } else if (auto bitmap = layout_box().image_provider().current_image_bitmap(image_rect.size().to_type())) { ScopedCornerRadiusClip corner_clip { context, image_rect, normalized_border_radii_data(ShrinkRadiiForBorders::Yes) };