From 9d382c1d90116ce27917af5020608be1225e3f8b Mon Sep 17 00:00:00 2001 From: "Andreas L. Delmelle" Date: Wed, 15 Feb 2006 15:06:06 +0000 Subject: [PATCH] Added default empty String to the border-* shorthands. Added warning for the case where inherit is used, but no value is available from the parent. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@378017 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/fo/FOPropertyMapping.java | 7 +++++++ .../apache/fop/fo/properties/PropertyMaker.java | 14 ++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/java/org/apache/fop/fo/FOPropertyMapping.java b/src/java/org/apache/fop/fo/FOPropertyMapping.java index afa83e99c..476810715 100644 --- a/src/java/org/apache/fop/fo/FOPropertyMapping.java +++ b/src/java/org/apache/fop/fo/FOPropertyMapping.java @@ -2640,30 +2640,35 @@ public class FOPropertyMapping implements Constants { // border-bottom m = new ListProperty.Maker(PR_BORDER_BOTTOM); m.setInherited(false); + m.setDefault(""); m.setDatatypeParser(new GenericShorthandParser()); addPropertyMaker("border-bottom", m); // border-color m = new ListProperty.Maker(PR_BORDER_COLOR); m.setInherited(false); + m.setDefault(""); m.setDatatypeParser(new BoxPropShorthandParser()); addPropertyMaker("border-color", m); // border-left m = new ListProperty.Maker(PR_BORDER_LEFT); m.setInherited(false); + m.setDefault(""); m.setDatatypeParser(new GenericShorthandParser()); addPropertyMaker("border-left", m); // border-right m = new ListProperty.Maker(PR_BORDER_RIGHT); m.setInherited(false); + m.setDefault(""); m.setDatatypeParser(new GenericShorthandParser()); addPropertyMaker("border-right", m); // border-style m = new ListProperty.Maker(PR_BORDER_STYLE); m.setInherited(false); + m.setDefault(""); m.setDatatypeParser(new BoxPropShorthandParser()); addPropertyMaker("border-style", m); @@ -2677,12 +2682,14 @@ public class FOPropertyMapping implements Constants { // border-top m = new ListProperty.Maker(PR_BORDER_TOP); m.setInherited(false); + m.setDefault(""); m.setDatatypeParser(new GenericShorthandParser()); addPropertyMaker("border-top", m); // border-width m = new ListProperty.Maker(PR_BORDER_WIDTH); m.setInherited(false); + m.setDefault(""); m.setDatatypeParser(new BoxPropShorthandParser()); addPropertyMaker("border-width", m); diff --git a/src/java/org/apache/fop/fo/properties/PropertyMaker.java b/src/java/org/apache/fop/fo/properties/PropertyMaker.java index caf9f87bb..d46950a45 100644 --- a/src/java/org/apache/fop/fo/properties/PropertyMaker.java +++ b/src/java/org/apache/fop/fo/properties/PropertyMaker.java @@ -413,6 +413,12 @@ public class PropertyMaker implements Cloneable { if ((propId & Constants.COMPOUND_MASK) != 0) { newProp = getSubprop(newProp, propId & Constants.COMPOUND_MASK); } + if (newProp.getString() == null) { + log.warn("Specified value of \"inherit\" for " + + FOPropertyMapping.getPropertyName(getPropId()) + " on " + + propertyList.getFObj().getName() + ", but no " + + "inherited or specified value found on the parent FO."); + } } else { // Check for keyword shorthand values to be substituted. pvalue = checkValueKeywords(pvalue); @@ -477,13 +483,13 @@ public class PropertyMaker implements Cloneable { // If value is a name token, may be keyword or Enum String sval = prop.getNCname(); if (sval != null) { - log.debug("Convert shorthand ncname " + sval); + //log.debug("Convert shorthand ncname " + sval); pret = checkEnumValues(sval); if (pret == null) { /* Check for keyword shorthand values to be substituted. */ String pvalue = checkValueKeywords(sval); if (!pvalue.equals(sval)) { - log.debug("Convert shorthand keyword" + pvalue); + //log.debug("Convert shorthand keyword" + pvalue); // Substituted a value: must parse it Property p = PropertyParser.parse(pvalue, new PropertyInfo(this, @@ -525,8 +531,8 @@ public class PropertyMaker implements Cloneable { * file specifies a length value equivalent for these keywords, * such as "0.5pt" for "thin". * @param keyword the string value of property attribute. - * @return a String containing a parseable equivalent or null if - * the passed value isn't a keyword initializer for this Property. + * @return a String containing a parseable equivalent or null if + * the passed value isn't a keyword initializer for this Property */ protected String checkValueKeywords(String keyword) { if (keywords != null) { -- 2.39.5