if (styleSheet.getBooleanStyleProperty(ElementStyleKeys.KEEP_ASPECT_RATIO) &&
(contentWidth > 0 && contentHeight > 0))
{
final double scaleFactor = Math.min(nodeWidth / (double) contentWidth, nodeHeight / (double) contentHeight);
styleBuilder.append(WIDTH_STYLE, pointConverter.format
(HtmlPrinter.fixLengthForSafari(StrictGeomUtility.toExternalValue((long) (contentWidth * scaleFactor)),
safariLengthFix)), PT_UNIT);
styleBuilder.append(HEIGHT_STYLE, pointConverter.format
(HtmlPrinter.fixLengthForSafari(StrictGeomUtility.toExternalValue((long) (contentHeight * scaleFactor)),
safariLengthFix)), PT_UNIT);