You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Width of container with IFrame inside resets when a link in the IFrame is clicked #12554
Width of container with IFrame inside resets when a link in the IFrame is clicked. The issue only occurs when the container has a transition on the width property.
There is an IFrame in a container 'strip'. The IFrame is styled to have a width and height of 100% of the container.
When the page loads, JavaScript expands the container width to 100vw. The issue occurs whens clicking a link inside the IFrame. This causes the parent container to unexpectedly revert to the original width, 'resetting' the width property that had been applied with JavaScript.
The parent container has a CSS transition on the width property so that the initial change of width to 100vw is animated. Crucially, removing this CSS transition stops the container collapsing when clicking a link in the IFrame, suggesting that the issue is related to the transition property.
<!doctype html><html><head><metacharset="utf-8" /><style>.container{width:120px;background-color: red;transition: background-color 2s ease-in-out;/* Commenting out this transition property stops the issue occuring*/}</style><script>window.addEventListener('load',function(){varcontainer=document.querySelector('.container');container.style.backgroundColor="black";});window.setInterval(function(){varcontainer=document.querySelector('.container');console.log(window.getComputedStyle(container).backgroundColor);},100);</script></head><body><articleclass="container"><div>a</div></article><ahref="#" onclick="document.getElementsByTagName('div')[0].innerHTML = 'b'">click me</a></body></html>
Current working theory: the fact that getComputedValues() isn't changed by the transition (which is also a bug, by the way) is related to this bug. We're cloning the Arc corresponding to this DOM node, attaching it to the fragment. We perform the animation on the fragment's copy, but not on the node's. When we rebuild the fragment without restyling it, we make a new clone of the node's computed style, which has not been updated by the animation, thus reverting it.
@notriddle getComputedStyle may be a separate bug, since the original one was fixed by turning off incremental layout, but the most recent test case is not.
Activity
jdm commentedon Jul 22, 2016
Reduced:
jdm commentedon Jul 22, 2016
Interestingly, this doesn't reproduce if incremental layout is disabled (using
-i).jdm commentedon Jul 25, 2016
@notriddle I've been flailing around in the layout code trying to figure this out and getting nowhere. Are you interested in taking a crack at it?
jdm commentedon Jul 25, 2016
The furthest I got was determining that forcing https://dxr.mozilla.org/servo/rev/24d621145ca9e689b442c6f6afb3a247ab40fc5f/components/style/traversal.rs#168 to execute made the problem disappear.
notriddle commentedon Jul 25, 2016
Yes, I'm interested.
notriddle commentedon Jul 25, 2016
Seems to be a generic bug related to all replaced content:
notriddle commentedon Jul 26, 2016
It also applies to a similarly setup test with color instead of width.
notriddle commentedon Jul 26, 2016
It also has nothing to do with replaced content:
Current working theory: the fact that getComputedValues() isn't changed by the transition (which is also a bug, by the way) is related to this bug. We're cloning the Arc corresponding to this DOM node, attaching it to the fragment. We perform the animation on the fragment's copy, but not on the node's. When we rebuild the fragment without restyling it, we make a new clone of the node's computed style, which has not been updated by the animation, thus reverting it.
jdm commentedon Jul 27, 2016
@notriddle getComputedStyle may be a separate bug, since the original one was fixed by turning off incremental layout, but the most recent test case is not.
Auto merge of #12623 - notriddle:master, r=<try>
Auto merge of #12623 - notriddle:master, r=emilio