Fix CSS to avoid flickering on Firefox #117
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1750204 (see there for
steps to reproduce and some analysis).
I think this is a bug in the plugin, not in Firefox, and is triggered in
Firefox mostly due to timing differences on how we fire resize and timers (the
plugin triggers resizes off a setTimeout). I can get to trigger it in Chrome if
I fiddle manually with the timers.
Explanation is as follows: the resizing code reads clientHeight and
scrollHeight, and it assumes it means "desired content height" and "max scroll
height".
The later is always right, the former is not because of this rule. If the first
resize happens at a time the iframe is small (like 1px), this rule prevents the
body to get the right desired size (clamping it to 1px in that example).
This causes clientHeight to be wrong. If the timing is unfortunate, this can
gets us into an infinite resize loop because of how the resize event listeners
and timers are set up.
Ensure the clientHeight doesn't depend on the current viewport size, and thus
avoid the loops, by not clamping the html and body sizes.