Closed Bug 684 Opened 26 years ago Closed 26 years ago

Image.setDOMAttribute("WIDTH",400); is broken

Categories

(Core :: Layout, defect, P2)

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: angus, Assigned: buster)

References

()

Details

... this would be incredibly cool for demos ... Also, if I change the SRC of an image, I'd like a way to programmatically tell it be the correct size for the new SRC (without breaking old content that assumes we won't scale, of course.) I suppose the best way to do this is to createElement with the new image and then replaceChild on the old one.
Component: Unknown → Content Model
Adding Kipp to the "CC" list - Kipp, is this affected by your recent additions to the content classes?
Status: NEW → ASSIGNED
You can now do image.width = 400. It still doesn't do the right thing, unfortunately. :( Still waiting for Kipp.
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
The attribute stuff is hooked up now. image.width and image.height should work.
QA Contact: 4137
QA Contact: 4137
QA Contact: 3849
Beth, I'm reassigning QA to you so that this can be assigned to someone who understands this... thanks!
QA Contact: 3849 → 4015
QA Contact: 4015 → 4078
Whiteboard: working on a testcase to verify...
Status: RESOLVED → REOPENED
OS: Windows NT → All
Hardware: PC → All
Summary: Image.setDOMAttribute("WIDTH",400); doesn't work yet → Image.setDOMAttribute("WIDTH",400); is broken
*PROBLEM DOM does not accurately change image width (but border width is ok.) *HAPPENS ON Redhat 5.2 i386 -- build 99032614 (march 26 1999, 2PM) MacOS 8.51 -- build 99032608 (march 26 1999, 8AM) WinNT 4.0 sp4 y2k -- build 99032614 (march 26 1999, 2PM) *STEPS TO REPRODUCE 1. start apprunner. 2. load the above URL or the included html snippet (if you're outside the firewall. 3. click on buttons 1 and 3 alot. notice the border grows and shrinks but the image stays stagnant. the image width should also change. 4. click on button 2 ('toggle image') once 5. click on grow and shrink. the border grows correctly, but the image grows far too quickly. the image width does not shrink either. *EXPECTED BEHAVIOR ImageWidth and BorderWidth should grow and shrink by 10 pixels each according to buttons depressed by the user. *ACTUAL BEHAVIOR At first, clicking the grow/shrink buttons does not affect the image width. (but affects border width, as it should) Once the toggle image button is clicked, the grow/shrink buttons sort of work. Both the height and width change, even though only height should change. Even better, the DOM would suggest that the height/width shrink when you click 'shrink', but the image grows anyway. *HTML SNIPPET: a pretty small testcase that is also available at the URL above. <HTML> <HEAD> <TITLE>bug684.html</TITLE> </HEAD> <BODY bgcolor=white> <div id="div1" border=1 height="50px"></div> <form> <input type=button onClick="changeWidth(10)" value="Grow by 10px"> <input type=button onClick="toggleImage()" value="toggle image"> <input type=button onClick="changeWidth(-10)" value="Shrink by 10px"> </form><br> <img id="mozlogo" src="/images/logo-star.gif" width=64 height=100 alt="alt src description." border=2> <SCRIPT type="text/javascript"> //<!-- imgWidth = 12; function changeWidth( delta ){ var logo = document.images.item(0); imgWidth += delta; logo.setAttribute("WIDTH", imgWidth + "px"); logo.setAttribute("BORDER", imgWidth); var bw = logo.getAttribute("BORDER"); var iw = logo.getAttribute("WIDTH"); var ih = logo.getAttribute("WIDTH"); add_comment( 'boder width, image width, image height:|'+bw+'|'+iw+'|'+ih+'|'); } function toggleImage( ){ var logo = document.images.item(0); if ( logo.getAttribute("SRC") == "") logo.setAttribute("SRC", "/images/logo-star.gif"); else logo.setAttribute("SRC", ""); } var num_els = 0; function add_comment ( comment ){ var el = document.getElementById( "div1" ); if ( num_els > 2){ el.removeChild( el.firstChild ); el.removeChild( el.firstChild ); } else num_els ++; el.appendChild( document.createTextNode(comment)); el.appendChild( document.createElement("BR")); } //--> </SCRIPT> </BODY> </HTML>
Resolution: FIXED → ---
Whiteboard: working on a testcase to verify... → Mar 26 - testcase complete.
a fix to the testcase (the URL has been updated: [in function changeWidth()] var bw = logo.getAttribute("BORDER"); var iw = logo.getAttribute("WIDTH"); var ih = logo.getAttribute("HEIGHT"); <------ was originally WIDTH...
Assignee: vidur → kipp
Status: REOPENED → NEW
Component: DOM Level 1 → Layout
The attribute notification happens correctly. We're reflowing, but the image frame code isn't doing the right thing with the size change.
Severity: normal → critical
Status: NEW → ASSIGNED
Target Milestone: M4
Target Milestone: M4 → M5
Status: ASSIGNED → RESOLVED
Closed: 26 years ago26 years ago
Resolution: --- → FIXED
Fixed. I've updated the image code to properly respond to the attribute changes in the test.
i checked this on build NT4 build 1999-04-14-12 RH5.2 1999-04-14-12 MacOS 8.51 1999-04-14-10 The image does grow and shrink as it should, and clicking the 'toggle image' button causes the image to disappear, (as it should). the new problem is the image floats up into the DIV and toggle never works again. this behavior did not happen in yesterday's builds. since today's builds are broken, i'll try again on a later build before i reopen
Whiteboard: Mar 26 - testcase complete. → waiting until 4-19 to verify
Status: RESOLVED → VERIFIED
Whiteboard: waiting until 4-19 to verify
ok. the width attribute changes as it should. i'll investigate the image toggling problem and report a bug if i dont find one in bugzilla.
You need to log in before you can comment on or make changes to this bug.