Bug 17967

Summary: image ALT text not shown when image loading is disabled
Product: WebKit Reporter: Alan Jenkins <alan-jenkins>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: webkit
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Test case
none
Proposed fix hyatt: review-

Description Alan Jenkins 2008-03-20 07:00:18 PDT
This is the ALT attribute of the IMG tag.

The HTML specification implies that this text should be shown to users "who have configured their graphical user agents not to display images" <http://www.w3.org/TR/REC-html40/struct/objects.html#h-13.8>.

Firefox and Opera do this; WebKit should do so too.  It's a useful feature for limiting bandwidth requirements.  Personally I found it very useful when browsing Ubuntu's Launchpad over dialup and though HTTPS.

I have reproduced this bug in svn r31157 on linux, both Qt and Gtk ports.  The bug is in core code, not platform specific.

This is a longstanding bug from KHTML which has yet to be fixed in WebKit.
Also at Kubuntu Launchpad <https://bugs.launchpad.net/bugs/136348>.
Also at KDE bugzilla <http://bugs.kde.org/show_bug.cgi?id=145224>.
Comment 1 Alan Jenkins 2008-03-20 07:07:56 PDT
Created attachment 19897 [details]
Test case

Here's an example of an image with ALT text.

Note that if you try this in Firefox you need to access it via http.  If you use file:// then the image will load even if you disable image loading.
Comment 2 Alan Jenkins 2008-03-20 07:20:30 PDT
Created attachment 19898 [details]
Proposed fix

Regression tests aren't running under linux :-(.  I've tried to follow the rest of the code submission guidelines though.

Build and run-tested, on linux Qt and Gtk.  Does more or less what it's supposed to.  It's not ideal - Firefox has a better solution, where it almost looks like the ALT text is made into a text node and completely replaces the image.  In particular, the ALT text for inline images will not have the same baseline as the surrounding text.  It's much better than doing nothing though.
Comment 3 Dave Hyatt 2008-04-22 22:39:01 PDT
Comment on attachment 19898 [details]
Proposed fix

You didn't mean to turn off image autoloading in the QTLauncher did you?

This patch will need to be updated to reflect the changes that made generated content wrap the cached image... you might need a virtual stillNeedsLoad method on RenderImage (similar to errorOccurred).
Comment 4 Robert Blaut 2008-06-13 11:37:25 PDT

*** This bug has been marked as a duplicate of 5566 ***