ReplacedElement re = super.createReplacedElement(c, box, uac, cssWidth,
cssHeight);
if (re == null
&& c.getNamespaceHandler() instanceof XhtmlNamespaceHandler
&& !c.isPrint()) {
XhtmlNamespaceHandler nsh = (XhtmlNamespaceHandler) c
.getNamespaceHandler();
Element e = box.getElement();
if (e == null) {
return null;
}
// form controls
// first check if the control already exists
if (_controls != null) {
re = (ReplacedElement) _controls.get(e);
}
if (re != null) {
if (re instanceof FormControlReplacementElement) {
// update the size
((FormControlReplacementElement) re).calculateSize(c, box
.getStyle(), cssWidth, cssHeight);
}
return re;
}
// not found, try to create one
Element parentForm = getParentForm(e, c);
// parentForm may be null, this is not a problem
XhtmlForm form = (XhtmlForm) _forms.get(parentForm);
if (form == null) {
form = nsh.createForm(parentForm);
_forms.put(parentForm, form);
}
FormControl control = form.createControl(e);
if (control == null) {