// rendering a pane table which will always be optimised then we need
// to keep the style value as we know that the HTML will be thown away.
// See 2005110903/2005113024.
//
// Default to removing the width: after creating the HTML version.
PropertyHandler widthRenderer = widthHandler;
// If we are rendering a pane table..
if (table) {
// and if we are always going to optimise this pane table
String optimize = getOptimizeAttributeValue(attributes.getPane());
if (OptimizationConstants.OPTIMIZE_ALWAYS.equals(optimize)) {
// Then do not remove the width: after creating the HTML
// version.
// todo: better: maybe we do not need to bother rendering width
// into the html at all since it will be discarded anyway?
widthRenderer = tableWidthChecker;
} else {
widthRenderer = tableWidthHandler;
}
}
// TODO: should this significance check be done automagically by
// the handler? (and by extension, all handlers?)
// TODO: investigate to see if we need render table and non-table
// widths differently as was done in pre 3.5 versions. This may require
// refactoring the significance checking out of PropertyHandler into
// a higher level object so that we can define a different significance
// for both pane tables and cells.
// NOTE: significant check must be done before getAsString because the
// latter is destructive.
final boolean significant = widthRenderer.isSignificant(styles);
String value;
if ((value = widthRenderer.getAsString(styles)) != null) {
if (significant) {
element.setAttribute("width", value);
} else {
// throw away the value otherwise it stays in the theme
// and will be used by CSS aware browsers to override