From 4e8e109d7cc7d2e809b74b4afa170060f9e281db Mon Sep 17 00:00:00 2001 From: Aditya Bhatt Date: Sun, 16 Jun 2013 16:38:05 +0200 Subject: [PATCH] % line-height values in CSS are unreliable. Use a multiplier (1.x) type % of value in stead of %ages. --- webodf/lib/odf/Style2CSS.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/webodf/lib/odf/Style2CSS.js b/webodf/lib/odf/Style2CSS.js index 8fee4f4d..456357fe 100644 --- a/webodf/lib/odf/Style2CSS.js +++ b/webodf/lib/odf/Style2CSS.js @@ -128,7 +128,6 @@ odf.Style2CSS = function Style2CSS() { [ fons, 'background-color', 'background-color' ], [ fons, 'text-align', 'text-align' ], [ fons, 'text-indent', 'text-indent' ], - [ fons, 'line-height', 'line-height' ], [ fons, 'padding', 'padding' ], [ fons, 'padding-left', 'padding-left' ], [ fons, 'padding-right', 'padding-right' ], @@ -540,7 +539,7 @@ odf.Style2CSS = function Style2CSS() { * @return {!string} */ function getParagraphProperties(props) { - var rule = '', imageProps, url, element; + var rule = '', imageProps, url, element, value; rule += applySimpleMapping(props, paragraphPropertySimpleMapping); imageProps = props.getElementsByTagNameNS(stylens, 'background-image'); if (imageProps.length > 0) { @@ -552,6 +551,16 @@ odf.Style2CSS = function Style2CSS() { rule += applySimpleMapping(element, bgImageSimpleMapping); } } + + value = props.getAttributeNS(fons, 'line-height'); + if (value !== 'normal') { + if (value.indexOf('%') === -1) { + rule += 'line-height: ' + value + ';'; + } else { + rule += 'line-height: ' + parseFloat(value) / 100 + ';'; + } + } + return rule; }