return null;
}
if (textElement.isLeaf())
{
final AttributeSet attributes = textElement.getAttributes();
if (HTML.Tag.IMG.equals(attributes.getAttribute(StyleConstants.NameAttribute)))
{
final Element result = new Element();
result.setName(textElement.getName());
result.setElementType(ContentType.INSTANCE);
final String src = (String) attributes.getAttribute(HTML.Attribute.SRC);
final String alt = (String) attributes.getAttribute(HTML.Attribute.TITLE);
result.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, convertURL(src));
result.setAttribute(AttributeNames.Html.NAMESPACE, AttributeNames.Html.TITLE, alt);
result.setAttribute(AttributeNames.Html.NAMESPACE, AttributeNames.Swing.TOOLTIP, alt);
if (attributes.isDefined(HTML.Attribute.WIDTH) &&
attributes.isDefined(HTML.Attribute.HEIGHT))
{
result.getStyle().setStyleProperty(ElementStyleKeys.SCALE, Boolean.TRUE);
result.getStyle().setStyleProperty(ElementStyleKeys.KEEP_ASPECT_RATIO, Boolean.FALSE);
result.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH,
parseLength(String.valueOf(attributes.getAttribute(HTML.Attribute.WIDTH))));
result.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT,
parseLength(String.valueOf(attributes.getAttribute(HTML.Attribute.HEIGHT))));
}
else if (attributes.isDefined(HTML.Attribute.WIDTH))
{
result.getStyle().setStyleProperty(ElementStyleKeys.SCALE, Boolean.TRUE);
result.getStyle().setStyleProperty(ElementStyleKeys.KEEP_ASPECT_RATIO, Boolean.TRUE);
result.getStyle().setStyleProperty(ElementStyleKeys.MIN_WIDTH,
parseLength(String.valueOf(attributes.getAttribute(HTML.Attribute.WIDTH))));
result.getStyle().setStyleProperty(ElementStyleKeys.DYNAMIC_HEIGHT, Boolean.TRUE);
}
else if (attributes.isDefined(HTML.Attribute.HEIGHT))
{
result.getStyle().setStyleProperty(ElementStyleKeys.SCALE, Boolean.TRUE);
result.getStyle().setStyleProperty(ElementStyleKeys.KEEP_ASPECT_RATIO, Boolean.TRUE);
result.getStyle().setStyleProperty(ElementStyleKeys.MIN_HEIGHT,
parseLength(String.valueOf(attributes.getAttribute(HTML.Attribute.HEIGHT))));
result.getStyle().setStyleProperty(ElementStyleKeys.DYNAMIC_HEIGHT, Boolean.TRUE);
}
else
{
result.getStyle().setStyleProperty(ElementStyleKeys.SCALE, Boolean.FALSE);