Bug 456229 - Implement <input type="search">. r=smaug sr=sicking
This commit is contained in:
Родитель
a41b45d79b
Коммит
89e8757c9c
|
@ -1737,6 +1737,7 @@ nsEventStateManager::FireContextClick()
|
||||||
PRInt32 type = formCtrl->GetType();
|
PRInt32 type = formCtrl->GetType();
|
||||||
|
|
||||||
allowedToDispatch = (type == NS_FORM_INPUT_TEXT ||
|
allowedToDispatch = (type == NS_FORM_INPUT_TEXT ||
|
||||||
|
type == NS_FORM_INPUT_SEARCH ||
|
||||||
type == NS_FORM_INPUT_TEL ||
|
type == NS_FORM_INPUT_TEL ||
|
||||||
type == NS_FORM_INPUT_PASSWORD ||
|
type == NS_FORM_INPUT_PASSWORD ||
|
||||||
type == NS_FORM_INPUT_FILE ||
|
type == NS_FORM_INPUT_FILE ||
|
||||||
|
|
|
@ -57,17 +57,18 @@ class nsFormSubmission;
|
||||||
#define NS_FORM_INPUT_IMAGE 10
|
#define NS_FORM_INPUT_IMAGE 10
|
||||||
#define NS_FORM_INPUT_PASSWORD 11
|
#define NS_FORM_INPUT_PASSWORD 11
|
||||||
#define NS_FORM_INPUT_RADIO 12
|
#define NS_FORM_INPUT_RADIO 12
|
||||||
#define NS_FORM_INPUT_SUBMIT 13
|
#define NS_FORM_INPUT_SEARCH 13
|
||||||
#define NS_FORM_INPUT_TEL 14
|
#define NS_FORM_INPUT_SUBMIT 14
|
||||||
#define NS_FORM_INPUT_TEXT 15
|
#define NS_FORM_INPUT_TEL 15
|
||||||
#define NS_FORM_LABEL 16
|
#define NS_FORM_INPUT_TEXT 16
|
||||||
#define NS_FORM_OPTION 17
|
#define NS_FORM_LABEL 17
|
||||||
#define NS_FORM_OPTGROUP 18
|
#define NS_FORM_OPTION 18
|
||||||
#define NS_FORM_OUTPUT 19
|
#define NS_FORM_OPTGROUP 19
|
||||||
#define NS_FORM_LEGEND 20
|
#define NS_FORM_OUTPUT 20
|
||||||
#define NS_FORM_SELECT 21
|
#define NS_FORM_LEGEND 21
|
||||||
#define NS_FORM_TEXTAREA 22
|
#define NS_FORM_SELECT 22
|
||||||
#define NS_FORM_OBJECT 23
|
#define NS_FORM_TEXTAREA 23
|
||||||
|
#define NS_FORM_OBJECT 24
|
||||||
|
|
||||||
#define NS_IFORMCONTROL_IID \
|
#define NS_IFORMCONTROL_IID \
|
||||||
{ 0x52dc1f0d, 0x1683, 0x4dd7, \
|
{ 0x52dc1f0d, 0x1683, 0x4dd7, \
|
||||||
|
|
|
@ -2624,6 +2624,7 @@ nsGenericHTMLFormElement::IsSingleLineTextControl(PRBool aExcludePassword) const
|
||||||
{
|
{
|
||||||
PRInt32 type = GetType();
|
PRInt32 type = GetType();
|
||||||
return type == NS_FORM_INPUT_TEXT ||
|
return type == NS_FORM_INPUT_TEXT ||
|
||||||
|
type == NS_FORM_INPUT_SEARCH ||
|
||||||
type == NS_FORM_INPUT_TEL ||
|
type == NS_FORM_INPUT_TEL ||
|
||||||
(!aExcludePassword && type == NS_FORM_INPUT_PASSWORD);
|
(!aExcludePassword && type == NS_FORM_INPUT_PASSWORD);
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,6 +185,7 @@ ShouldBeInElements(nsIFormControl* aFormControl)
|
||||||
case NS_FORM_INPUT_RESET :
|
case NS_FORM_INPUT_RESET :
|
||||||
case NS_FORM_INPUT_PASSWORD :
|
case NS_FORM_INPUT_PASSWORD :
|
||||||
case NS_FORM_INPUT_RADIO :
|
case NS_FORM_INPUT_RADIO :
|
||||||
|
case NS_FORM_INPUT_SEARCH :
|
||||||
case NS_FORM_INPUT_SUBMIT :
|
case NS_FORM_INPUT_SUBMIT :
|
||||||
case NS_FORM_INPUT_TEXT :
|
case NS_FORM_INPUT_TEXT :
|
||||||
case NS_FORM_INPUT_TEL :
|
case NS_FORM_INPUT_TEL :
|
||||||
|
|
|
@ -162,6 +162,7 @@ static const nsAttrValue::EnumTable kInputTypeTable[] = {
|
||||||
{ "image", NS_FORM_INPUT_IMAGE },
|
{ "image", NS_FORM_INPUT_IMAGE },
|
||||||
{ "password", NS_FORM_INPUT_PASSWORD },
|
{ "password", NS_FORM_INPUT_PASSWORD },
|
||||||
{ "radio", NS_FORM_INPUT_RADIO },
|
{ "radio", NS_FORM_INPUT_RADIO },
|
||||||
|
{ "search", NS_FORM_INPUT_SEARCH },
|
||||||
{ "submit", NS_FORM_INPUT_SUBMIT },
|
{ "submit", NS_FORM_INPUT_SUBMIT },
|
||||||
{ "tel", NS_FORM_INPUT_TEL },
|
{ "tel", NS_FORM_INPUT_TEL },
|
||||||
{ "text", NS_FORM_INPUT_TEXT },
|
{ "text", NS_FORM_INPUT_TEXT },
|
||||||
|
@ -169,7 +170,7 @@ static const nsAttrValue::EnumTable kInputTypeTable[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Default type is 'text'.
|
// Default type is 'text'.
|
||||||
static const nsAttrValue::EnumTable* kInputDefaultType = &kInputTypeTable[10];
|
static const nsAttrValue::EnumTable* kInputDefaultType = &kInputTypeTable[11];
|
||||||
|
|
||||||
#define NS_INPUT_ELEMENT_STATE_IID \
|
#define NS_INPUT_ELEMENT_STATE_IID \
|
||||||
{ /* dc3b3d14-23e2-4479-b513-7b369343e3a0 */ \
|
{ /* dc3b3d14-23e2-4479-b513-7b369343e3a0 */ \
|
||||||
|
@ -561,6 +562,7 @@ nsHTMLInputElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
switch (mType) {
|
switch (mType) {
|
||||||
|
case NS_FORM_INPUT_SEARCH:
|
||||||
case NS_FORM_INPUT_TEXT:
|
case NS_FORM_INPUT_TEXT:
|
||||||
case NS_FORM_INPUT_PASSWORD:
|
case NS_FORM_INPUT_PASSWORD:
|
||||||
case NS_FORM_INPUT_TEL:
|
case NS_FORM_INPUT_TEL:
|
||||||
|
@ -662,6 +664,7 @@ nsHTMLInputElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
if (aName == nsGkAtoms::value &&
|
if (aName == nsGkAtoms::value &&
|
||||||
!GET_BOOLBIT(mBitField, BF_VALUE_CHANGED) &&
|
!GET_BOOLBIT(mBitField, BF_VALUE_CHANGED) &&
|
||||||
(mType == NS_FORM_INPUT_TEXT ||
|
(mType == NS_FORM_INPUT_TEXT ||
|
||||||
|
mType == NS_FORM_INPUT_SEARCH ||
|
||||||
mType == NS_FORM_INPUT_PASSWORD ||
|
mType == NS_FORM_INPUT_PASSWORD ||
|
||||||
mType == NS_FORM_INPUT_TEL ||
|
mType == NS_FORM_INPUT_TEL ||
|
||||||
mType == NS_FORM_INPUT_FILE)) {
|
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
|
// to other input types we need save the mValue into value attribute
|
||||||
if (mValue &&
|
if (mValue &&
|
||||||
mType != NS_FORM_INPUT_TEXT &&
|
mType != NS_FORM_INPUT_TEXT &&
|
||||||
|
mType != NS_FORM_INPUT_SEARCH &&
|
||||||
mType != NS_FORM_INPUT_PASSWORD &&
|
mType != NS_FORM_INPUT_PASSWORD &&
|
||||||
mType != NS_FORM_INPUT_TEL &&
|
mType != NS_FORM_INPUT_TEL &&
|
||||||
mType != NS_FORM_INPUT_FILE) {
|
mType != NS_FORM_INPUT_FILE) {
|
||||||
|
@ -2063,6 +2067,7 @@ nsHTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||||
(keyEvent->keyCode == NS_VK_RETURN ||
|
(keyEvent->keyCode == NS_VK_RETURN ||
|
||||||
keyEvent->keyCode == NS_VK_ENTER) &&
|
keyEvent->keyCode == NS_VK_ENTER) &&
|
||||||
(mType == NS_FORM_INPUT_TEXT ||
|
(mType == NS_FORM_INPUT_TEXT ||
|
||||||
|
mType == NS_FORM_INPUT_SEARCH ||
|
||||||
mType == NS_FORM_INPUT_PASSWORD ||
|
mType == NS_FORM_INPUT_PASSWORD ||
|
||||||
mType == NS_FORM_INPUT_TEL ||
|
mType == NS_FORM_INPUT_TEL ||
|
||||||
mType == NS_FORM_INPUT_FILE)) {
|
mType == NS_FORM_INPUT_FILE)) {
|
||||||
|
@ -2573,6 +2578,7 @@ nsHTMLInputElement::Reset()
|
||||||
SetCheckedChanged(PR_FALSE);
|
SetCheckedChanged(PR_FALSE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case NS_FORM_INPUT_SEARCH:
|
||||||
case NS_FORM_INPUT_PASSWORD:
|
case NS_FORM_INPUT_PASSWORD:
|
||||||
case NS_FORM_INPUT_TEXT:
|
case NS_FORM_INPUT_TEXT:
|
||||||
case NS_FORM_INPUT_TEL:
|
case NS_FORM_INPUT_TEL:
|
||||||
|
@ -2757,6 +2763,7 @@ nsHTMLInputElement::SaveState()
|
||||||
// Never save passwords in session history
|
// Never save passwords in session history
|
||||||
case NS_FORM_INPUT_PASSWORD:
|
case NS_FORM_INPUT_PASSWORD:
|
||||||
break;
|
break;
|
||||||
|
case NS_FORM_INPUT_SEARCH:
|
||||||
case NS_FORM_INPUT_TEXT:
|
case NS_FORM_INPUT_TEXT:
|
||||||
case NS_FORM_INPUT_TEL:
|
case NS_FORM_INPUT_TEL:
|
||||||
case NS_FORM_INPUT_HIDDEN:
|
case NS_FORM_INPUT_HIDDEN:
|
||||||
|
@ -2891,6 +2898,7 @@ nsHTMLInputElement::RestoreState(nsPresState* aState)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case NS_FORM_INPUT_SEARCH:
|
||||||
case NS_FORM_INPUT_TEXT:
|
case NS_FORM_INPUT_TEXT:
|
||||||
case NS_FORM_INPUT_TEL:
|
case NS_FORM_INPUT_TEL:
|
||||||
case NS_FORM_INPUT_HIDDEN:
|
case NS_FORM_INPUT_HIDDEN:
|
||||||
|
|
|
@ -217,6 +217,7 @@ EmbedContextMenuInfo::SetFormControlType(nsIDOMEventTarget *originalTarget)
|
||||||
break;
|
break;
|
||||||
case NS_FORM_INPUT_SUBMIT:
|
case NS_FORM_INPUT_SUBMIT:
|
||||||
break;
|
break;
|
||||||
|
case NS_FORM_INPUT_SEARCH:
|
||||||
case NS_FORM_INPUT_TEXT:
|
case NS_FORM_INPUT_TEXT:
|
||||||
case NS_FORM_INPUT_TEL:
|
case NS_FORM_INPUT_TEL:
|
||||||
mEmbedCtxType |= GTK_MOZ_EMBED_CTX_INPUT;
|
mEmbedCtxType |= GTK_MOZ_EMBED_CTX_INPUT;
|
||||||
|
|
|
@ -3304,6 +3304,7 @@ nsWebBrowserPersist::CloneNodeWithFixedUpAttributes(
|
||||||
nsCOMPtr<nsIDOMHTMLInputElement> outElt = do_QueryInterface(*aNodeOut);
|
nsCOMPtr<nsIDOMHTMLInputElement> outElt = do_QueryInterface(*aNodeOut);
|
||||||
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(*aNodeOut);
|
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(*aNodeOut);
|
||||||
switch (formControl->GetType()) {
|
switch (formControl->GetType()) {
|
||||||
|
case NS_FORM_INPUT_SEARCH:
|
||||||
case NS_FORM_INPUT_TEXT:
|
case NS_FORM_INPUT_TEXT:
|
||||||
case NS_FORM_INPUT_TEL:
|
case NS_FORM_INPUT_TEL:
|
||||||
nodeAsInput->GetValue(valueStr);
|
nodeAsInput->GetValue(valueStr);
|
||||||
|
|
|
@ -3628,6 +3628,7 @@ nsCSSFrameConstructor::FindInputData(nsIContent* aContent,
|
||||||
SIMPLE_INT_CREATE(NS_FORM_INPUT_FILE, NS_NewFileControlFrame),
|
SIMPLE_INT_CREATE(NS_FORM_INPUT_FILE, NS_NewFileControlFrame),
|
||||||
SIMPLE_INT_CHAIN(NS_FORM_INPUT_IMAGE,
|
SIMPLE_INT_CHAIN(NS_FORM_INPUT_IMAGE,
|
||||||
nsCSSFrameConstructor::FindImgControlData),
|
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_TEXT, NS_NewTextControlFrame),
|
||||||
SIMPLE_INT_CREATE(NS_FORM_INPUT_TEL, NS_NewTextControlFrame),
|
SIMPLE_INT_CREATE(NS_FORM_INPUT_TEL, NS_NewTextControlFrame),
|
||||||
SIMPLE_INT_CREATE(NS_FORM_INPUT_PASSWORD, NS_NewTextControlFrame),
|
SIMPLE_INT_CREATE(NS_FORM_INPUT_PASSWORD, NS_NewTextControlFrame),
|
||||||
|
|
Загрузка…
Ссылка в новой задаче