Open Bug 1404419 Opened 3 years ago Updated 3 years ago

Setting Object.data sometimes scrolls long page slightly up

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

UNCONFIRMED

People

(Reporter: crimsteam, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0
Build ID: 20170628075643

Steps to reproduce:

I see that setting Object.data to image type sometimes scrolls page slightly up (don't check other file type - only image). On actuall Nightly this is less visible, but it still happens. I also test other browser (Chrome, IE6-IE11, Edge and Opera Presto) and no one has this behaviour. When we have a long page this autojumping is annoing.

Example code:
<object data="bridge.jpg" type="image/jpeg" id="obj">Alternate content</object>
<a href="#" onclick="document.getElementById('obj').data = 'other.jpg'; return false;">Click me!</a>

Here is a live example (but not in english version):
http://webref.pl/przyklady/html/ramki/lokalne/przyklad9/iframe.htm
Just click few times on links in blue box (below img), but firstly scroll the page to the bottom.
Priority: -- → P3
Presumably the main issue is that we transition into a loading state, in which the object does not represent an image, do a layout in that state, the page ends up a lot shorter, we clamp the scroll position.  Then the loads come in, we see they're images, transition back to image state, get our new size, the page gets longer, but the scroll position is now smaller than it used to be.  You'd have the same thing happen if you just went to display:none and then back (with a layout flush in the "none" state)...
You need to log in before you can comment on or make changes to this bug.