After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 324796 - python gtkhtml2 can't show small gif image bug
python gtkhtml2 can't show small gif image bug
Status: RESOLVED DUPLICATE of bug 118872
Product: gtkhtml2
Classification: Deprecated
Component: General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Rodney Dawes
Rodney Dawes
Depends on:
Blocks:
 
 
Reported: 2005-12-22 11:59 UTC by rubensr
Modified: 2005-12-25 02:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test that causes testgtkhtml to behave incorrectly (17.05 KB, application/x-compressed-tar)
2005-12-24 02:30 UTC, rubensr
Details

Description rubensr 2005-12-22 11:59:31 UTC
+++ This bug was initially created as a clone of Bug #118872 +++

python+gtkhtml2 can't show small size gif file.
But small size jpeg file, normal size(190bytes)gif file show ok.
and C+gtkhtml2 show everythings ok.
example) http://msrv.yahoo.co.kr/engdic/images/54.gif (65 bytes)

-------------------------------------------------------------------

This is still happening, but looking at the python bindings, I could not find any reason why small images would not show up (the bindings simply map
to the C functions, no complex conversions or anything).

This problem happens in gnochm, which uses the python bindings, but since I am no expert in gtkhtml2, I could not trace the issue further.

Here are the steps to reproduce this in gnochm (I am the maintainer):

1. Download and open this CHM document in GnoCHM:
http://download.microsoft.com/download/d/e/e/deed938b-25ac-4943-8dba-cfc78d05a2ff/hwlogo2.chm

2. In GnoCHM's 'Contents' tab, open the node for
'Chapter 1 - Introduction to Windows Logo Program for
Hardware' then select the 'How to Use This Document'
child node.

3. Scroll down in the gtkhtml view pane. You should see
empty image placeholders to the left of each 'Click to
launch' hyperlink. The missing images are small
embedded GIFs which are rendered properly when the
document is viewed with xCHM.

Since every other image in the file works fine, I am suspecting gtkthml2 might
be the reason for this issue.

Please contact me for any additional information you need.
Comment 1 Rodney Dawes 2005-12-22 15:16:49 UTC
It looks like a problem with the code according to the duplicate bug. I' marking this as a duplicate. Python bindings bugs should be filed against the bindings though, not gtkhtml2 itself. The product for that is gnome-python-extras.

*** This bug has been marked as a duplicate of 118872 ***
Comment 2 rubensr 2005-12-23 07:15:54 UTC
Could someone please *at least* have a look at the gtkhtml2 code and give me a reasonable explanation *why* small images work differently to large images?
All other images work fine on my application, only small ones crash.

I already mentioned in my report that it does not look like the pygtk code is
causing this because the bindings do not make any distinction between large or small files.

If I call stream.close() as indicated in the original bug report for pygtk,
it breaks the rest of the page!

*Please* can someone help instead of just assume I am wrong?
Comment 3 Rodney Dawes 2005-12-23 14:45:39 UTC
Crash? I've seen no reports of a crash. You are reporting an image simply doesn't load. You need to close the stream for the image, when it is finished loading, not the stream for the document. Small images work perfectly fine for me in C. The gtkhtml code does not make any distinction between file sizes. It simply shoves the buffer into a GdkPixbuf.

If there's a crash in libgtkhtml2 then please get a backtrace. Perhaps someone could attach an actual HTML example that doesn't work in testgtkhtml? All images that actually exist, load just fine for me in testgtkhtml and encompass. The size is irrelevant.

One can't help without being able to reproduce the problem. All signs so far point to the problem being a coding error. It's not an assumption, it's what the facts point at. If I make a test.html that simply includes the image URL listed at the beginning of this bug report, and load it in testgtkhtml, it works fine. So far, this seems to be an issue with gnochm, not gtkhtml2.
Comment 4 rubensr 2005-12-24 02:30:32 UTC
Created attachment 56352 [details]
Test that causes testgtkhtml to behave incorrectly

Ok here is the example. It seems to somehow be related to the CSS, but I am not sure. If I load this in testgtkhtml, the images are shown, but the font somehow does not seem right (it looks crappy), and the paragraphs where the little icons are shown are off the visible canvas.
When I close the stream, this is what I get in gnochm. If I dont close the stream, I dont get the small (< 100 bytes) images, but the page (and fonts) render properly.
Comment 5 rubensr 2005-12-24 02:32:00 UTC
By the way, these files (in the attachment) render properly in Firefox and in the KDE html control.
Comment 6 Rodney Dawes 2005-12-25 01:08:17 UTC
So. The CSS file specifies -18.0pt for the left margin on the list elements that were drawing off the left edge of the canvas. This is technically correct, as CSS2 does not specify what the behavior of negative values are for margins, but does specify that negative values are permissable. However, I will concede that it looks like crap, and whoever wrote that CSS needs to be slapped with a very large fish. For the CSS2 specification for margin properties, see:

http://www.w3.org/TR/REC-CSS2/box.html

I've committed a fix to ignore margin values that are less than 0. However, it still stands that images work. It actually didn't render correctly without closing the stream, since the CSS did not get applied. In the future, please report additional bugs, in separate bug reports, rather than adding comments to an unrelated bug report because you were not happy with its closure. :)
Comment 7 rubensr 2005-12-25 02:13:50 UTC
Ok thanks for fixing this. As per your other comments:

1. I dont care what the CSS spec is or says - I (and my users) just want gtkhtml2 to work like the other HTML controls. It's not going to change anything for me. People will still complain about CHM files not being displayed correctly, and will not accept 'the CSS is not good enough' as an answer. And eventually they will use KDE or something else.

2. I did not know what the source of the bug was - as I mentioned already, large images work (or seem to work). Nobody complained about it for 3 years. When I started closing the stream, the page looked like crap. Even the fonts were stuffed. If *you* suspect the error is being caused by something else, I would expect to hear constructive suggestions.