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

VERIFIED FIXED in M5

Status

()

Core
Layout
P2
critical
VERIFIED FIXED
20 years ago
18 years ago

People

(Reporter: Angus Davis, Assigned: buster)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

20 years ago
... 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.
(Reporter)

Updated

20 years ago
Component: Unknown → Content Model
(Reporter)

Comment 1

20 years ago
Adding Kipp to the "CC" list - Kipp, is this affected by your recent additions
to the content classes?

Updated

20 years ago
Status: NEW → ASSIGNED

Comment 2

20 years ago
You can now do image.width = 400. It still doesn't do the right thing,
unfortunately. :( Still waiting for Kipp.

Updated

20 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 20 years ago
Resolution: --- → FIXED

Comment 3

20 years ago
The attribute stuff is hooked up now. image.width and image.height should work.

Updated

20 years ago
QA Contact: 4137

Updated

19 years ago
QA Contact: 4137

Updated

19 years ago
QA Contact: 3849

Comment 4

19 years ago
Beth, I'm reassigning QA to you so that this can be assigned to someone who
understands this... thanks!

Updated

19 years ago
QA Contact: 3849 → 4015

Updated

19 years ago
QA Contact: 4015 → 4078

Updated

19 years ago
Whiteboard: working on a testcase to verify...

Updated

19 years ago
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

Comment 5

19 years ago
*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>

Updated

19 years ago
Resolution: FIXED → ---

Updated

19 years ago
Whiteboard: working on a testcase to verify... → Mar 26 - testcase complete.

Comment 6

19 years ago
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...

Updated

19 years ago
Assignee: vidur → kipp
Status: REOPENED → NEW
Component: DOM Level 1 → Layout

Comment 7

19 years ago
The attribute notification happens correctly. We're reflowing, but the image
frame code isn't doing the right thing with the size change.

Updated

19 years ago
Severity: normal → critical
Status: NEW → ASSIGNED

Updated

19 years ago
Target Milestone: M4

Updated

19 years ago
Target Milestone: M4 → M5

Updated

19 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 20 years ago19 years ago
Resolution: --- → FIXED

Comment 8

19 years ago
Fixed. I've updated the image code to properly respond to the attribute changes
in the test.

Comment 9

19 years ago
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

Updated

19 years ago
Whiteboard: Mar 26 - testcase complete. → waiting until 4-19 to verify

Updated

19 years ago
Status: RESOLVED → VERIFIED
Whiteboard: waiting until 4-19 to verify

Comment 10

19 years ago
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.