Bug 1395146 - part1: Get rid of nsITextControlElement::IsPlainTextControl() and nsTextEditorState::IsPlainTextEditor() r=smaug

nsTextEditorState::GetValue() refers nsITextControlElement::IsPlainTextControl()
via nsTextEditorState::IsPlainTextEditor().  However, it always returns true and
virtual call with QI.  So, we should get rid of these unnecessary methods.

MozReview-Commit-ID: 3gHdGrzlys4
This commit is contained in:
Masayuki Nakano
2017-08-30 18:57:55 +09:00
parent 592b07f1d9
commit 49283b88fb
8 changed files with 3 additions and 36 deletions

View File

@@ -7402,13 +7402,6 @@ HTMLInputElement::IsTextArea() const
return false;
}
NS_IMETHODIMP_(bool)
HTMLInputElement::IsPlainTextControl() const
{
// need to check our HTML attribute and/or CSS.
return true;
}
NS_IMETHODIMP_(bool)
HTMLInputElement::IsPasswordTextControl() const
{

View File

@@ -233,7 +233,6 @@ public:
NS_IMETHOD SetValueChanged(bool aValueChanged) override;
NS_IMETHOD_(bool) IsSingleLineTextControl() const override;
NS_IMETHOD_(bool) IsTextArea() const override;
NS_IMETHOD_(bool) IsPlainTextControl() const override;
NS_IMETHOD_(bool) IsPasswordTextControl() const override;
NS_IMETHOD_(int32_t) GetCols() override;
NS_IMETHOD_(int32_t) GetWrapCols() override;

View File

@@ -1330,13 +1330,6 @@ HTMLTextAreaElement::IsTextArea() const
return true;
}
NS_IMETHODIMP_(bool)
HTMLTextAreaElement::IsPlainTextControl() const
{
// need to check our HTML attribute and/or CSS.
return true;
}
NS_IMETHODIMP_(bool)
HTMLTextAreaElement::IsPasswordTextControl() const
{

View File

@@ -89,7 +89,6 @@ public:
NS_IMETHOD SetValueChanged(bool aValueChanged) override;
NS_IMETHOD_(bool) IsSingleLineTextControl() const override;
NS_IMETHOD_(bool) IsTextArea() const override;
NS_IMETHOD_(bool) IsPlainTextControl() const override;
NS_IMETHOD_(bool) IsPasswordTextControl() const override;
NS_IMETHOD_(int32_t) GetCols() override;
NS_IMETHOD_(int32_t) GetWrapCols() override;

View File

@@ -56,12 +56,6 @@ public:
*/
NS_IMETHOD_(bool) IsTextArea() const = 0;
/**
* Find out whether this control edits plain text. (Currently always true.)
* @return whether this is a plain text control
*/
NS_IMETHOD_(bool) IsPlainTextControl() const = 0;
/**
* Find out whether this is a password control (input type=password)
* @return whether this is a password ontrol

View File

@@ -1420,9 +1420,7 @@ nsTextEditorState::PrepareEditor(const nsAString *aValue)
nsIPresShell *shell = presContext->GetPresShell();
// Setup the editor flags
uint32_t editorFlags = 0;
if (IsPlainTextControl())
editorFlags |= nsIPlaintextEditor::eEditorPlaintextMask;
uint32_t editorFlags = nsIPlaintextEditor::eEditorPlaintextMask;
if (IsSingleLineTextControl())
editorFlags |= nsIPlaintextEditor::eEditorSingleLineMask;
if (IsPasswordTextControl())
@@ -2447,13 +2445,8 @@ nsTextEditorState::GetValue(nsAString& aValue, bool aIgnoreWrap) const
uint32_t flags = (nsIDocumentEncoder::OutputLFLineBreak |
nsIDocumentEncoder::OutputPreformatted |
nsIDocumentEncoder::OutputPersistNBSP);
if (IsPlainTextControl())
{
flags |= nsIDocumentEncoder::OutputBodyOnly;
}
nsIDocumentEncoder::OutputPersistNBSP |
nsIDocumentEncoder::OutputBodyOnly);
if (!aIgnoreWrap) {
nsITextControlElement::nsHTMLTextWrap wrapProp;
nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);

View File

@@ -220,9 +220,6 @@ public:
bool IsTextArea() const {
return mTextCtrlElement->IsTextArea();
}
bool IsPlainTextControl() const {
return mTextCtrlElement->IsPlainTextControl();
}
bool IsPasswordTextControl() const {
return mTextCtrlElement->IsPasswordTextControl();
}

View File

@@ -206,7 +206,6 @@ public: //for methods who access nsTextControlFrame directly
DEFINE_TEXTCTRL_CONST_FORWARDER(bool, IsSingleLineTextControl)
DEFINE_TEXTCTRL_CONST_FORWARDER(bool, IsTextArea)
DEFINE_TEXTCTRL_CONST_FORWARDER(bool, IsPlainTextControl)
DEFINE_TEXTCTRL_CONST_FORWARDER(bool, IsPasswordTextControl)
DEFINE_TEXTCTRL_CONST_FORWARDER(int32_t, GetCols)
DEFINE_TEXTCTRL_CONST_FORWARDER(int32_t, GetWrapCols)