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

JBR-8332 SizeRequirements: Compensate for remaining unallocated span when laying out HTML tables #518

Open
wants to merge 1 commit into
base: jbr21
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ private static void expandedTile(int allocated, long min, long pref, long max,
boolean forward) {

// ---- determine what we have to work with ----
float totalPlay = Math.min(allocated - pref, max - pref);
float factor = (max - pref == 0) ? 0.0f : totalPlay / (max - pref);
long totalPlay = Math.min(allocated - pref, max - pref);
float factor = (max - pref == 0) ? 0.0f : ((float)totalPlay) / (max - pref);

// ---- make the adjustments ----
int totalOffset;
Expand All @@ -377,6 +377,10 @@ private static void expandedTile(int allocated, long min, long pref, long max,
spans[i] = (int) Math.min((long) req.preferred + (long) play, Integer.MAX_VALUE);
totalOffset = (int) Math.min((long) totalOffset + (long) spans[i], Integer.MAX_VALUE);
}
long remaining = Math.min(allocated, max) - (long)totalOffset;
if (remaining > 0) {
spans[spans.length - 1] = (int) Math.min((long) spans[spans.length - 1] + remaining, Integer.MAX_VALUE);
}
} else {
// lay out with offsets decreasing from the end of the allocation
totalOffset = allocated;
Expand Down