From 0cc7a43ded42fe73c3e7ad78a63542070304c1a2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 12 Jun 2013 11:23:45 +0530 Subject: [PATCH] DOCX: Fix partially broken style cascading Style cascading for font sizes was not working fully because of premature evaluation of run css while checking the borders. --- src/calibre/ebooks/docx/char_styles.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/calibre/ebooks/docx/char_styles.py b/src/calibre/ebooks/docx/char_styles.py index 77a131da9c..512999afaf 100644 --- a/src/calibre/ebooks/docx/char_styles.py +++ b/src/calibre/ebooks/docx/char_styles.py @@ -235,16 +235,5 @@ class RunStyle(object): return self._css def same_border(self, other): - for x in (self, other): - has_border = False - for y in ('color', 'style', 'width'): - if ('border-%s' % y) in x.css: - has_border = True - break - if not has_border: - return False - - s = tuple(self.css.get('border-%s' % y, None) for y in ('color', 'style', 'width')) - o = tuple(other.css.get('border-%s' % y, None) for y in ('color', 'style', 'width')) - return s == o + return self.get_border_css({}) == other.get_border_css({})