Sfoglia il codice sorgente

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.
Andreas Kling 1 anno fa
parent
commit
473f3a0931
1 ha cambiato i file con 0 aggiunte e 2 eliminazioni
  1. 0 2
      Userland/Libraries/LibWeb/Painting/ImagePaintable.cpp

+ 0 - 2
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().set_font(Platform::FontPlugin::the().default_font());
             context.recording_painter().paint_frame(enclosing_rect, context.palette(), Gfx::FrameStyle::SunkenContainer);
             context.recording_painter().paint_frame(enclosing_rect, context.palette(), Gfx::FrameStyle::SunkenContainer);
             auto alt = image_element.get_attribute_value(HTML::AttributeNames::alt);
             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);
             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<int>())) {
         } else if (auto bitmap = layout_box().image_provider().current_image_bitmap(image_rect.size().to_type<int>())) {
             ScopedCornerRadiusClip corner_clip { context, image_rect, normalized_border_radii_data(ShrinkRadiiForBorders::Yes) };
             ScopedCornerRadiusClip corner_clip { context, image_rect, normalized_border_radii_data(ShrinkRadiiForBorders::Yes) };