DisplayKeywords.TABLE);
addOptimizeAttribute(element, attributes.getPane());
addPaneTableAttributes(element, attributes);
StylingFactory factory = StylingFactory.getDefaultInstance();
Styles rowStyles = factory.createInheritedStyles(tableStyles,
DisplayKeywords.TABLE_ROW);
dom.openStyledElement("tr", rowStyles);
Styles cellStyles = factory.createInheritedStyles(rowStyles,
DisplayKeywords.TABLE_CELL);
// Move the padding style from the table to the cell. This is required
// because we render cell padding as a cellpadding attribute on the
// table and a padding CSS style. The cellpadding attribute is equivalent
// to the padding style on the cell - applying the style to the table
// results in the padding being set twice (once between the table and the
// cell, once between the cell and its content).
//
// Note that we must do this after opening the table since the padding
// information is required in order to specify the cellpadding attribute.
moveProperty(tableStyles, cellStyles, StylePropertyDetails.PADDING_BOTTOM);
moveProperty(tableStyles, cellStyles, StylePropertyDetails.PADDING_TOP);
moveProperty(tableStyles, cellStyles, StylePropertyDetails.PADDING_LEFT);
moveProperty(tableStyles, cellStyles, StylePropertyDetails.PADDING_RIGHT);
Element cell = dom.openStyledElement("td", cellStyles);
// Add the styles from the pane styles which were added to the table.
// todo: This will cause the text-align style on the table to be
// todo: ignored when generating the CSS (but will still be used for
// todo: detecting inherited values. This should use the cell styles
// todo: and copy the styles needed down from the table.
addPaneCellAttributes(cell, tableStyles);
// todo XDIME-CP check to see whether the tableStyles associated cannot be added to the td, if not then add the div, otherwise do not.
if (supportsStyleSheets()) {
Styles divStyles = factory.createInheritedStyles(cellStyles,
DisplayKeywords.BLOCK);
Element div = dom.openStyledElement("div", divStyles);
addCoreAttributes(div, attributes);
} else {
addCoreAttributes(element, attributes);