Skip to content

Commit

Permalink
Bug 1439812 - Move noscript methods of nsIPlainTextEditor to TextEdit…
Browse files Browse the repository at this point in the history
…or. r=masayuki

maxTextLength is unused from script, so I would like to move to TextEditor.
Also, there is no reason to keep setText on nsIPlainText.

MozReview-Commit-ID: CZ8pa9Pm8qt
  • Loading branch information
makotokato committed Feb 21, 2018
1 parent cf8e9fa commit dbc71bd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 34 deletions.
21 changes: 1 addition & 20 deletions editor/libeditor/TextEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ TextEditor::InsertLineBreak()
return rv;
}

NS_IMETHODIMP
nsresult
TextEditor::SetText(const nsAString& aString)
{
if (NS_WARN_IF(!mRules)) {
Expand Down Expand Up @@ -1018,25 +1018,6 @@ TextEditor::GetTextLength(int32_t* aCount)
return NS_OK;
}

NS_IMETHODIMP
TextEditor::SetMaxTextLength(int32_t aMaxTextLength)
{
mMaxTextLength = aMaxTextLength;
return NS_OK;
}

NS_IMETHODIMP
TextEditor::GetMaxTextLength(int32_t* aMaxTextLength)
{
// NOTE: If you need to override this method, you need to make
// MaxTextLength() virtual.
if (NS_WARN_IF(!aMaxTextLength)) {
return NS_ERROR_INVALID_POINTER;
}
*aMaxTextLength = MaxTextLength();
return NS_OK;
}

NS_IMETHODIMP
TextEditor::GetWrapWidth(int32_t* aWrapColumn)
{
Expand Down
13 changes: 13 additions & 0 deletions editor/libeditor/TextEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,20 @@ class TextEditor : public EditorBase
static void GetDefaultEditorPrefs(int32_t& aNewLineHandling,
int32_t& aCaretStyle);

/**
* The maximum number of characters allowed.
* default: -1 (unlimited).
*/
int32_t MaxTextLength() const { return mMaxTextLength; }
void SetMaxTextLength(int32_t aLength) { mMaxTextLength = aLength; }

/**
* Replace existed string with a string.
* This is fast path to replace all string when using single line control.
*
* @ param aString the string to be set
*/
nsresult SetText(const nsAString& aString);

protected:
virtual ~TextEditor();
Expand Down
14 changes: 0 additions & 14 deletions editor/nsIPlaintextEditor.idl
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ interface nsIPlaintextEditor : nsISupports
*/
readonly attribute long textLength;

/**
* The maximum number of characters allowed.
* default: -1 (unlimited).
*/
attribute long maxTextLength;

/** Get and set the body wrap width.
*
* Special values:
Expand Down Expand Up @@ -102,14 +96,6 @@ interface nsIPlaintextEditor : nsISupports
*/
void insertText(in DOMString aStringToInsert);

/**
* Replace existed string with a string.
* This is fast path to replace all string when using single line control.
*
* @ param aString the string to be set
*/
[noscript] void setText(in DOMString aString);

/**
* Insert a line break into the content model.
* The interpretation of a break is up to the implementation:
Expand Down

0 comments on commit dbc71bd

Please sign in to comment.