You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ad...@apache.org on 2007/09/21 18:27:35 UTC
svn commit: r578197 -
/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/PropertyList.java
Author: adelmelle
Date: Fri Sep 21 09:27:33 2007
New Revision: 578197
URL: http://svn.apache.org/viewvc?rev=578197&view=rev
Log:
Fix behavior of from-nearest-specified-value(): the value should be that of 'the closest ancestor', so the iteration should start with the parent PropertyList.
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/PropertyList.java
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/PropertyList.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/PropertyList.java?rev=578197&r1=578196&r2=578197&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/PropertyList.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/PropertyList.java Fri Sep 21 09:27:33 2007
@@ -183,21 +183,24 @@
* @param propId The ID of the property whose value is desired.
* @return The computed value if the property is explicitly set on some
* ancestor of the current FO, else the initial value.
- * @throws PropertyException ...
+ * @throws PropertyException if there an error occurred when getting the property
*/
public Property getNearestSpecified(int propId) throws PropertyException {
Property p = null;
-
- for (PropertyList plist = this; p == null && plist != null;
- plist = plist.parentPropertyList) {
- p = plist.getExplicit(propId);
- }
-
- if (p == null) {
- // If no explicit setting found, return initial (default) value.
- p = makeProperty(propId);
+ PropertyList pList = parentPropertyList;
+
+ while (pList != null) {
+ p = pList.getExplicit(propId);
+ if (p != null) {
+ return p;
+ } else {
+ pList = pList.parentPropertyList;
+ }
}
- return p;
+
+ // If no explicit value found on any of the ancestor-nodes,
+ // return initial (default) value.
+ return makeProperty(propId);
}
/**
@@ -574,7 +577,7 @@
*/
public CommonBorderPaddingBackground getBorderPaddingBackgroundProps()
throws PropertyException {
- return new CommonBorderPaddingBackground(this, getFObj());
+ return new CommonBorderPaddingBackground(this);
}
/**
@@ -583,7 +586,7 @@
* @throws PropertyException if there's a problem while processing the properties
*/
public CommonHyphenation getHyphenationProps() throws PropertyException {
- return new CommonHyphenation(this);
+ return CommonHyphenation.getInstance(this);
}
/**
@@ -643,12 +646,13 @@
/**
- * Constructs a CommonFont object.
+ * Constructs a CommonFont object.
+ *
* @return A CommonFont object
* @throws PropertyException if there's a problem while processing the properties
*/
public CommonFont getFontProps() throws PropertyException {
- return new CommonFont(this);
+ return CommonFont.getInstance(this);
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org