/* NOTE: The precedence of the various properties and shorthand values
* is discussed in XSL-FO Recommendation 1.1, Section 5.2. */
/* Try the most explicit setting first, e.g. "border-before-width". */
AbstractBorderWidth abstractBorderWidth = null;
FoProperty rawPropertyType = AbstractBorderWidth.rawPropertyType(
direction);
abstractBorderWidth = (AbstractBorderWidth) getProperty(
rawPropertyType);
if (abstractBorderWidth != null) {
return abstractBorderWidth.getValue(context, fobj);
}
/* Now try the corresponding explicit value, e.g. "border-top-width". */
final DtWritingMode writingMode = this.getWritingMode(fobj, context);
final AbsoluteCompass otherDirection = writingMode.getAbsoluteDirection(
direction);
rawPropertyType = AbstractBorderWidth.rawPropertyType(otherDirection);
abstractBorderWidth = (AbstractBorderWidth) getProperty(
rawPropertyType);
if (abstractBorderWidth != null) {
return abstractBorderWidth.getValue(context, fobj);
}
/* Now try the lowest-level shorthand, e.g. "border-top". */
rawPropertyType = AbstractBorder.rawPropertyType(otherDirection);
final AbstractBorder abstractBorder = (AbstractBorder) getProperty(
rawPropertyType);
if (abstractBorder != null) {
abstractBorderWidth = abstractBorder.getBorderWidth();
if (abstractBorderWidth != null) {
return abstractBorderWidth.getValue(context, fobj);
}
}
/* Now try the next least-precise shorthand, that is, "border-width". */
final PdBorderWidth borderWidth = (PdBorderWidth) getProperty(
FoProperty.BORDER_WIDTH);
if (borderWidth != null) {
return borderWidth.getValue(context, direction, fobj);
}
/* Now try the least-precise shorthand, that is, "border". */
final AbstractBorder border = (AbstractBorder) getProperty(
FoProperty.BORDER);
if (border != null) {
abstractBorderWidth = border.getBorderWidth();
}
if (abstractBorderWidth != null) {
return abstractBorderWidth.getValue(context, fobj);
}
return AbstractBorderWidth.getValueNoInstance();
}