зеркало из https://github.com/mozilla/gecko-dev.git
Added wrap width attribute
This commit is contained in:
Родитель
1f14b3c9f0
Коммит
e9fa3630d0
|
@ -48,6 +48,9 @@ public:
|
|||
|
||||
NS_IMETHOD GetParagraphFormat(nsString& aParagraphFormat)=0;
|
||||
|
||||
NS_IMETHOD GetWrapColumn(PRInt32* aWrapColumn)=0;
|
||||
NS_IMETHOD SetWrapColumn(PRInt32 aWrapColumn)=0;
|
||||
|
||||
NS_IMETHOD SetEditorType(const nsString& aEditorType)=0;
|
||||
|
||||
NS_IMETHOD SetTextProperty(const nsString& aProp, const nsString& aAttr, const nsString& aValue)=0;
|
||||
|
@ -120,6 +123,8 @@ public:
|
|||
NS_IMETHOD GetEditorDocument(nsIDOMDocument** aEditorDocument); \
|
||||
NS_IMETHOD GetEditorSelection(nsIDOMSelection** aEditorSelection); \
|
||||
NS_IMETHOD GetParagraphFormat(nsString& aParagraphFormat); \
|
||||
NS_IMETHOD GetWrapColumn(PRInt32* aWrapColumn); \
|
||||
NS_IMETHOD SetWrapColumn(PRInt32 aWrapColumn); \
|
||||
NS_IMETHOD SetEditorType(const nsString& aEditorType); \
|
||||
NS_IMETHOD SetTextProperty(const nsString& aProp, const nsString& aAttr, const nsString& aValue); \
|
||||
NS_IMETHOD RemoveTextProperty(const nsString& aProp, const nsString& aAttr); \
|
||||
|
@ -161,6 +166,8 @@ public:
|
|||
NS_IMETHOD GetEditorDocument(nsIDOMDocument** aEditorDocument) { return _to GetEditorDocument(aEditorDocument); } \
|
||||
NS_IMETHOD GetEditorSelection(nsIDOMSelection** aEditorSelection) { return _to GetEditorSelection(aEditorSelection); } \
|
||||
NS_IMETHOD GetParagraphFormat(nsString& aParagraphFormat) { return _to GetParagraphFormat(aParagraphFormat); } \
|
||||
NS_IMETHOD GetWrapColumn(PRInt32* aWrapColumn) { return _to GetWrapColumn(aWrapColumn); } \
|
||||
NS_IMETHOD SetWrapColumn(PRInt32 aWrapColumn) { return _to SetWrapColumn(aWrapColumn); } \
|
||||
NS_IMETHOD SetEditorType(const nsString& aEditorType) { return _to SetEditorType(aEditorType); } \
|
||||
NS_IMETHOD SetTextProperty(const nsString& aProp, const nsString& aAttr, const nsString& aValue) { return _to SetTextProperty(aProp, aAttr, aValue); } \
|
||||
NS_IMETHOD RemoveTextProperty(const nsString& aProp, const nsString& aAttr) { return _to RemoveTextProperty(aProp, aAttr); } \
|
||||
|
|
|
@ -60,7 +60,8 @@ enum EditorAppCore_slots {
|
|||
EDITORAPPCORE_CONTENTSASHTML = -2,
|
||||
EDITORAPPCORE_EDITORDOCUMENT = -3,
|
||||
EDITORAPPCORE_EDITORSELECTION = -4,
|
||||
EDITORAPPCORE_PARAGRAPHFORMAT = -5
|
||||
EDITORAPPCORE_PARAGRAPHFORMAT = -5,
|
||||
EDITORAPPCORE_WRAPCOLUMN = -6
|
||||
};
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -136,6 +137,17 @@ GetEditorAppCoreProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case EDITORAPPCORE_WRAPCOLUMN:
|
||||
{
|
||||
PRInt32 prop;
|
||||
if (NS_OK == a->GetWrapColumn(&prop)) {
|
||||
*vp = INT_TO_JSVAL(prop);
|
||||
}
|
||||
else {
|
||||
return JS_FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
|
||||
}
|
||||
|
@ -163,7 +175,22 @@ SetEditorAppCoreProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|||
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
case EDITORAPPCORE_WRAPCOLUMN:
|
||||
{
|
||||
PRInt32 prop;
|
||||
int32 temp;
|
||||
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
||||
prop = (PRInt32)temp;
|
||||
}
|
||||
else {
|
||||
JS_ReportError(cx, "Parameter must be a number");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
a->SetWrapColumn(prop);
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
|
||||
}
|
||||
|
@ -1407,6 +1434,7 @@ static JSPropertySpec EditorAppCoreProperties[] =
|
|||
{"editorDocument", EDITORAPPCORE_EDITORDOCUMENT, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"editorSelection", EDITORAPPCORE_EDITORSELECTION, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"ParagraphFormat", EDITORAPPCORE_PARAGRAPHFORMAT, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{"wrapColumn", EDITORAPPCORE_WRAPCOLUMN, JSPROP_ENUMERATE},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче