Fix border sizes around thumbnails #5596
Merged
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 PR fixes two issues:
1. Thumbnail borders do not have the same width in all directions
Currently, the thumbnail border width is [7, 5, 6, 7]px in [top, right, bottom, left] direction. This is because the thumbnail canvas has a 1px border which is not accounted for in the size of the div element around it (which would explain a border size of [7, 5, 5, 7]px). The remaining pixel difference is because the size of the thumbnail canvas and its surrounding div is set as a fractional number, whose fractional part is ignored by the canvas element but respected by the div element. This PR ensures a 7px border width by taking the canvas border into account and setting an integer height to canvas and its surrounding div element.
2. Thumbnails jump up and down by a few pixels whenever a new thumbnail is loaded.
Thumbnails currently have a different size, depending on whether or not the "data-loaded" tag is set.
This PR adjust the CSS style of the not([data-loaded]) elements so that its size matches the other ones.
(The not([data-loaded]) elements have a 1px dashed border, whose size must be subtracted).
The second fix works perfectly for the tracemonkey paper, but images still move if pages have different aspect ratio. Nevertheless, there is much less movement than before.