This commit is contained in:
jkeiser@netscape.com
2002-09-26 07:41:53 +00:00
parent 2b3ac9b57f
commit e7efa98e80
8 changed files with 884 additions and 454 deletions

View File

@@ -1649,39 +1649,47 @@ nsCSSFrameConstructor::CreateInputFrame(nsIPresShell *aPresShell,
nsIFrame *&aFrame,
nsIStyleContext *aStyleContext)
{
// Figure out which type of input frame to create
nsAutoString val;
if (NS_OK == aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::type, val)) {
if (val.EqualsIgnoreCase("submit") ||
val.EqualsIgnoreCase("reset") ||
val.EqualsIgnoreCase("button")) {
nsCOMPtr<nsIFormControl> control = do_QueryInterface(aContent);
NS_ASSERTION(control, "input is not an nsIFormControl!");
PRInt32 type;
control->GetType(&type);
switch (type) {
case NS_FORM_INPUT_SUBMIT:
case NS_FORM_INPUT_RESET:
case NS_FORM_INPUT_BUTTON:
if (UseXBLForms())
return NS_OK;
return ConstructButtonControlFrame(aPresShell, aPresContext, aFrame);
}
else if (val.EqualsIgnoreCase("checkbox")) {
case NS_FORM_INPUT_CHECKBOX:
if (UseXBLForms())
return NS_OK;
return ConstructCheckboxControlFrame(aPresShell, aPresContext, aFrame, aContent, aStyleContext);
}
else if (val.EqualsIgnoreCase("file")) {
return NS_NewFileControlFrame(aPresShell, &aFrame);
}
else if (val.EqualsIgnoreCase("hidden")) {
return NS_OK;
}
else if (val.EqualsIgnoreCase("image")) {
return NS_NewImageControlFrame(aPresShell, &aFrame);
}
else if (val.EqualsIgnoreCase("radio")) {
case NS_FORM_INPUT_RADIO:
if (UseXBLForms())
return NS_OK;
return ConstructRadioControlFrame(aPresShell, aPresContext, aFrame, aContent, aStyleContext);
}
}
// "password", "text", and all others
return ConstructTextControlFrame(aPresShell, aPresContext, aFrame, aContent);
case NS_FORM_INPUT_FILE:
return NS_NewFileControlFrame(aPresShell, &aFrame);
case NS_FORM_INPUT_HIDDEN:
return NS_OK;
case NS_FORM_INPUT_IMAGE:
return NS_NewImageControlFrame(aPresShell, &aFrame);
case NS_FORM_INPUT_TEXT:
case NS_FORM_INPUT_PASSWORD:
return ConstructTextControlFrame(aPresShell, aPresContext,
aFrame, aContent);
default:
NS_ASSERTION(0, "Unknown input type!");
return NS_ERROR_INVALID_ARG;
}
}
static PRBool