Change image size with javascript on first load gives very flat picture, on reload ok

NEW
Unassigned

Status

()

9 years ago
9 years ago

People

(Reporter: mail, Unassigned)

Tracking

({regression, testcase})

Trunk
x86
All
regression, testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(3 attachments)

(Reporter)

Description

9 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE; rv:1.4) Gecko/20030619 Netscape/7.1 (ax)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE; rv:1.4) Gecko/20030619 Netscape/7.1 (ax)

On a web page I change the sizes of images with javascript according to screen size.
Part of the javascript is:
      var altebreite = bild.width;
      var altehoehe  = bild.height;
       ...
      bild.width  = neuebreite;
      bild.height = neuehoehe;
When I apply this to a HTML-page that is first loaded in this session of Firefox (3.0.11), the height of the pictures is very small. On "reload" all is fine.
This obviously happens with all graphics that had not been loaded before in the same session, not with others.
More details: the HTML code contain "width=", but not "height=".
Changing width resp. height only if the old values are unequal to zero does not help.
The problem does not occur in Internet Explorer 8 and Opera 9.51.
It is reproducable as described.


Reproducible: Always

Steps to Reproduce:
1. load http://www.gueltsteiner-tor.de/Wuerfe/M-Wurf/M-Wurf-Test-bug.htm
2.  press "reload"
3.  The javascript is in http://www.gueltsteiner-tor.de/JavaScript/JavaScript-Bildanpassungs-Funktionen-bug.js


Expected Results:  
Should have done the same as after "reload" in the first place

Updated

9 years ago
Assignee: nobody → general
Status: UNCONFIRMED → NEW
Component: General → JavaScript Engine
Ever confirmed: true
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → Trunk
Confirmed on Windows Vista.
Regression range is http://bonsai.mozilla.org/cvsquery.cgi?module=PhoenixTinderbox&date=explicit&mindate=1170830280&maxdate=1170835619
Probably Bug 177805.
Assignee: general → nobody
Component: JavaScript Engine → Layout
Keywords: regression
QA Contact: general → layout

Updated

9 years ago
Depends on: 177805
OS: Windows XP → All

Updated

9 years ago
Blocks: 177805
No longer depends on: 177805
(Reporter)

Comment 2

9 years ago
Created attachment 385699 [details]
More information on the bug

Additional information on the problem, that I forgot to mention:
When I added an "alert" to show the width and height values read and to be stored, they looked as expected, and only the first graphic was distorted.
When checking for "bild.complete==true" only the first graphic showed false (and resultet in an alert), and only the first graphic was distorted.
So very likely a timing problem. However, a simple (CPU-intensive) wait for 10 ms
did not solve the problem.
Kind regards, Gerhard Müller

Comment 3

9 years ago
Gerhard, could you please attach a reduced test case with the least ammount of code needed to reproduce this bug?  That would help get this bug fixed as quickly as possible.

Comment 4

9 years ago
Gerhard, in reply to your email response: "I did not succeed in creating a new attachment to the bugzilla file,
but attached please find a reduced minimal test case.

This is what I wanted to add as attachment

File:
As attached

Description:
A reduced minimal test consisting of .html and .jpg file zipped by 7-Zip"

Could you attach the html file and for the images just link to lets say the google logo (http://www.google.com/intl/en_ALL/images/logo.gif) or the bugzilla logo (http://www.bugzilla.org/img/buggie.png), just some image that isn't likely to go missing.

I can attach the zip when I get home but having just the html file is easier to test and more people are likely to test without having to download and unzip files.
(Reporter)

Comment 5

9 years ago
Created attachment 385784 [details]
A testcase with minimal code for this problem

Testcase (.htm-file) with (almost) minimal lines of code.
It uses a graphic from the internet.
Funnily enough, this testcase shows the same problem with Internet Explorer 8 and Opera 9.51 as well - and with IE a reload does not even help!
With my original (large) file the problem occurred only with Firefox.
Kind regards, Gerhard Mueller

Comment 6

9 years ago
FWIW, The attached test WFM with IE7 at work.

Updated

9 years ago
Keywords: testcase
(Reporter)

Comment 7

9 years ago
Created attachment 386735 [details]
A circumvention for the bug that works in most cases

The testcase I mailed in earlier with a wait (setTimeout) of 500 ms before execution. It works in most cases - seemingly not when the download time for the picture ist slow in comparison to the browser speed.
Kind regards, Gerhard Mueller
You need to log in before you can comment on or make changes to this bug.