зеркало из https://github.com/mozilla/gecko-dev.git
Add attribute "autocomplete"
This commit is contained in:
Родитель
04f9bf4079
Коммит
687d50d4e3
|
@ -87,6 +87,9 @@ public:
|
|||
NS_IMETHOD GetValue(nsString& aValue)=0;
|
||||
NS_IMETHOD SetValue(const nsString& aValue)=0;
|
||||
|
||||
NS_IMETHOD GetAutocomplete(nsString& aAutocomplete)=0;
|
||||
NS_IMETHOD SetAutocomplete(const nsString& aAutocomplete)=0;
|
||||
|
||||
NS_IMETHOD Blur()=0;
|
||||
|
||||
NS_IMETHOD Focus()=0;
|
||||
|
@ -132,6 +135,8 @@ public:
|
|||
NS_IMETHOD SetUseMap(const nsString& aUseMap); \
|
||||
NS_IMETHOD GetValue(nsString& aValue); \
|
||||
NS_IMETHOD SetValue(const nsString& aValue); \
|
||||
NS_IMETHOD GetAutocomplete(nsString& aAutocomplete); \
|
||||
NS_IMETHOD SetAutocomplete(const nsString& aAutocomplete); \
|
||||
NS_IMETHOD Blur(); \
|
||||
NS_IMETHOD Focus(); \
|
||||
NS_IMETHOD Select(); \
|
||||
|
@ -174,6 +179,8 @@ public:
|
|||
NS_IMETHOD SetUseMap(const nsString& aUseMap) { return _to SetUseMap(aUseMap); } \
|
||||
NS_IMETHOD GetValue(nsString& aValue) { return _to GetValue(aValue); } \
|
||||
NS_IMETHOD SetValue(const nsString& aValue) { return _to SetValue(aValue); } \
|
||||
NS_IMETHOD GetAutocomplete(PRInt32* aAutocomplete) { return _to GetAutocomplete(aAutocomplete); } \
|
||||
NS_IMETHOD SetAutocomplete(PRInt32 aAutocomplete) { return _to SetAutocomplete(aAutocomplete); } \
|
||||
NS_IMETHOD Blur() { return _to Blur(); } \
|
||||
NS_IMETHOD Focus() { return _to Focus(); } \
|
||||
NS_IMETHOD Select() { return _to Select(); } \
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
readonly attribute DOMString type;
|
||||
attribute DOMString useMap;
|
||||
attribute DOMString value;
|
||||
attribute DOMString autocomplete;
|
||||
void blur();
|
||||
void focus();
|
||||
void select();
|
||||
|
|
|
@ -61,7 +61,8 @@ enum HTMLInputElement_slots {
|
|||
HTMLINPUTELEMENT_TABINDEX = -15,
|
||||
HTMLINPUTELEMENT_TYPE = -16,
|
||||
HTMLINPUTELEMENT_USEMAP = -17,
|
||||
HTMLINPUTELEMENT_VALUE = -18
|
||||
HTMLINPUTELEMENT_VALUE = -18,
|
||||
HTMLINPUTELEMENT_AUTOCOMPLETE = -19
|
||||
};
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -375,6 +376,22 @@ GetHTMLInputElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case HTMLINPUTELEMENT_AUTOCOMPLETE:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "htmlinputelement.autocomplete", &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
nsAutoString prop;
|
||||
if (NS_OK == a->GetAutocomplete(prop)) {
|
||||
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
||||
}
|
||||
else {
|
||||
return JS_FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
|
||||
}
|
||||
|
@ -655,7 +672,21 @@ SetHTMLInputElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
case HTMLINPUTELEMENT_AUTOCOMPLETE:
|
||||
{
|
||||
secMan->CheckScriptAccess(scriptCX, obj, "htmlinputelement.autocomplete", &ok);
|
||||
if (!ok) {
|
||||
//Need to throw error here
|
||||
return JS_FALSE;
|
||||
}
|
||||
nsAutoString prop;
|
||||
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
||||
|
||||
a->SetAutocomplete(prop);
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
|
||||
}
|
||||
NS_RELEASE(secMan);
|
||||
|
@ -911,6 +942,7 @@ static JSPropertySpec HTMLInputElementProperties[] =
|
|||
{"type", HTMLINPUTELEMENT_TYPE, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"useMap", HTMLINPUTELEMENT_USEMAP, JSPROP_ENUMERATE},
|
||||
{"value", HTMLINPUTELEMENT_VALUE, JSPROP_ENUMERATE},
|
||||
{"autocomplete", HTMLINPUTELEMENT_AUTOCOMPLETE, JSPROP_ENUMERATE},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче