Summary: | Part of page incorrectly aligned when inserting an empty beforeLoad listener | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | famlam <fam.lam> | ||||||
Component: | UI Events | Assignee: | Nobody <webkit-unassigned> | ||||||
Status: | RESOLVED CONFIGURATION CHANGED | ||||||||
Severity: | Normal | CC: | aestes, ahmad.saleem792, ap, bfulgham, brent.montrose, eason.goodale, fam.lam, jberlin, rniwa, simon.fraser, zalan | ||||||
Priority: | P2 | ||||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | Unspecified | ||||||||
OS: | Windows 7 | ||||||||
URL: | http://highslide.com/examples/gallery-horizontal-strip.html | ||||||||
Attachments: |
|
Description
famlam
2011-12-13 15:02:07 PST
Created attachment 119168 [details]
Minimized test case
I can confirm the bug, minimized test case (no longer requiring an extension) is attached. Took me a while to figure this out but what this site does apparently:
* It preloads thumbnail images.
* When the user clicks an image it fills the thumbnail row with new images using the same src as for preloaded images.
* It expects the offsetWidth for the thumbnail row to be correct immediately after inserting the images.
It's that last step that fails - if a beforeload event handler is present the width is reported as if the width of all images were zero. That's what the testcase demonstrate: if you create a copy of a preloaded image and insert it into a table then the reported offsetWidth of the image container is usually immediately correct, not if you have a beforeload event listener however.
The strange thing is: if you test img2.width you will get the correct value before offsetWidth of the container is accessed and zero afterwards. I guess that accessing offsetWidth triggers a reflow and something goes wrong there.
Sorry to bring this up from the dead, but is there a fix planned? I am able to reproduce this bug in Safari 15.6 on macOS 12.5 on using attached test case and following instruction and by putting beforeload event, the image contain width becomes "2" rather than "102" as before and other browsers (Chrome Canary 106 and Firefox Nightly 105) does not change width even if event is added. Although it is fixed in Safari Technical Preview 151 and it does not change the image width. Since it is fixed, I am going to mark this "RESOLVED CONFIGURATION CHANGED". I don't know what fixed it but appreciate if someone can comment and share some input. Thanks! |