[patch] Cannot display embedded svg images if 'type' is specified

Koos Vriezen koos.vriezen at xs4all.nl
Sat Nov 22 16:40:48 GMT 2003


On Tue, 18 Nov 2003, Koos Vriezen wrote:

> On Mon, Nov 17, 2003 at 04:50:49PM +0000, Adrian Page wrote:
> > On Sunday 16 November 2003 11:58, Koos Vriezen wrote:
> > > Wouln't it be better to either remove the "image/" special case (and let
> > > khtmlimage show it for gif/png/jpeg), or have at least a
> > > 'static bool RenderImage::supportMimeType(QString)'? This goes for
> > > "image/x-eps" as well.
> >
> > It looks like the special case was added for performance reasons, though I'm
> > not that familiar with khtml. Having a supportMimeType() sounds like a better
> > solution. I had assumed that svg was the only exception.
>
> Looking at kdelibs/mimetypes/image, I think there are more.
> I guess 'if (KImageIO::typeForMime(serviceType) != QString::null)' would cover it.

Like the one attached. Can someone confirm this is correct, that if
KImageIO::typeForMime(serviceType) returns a valid QString it can display
it also. With my install, image/x-eps returns EPS but fails to render it
properly (for an eps that works fine with kghostview).


 >
> Koos
-------------- next part --------------
Index: html/html_objectimpl.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/html/html_objectimpl.cpp,v
retrieving revision 1.116
diff -u -3 -p -r1.116 html_objectimpl.cpp
--- html/html_objectimpl.cpp	11 Nov 2003 03:39:06 -0000	1.116
+++ html/html_objectimpl.cpp	22 Nov 2003 16:34:48 -0000
@@ -30,7 +30,9 @@
 #include <qvariant.h>
 #include <qmap.h>
 #include <qtimer.h>
+
 #include <kdebug.h>
+#include <kimageio.h>
 
 #include "xml/dom_docimpl.h"
 #include "css/cssstyleselector.h"
@@ -191,7 +193,8 @@ void HTMLObjectBaseElementImpl::attach()
         _style->display() != NONE)
     {
         needWidgetUpdate = false;
-        bool imagelike = serviceType.startsWith("image/");
+        bool imagelike = serviceType.startsWith("image/") &&
+                         (KImageIO::typeForMime(serviceType) != QString::null);
         if (imagelike) {
             m_render = new (getDocument()->renderArena()) RenderImage(this);
             // make sure we don't attach the inner contents


More information about the kfm-devel mailing list