mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Base vertical space on height instead of width
This commit is contained in:
parent
2d9f59f4dc
commit
7e100ac515
@ -385,7 +385,7 @@ class Style(object):
|
|||||||
@property
|
@property
|
||||||
def width(self):
|
def width(self):
|
||||||
if self._width is None:
|
if self._width is None:
|
||||||
result = None
|
width = None
|
||||||
base = None
|
base = None
|
||||||
parent = self._get_parent()
|
parent = self._get_parent()
|
||||||
if parent is not None:
|
if parent is not None:
|
||||||
@ -396,9 +396,9 @@ class Style(object):
|
|||||||
width = self._element.attrib['width']
|
width = self._element.attrib['width']
|
||||||
elif 'width' in self._style:
|
elif 'width' in self._style:
|
||||||
width = self._style['width']
|
width = self._style['width']
|
||||||
else:
|
if not width or width == 'auto':
|
||||||
result = base
|
result = base
|
||||||
if not result:
|
else:
|
||||||
result = self._unit_convert(width, base=base)
|
result = self._unit_convert(width, base=base)
|
||||||
self._width = result
|
self._width = result
|
||||||
return self._width
|
return self._width
|
||||||
@ -406,7 +406,7 @@ class Style(object):
|
|||||||
@property
|
@property
|
||||||
def height(self):
|
def height(self):
|
||||||
if self._height is None:
|
if self._height is None:
|
||||||
result = None
|
height = None
|
||||||
base = None
|
base = None
|
||||||
parent = self._get_parent()
|
parent = self._get_parent()
|
||||||
if parent is not None:
|
if parent is not None:
|
||||||
@ -417,9 +417,9 @@ class Style(object):
|
|||||||
height = self._element.attrib['height']
|
height = self._element.attrib['height']
|
||||||
elif 'height' in self._style:
|
elif 'height' in self._style:
|
||||||
height = self._style['height']
|
height = self._style['height']
|
||||||
else:
|
if not height or height == 'auto':
|
||||||
result = base
|
result = base
|
||||||
if not result:
|
else:
|
||||||
result = self._unit_convert(height, base=base)
|
result = self._unit_convert(height, base=base)
|
||||||
self._height = result
|
self._height = result
|
||||||
return self._height
|
return self._height
|
||||||
@ -445,6 +445,26 @@ class Style(object):
|
|||||||
self._lineHeight = result
|
self._lineHeight = result
|
||||||
return self._lineHeight
|
return self._lineHeight
|
||||||
|
|
||||||
|
@property
|
||||||
|
def marginTop(self):
|
||||||
|
return self._unit_convert(
|
||||||
|
self._get('margin-top'), base=self.height)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def marginBottom(self):
|
||||||
|
return self._unit_convert(
|
||||||
|
self._get('margin-bottom'), base=self.height)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def paddingTop(self):
|
||||||
|
return self._unit_convert(
|
||||||
|
self._get('padding-top'), base=self.height)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def paddingBottom(self):
|
||||||
|
return self._unit_convert(
|
||||||
|
self._get('padding-bottom'), base=self.height)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
items = self._style.items()
|
items = self._style.items()
|
||||||
items.sort()
|
items.sort()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user