Handle adjusting cell heights properly. #1500 #1503
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.
The actual height and depth of the row is in
state.H[i]
andstate.D[i]
, but we were usingLH
andLD
, the usual line height and depth. This PR fixes that. This works if there is actual text in the cell, but if the cell is empty, the margin-bottom doesn't fall below the baseline, it sits on top of the baseline, which spoils the alignment. Also, if the height of the cell is less than the midpoint of the font, the browser adds extra height making it the midpoint of the font, and we didn't compensate for that.Both issues are resolved by adding a 1em strut to the cell (so it has content and is not too short), and compensating for that in the height adjustments. (Since the font in question was the surrounding font, it was not easy to tell where its midpoint was; this solution is independent of the surrounding font.)
Resolves issue #1500.