Improve the styling and performance of diff expansion in reviews.
Review Request #9057 — Created July 7, 2017 and submitted — Latest diff uploaded
The existing implementation of diff expansion in reviews used
JavaScript-side animations for expanding the collapsed expansion
controls in a diff on hover. As the controls expanded, the content below
the diff would get pushed down. This caused a lot of rendering on the
page, which could be slow and made scrolling through the review request
page a bit more tedious.The new implementation uses CSS transforms and transitions to shift and
scale the controls and the diff header, which allows us to expand
outward from the diff without impacting the position of the diff itself
or any of the content below it on the page. This is much faster,
resulting in a smoother animation and less jumpiness on the page.To do this, we begin the diff fragments in a collapsed state, scaling
down the controls and shifting the diff header down by the same amount.
We do this without transitions. After it's been loaded and scaled down,
transitions are enabled, which will then start taking place when the
user hovers.
Tested on Chrome, Firefox, and IE9+.
Tested with transitions fully disabled to make sure functionality
still worked.Tested with diffs containing headers just above, just below, both
above and below, and neither above nor below.