package org.apache.fop.fo.properties;
import org.apache.fop.datatypes.CompoundDatatype;
+import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.PercentBaseContext;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
/**
* @see CompoundPropertyMaker#convertProperty
*/
- public Property convertProperty(Property p, PropertyList propertyList, FObj fo)
- throws PropertyException
- {
+ public Property convertProperty(Property p,
+ PropertyList propertyList, FObj fo)
+ throws PropertyException {
+
if (p instanceof LengthRangeProperty) {
return p;
}
+
+ if (this.propId == PR_BLOCK_PROGRESSION_DIMENSION
+ || this.propId == PR_INLINE_PROGRESSION_DIMENSION) {
+ Length len = p.getLength();
+ if (len != null && len.getValue() < 0) {
+ log.warn("Replaced negative value for " + getName()
+ + " with 0mpt");
+ p = new FixedLength(0);
+ }
+ }
+
return super.convertProperty(p, propertyList, fo);
}
+
+
+ /**
+ * @see org.apache.fop.fo.properties.PropertyMaker#getSubprop()
+ */
+ protected Property setSubprop(Property baseProperty, int subpropertyId,
+ Property subproperty) {
+ CompoundDatatype val = (CompoundDatatype) baseProperty.getObject();
+ if (this.propId == PR_BLOCK_PROGRESSION_DIMENSION
+ || this.propId == PR_INLINE_PROGRESSION_DIMENSION) {
+ Length len = subproperty.getLength();
+ if (len != null && len.getValue() < 0) {
+ log.warn("Replaced negative value for " + getName()
+ + " with 0mpt");
+ val.setComponent(subpropertyId,
+ new FixedLength(0), false);
+ return baseProperty;
+ }
+ }
+ val.setComponent(subpropertyId, subproperty, false);
+ return baseProperty;
+ }
+
}
// opt is default and max is explicit or default
optimum = maximum;
}
- } else if (!optimum.isAuto() && !minimum.isAuto() &&
- optimum.getLength().getValue(context) < minimum.getLength().getValue(context)) {
+ } else if (!optimum.isAuto() && !minimum.isAuto()
+ && optimum.getLength().getValue(context)
+ < minimum.getLength().getValue(context)) {
if ((bfSet & MINSET) != 0) {
// if minimum is explicit, force opt to min
if ((bfSet & OPTSET) != 0) {
/**
* @return this.lengthRange cast as an Object
*/
- public Object getObject() {
+ protected Object getObject() {
return this;
}
<file>demo-test-failure.fo</file>\r
<description></description>\r
</testcase>\r
- <testcase>\r
- <name>Negative values on block-progression-dimension</name>\r
- <file>block-progression-dimension_negative.fo</file>\r
- <description>The code currently doesn't set negative values to 0mpt as mandated by the spec.</description>\r
- </testcase>\r
- <testcase>\r
- <name>Negative values on inline-progression-dimension</name>\r
- <file>inline-progression-dimension_negative.fo</file>\r
- <description>The code currently doesn't set negative values to 0mpt as mandated by the spec.</description>\r
- </testcase>\r
<testcase>\r
<name>Markers and core function evaluation</name>\r
<file>from-table-column_marker.fo</file>\r
<description>The code currently evaluates this function according to the column in which the \r
- marker appearsin the source document, rather than the column it is retrieved in.</description>\r
+ marker appears in the source document, rather than the column it is retrieved in.</description>\r
</testcase>\r
</disabled-testcases>\r