Closed Bug 4661 Opened 26 years ago Closed 26 years ago

Win32: InsertImage fails to load image and displays alternate text

Categories

(Core :: DOM: Editor, defect, P1)

x86
Windows NT
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: kinmoz, Assigned: akkzilla)

Details

This bug was originally reported as part of bug #4584. On Win32, performing an InsertImage fails to load the image. Instead, it displays the image's alternate text. Steps to reproduce: 1. run apprunner -editor 2. Place the cursor in any Non-preformatted text block. 3. Select Insert->Image from the menu. Notice how the string "[pen splat]" appears instead of the image.
Status: NEW → ASSIGNED
Priority: P3 → P1
Target Milestone: M4
Changed priority to P1, Milestone to M4, and status to Assigned.
So it looks like there are actually two problems here. The first problem is that nsHTMLImageLoader::StartLoadImage() has some _WIN32 ifdef'd code that causes it to do things different things from Linux and Mac when mLoadImageFailed is true or mURLSpec is NULL. This ifdef'd code renders the image alt text on WIN32 when the mURLSpec is NULL, and broken image on all other platforms. Why is this ifdef'd? I've Cc'd kipp and troy on this bug. The second problem is that it looks like nsHTMLImageLoader::StartLoadImage() expects all the image attributes to be set before it is called. This is not the case in nsHTMLEditor::InsertImage(). nsHTMLEditor::InsertImage() creates a node of type "IMG" adds it to the DOM tree and then set's it's attributes. The problem here is that nsHTMLImageLoader::StartLoadImage() gets called when the node is added to DOM tree so we hit the mURLSpec == NULL case. The code in nsHTMLEditor::InsertImage() needs to be rewritten to create an "IMG" node, set it's attributes and then add it to the DOM tree. Assigning to akkana@netscape.com, the author of nsHTMLEditor::InsertImage().
Assignee: kin → akkana
Status: ASSIGNED → NEW
Summary: InsertImage fails to load image and displays alternate text → Win32: InsertImage fails to load image and displays alternate text
Status: NEW → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Fixed the crasher by setting the image attributes before inserting the node into the tree; should be in the Thursday morning M4 build. Layout still doesn't obey alignment properly on win32, though (separate bug).
Status: RESOLVED → VERIFIED
verified in 4/7 build. now I see the actual pen splat image inserted so I presume this is fixed.
This bug is one of many related to alternate text of images. All these bugs have been marked. To find related bugs, search the description field for the string "[ALT]".
You need to log in before you can comment on or make changes to this bug.