pbwest 2002/10/04 19:40:31
Modified: src/org/apache/fop/datatypes/indirect Tag:
FOP_0-20-0_Alt-Design IndirectValue.java
Log:
Added adjustedPropertyValue() to generate Inherit object
if property value is unresolved.
Prevent cloning when resolve() returns an indirect value.
Revision Changes Path
No revision
No revision
1.1.2.4 +18 -4
xml-fop/src/org/apache/fop/datatypes/indirect/Attic/IndirectValue.java
Index: IndirectValue.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/org/apache/fop/datatypes/indirect/Attic/IndirectValue.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- IndirectValue.java 3 Oct 2002 12:47:23 -0000 1.1.2.3
+++ IndirectValue.java 5 Oct 2002 02:40:31 -0000 1.1.2.4
@@ -156,12 +156,15 @@
public PropertyValue resolve(FONode node) throws PropertyException {
PropertyValue pv;
if (inheritedValue == null)
- inheritedValue = node.getParentPropertyValue(sourceProperty);
+ inheritedValue = node.fromParent(sourceProperty);
if (isUnresolved(inheritedValue))
return this;
pv = inheritedValue;
// Check that the property is the same
if (property != pv.getProperty()) {
+ // Don't clone if it's another indirect value - just keep this one
+ // When the value finally resolves into a length, we will clone.
+ if (pv instanceof IndirectValue) return this;
try {
pv = (PropertyValue)(pv.clone());
} catch (CloneNotSupportedException e) {
@@ -176,6 +179,17 @@
{
return (value.getType() == PropertyValue.NUMERIC
&& ((Numeric)(value)).isPercentage());
+ }
+
+ public static PropertyValue adjustedPropertyValue(PropertyValue value)
+ throws PropertyException
+ {
+ if (isUnresolved(value)) {
+ Inherit inherit = new Inherit(value.getProperty());
+ inherit.setInheritedValue(value);
+ return inherit;
+ }
+ return value;
}
// N.B. no validation on this class - subclasses will validate
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]