Open Bug 321919 Opened 19 years ago Updated 2 years ago

getPropertyValue always returns "auto" for image widths when called from onStateChange (in Extension).

Categories

(Core :: DOM: CSS Object Model, defect, P5)

x86
Windows XP
defect

Tracking

()

UNCONFIRMED

People

(Reporter: morac, Unassigned)

Details

(Keywords: testcase)

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5

To get the width or height for an image on a page, the getPropertyValue function of getComputedStyle should be used, but if an image does not have a specified width or height, the value of "auto" will always be returned when called from within an onStateChange function in an extension.  "auto" is returned even if the width and/or height is being modified by a specific style.  This is incorrect.

Reproducible: Always

Steps to Reproduce:
Here's a demonstration.  I created a test page with 3 64x64 images loaded from the same source.  The first image has no stylesheet applies to it.  The second image has it's size changed to 40x40 using CSS.  The third image has it's size changed to 40x40 and is hidden.  The page itself will dump out the values of width, style.width and getPropertyValue("width") for all 3 images.

Interesting to note, the hidden image lists it's width as 64 while the 2nd image reports it's width as 40 even though both are being resized to 40x40.  In any case the getPropertyValue is correct for all 3.

Now install the provided test extension, which for each page will open a window and dump out the same data.  Open the page and notice that in this case the getPropertyValue for width is listed as "auto" in all three cases.  
Actual Results:  
"auto" is return for getPropertyValue("width").

Attempting to close the tab after the extension reads the values will result in the browser hanging or crashing.

Expected Results:  
The same value that the page returns for getPropertyValue("width") should be returned for the extension.

I first noticed this problem with the Image Zoom Extension (http://imagezoom.yellowgorilla.net/).
Attached file Test page
Attached file Test Extension
I'm not sure, the hidden image displays the right computed style width for the testcase.
Myabe it should - just like Opera9 - return 0px for the computed style width for the hidden image.
Assignee: nobody → general
Component: General → DOM: CSSOM
Keywords: testcase
Product: Firefox → Core
QA Contact: general → ian
Version: unspecified → Trunk
"auto" is a valid return for this method, since it is a valid value of the property (the default value, in fact).  The extension should be updated to be aware of that.
Assignee: general → nobody
QA Contact: ian → general
QA Contact: general → style-system
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: