Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CSS to avoid flickering on Firefox #117

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

emilio
Copy link

@emilio emilio commented Feb 4, 2022

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant