From 030df7432b1f6ae2c1935112894acf4431f61dbd Mon Sep 17 00:00:00 2001 From: Philip Peitsch Date: Thu, 23 Jan 2014 17:06:18 +1100 Subject: [PATCH] Include webodf-specified formatting properties by default Every existing use of this function will return better data if the system defaults are included. --- webodf/lib/odf/Formatting.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/webodf/lib/odf/Formatting.js b/webodf/lib/odf/Formatting.js index 761b2a3d..8474654d 100644 --- a/webodf/lib/odf/Formatting.js +++ b/webodf/lib/odf/Formatting.js @@ -310,7 +310,7 @@ odf.Formatting = function Formatting() { * Returns a JSON representation of the style attributes of a given style element, also containing attributes * inherited from it's ancestry - up to and including the default style for the family. * @param {!Element} styleNode - * @param {!boolean=} includeSystemDefault + * @param {!boolean=} includeSystemDefault True by default. Specify false to suppress inclusion of system defaults * @return {!Object.>} */ function getInheritedStyleAttributes(styleNode, includeSystemDefault) { @@ -344,12 +344,10 @@ odf.Formatting = function Formatting() { } // Last incorporate attributes from the built-in default style - if (includeSystemDefault) { + if (includeSystemDefault !== false) { propertiesMap = getSystemDefaultStyleAttributes(styleFamily); - if (propertiesMap) { - // All child properties should override any matching parent properties - inheritedPropertiesMap = utils.mergeObjects(propertiesMap, inheritedPropertiesMap); - } + // All child properties should override any matching parent properties + inheritedPropertiesMap = utils.mergeObjects(propertiesMap, inheritedPropertiesMap); } return inheritedPropertiesMap;