Bug 456229 - Implement <input type="search">. r=smaug sr=sicking

This commit is contained in:
Mounir Lamouri 2010-05-17 12:20:22 +02:00
Родитель fdcb39e893
Коммит 397561047a
8 изменённых файлов: 27 добавлений и 12 удалений

Просмотреть файл

@ -1737,6 +1737,7 @@ nsEventStateManager::FireContextClick()
PRInt32 type = formCtrl->GetType();
allowedToDispatch = (type == NS_FORM_INPUT_TEXT ||
type == NS_FORM_INPUT_SEARCH ||
type == NS_FORM_INPUT_TEL ||
type == NS_FORM_INPUT_PASSWORD ||
type == NS_FORM_INPUT_FILE ||

Просмотреть файл

@ -57,17 +57,18 @@ class nsFormSubmission;
#define NS_FORM_INPUT_IMAGE 10
#define NS_FORM_INPUT_PASSWORD 11
#define NS_FORM_INPUT_RADIO 12
#define NS_FORM_INPUT_SUBMIT 13
#define NS_FORM_INPUT_TEL 14
#define NS_FORM_INPUT_TEXT 15
#define NS_FORM_LABEL 16
#define NS_FORM_OPTION 17
#define NS_FORM_OPTGROUP 18
#define NS_FORM_OUTPUT 19
#define NS_FORM_LEGEND 20
#define NS_FORM_SELECT 21
#define NS_FORM_TEXTAREA 22
#define NS_FORM_OBJECT 23
#define NS_FORM_INPUT_SEARCH 13
#define NS_FORM_INPUT_SUBMIT 14
#define NS_FORM_INPUT_TEL 15
#define NS_FORM_INPUT_TEXT 16
#define NS_FORM_LABEL 17
#define NS_FORM_OPTION 18
#define NS_FORM_OPTGROUP 19
#define NS_FORM_OUTPUT 20
#define NS_FORM_LEGEND 21
#define NS_FORM_SELECT 22
#define NS_FORM_TEXTAREA 23
#define NS_FORM_OBJECT 24
#define NS_IFORMCONTROL_IID \
{ 0x52dc1f0d, 0x1683, 0x4dd7, \

Просмотреть файл

@ -2624,6 +2624,7 @@ nsGenericHTMLFormElement::IsSingleLineTextControl(PRBool aExcludePassword) const
{
PRInt32 type = GetType();
return type == NS_FORM_INPUT_TEXT ||
type == NS_FORM_INPUT_SEARCH ||
type == NS_FORM_INPUT_TEL ||
(!aExcludePassword && type == NS_FORM_INPUT_PASSWORD);
}

Просмотреть файл

@ -185,6 +185,7 @@ ShouldBeInElements(nsIFormControl* aFormControl)
case NS_FORM_INPUT_RESET :
case NS_FORM_INPUT_PASSWORD :
case NS_FORM_INPUT_RADIO :
case NS_FORM_INPUT_SEARCH :
case NS_FORM_INPUT_SUBMIT :
case NS_FORM_INPUT_TEXT :
case NS_FORM_INPUT_TEL :

Просмотреть файл

@ -162,6 +162,7 @@ static const nsAttrValue::EnumTable kInputTypeTable[] = {
{ "image", NS_FORM_INPUT_IMAGE },
{ "password", NS_FORM_INPUT_PASSWORD },
{ "radio", NS_FORM_INPUT_RADIO },
{ "search", NS_FORM_INPUT_SEARCH },
{ "submit", NS_FORM_INPUT_SUBMIT },
{ "tel", NS_FORM_INPUT_TEL },
{ "text", NS_FORM_INPUT_TEXT },
@ -169,7 +170,7 @@ static const nsAttrValue::EnumTable kInputTypeTable[] = {
};
// Default type is 'text'.
static const nsAttrValue::EnumTable* kInputDefaultType = &kInputTypeTable[10];
static const nsAttrValue::EnumTable* kInputDefaultType = &kInputTypeTable[11];
#define NS_INPUT_ELEMENT_STATE_IID \
{ /* dc3b3d14-23e2-4479-b513-7b369343e3a0 */ \
@ -561,6 +562,7 @@ nsHTMLInputElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
NS_ENSURE_SUCCESS(rv, rv);
switch (mType) {
case NS_FORM_INPUT_SEARCH:
case NS_FORM_INPUT_TEXT:
case NS_FORM_INPUT_PASSWORD:
case NS_FORM_INPUT_TEL:
@ -662,6 +664,7 @@ nsHTMLInputElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
if (aName == nsGkAtoms::value &&
!GET_BOOLBIT(mBitField, BF_VALUE_CHANGED) &&
(mType == NS_FORM_INPUT_TEXT ||
mType == NS_FORM_INPUT_SEARCH ||
mType == NS_FORM_INPUT_PASSWORD ||
mType == NS_FORM_INPUT_TEL ||
mType == NS_FORM_INPUT_FILE)) {
@ -703,6 +706,7 @@ nsHTMLInputElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
// to other input types we need save the mValue into value attribute
if (mValue &&
mType != NS_FORM_INPUT_TEXT &&
mType != NS_FORM_INPUT_SEARCH &&
mType != NS_FORM_INPUT_PASSWORD &&
mType != NS_FORM_INPUT_TEL &&
mType != NS_FORM_INPUT_FILE) {
@ -2063,6 +2067,7 @@ nsHTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
(keyEvent->keyCode == NS_VK_RETURN ||
keyEvent->keyCode == NS_VK_ENTER) &&
(mType == NS_FORM_INPUT_TEXT ||
mType == NS_FORM_INPUT_SEARCH ||
mType == NS_FORM_INPUT_PASSWORD ||
mType == NS_FORM_INPUT_TEL ||
mType == NS_FORM_INPUT_FILE)) {
@ -2573,6 +2578,7 @@ nsHTMLInputElement::Reset()
SetCheckedChanged(PR_FALSE);
break;
}
case NS_FORM_INPUT_SEARCH:
case NS_FORM_INPUT_PASSWORD:
case NS_FORM_INPUT_TEXT:
case NS_FORM_INPUT_TEL:
@ -2757,6 +2763,7 @@ nsHTMLInputElement::SaveState()
// Never save passwords in session history
case NS_FORM_INPUT_PASSWORD:
break;
case NS_FORM_INPUT_SEARCH:
case NS_FORM_INPUT_TEXT:
case NS_FORM_INPUT_TEL:
case NS_FORM_INPUT_HIDDEN:
@ -2891,6 +2898,7 @@ nsHTMLInputElement::RestoreState(nsPresState* aState)
break;
}
case NS_FORM_INPUT_SEARCH:
case NS_FORM_INPUT_TEXT:
case NS_FORM_INPUT_TEL:
case NS_FORM_INPUT_HIDDEN:

Просмотреть файл

@ -217,6 +217,7 @@ EmbedContextMenuInfo::SetFormControlType(nsIDOMEventTarget *originalTarget)
break;
case NS_FORM_INPUT_SUBMIT:
break;
case NS_FORM_INPUT_SEARCH:
case NS_FORM_INPUT_TEXT:
case NS_FORM_INPUT_TEL:
mEmbedCtxType |= GTK_MOZ_EMBED_CTX_INPUT;

Просмотреть файл

@ -3304,6 +3304,7 @@ nsWebBrowserPersist::CloneNodeWithFixedUpAttributes(
nsCOMPtr<nsIDOMHTMLInputElement> outElt = do_QueryInterface(*aNodeOut);
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(*aNodeOut);
switch (formControl->GetType()) {
case NS_FORM_INPUT_SEARCH:
case NS_FORM_INPUT_TEXT:
case NS_FORM_INPUT_TEL:
nodeAsInput->GetValue(valueStr);

Просмотреть файл

@ -3628,6 +3628,7 @@ nsCSSFrameConstructor::FindInputData(nsIContent* aContent,
SIMPLE_INT_CREATE(NS_FORM_INPUT_FILE, NS_NewFileControlFrame),
SIMPLE_INT_CHAIN(NS_FORM_INPUT_IMAGE,
nsCSSFrameConstructor::FindImgControlData),
SIMPLE_INT_CREATE(NS_FORM_INPUT_SEARCH, NS_NewTextControlFrame),
SIMPLE_INT_CREATE(NS_FORM_INPUT_TEXT, NS_NewTextControlFrame),
SIMPLE_INT_CREATE(NS_FORM_INPUT_TEL, NS_NewTextControlFrame),
SIMPLE_INT_CREATE(NS_FORM_INPUT_PASSWORD, NS_NewTextControlFrame),