aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/fo/PropertyList.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/fop/fo/PropertyList.java')
-rw-r--r--src/java/org/apache/fop/fo/PropertyList.java34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/java/org/apache/fop/fo/PropertyList.java b/src/java/org/apache/fop/fo/PropertyList.java
index 4ec6ec26d..6d4dbd43c 100644
--- a/src/java/org/apache/fop/fo/PropertyList.java
+++ b/src/java/org/apache/fop/fo/PropertyList.java
@@ -183,21 +183,24 @@ public abstract class PropertyList {
* @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 abstract class PropertyList {
*/
public CommonBorderPaddingBackground getBorderPaddingBackgroundProps()
throws PropertyException {
- return new CommonBorderPaddingBackground(this, getFObj());
+ return new CommonBorderPaddingBackground(this);
}
/**
@@ -583,7 +586,7 @@ public abstract class PropertyList {
* @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 @@ public abstract class PropertyList {
/**
- * 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);
}
/**