HTML <img> tag emitted for icons/images with zero width/height

4 views
Skip to first unread message

Luke

unread,
Jan 27, 2023, 10:50:10 AM1/27/23
to Cappuccino & Objective-J
Running in 'debug' mode (haven't tried building with Jake yet), any icons embedded in my UI (e.g. CPButton, CPImageView) are emitted with zero width and height.  Ergo, while the rest of the wide is drawn, the image is not visible, despite the image resource being referenced and loaded correctly. 

Below is a screen capture of a CPImageView adjacent to a CPButton.  Each has an image loaded for display, but the browser content shows that the img tag has 0 values for the width and height properties.  (Note I just hacked the button size to non zero in the browser for the button, just to prove that the image was actually present). 

I've tried Safari and Chrome (on MacOS X) in case this was agent dependent, but the behaviour is the same, and while I suppose this might be the result of some style setting, it's nothing outside of the Cappuccino deployment, as this happens then just directly serving up the Cappuccino client using a temporary python web server. 


ZeroWidthImg.png

Keary Suska

unread,
Jan 27, 2023, 2:10:59 PM1/27/23
to objec...@googlegroups.com
I don’t know if this has been fixed yet but it is a bug I have had to work around. My solution was to use a category to fix image loading. It’s probably a bit of a kludge, as I am just rechecking the image size for zero size. I suspect that the issue is either in xib translation (nib2cib) or xib decoding. Can’t tell as the cib format is rather opaque.

@implementation CPImage (CPImageBugFixing)

var CPImageDelegate_imageDidLoad_ = 1 << 1,
CPImageDelegate_imageDidError_ = 1 << 2,
CPImageDelegate_imageDidAbort_ = 1 << 3;

- (void)_imageDidLoad
{
_loadStatus = CPImageLoadStatusCompleted;

// FIXME: IE is wrong on image sizes????
if (!_size || (_size.width < 1 && _size.height < 1))
_size = CGSizeMake(_image.width, _image.height);

[[CPNotificationCenter defaultCenter]
postNotificationName:CPImageDidLoadNotification
object:self];

if (_implementedDelegateMethods & CPImageDelegate_imageDidLoad_)
[_delegate imageDidLoad:self];
}

@end


HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business”
> <ZeroWidthImg.png>
>
> --
> You received this message because you are subscribed to the Google Groups "Cappuccino & Objective-J" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to objectivej+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/objectivej/8b472727-4c48-4c7c-be5b-97bde4c94130n%40googlegroups.com.
> <ZeroWidthImg.png>

Luke

unread,
Jan 27, 2023, 7:45:36 PM1/27/23
to Cappuccino & Objective-J
Wow, thanks Keary!  Worked a charm and saved me a lot of time!
Bit of a nasty bug that one and rather surprising that it hasn't been fixed in Cappuccino master yet, at least considering the apparent triviality of the issue.  
Reply all
Reply to author
Forward
0 new messages