mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-11-05 20:13:03 -05:00
Dont let width: % CSS directive override minimum widths
This commit is contained in:
parent
9ce71ce76b
commit
4b3c2b6e80
@ -328,6 +328,7 @@ class Table(object):
|
|||||||
continue
|
continue
|
||||||
widths[c] = max(cellwidths)
|
widths[c] = max(cellwidths)
|
||||||
adjustable_columns, psum = [], 0.
|
adjustable_columns, psum = [], 0.
|
||||||
|
min_widths = [self.minimum_width(i)+10 for i in xrange(cols)]
|
||||||
for i in xrange(len(widths)):
|
for i in xrange(len(widths)):
|
||||||
wp = self.width_percent(i)
|
wp = self.width_percent(i)
|
||||||
if wp >= 0.:
|
if wp >= 0.:
|
||||||
@ -336,11 +337,13 @@ class Table(object):
|
|||||||
adjustable_columns.append(i)
|
adjustable_columns.append(i)
|
||||||
else:
|
else:
|
||||||
widths[i] = ceil((wp/100.) * (maxwidth - (cols-1)*self.colpad))
|
widths[i] = ceil((wp/100.) * (maxwidth - (cols-1)*self.colpad))
|
||||||
|
if widths[i] < min_widths[i]:
|
||||||
|
widths[i] = min_widths[i]
|
||||||
else:
|
else:
|
||||||
adjustable_columns.append(i)
|
adjustable_columns.append(i)
|
||||||
|
|
||||||
itercount = 0
|
itercount = 0
|
||||||
min_widths = [self.minimum_width(i)+10 for i in xrange(cols)]
|
|
||||||
while sum(widths) > maxwidth-((len(widths)-1)*self.colpad) and itercount < 100:
|
while sum(widths) > maxwidth-((len(widths)-1)*self.colpad) and itercount < 100:
|
||||||
for i in adjustable_columns:
|
for i in adjustable_columns:
|
||||||
widths[i] = ceil((95./100.)*widths[i]) if \
|
widths[i] = ceil((95./100.)*widths[i]) if \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user