Bug 838582 - Part 1: Rename nsHTMLTextAreaElement to mozilla::dom::HTMLTextAreaElement; r=bzbarsky
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 18 Feb 2013 16:18:40 -0500
changeset 122544 6441636bcf581fe565ea4b435f0b55269a0b76a1
parent 122543 1e7f2fba386c719f1032441da3b5bf4b1c6d9c22
child 122545 6c7e514acc366f59833744a08766b5ca9c3aa697
push id23359
push usereakhgari@mozilla.com
push dateThu, 21 Feb 2013 14:14:07 +0000
treeherdermozilla-inbound@6441636bcf58 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs838582
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 838582 - Part 1: Rename nsHTMLTextAreaElement to mozilla::dom::HTMLTextAreaElement; r=bzbarsky
content/html/content/src/HTMLTextAreaElement.cpp
content/html/content/src/HTMLTextAreaElement.h
content/html/content/src/Makefile.in
content/html/content/src/nsHTMLTextAreaElement.cpp
rename from content/html/content/src/nsHTMLTextAreaElement.cpp
rename to content/html/content/src/HTMLTextAreaElement.cpp
--- a/content/html/content/src/nsHTMLTextAreaElement.cpp
+++ b/content/html/content/src/HTMLTextAreaElement.cpp
@@ -1,286 +1,63 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set sw=2 ts=2 et tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+#include "mozilla/dom/HTMLTextAreaElement.h"
 #include "mozilla/Util.h"
 
-#include "nsIDOMHTMLTextAreaElement.h"
-#include "nsITextControlElement.h"
-#include "nsIDOMNSEditableElement.h"
 #include "nsIControllers.h"
 #include "nsFocusManager.h"
 #include "nsPIDOMWindow.h"
 #include "nsContentCID.h"
-#include "nsCOMPtr.h"
 #include "nsIComponentManager.h"
 #include "nsIDOMHTMLFormElement.h"
 #include "nsIFormControl.h"
 #include "nsIForm.h"
 #include "nsFormSubmission.h"
 #include "nsIDOMEventTarget.h"
-#include "nsGenericHTMLElement.h"
 #include "nsAttrValueInlines.h"
 #include "nsGkAtoms.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsMappedAttributes.h"
 #include "nsIFormControlFrame.h"
 #include "nsITextControlFrame.h"
-#include "nsEventStates.h"
 #include "nsLinebreakConverter.h"
 #include "nsIDocument.h"
 #include "nsIFrame.h"
 #include "nsGUIEvent.h"
 #include "nsPresState.h"
 #include "nsReadableUtils.h"
 #include "nsEventDispatcher.h"
 #include "nsLayoutUtils.h"
 #include "nsError.h"
-#include "nsStubMutationObserver.h"
 #include "mozAutoDocUpdate.h"
 #include "nsISupportsPrimitives.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsIConstraintValidation.h"
-#include "nsHTMLFormElement.h"
 
 #include "nsTextEditorState.h"
 
-using namespace mozilla;
-using namespace mozilla::dom;
-
 static NS_DEFINE_CID(kXULControllersCID,  NS_XULCONTROLLERS_CID);
 
 #define NS_NO_CONTENT_DISPATCH (1 << 0)
 
-class nsHTMLTextAreaElement : public nsGenericHTMLFormElement,
-                              public nsIDOMHTMLTextAreaElement,
-                              public nsITextControlElement,
-                              public nsIDOMNSEditableElement,
-                              public nsStubMutationObserver,
-                              public nsIConstraintValidation
-{
-public:
-  using nsIConstraintValidation::GetValidationMessage;
-
-  nsHTMLTextAreaElement(already_AddRefed<nsINodeInfo> aNodeInfo,
-                        mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
-
-  // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
-
-  // nsIDOMNode
-  NS_FORWARD_NSIDOMNODE_TO_NSINODE
-
-  // nsIDOMElement
-  NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
-
-  // nsIDOMHTMLElement
-  NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
-
-  virtual int32_t TabIndexDefault() MOZ_OVERRIDE;
-
-  // nsIDOMHTMLTextAreaElement
-  NS_DECL_NSIDOMHTMLTEXTAREAELEMENT
-
-  // nsIDOMNSEditableElement
-  NS_IMETHOD GetEditor(nsIEditor** aEditor)
-  {
-    return nsGenericHTMLElement::GetEditor(aEditor);
-  }
-  NS_IMETHOD SetUserInput(const nsAString& aInput);
-
-  // nsIFormControl
-  NS_IMETHOD_(uint32_t) GetType() const { return NS_FORM_TEXTAREA; }
-  NS_IMETHOD Reset();
-  NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission);
-  NS_IMETHOD SaveState();
-  virtual bool RestoreState(nsPresState* aState);
-  virtual bool IsDisabledForEvents(uint32_t aMessage);
-
-  virtual void FieldSetDisabledChanged(bool aNotify);
-
-  virtual nsEventStates IntrinsicState() const;
-
-  // nsITextControlElemet
-  NS_IMETHOD SetValueChanged(bool aValueChanged);
-  NS_IMETHOD_(bool) IsSingleLineTextControl() const;
-  NS_IMETHOD_(bool) IsTextArea() const;
-  NS_IMETHOD_(bool) IsPlainTextControl() const;
-  NS_IMETHOD_(bool) IsPasswordTextControl() const;
-  NS_IMETHOD_(int32_t) GetCols();
-  NS_IMETHOD_(int32_t) GetWrapCols();
-  NS_IMETHOD_(int32_t) GetRows();
-  NS_IMETHOD_(bool) ValueChanged() const;
-  NS_IMETHOD_(void) GetTextEditorValue(nsAString& aValue, bool aIgnoreWrap) const;
-  NS_IMETHOD_(nsIEditor*) GetTextEditor();
-  NS_IMETHOD_(nsISelectionController*) GetSelectionController();
-  NS_IMETHOD_(nsFrameSelection*) GetConstFrameSelection();
-  NS_IMETHOD BindToFrame(nsTextControlFrame* aFrame);
-  NS_IMETHOD_(void) UnbindFromFrame(nsTextControlFrame* aFrame);
-  NS_IMETHOD CreateEditor();
-  NS_IMETHOD_(nsIContent*) GetRootEditorNode();
-  NS_IMETHOD_(nsIContent*) CreatePlaceholderNode();
-  NS_IMETHOD_(nsIContent*) GetPlaceholderNode();
-  NS_IMETHOD_(void) UpdatePlaceholderVisibility(bool aNotify);
-  NS_IMETHOD_(bool) GetPlaceholderVisibility();
-  NS_IMETHOD_(void) InitializeKeyboardEventListeners();
-  NS_IMETHOD_(void) OnValueChanged(bool aNotify);
-  NS_IMETHOD_(bool) HasCachedSelection();
-
-  // nsIContent
-  virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
-                               nsIContent* aBindingParent,
-                               bool aCompileEventHandlers);
-  virtual void UnbindFromTree(bool aDeep = true,
-                              bool aNullParent = true);
-  virtual bool ParseAttribute(int32_t aNamespaceID,
-                                nsIAtom* aAttribute,
-                                const nsAString& aValue,
-                                nsAttrValue& aResult);
-  virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
-  virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
-                                              int32_t aModType) const;
-  NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
-
-  virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
-  virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
-
-  virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t *aTabIndex);
-
-  virtual void DoneAddingChildren(bool aHaveNotified);
-  virtual bool IsDoneAddingChildren();
-
-  virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
-
-  nsresult CopyInnerTo(Element* aDest);
-
-  /**
-   * Called when an attribute is about to be changed
-   */
-  virtual nsresult BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
-                                 const nsAttrValueOrString* aValue,
-                                 bool aNotify);
-
-  // nsIMutationObserver
-  NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
-  NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
-  NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
-  NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
-
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLTextAreaElement,
-                                           nsGenericHTMLFormElement)
-
-  virtual nsXPCClassInfo* GetClassInfo();
-
-  virtual nsIDOMNode* AsDOMNode() { return this; }
-
-  // nsIConstraintValidation
-  bool     IsTooLong();
-  bool     IsValueMissing() const;
-  void     UpdateTooLongValidityState();
-  void     UpdateValueMissingValidityState();
-  void     UpdateBarredFromConstraintValidation();
-  nsresult GetValidationMessage(nsAString& aValidationMessage,
-                                ValidityStateType aType);
-
-protected:
-  using nsGenericHTMLFormElement::IsSingleLineTextControl; // get rid of the compiler warning
-
-  nsCOMPtr<nsIControllers> mControllers;
-  /** Whether or not the value has changed since its default value was given. */
-  bool                     mValueChanged;
-  /** Whether or not we are already handling select event. */
-  bool                     mHandlingSelect;
-  /** Whether or not we are done adding children (always true if not
-      created by a parser */
-  bool                     mDoneAddingChildren;
-  /** Whether state restoration should be inhibited in DoneAddingChildren. */
-  bool                     mInhibitStateRestoration;
-  /** Whether our disabled state has changed from the default **/
-  bool                     mDisabledChanged;
-  /** Whether we should make :-moz-ui-invalid apply on the element. **/
-  bool                     mCanShowInvalidUI;
-  /** Whether we should make :-moz-ui-valid apply on the element. **/
-  bool                     mCanShowValidUI;
-  
-  void FireChangeEventIfNeeded();
-  
-  nsString mFocusedValue;
-
-  /** The state of the text editor (selection controller and the editor) **/
-  nsTextEditorState mState;
-
-  NS_IMETHOD SelectAll(nsPresContext* aPresContext);
-  /**
-   * Get the value, whether it is from the content or the frame.
-   * @param aValue the value [out]
-   * @param aIgnoreWrap whether to ignore the wrap attribute when getting the
-   *        value.  If this is true, linebreaks will not be inserted even if
-   *        wrap=hard.
-   */
-  void GetValueInternal(nsAString& aValue, bool aIgnoreWrap) const;
-
-  nsresult SetValueInternal(const nsAString& aValue,
-                            bool aUserInput);
-  nsresult GetSelectionRange(int32_t* aSelectionStart, int32_t* aSelectionEnd);
-
-  /**
-   * Common method to call from the various mutation observer methods.
-   * aContent is a content node that's either the one that changed or its
-   * parent; we should only respond to the change if aContent is non-anonymous.
-   */
-  void ContentChanged(nsIContent* aContent);
-
-  virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom *aName,
-                                const nsAttrValue* aValue, bool aNotify);
-
-  /**
-   * Return if an element should have a specific validity UI
-   * (with :-moz-ui-invalid and :-moz-ui-valid pseudo-classes).
-   *
-   * @return Whether the element should have a validity UI.
-   */
-  bool ShouldShowValidityUI() const {
-    /**
-     * Always show the validity UI if the form has already tried to be submitted
-     * but was invalid.
-     *
-     * Otherwise, show the validity UI if the element's value has been changed.
-     */
-
-    if (mForm && mForm->HasEverTriedInvalidSubmit()) {
-      return true;
-    }
-
-    return mValueChanged;
-  }
-
-  /**
-   * Get the mutable state of the element.
-   */
-  bool IsMutable() const;
-
-  /**
-   * Returns whether the current value is the empty string.
-   *
-   * @return whether the current value is the empty string.
-   */
-  bool IsValueEmpty() const;
-};
-
-
 NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(TextArea)
 
+DOMCI_NODE_DATA(HTMLTextAreaElement, mozilla::dom::HTMLTextAreaElement)
 
-nsHTMLTextAreaElement::nsHTMLTextAreaElement(already_AddRefed<nsINodeInfo> aNodeInfo,
-                                             FromParser aFromParser)
+namespace mozilla {
+namespace dom {
+
+HTMLTextAreaElement::HTMLTextAreaElement(already_AddRefed<nsINodeInfo> aNodeInfo,
+                                         FromParser aFromParser)
   : nsGenericHTMLFormElement(aNodeInfo),
     mValueChanged(false),
     mHandlingSelect(false),
     mDoneAddingChildren(!aFromParser),
     mInhibitStateRestoration(!!(aFromParser & FROM_PARSER_FRAGMENT)),
     mDisabledChanged(false),
     mCanShowInvalidUI(true),
     mCanShowValidUI(true),
@@ -294,68 +71,66 @@ nsHTMLTextAreaElement::nsHTMLTextAreaEle
   // until someone calls UpdateEditableState on us, apparently!  Also
   // by default we don't have to show validity UI and so forth.
   AddStatesSilently(NS_EVENT_STATE_ENABLED |
                     NS_EVENT_STATE_OPTIONAL |
                     NS_EVENT_STATE_VALID);
 }
 
 
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLTextAreaElement,
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLTextAreaElement,
                                                 nsGenericHTMLFormElement)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mValidity)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mControllers)
   tmp->mState.Unlink();
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLTextAreaElement,
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLTextAreaElement,
                                                   nsGenericHTMLFormElement)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mValidity)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mControllers)
   tmp->mState.Traverse(cb);
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
-NS_IMPL_ADDREF_INHERITED(nsHTMLTextAreaElement, Element)
-NS_IMPL_RELEASE_INHERITED(nsHTMLTextAreaElement, Element)
+NS_IMPL_ADDREF_INHERITED(HTMLTextAreaElement, Element)
+NS_IMPL_RELEASE_INHERITED(HTMLTextAreaElement, Element)
 
 
-DOMCI_NODE_DATA(HTMLTextAreaElement, nsHTMLTextAreaElement)
-
-// QueryInterface implementation for nsHTMLTextAreaElement
-NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsHTMLTextAreaElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE5(nsHTMLTextAreaElement,
+// QueryInterface implementation for HTMLTextAreaElement
+NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLTextAreaElement)
+  NS_HTML_CONTENT_INTERFACE_TABLE5(HTMLTextAreaElement,
                                    nsIDOMHTMLTextAreaElement,
                                    nsITextControlElement,
                                    nsIDOMNSEditableElement,
                                    nsIMutationObserver,
                                    nsIConstraintValidation)
-  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLTextAreaElement,
+  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLTextAreaElement,
                                                nsGenericHTMLFormElement)
 NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLTextAreaElement)
 
 
 // nsIDOMHTMLTextAreaElement
 
 
-NS_IMPL_ELEMENT_CLONE(nsHTMLTextAreaElement)
+NS_IMPL_ELEMENT_CLONE(HTMLTextAreaElement)
 
 // nsIConstraintValidation
-NS_IMPL_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(nsHTMLTextAreaElement)
+NS_IMPL_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(HTMLTextAreaElement)
 
 
 NS_IMETHODIMP
-nsHTMLTextAreaElement::GetForm(nsIDOMHTMLFormElement** aForm)
+HTMLTextAreaElement::GetForm(nsIDOMHTMLFormElement** aForm)
 {
   return nsGenericHTMLFormElement::GetForm(aForm);
 }
 
 
 // nsIContent
 
 NS_IMETHODIMP
-nsHTMLTextAreaElement::Select()
+HTMLTextAreaElement::Select()
 {
   // XXX Bug?  We have to give the input focus before contents can be
   // selected
 
   FocusTristate state = FocusState();
   if (state == eUnfocusable) {
     return NS_OK;
   }
@@ -391,162 +166,162 @@ nsHTMLTextAreaElement::Select()
       }
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHTMLTextAreaElement::SelectAll(nsPresContext* aPresContext)
+HTMLTextAreaElement::SelectAll(nsPresContext* aPresContext)
 {
   nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
 
   if (formControlFrame) {
     formControlFrame->SetFormProperty(nsGkAtoms::select, EmptyString());
   }
 
   return NS_OK;
 }
 
 bool
-nsHTMLTextAreaElement::IsHTMLFocusable(bool aWithMouse,
-                                       bool *aIsFocusable, int32_t *aTabIndex)
+HTMLTextAreaElement::IsHTMLFocusable(bool aWithMouse,
+                                     bool *aIsFocusable, int32_t *aTabIndex)
 {
   if (nsGenericHTMLFormElement::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex)) {
     return true;
   }
 
   // disabled textareas are not focusable
   *aIsFocusable = !IsDisabled();
   return false;
 }
 
-NS_IMPL_BOOL_ATTR(nsHTMLTextAreaElement, Autofocus, autofocus)
-NS_IMPL_UINT_ATTR_NON_ZERO_DEFAULT_VALUE(nsHTMLTextAreaElement, Cols, cols, DEFAULT_COLS)
-NS_IMPL_BOOL_ATTR(nsHTMLTextAreaElement, Disabled, disabled)
-NS_IMPL_NON_NEGATIVE_INT_ATTR(nsHTMLTextAreaElement, MaxLength, maxlength)
-NS_IMPL_STRING_ATTR(nsHTMLTextAreaElement, Name, name)
-NS_IMPL_BOOL_ATTR(nsHTMLTextAreaElement, ReadOnly, readonly)
-NS_IMPL_BOOL_ATTR(nsHTMLTextAreaElement, Required, required)
-NS_IMPL_UINT_ATTR_NON_ZERO_DEFAULT_VALUE(nsHTMLTextAreaElement, Rows, rows, DEFAULT_ROWS_TEXTAREA)
-NS_IMPL_STRING_ATTR(nsHTMLTextAreaElement, Wrap, wrap)
-NS_IMPL_STRING_ATTR(nsHTMLTextAreaElement, Placeholder, placeholder)
+NS_IMPL_BOOL_ATTR(HTMLTextAreaElement, Autofocus, autofocus)
+NS_IMPL_UINT_ATTR_NON_ZERO_DEFAULT_VALUE(HTMLTextAreaElement, Cols, cols, DEFAULT_COLS)
+NS_IMPL_BOOL_ATTR(HTMLTextAreaElement, Disabled, disabled)
+NS_IMPL_NON_NEGATIVE_INT_ATTR(HTMLTextAreaElement, MaxLength, maxlength)
+NS_IMPL_STRING_ATTR(HTMLTextAreaElement, Name, name)
+NS_IMPL_BOOL_ATTR(HTMLTextAreaElement, ReadOnly, readonly)
+NS_IMPL_BOOL_ATTR(HTMLTextAreaElement, Required, required)
+NS_IMPL_UINT_ATTR_NON_ZERO_DEFAULT_VALUE(HTMLTextAreaElement, Rows, rows, DEFAULT_ROWS_TEXTAREA)
+NS_IMPL_STRING_ATTR(HTMLTextAreaElement, Wrap, wrap)
+NS_IMPL_STRING_ATTR(HTMLTextAreaElement, Placeholder, placeholder)
   
 int32_t
-nsHTMLTextAreaElement::TabIndexDefault()
+HTMLTextAreaElement::TabIndexDefault()
 {
   return 0;
 }
 
 NS_IMETHODIMP 
-nsHTMLTextAreaElement::GetType(nsAString& aType)
+HTMLTextAreaElement::GetType(nsAString& aType)
 {
   aType.AssignLiteral("textarea");
 
   return NS_OK;
 }
 
 NS_IMETHODIMP 
-nsHTMLTextAreaElement::GetValue(nsAString& aValue)
+HTMLTextAreaElement::GetValue(nsAString& aValue)
 {
   GetValueInternal(aValue, true);
   return NS_OK;
 }
 
 void
-nsHTMLTextAreaElement::GetValueInternal(nsAString& aValue, bool aIgnoreWrap) const
+HTMLTextAreaElement::GetValueInternal(nsAString& aValue, bool aIgnoreWrap) const
 {
   mState.GetValue(aValue, aIgnoreWrap);
 }
 
 NS_IMETHODIMP_(nsIEditor*)
-nsHTMLTextAreaElement::GetTextEditor()
+HTMLTextAreaElement::GetTextEditor()
 {
   return mState.GetEditor();
 }
 
 NS_IMETHODIMP_(nsISelectionController*)
-nsHTMLTextAreaElement::GetSelectionController()
+HTMLTextAreaElement::GetSelectionController()
 {
   return mState.GetSelectionController();
 }
 
 NS_IMETHODIMP_(nsFrameSelection*)
-nsHTMLTextAreaElement::GetConstFrameSelection()
+HTMLTextAreaElement::GetConstFrameSelection()
 {
   return mState.GetConstFrameSelection();
 }
 
 NS_IMETHODIMP
-nsHTMLTextAreaElement::BindToFrame(nsTextControlFrame* aFrame)
+HTMLTextAreaElement::BindToFrame(nsTextControlFrame* aFrame)
 {
   return mState.BindToFrame(aFrame);
 }
 
 NS_IMETHODIMP_(void)
-nsHTMLTextAreaElement::UnbindFromFrame(nsTextControlFrame* aFrame)
+HTMLTextAreaElement::UnbindFromFrame(nsTextControlFrame* aFrame)
 {
   if (aFrame) {
     mState.UnbindFromFrame(aFrame);
   }
 }
 
 NS_IMETHODIMP
-nsHTMLTextAreaElement::CreateEditor()
+HTMLTextAreaElement::CreateEditor()
 {
   return mState.PrepareEditor();
 }
 
 NS_IMETHODIMP_(nsIContent*)
-nsHTMLTextAreaElement::GetRootEditorNode()
+HTMLTextAreaElement::GetRootEditorNode()
 {
   return mState.GetRootNode();
 }
 
 NS_IMETHODIMP_(nsIContent*)
-nsHTMLTextAreaElement::CreatePlaceholderNode()
+HTMLTextAreaElement::CreatePlaceholderNode()
 {
   NS_ENSURE_SUCCESS(mState.CreatePlaceholderNode(), nullptr);
   return mState.GetPlaceholderNode();
 }
 
 NS_IMETHODIMP_(nsIContent*)
-nsHTMLTextAreaElement::GetPlaceholderNode()
+HTMLTextAreaElement::GetPlaceholderNode()
 {
   return mState.GetPlaceholderNode();
 }
 
 NS_IMETHODIMP_(void)
-nsHTMLTextAreaElement::UpdatePlaceholderVisibility(bool aNotify)
+HTMLTextAreaElement::UpdatePlaceholderVisibility(bool aNotify)
 {
   mState.UpdatePlaceholderVisibility(aNotify);
 }
 
 NS_IMETHODIMP_(bool)
-nsHTMLTextAreaElement::GetPlaceholderVisibility()
+HTMLTextAreaElement::GetPlaceholderVisibility()
 {
   return mState.GetPlaceholderVisibility();
 }
 
 nsresult
-nsHTMLTextAreaElement::SetValueInternal(const nsAString& aValue,
-                                        bool aUserInput)
+HTMLTextAreaElement::SetValueInternal(const nsAString& aValue,
+                                      bool aUserInput)
 {
   // Need to set the value changed flag here, so that
   // nsTextControlFrame::UpdateValueDisplay retrieves the correct value
   // if needed.
   SetValueChanged(true);
   mState.SetValue(aValue, aUserInput, true);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP 
-nsHTMLTextAreaElement::SetValue(const nsAString& aValue)
+HTMLTextAreaElement::SetValue(const nsAString& aValue)
 {
   // If the value has been set by a script, we basically want to keep the
   // current change event state. If the element is ready to fire a change
   // event, we should keep it that way. Otherwise, we should make sure the
   // element will not fire any event because of the script interaction.
   //
   // NOTE: this is currently quite expensive work (too much string
   // manipulation). We should probably optimize that.
@@ -558,61 +333,61 @@ nsHTMLTextAreaElement::SetValue(const ns
   if (mFocusedValue.Equals(currentValue)) {
     GetValueInternal(mFocusedValue, true);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP 
-nsHTMLTextAreaElement::SetUserInput(const nsAString& aValue)
+HTMLTextAreaElement::SetUserInput(const nsAString& aValue)
 {
   if (!nsContentUtils::IsCallerChrome()) {
     return NS_ERROR_DOM_SECURITY_ERR;
   }
   SetValueInternal(aValue, true);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHTMLTextAreaElement::SetValueChanged(bool aValueChanged)
+HTMLTextAreaElement::SetValueChanged(bool aValueChanged)
 {
   bool previousValue = mValueChanged;
 
   mValueChanged = aValueChanged;
 
   if (mValueChanged != previousValue) {
     UpdateState(true);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHTMLTextAreaElement::GetDefaultValue(nsAString& aDefaultValue)
+HTMLTextAreaElement::GetDefaultValue(nsAString& aDefaultValue)
 {
   nsContentUtils::GetNodeTextContent(this, false, aDefaultValue);
   return NS_OK;
 }  
 
 NS_IMETHODIMP
-nsHTMLTextAreaElement::SetDefaultValue(const nsAString& aDefaultValue)
+HTMLTextAreaElement::SetDefaultValue(const nsAString& aDefaultValue)
 {
   nsresult rv = nsContentUtils::SetNodeTextContent(this, aDefaultValue, true);
   if (NS_SUCCEEDED(rv) && !mValueChanged) {
     Reset();
   }
   return rv;
 }
 
 bool
-nsHTMLTextAreaElement::ParseAttribute(int32_t aNamespaceID,
-                                      nsIAtom* aAttribute,
-                                      const nsAString& aValue,
-                                      nsAttrValue& aResult)
+HTMLTextAreaElement::ParseAttribute(int32_t aNamespaceID,
+                                    nsIAtom* aAttribute,
+                                    const nsAString& aValue,
+                                    nsAttrValue& aResult)
 {
   if (aNamespaceID == kNameSpaceID_None) {
     if (aAttribute == nsGkAtoms::maxlength) {
       return aResult.ParseNonNegativeIntValue(aValue);
     } else if (aAttribute == nsGkAtoms::cols ||
                aAttribute == nsGkAtoms::rows) {
       return aResult.ParsePositiveIntValue(aValue);
     }
@@ -625,62 +400,62 @@ static void
 MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
                       nsRuleData* aData)
 {
   nsGenericHTMLFormElement::MapDivAlignAttributeInto(aAttributes, aData);
   nsGenericHTMLFormElement::MapCommonAttributesInto(aAttributes, aData);
 }
 
 nsChangeHint
-nsHTMLTextAreaElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
-                                              int32_t aModType) const
+HTMLTextAreaElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
+                                            int32_t aModType) const
 {
   nsChangeHint retval =
       nsGenericHTMLFormElement::GetAttributeChangeHint(aAttribute, aModType);
   if (aAttribute == nsGkAtoms::rows ||
       aAttribute == nsGkAtoms::cols) {
     NS_UpdateHint(retval, NS_STYLE_HINT_REFLOW);
   } else if (aAttribute == nsGkAtoms::wrap) {
     NS_UpdateHint(retval, nsChangeHint_ReconstructFrame);
   } else if (aAttribute == nsGkAtoms::placeholder) {
     NS_UpdateHint(retval, NS_STYLE_HINT_FRAMECHANGE);
   }
   return retval;
 }
 
 NS_IMETHODIMP_(bool)
-nsHTMLTextAreaElement::IsAttributeMapped(const nsIAtom* aAttribute) const
+HTMLTextAreaElement::IsAttributeMapped(const nsIAtom* aAttribute) const
 {
   static const MappedAttributeEntry* const map[] = {
     sDivAlignAttributeMap,
     sCommonAttributeMap,
   };
 
   return FindAttributeDependence(aAttribute, map);
 }
 
 nsMapRuleToAttributesFunc
-nsHTMLTextAreaElement::GetAttributeMappingFunction() const
+HTMLTextAreaElement::GetAttributeMappingFunction() const
 {
   return &MapAttributesIntoRule;
 }
 
 bool
-nsHTMLTextAreaElement::IsDisabledForEvents(uint32_t aMessage)
+HTMLTextAreaElement::IsDisabledForEvents(uint32_t aMessage)
 {
   nsIFormControlFrame* formControlFrame = GetFormControlFrame(false);
   nsIFrame* formFrame = NULL;
   if (formControlFrame) {
     formFrame = do_QueryFrame(formControlFrame);
   }
   return IsElementDisabledForEvents(aMessage, formFrame);
 }
 
 nsresult
-nsHTMLTextAreaElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
+HTMLTextAreaElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
 {
   aVisitor.mCanHandle = false;
   if (IsDisabledForEvents(aVisitor.mEvent->message)) {
     return NS_OK;
   }
 
   // Don't dispatch a second select event if we are already handling
   // one.
@@ -708,17 +483,17 @@ nsHTMLTextAreaElement::PreHandleEvent(ns
   if (aVisitor.mEvent->message == NS_BLUR_CONTENT) {
     FireChangeEventIfNeeded();
   }
 
   return nsGenericHTMLFormElement::PreHandleEvent(aVisitor);
 }
 
 void
-nsHTMLTextAreaElement::FireChangeEventIfNeeded()
+HTMLTextAreaElement::FireChangeEventIfNeeded()
 {
   nsString value;
   GetValueInternal(value, true);
 
   if (mFocusedValue.Equals(value)) {
     return;
   }
 
@@ -726,17 +501,17 @@ nsHTMLTextAreaElement::FireChangeEventIf
   mFocusedValue = value;
   nsContentUtils::DispatchTrustedEvent(OwnerDoc(),
                                        static_cast<nsIContent*>(this),
                                        NS_LITERAL_STRING("change"), true,
                                        false);
 }
 
 nsresult
-nsHTMLTextAreaElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
+HTMLTextAreaElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
 {
   if (aVisitor.mEvent->message == NS_FORM_SELECTED) {
     mHandlingSelect = false;
   }
 
   if (aVisitor.mEvent->message == NS_FOCUS_CONTENT ||
       aVisitor.mEvent->message == NS_BLUR_CONTENT) {
     if (aVisitor.mEvent->message == NS_FOCUS_CONTENT) {
@@ -759,42 +534,42 @@ nsHTMLTextAreaElement::PostHandleEvent(n
   // Reset the flag for other content besides this text field
   aVisitor.mEvent->mFlags.mNoContentDispatch =
     ((aVisitor.mItemFlags & NS_NO_CONTENT_DISPATCH) != 0);
 
   return NS_OK;
 }
 
 void
-nsHTMLTextAreaElement::DoneAddingChildren(bool aHaveNotified)
+HTMLTextAreaElement::DoneAddingChildren(bool aHaveNotified)
 {
   if (!mValueChanged) {
     if (!mDoneAddingChildren) {
       // Reset now that we're done adding children if the content sink tried to
       // sneak some text in without calling AppendChildTo.
       Reset();
     }
     if (!mInhibitStateRestoration) {
       RestoreFormControlState(this, this);
     }
   }
 
   mDoneAddingChildren = true;
 }
 
 bool
-nsHTMLTextAreaElement::IsDoneAddingChildren()
+HTMLTextAreaElement::IsDoneAddingChildren()
 {
   return mDoneAddingChildren;
 }
 
 // Controllers Methods
 
 NS_IMETHODIMP
-nsHTMLTextAreaElement::GetControllers(nsIControllers** aResult)
+HTMLTextAreaElement::GetControllers(nsIControllers** aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
 
   if (!mControllers)
   {
     nsresult rv;
     mControllers = do_CreateInstance(kXULControllersCID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
@@ -814,43 +589,43 @@ nsHTMLTextAreaElement::GetControllers(ns
 
   *aResult = mControllers;
   NS_IF_ADDREF(*aResult);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHTMLTextAreaElement::GetTextLength(int32_t *aTextLength)
+HTMLTextAreaElement::GetTextLength(int32_t *aTextLength)
 {
   NS_ENSURE_ARG_POINTER(aTextLength);
   nsAutoString val;
   nsresult rv = GetValue(val);
   *aTextLength = val.Length();
 
   return rv;
 }
 
 NS_IMETHODIMP
-nsHTMLTextAreaElement::GetSelectionStart(int32_t *aSelectionStart)
+HTMLTextAreaElement::GetSelectionStart(int32_t *aSelectionStart)
 {
   NS_ENSURE_ARG_POINTER(aSelectionStart);
 
   int32_t selEnd;
   nsresult rv = GetSelectionRange(aSelectionStart, &selEnd);
 
   if (NS_FAILED(rv) && mState.IsSelectionCached()) {
     *aSelectionStart = mState.GetSelectionProperties().mStart;
     return NS_OK;
   }
   return rv;
 }
 
 NS_IMETHODIMP
-nsHTMLTextAreaElement::SetSelectionStart(int32_t aSelectionStart)
+HTMLTextAreaElement::SetSelectionStart(int32_t aSelectionStart)
 {
   if (mState.IsSelectionCached()) {
     mState.GetSelectionProperties().mStart = aSelectionStart;
     return NS_OK;
   }
 
   nsAutoString direction;
   nsresult rv = GetSelectionDirection(direction);
@@ -861,32 +636,32 @@ nsHTMLTextAreaElement::SetSelectionStart
   start = aSelectionStart;
   if (end < start) {
     end = start;
   }
   return SetSelectionRange(start, end, direction);
 }
 
 NS_IMETHODIMP
-nsHTMLTextAreaElement::GetSelectionEnd(int32_t *aSelectionEnd)
+HTMLTextAreaElement::GetSelectionEnd(int32_t *aSelectionEnd)
 {
   NS_ENSURE_ARG_POINTER(aSelectionEnd);
 
   int32_t selStart;
   nsresult rv = GetSelectionRange(&selStart, aSelectionEnd);
 
   if (NS_FAILED(rv) && mState.IsSelectionCached()) {
     *aSelectionEnd = mState.GetSelectionProperties().mEnd;
     return NS_OK;
   }
   return rv;
 }
 
 NS_IMETHODIMP
-nsHTMLTextAreaElement::SetSelectionEnd(int32_t aSelectionEnd)
+HTMLTextAreaElement::SetSelectionEnd(int32_t aSelectionEnd)
 {
   if (mState.IsSelectionCached()) {
     mState.GetSelectionProperties().mEnd = aSelectionEnd;
     return NS_OK;
   }
 
   nsAutoString direction;
   nsresult rv = GetSelectionDirection(direction);
@@ -897,18 +672,18 @@ nsHTMLTextAreaElement::SetSelectionEnd(i
   end = aSelectionEnd;
   if (start > end) {
     start = end;
   }
   return SetSelectionRange(start, end, direction);
 }
 
 nsresult
-nsHTMLTextAreaElement::GetSelectionRange(int32_t* aSelectionStart,
-                                      int32_t* aSelectionEnd)
+HTMLTextAreaElement::GetSelectionRange(int32_t* aSelectionStart,
+                                       int32_t* aSelectionEnd)
 {
   nsresult rv = NS_ERROR_FAILURE;
   nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
 
   if (formControlFrame) {
     nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
     if (textControlFrame)
       rv = textControlFrame->GetSelectionRange(aSelectionStart, aSelectionEnd);
@@ -927,17 +702,17 @@ DirectionToName(nsITextControlFrame::Sel
   } else if (dir == nsITextControlFrame::eBackward) {
     aDirection.AssignLiteral("backward");
   } else {
     NS_NOTREACHED("Invalid SelectionDirection value");
   }
 }
 
 nsresult
-nsHTMLTextAreaElement::GetSelectionDirection(nsAString& aDirection)
+HTMLTextAreaElement::GetSelectionDirection(nsAString& aDirection)
 {
   nsresult rv = NS_ERROR_FAILURE;
   nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
 
   if (formControlFrame) {
     nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
     if (textControlFrame) {
       nsITextControlFrame::SelectionDirection dir;
@@ -954,17 +729,17 @@ nsHTMLTextAreaElement::GetSelectionDirec
       return NS_OK;
     }
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
-nsHTMLTextAreaElement::SetSelectionDirection(const nsAString& aDirection) {
+HTMLTextAreaElement::SetSelectionDirection(const nsAString& aDirection) {
   if (mState.IsSelectionCached()) {
     nsITextControlFrame::SelectionDirection dir = nsITextControlFrame::eNone;
     if (aDirection.EqualsLiteral("forward")) {
       dir = nsITextControlFrame::eForward;
     } else if (aDirection.EqualsLiteral("backward")) {
       dir = nsITextControlFrame::eBackward;
     }
     mState.GetSelectionProperties().mDirection = dir;
@@ -976,19 +751,19 @@ nsHTMLTextAreaElement::SetSelectionDirec
   if (NS_SUCCEEDED(rv)) {
     rv = SetSelectionRange(start, end, aDirection);
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
-nsHTMLTextAreaElement::SetSelectionRange(int32_t aSelectionStart,
-                                         int32_t aSelectionEnd,
-                                         const nsAString& aDirection)
+HTMLTextAreaElement::SetSelectionRange(int32_t aSelectionStart,
+                                       int32_t aSelectionEnd,
+                                       const nsAString& aDirection)
 { 
   nsresult rv = NS_ERROR_FAILURE;
   nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
 
   if (formControlFrame) {
     nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
     if (textControlFrame) {
       // Default to forward, even if not specified.
@@ -1005,34 +780,34 @@ nsHTMLTextAreaElement::SetSelectionRange
       }
     }
   }
 
   return rv;
 } 
 
 nsresult
-nsHTMLTextAreaElement::Reset()
+HTMLTextAreaElement::Reset()
 {
   nsresult rv;
 
   // To get the initial spellchecking, reset value to
   // empty string before setting the default value.
   SetValue(EmptyString());
   nsAutoString resetVal;
   GetDefaultValue(resetVal);
   rv = SetValue(resetVal);
   NS_ENSURE_SUCCESS(rv, rv);
 
   SetValueChanged(false);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHTMLTextAreaElement::SubmitNamesValues(nsFormSubmission* aFormSubmission)
+HTMLTextAreaElement::SubmitNamesValues(nsFormSubmission* aFormSubmission)
 {
   // Disabled elements don't submit
   if (IsDisabled()) {
     return NS_OK;
   }
 
   //
   // Get the name (if no name, no submit)
@@ -1051,17 +826,17 @@ nsHTMLTextAreaElement::SubmitNamesValues
 
   //
   // Submit
   //
   return aFormSubmission->AddNameValuePair(name, value);
 }
 
 NS_IMETHODIMP
-nsHTMLTextAreaElement::SaveState()
+HTMLTextAreaElement::SaveState()
 {
   nsresult rv = NS_OK;
 
   // Only save if value != defaultValue (bug 62713)
   nsPresState *state = nullptr;
   if (mValueChanged) {
     rv = GetPrimaryPresState(this, &state);
     if (state) {
@@ -1093,17 +868,17 @@ nsHTMLTextAreaElement::SaveState()
       // attribute.
       state->SetDisabled(HasAttr(kNameSpaceID_None, nsGkAtoms::disabled));
     }
   }
   return rv;
 }
 
 bool
-nsHTMLTextAreaElement::RestoreState(nsPresState* aState)
+HTMLTextAreaElement::RestoreState(nsPresState* aState)
 {
   nsCOMPtr<nsISupportsString> state
     (do_QueryInterface(aState->GetStateProperty()));
   
   if (state) {
     nsAutoString data;
     state->GetData(data);
     SetValue(data);
@@ -1112,17 +887,17 @@ nsHTMLTextAreaElement::RestoreState(nsPr
   if (aState->IsDisabledSet()) {
     SetDisabled(aState->GetDisabled());
   }
 
   return false;
 }
 
 nsEventStates
-nsHTMLTextAreaElement::IntrinsicState() const
+HTMLTextAreaElement::IntrinsicState() const
 {
   nsEventStates state = nsGenericHTMLFormElement::IntrinsicState();
 
   if (HasAttr(kNameSpaceID_None, nsGkAtoms::required)) {
     state |= NS_EVENT_STATE_REQUIRED;
   } else {
     state |= NS_EVENT_STATE_OPTIONAL;
   }
@@ -1157,19 +932,19 @@ nsHTMLTextAreaElement::IntrinsicState() 
       state |= NS_EVENT_STATE_MOZ_UI_VALID;
     }
   }
 
   return state;
 }
 
 nsresult
-nsHTMLTextAreaElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
-                                  nsIContent* aBindingParent,
-                                  bool aCompileEventHandlers)
+HTMLTextAreaElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
+                                nsIContent* aBindingParent,
+                                bool aCompileEventHandlers)
 {
   nsresult rv = nsGenericHTMLFormElement::BindToTree(aDocument, aParent,
                                                      aBindingParent,
                                                      aCompileEventHandlers);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // If there is a disabled fieldset in the parent chain, the element is now
   // barred from constraint validation and can't suffer from value missing.
@@ -1178,93 +953,93 @@ nsHTMLTextAreaElement::BindToTree(nsIDoc
 
   // And now make sure our state is up to date
   UpdateState(false);
 
   return rv;
 }
 
 void
-nsHTMLTextAreaElement::UnbindFromTree(bool aDeep, bool aNullParent)
+HTMLTextAreaElement::UnbindFromTree(bool aDeep, bool aNullParent)
 {
   nsGenericHTMLFormElement::UnbindFromTree(aDeep, aNullParent);
 
   // We might be no longer disabled because of parent chain changed.
   UpdateValueMissingValidityState();
   UpdateBarredFromConstraintValidation();
 
   // And now make sure our state is up to date
   UpdateState(false);
 }
 
 nsresult
-nsHTMLTextAreaElement::BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
-                                     const nsAttrValueOrString* aValue,
-                                     bool aNotify)
+HTMLTextAreaElement::BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
+                                   const nsAttrValueOrString* aValue,
+                                   bool aNotify)
 {
   if (aNotify && aName == nsGkAtoms::disabled &&
       aNameSpaceID == kNameSpaceID_None) {
     mDisabledChanged = true;
   }
 
   return nsGenericHTMLFormElement::BeforeSetAttr(aNameSpaceID, aName,
                                                  aValue, aNotify);
 }
 
 void
-nsHTMLTextAreaElement::CharacterDataChanged(nsIDocument* aDocument,
-                                            nsIContent* aContent,
-                                            CharacterDataChangeInfo* aInfo)
+HTMLTextAreaElement::CharacterDataChanged(nsIDocument* aDocument,
+                                          nsIContent* aContent,
+                                          CharacterDataChangeInfo* aInfo)
 {
   ContentChanged(aContent);
 }
 
 void
-nsHTMLTextAreaElement::ContentAppended(nsIDocument* aDocument,
-                                       nsIContent* aContainer,
-                                       nsIContent* aFirstNewContent,
-                                       int32_t /* unused */)
+HTMLTextAreaElement::ContentAppended(nsIDocument* aDocument,
+                                     nsIContent* aContainer,
+                                     nsIContent* aFirstNewContent,
+                                     int32_t /* unused */)
 {
   ContentChanged(aFirstNewContent);
 }
 
 void
-nsHTMLTextAreaElement::ContentInserted(nsIDocument* aDocument,
-                                       nsIContent* aContainer,
-                                       nsIContent* aChild,
-                                       int32_t /* unused */)
+HTMLTextAreaElement::ContentInserted(nsIDocument* aDocument,
+                                     nsIContent* aContainer,
+                                     nsIContent* aChild,
+                                     int32_t /* unused */)
 {
   ContentChanged(aChild);
 }
 
 void
-nsHTMLTextAreaElement::ContentRemoved(nsIDocument* aDocument,
-                                      nsIContent* aContainer,
-                                      nsIContent* aChild,
-                                      int32_t aIndexInContainer,
-                                      nsIContent* aPreviousSibling)
+HTMLTextAreaElement::ContentRemoved(nsIDocument* aDocument,
+                                    nsIContent* aContainer,
+                                    nsIContent* aChild,
+                                    int32_t aIndexInContainer,
+                                    nsIContent* aPreviousSibling)
 {
   ContentChanged(aChild);
 }
 
 void
-nsHTMLTextAreaElement::ContentChanged(nsIContent* aContent)
+HTMLTextAreaElement::ContentChanged(nsIContent* aContent)
 {
   if (!mValueChanged && mDoneAddingChildren &&
       nsContentUtils::IsInSameAnonymousTree(this, aContent)) {
     // Hard to say what the reset can trigger, so be safe pending
     // further auditing.
     nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
     Reset();
   }
 }
 
 nsresult
-nsHTMLTextAreaElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
-                                    const nsAttrValue* aValue, bool aNotify)
+HTMLTextAreaElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
+                                  const nsAttrValue* aValue, bool aNotify)
 {
   if (aNameSpaceID == kNameSpaceID_None) {
     if (aName == nsGkAtoms::required || aName == nsGkAtoms::disabled ||
         aName == nsGkAtoms::readonly) {
       UpdateValueMissingValidityState();
 
       // This *has* to be called *after* validity has changed.
       if (aName == nsGkAtoms::readonly || aName == nsGkAtoms::disabled) {
@@ -1277,58 +1052,58 @@ nsHTMLTextAreaElement::AfterSetAttr(int3
     UpdateState(aNotify);
   }
 
   return nsGenericHTMLFormElement::AfterSetAttr(aNameSpaceID, aName, aValue,
                                                 aNotify);
 }
 
 nsresult
-nsHTMLTextAreaElement::CopyInnerTo(Element* aDest)
+HTMLTextAreaElement::CopyInnerTo(Element* aDest)
 {
   nsresult rv = nsGenericHTMLFormElement::CopyInnerTo(aDest);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (aDest->OwnerDoc()->IsStaticDocument()) {
     nsAutoString value;
     GetValueInternal(value, true);
-    static_cast<nsHTMLTextAreaElement*>(aDest)->SetValue(value);
+    static_cast<HTMLTextAreaElement*>(aDest)->SetValue(value);
   }
   return NS_OK;
 }
 
 bool
-nsHTMLTextAreaElement::IsMutable() const
+HTMLTextAreaElement::IsMutable() const
 {
   return (!HasAttr(kNameSpaceID_None, nsGkAtoms::readonly) && !IsDisabled());
 }
 
 bool
-nsHTMLTextAreaElement::IsValueEmpty() const
+HTMLTextAreaElement::IsValueEmpty() const
 {
   nsAutoString value;
   GetValueInternal(value, true);
 
   return value.IsEmpty();
 }
 
 // nsIConstraintValidation
 
 NS_IMETHODIMP
-nsHTMLTextAreaElement::SetCustomValidity(const nsAString& aError)
+HTMLTextAreaElement::SetCustomValidity(const nsAString& aError)
 {
   nsIConstraintValidation::SetCustomValidity(aError);
 
   UpdateState(true);
 
   return NS_OK;
 }
 
 bool
-nsHTMLTextAreaElement::IsTooLong()
+HTMLTextAreaElement::IsTooLong()
 {
   if (!HasAttr(kNameSpaceID_None, nsGkAtoms::maxlength) || !mValueChanged) {
     return false;
   }
 
   int32_t maxLength = -1;
   GetMaxLength(&maxLength);
 
@@ -1339,51 +1114,51 @@ nsHTMLTextAreaElement::IsTooLong()
 
   int32_t textLength = -1;
   GetTextLength(&textLength);
 
   return textLength > maxLength;
 }
 
 bool
-nsHTMLTextAreaElement::IsValueMissing() const
+HTMLTextAreaElement::IsValueMissing() const
 {
   if (!HasAttr(kNameSpaceID_None, nsGkAtoms::required) || !IsMutable()) {
     return false;
   }
 
   return IsValueEmpty();
 }
 
 void
-nsHTMLTextAreaElement::UpdateTooLongValidityState()
+HTMLTextAreaElement::UpdateTooLongValidityState()
 {
   // TODO: this code will be re-enabled with bug 613016 and bug 613019.
 #if 0
   SetValidityState(VALIDITY_STATE_TOO_LONG, IsTooLong());
 #endif
 }
 
 void
-nsHTMLTextAreaElement::UpdateValueMissingValidityState()
+HTMLTextAreaElement::UpdateValueMissingValidityState()
 {
   SetValidityState(VALIDITY_STATE_VALUE_MISSING, IsValueMissing());
 }
 
 void
-nsHTMLTextAreaElement::UpdateBarredFromConstraintValidation()
+HTMLTextAreaElement::UpdateBarredFromConstraintValidation()
 {
   SetBarredFromConstraintValidation(HasAttr(kNameSpaceID_None,
                                             nsGkAtoms::readonly) ||
                                     IsDisabled());
 }
 
 nsresult
-nsHTMLTextAreaElement::GetValidationMessage(nsAString& aValidationMessage,
-                                            ValidityStateType aType)
+HTMLTextAreaElement::GetValidationMessage(nsAString& aValidationMessage,
+                                          ValidityStateType aType)
 {
   nsresult rv = NS_OK;
 
   switch (aType)
   {
     case VALIDITY_STATE_TOO_LONG:
       {
         nsXPIDLString message;
@@ -1417,120 +1192,123 @@ nsHTMLTextAreaElement::GetValidationMess
     default:
       rv = nsIConstraintValidation::GetValidationMessage(aValidationMessage, aType);
   }
 
   return rv;
 }
 
 NS_IMETHODIMP_(bool)
-nsHTMLTextAreaElement::IsSingleLineTextControl() const
+HTMLTextAreaElement::IsSingleLineTextControl() const
 {
   return false;
 }
 
 NS_IMETHODIMP_(bool)
-nsHTMLTextAreaElement::IsTextArea() const
+HTMLTextAreaElement::IsTextArea() const
 {
   return true;
 }
 
 NS_IMETHODIMP_(bool)
-nsHTMLTextAreaElement::IsPlainTextControl() const
+HTMLTextAreaElement::IsPlainTextControl() const
 {
   // need to check our HTML attribute and/or CSS.
   return true;
 }
 
 NS_IMETHODIMP_(bool)
-nsHTMLTextAreaElement::IsPasswordTextControl() const
+HTMLTextAreaElement::IsPasswordTextControl() const
 {
   return false;
 }
 
 NS_IMETHODIMP_(int32_t)
-nsHTMLTextAreaElement::GetCols()
+HTMLTextAreaElement::GetCols()
 {
   const nsAttrValue* attr = GetParsedAttr(nsGkAtoms::cols);
   if (attr) {
     int32_t cols = attr->Type() == nsAttrValue::eInteger ?
                    attr->GetIntegerValue() : 0;
     // XXX why a default of 1 char, why hide it
     return (cols <= 0) ? 1 : cols;
   }
 
   return DEFAULT_COLS;
 }
 
 NS_IMETHODIMP_(int32_t)
-nsHTMLTextAreaElement::GetWrapCols()
+HTMLTextAreaElement::GetWrapCols()
 {
   // wrap=off means -1 for wrap width no matter what cols is
   nsHTMLTextWrap wrapProp;
   nsITextControlElement::GetWrapPropertyEnum(this, wrapProp);
   if (wrapProp == nsITextControlElement::eHTMLTextWrap_Off) {
     // do not wrap when wrap=off
     return -1;
   }
 
   // Otherwise we just wrap at the given number of columns
   return GetCols();
 }
 
 
 NS_IMETHODIMP_(int32_t)
-nsHTMLTextAreaElement::GetRows()
+HTMLTextAreaElement::GetRows()
 {
   const nsAttrValue* attr = GetParsedAttr(nsGkAtoms::rows);
   if (attr && attr->Type() == nsAttrValue::eInteger) {
     int32_t rows = attr->GetIntegerValue();
     return (rows <= 0) ? DEFAULT_ROWS_TEXTAREA : rows;
   }
 
   return DEFAULT_ROWS_TEXTAREA;
 }
 
 NS_IMETHODIMP_(bool)
-nsHTMLTextAreaElement::ValueChanged() const
+HTMLTextAreaElement::ValueChanged() const
 {
   return mValueChanged;
 }
 
 NS_IMETHODIMP_(void)
-nsHTMLTextAreaElement::GetTextEditorValue(nsAString& aValue,
-                                          bool aIgnoreWrap) const
+HTMLTextAreaElement::GetTextEditorValue(nsAString& aValue,
+                                        bool aIgnoreWrap) const
 {
   mState.GetValue(aValue, aIgnoreWrap);
 }
 
 NS_IMETHODIMP_(void)
-nsHTMLTextAreaElement::InitializeKeyboardEventListeners()
+HTMLTextAreaElement::InitializeKeyboardEventListeners()
 {
   mState.InitializeKeyboardEventListeners();
 }
 
 NS_IMETHODIMP_(void)
-nsHTMLTextAreaElement::OnValueChanged(bool aNotify)
+HTMLTextAreaElement::OnValueChanged(bool aNotify)
 {
   // Update the validity state
   bool validBefore = IsValid();
   UpdateTooLongValidityState();
   UpdateValueMissingValidityState();
 
   if (validBefore != IsValid()) {
     UpdateState(aNotify);
   }
 }
 
 NS_IMETHODIMP_(bool)
-nsHTMLTextAreaElement::HasCachedSelection()
+HTMLTextAreaElement::HasCachedSelection()
 {
   return mState.IsSelectionCached();
 }
 
 void
-nsHTMLTextAreaElement::FieldSetDisabledChanged(bool aNotify)
+HTMLTextAreaElement::FieldSetDisabledChanged(bool aNotify)
 {
   UpdateValueMissingValidityState();
   UpdateBarredFromConstraintValidation();
 
   nsGenericHTMLFormElement::FieldSetDisabledChanged(aNotify);
 }
+
+} // namespace dom
+} // namespace mozilla
copy from content/html/content/src/nsHTMLTextAreaElement.cpp
copy to content/html/content/src/HTMLTextAreaElement.h
--- a/content/html/content/src/nsHTMLTextAreaElement.cpp
+++ b/content/html/content/src/HTMLTextAreaElement.h
@@ -1,76 +1,50 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set sw=2 ts=2 et tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "mozilla/Util.h"
+#ifndef mozilla_dom_HTMLTextAreaElement_h
+#define mozilla_dom_HTMLTextAreaElement_h
 
 #include "nsIDOMHTMLTextAreaElement.h"
 #include "nsITextControlElement.h"
 #include "nsIDOMNSEditableElement.h"
-#include "nsIControllers.h"
-#include "nsFocusManager.h"
-#include "nsPIDOMWindow.h"
-#include "nsContentCID.h"
 #include "nsCOMPtr.h"
-#include "nsIComponentManager.h"
-#include "nsIDOMHTMLFormElement.h"
-#include "nsIFormControl.h"
-#include "nsIForm.h"
-#include "nsFormSubmission.h"
-#include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
-#include "nsAttrValueInlines.h"
-#include "nsGkAtoms.h"
-#include "nsStyleConsts.h"
-#include "nsPresContext.h"
-#include "nsMappedAttributes.h"
-#include "nsIFormControlFrame.h"
-#include "nsITextControlFrame.h"
 #include "nsEventStates.h"
-#include "nsLinebreakConverter.h"
-#include "nsIDocument.h"
-#include "nsIFrame.h"
-#include "nsGUIEvent.h"
-#include "nsPresState.h"
-#include "nsReadableUtils.h"
-#include "nsEventDispatcher.h"
-#include "nsLayoutUtils.h"
-#include "nsError.h"
 #include "nsStubMutationObserver.h"
-#include "mozAutoDocUpdate.h"
-#include "nsISupportsPrimitives.h"
-#include "nsContentCreatorFunctions.h"
 #include "nsIConstraintValidation.h"
 #include "nsHTMLFormElement.h"
 
 #include "nsTextEditorState.h"
 
-using namespace mozilla;
-using namespace mozilla::dom;
-
-static NS_DEFINE_CID(kXULControllersCID,  NS_XULCONTROLLERS_CID);
-
-#define NS_NO_CONTENT_DISPATCH (1 << 0)
+class nsFormSubmission;
+class nsIControllers;
+class nsIDocument;
+class nsPresContext;
+class nsPresState;
 
-class nsHTMLTextAreaElement : public nsGenericHTMLFormElement,
-                              public nsIDOMHTMLTextAreaElement,
-                              public nsITextControlElement,
-                              public nsIDOMNSEditableElement,
-                              public nsStubMutationObserver,
-                              public nsIConstraintValidation
+namespace mozilla {
+namespace dom {
+
+class HTMLTextAreaElement MOZ_FINAL : public nsGenericHTMLFormElement,
+                                      public nsIDOMHTMLTextAreaElement,
+                                      public nsITextControlElement,
+                                      public nsIDOMNSEditableElement,
+                                      public nsStubMutationObserver,
+                                      public nsIConstraintValidation
 {
 public:
   using nsIConstraintValidation::GetValidationMessage;
 
-  nsHTMLTextAreaElement(already_AddRefed<nsINodeInfo> aNodeInfo,
-                        mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
+  HTMLTextAreaElement(already_AddRefed<nsINodeInfo> aNodeInfo,
+                      FromParser aFromParser = NOT_FROM_PARSER);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE_TO_NSINODE
 
   // nsIDOMElement
@@ -164,17 +138,17 @@ public:
                                  bool aNotify);
 
   // nsIMutationObserver
   NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
 
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLTextAreaElement,
+  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLTextAreaElement,
                                            nsGenericHTMLFormElement)
 
   virtual nsXPCClassInfo* GetClassInfo();
 
   virtual nsIDOMNode* AsDOMNode() { return this; }
 
   // nsIConstraintValidation
   bool     IsTooLong();
@@ -265,1272 +239,13 @@ protected:
   /**
    * Returns whether the current value is the empty string.
    *
    * @return whether the current value is the empty string.
    */
   bool IsValueEmpty() const;
 };
 
-
-NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(TextArea)
-
-
-nsHTMLTextAreaElement::nsHTMLTextAreaElement(already_AddRefed<nsINodeInfo> aNodeInfo,
-                                             FromParser aFromParser)
-  : nsGenericHTMLFormElement(aNodeInfo),
-    mValueChanged(false),
-    mHandlingSelect(false),
-    mDoneAddingChildren(!aFromParser),
-    mInhibitStateRestoration(!!(aFromParser & FROM_PARSER_FRAGMENT)),
-    mDisabledChanged(false),
-    mCanShowInvalidUI(true),
-    mCanShowValidUI(true),
-    mState(this)
-{
-  AddMutationObserver(this);
-
-  // Set up our default state.  By default we're enabled (since we're
-  // a control type that can be disabled but not actually disabled
-  // right now), optional, and valid.  We are NOT readwrite by default
-  // until someone calls UpdateEditableState on us, apparently!  Also
-  // by default we don't have to show validity UI and so forth.
-  AddStatesSilently(NS_EVENT_STATE_ENABLED |
-                    NS_EVENT_STATE_OPTIONAL |
-                    NS_EVENT_STATE_VALID);
-}
-
-
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLTextAreaElement,
-                                                nsGenericHTMLFormElement)
-  NS_IMPL_CYCLE_COLLECTION_UNLINK(mValidity)
-  NS_IMPL_CYCLE_COLLECTION_UNLINK(mControllers)
-  tmp->mState.Unlink();
-NS_IMPL_CYCLE_COLLECTION_UNLINK_END
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLTextAreaElement,
-                                                  nsGenericHTMLFormElement)
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mValidity)
-  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mControllers)
-  tmp->mState.Traverse(cb);
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-
-NS_IMPL_ADDREF_INHERITED(nsHTMLTextAreaElement, Element)
-NS_IMPL_RELEASE_INHERITED(nsHTMLTextAreaElement, Element)
-
-
-DOMCI_NODE_DATA(HTMLTextAreaElement, nsHTMLTextAreaElement)
-
-// QueryInterface implementation for nsHTMLTextAreaElement
-NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsHTMLTextAreaElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE5(nsHTMLTextAreaElement,
-                                   nsIDOMHTMLTextAreaElement,
-                                   nsITextControlElement,
-                                   nsIDOMNSEditableElement,
-                                   nsIMutationObserver,
-                                   nsIConstraintValidation)
-  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLTextAreaElement,
-                                               nsGenericHTMLFormElement)
-NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLTextAreaElement)
-
-
-// nsIDOMHTMLTextAreaElement
-
-
-NS_IMPL_ELEMENT_CLONE(nsHTMLTextAreaElement)
-
-// nsIConstraintValidation
-NS_IMPL_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(nsHTMLTextAreaElement)
-
-
-NS_IMETHODIMP
-nsHTMLTextAreaElement::GetForm(nsIDOMHTMLFormElement** aForm)
-{
-  return nsGenericHTMLFormElement::GetForm(aForm);
-}
-
-
-// nsIContent
-
-NS_IMETHODIMP
-nsHTMLTextAreaElement::Select()
-{
-  // XXX Bug?  We have to give the input focus before contents can be
-  // selected
-
-  FocusTristate state = FocusState();
-  if (state == eUnfocusable) {
-    return NS_OK;
-  }
-
-  nsIFocusManager* fm = nsFocusManager::GetFocusManager();
-
-  nsRefPtr<nsPresContext> presContext = GetPresContext();
-  if (state == eInactiveWindow) {
-    if (fm)
-      fm->SetFocus(this, nsIFocusManager::FLAG_NOSCROLL);
-    SelectAll(presContext);
-    return NS_OK;
-  }
-
-  nsEventStatus status = nsEventStatus_eIgnore;
-  nsGUIEvent event(true, NS_FORM_SELECTED, nullptr);
-  // XXXbz nsHTMLInputElement guards against this reentering; shouldn't we?
-  nsEventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext,
-                              &event, nullptr, &status);
-
-  // If the DOM event was not canceled (e.g. by a JS event handler
-  // returning false)
-  if (status == nsEventStatus_eIgnore) {
-    if (fm) {
-      fm->SetFocus(this, nsIFocusManager::FLAG_NOSCROLL);
-
-      // ensure that the element is actually focused
-      nsCOMPtr<nsIDOMElement> focusedElement;
-      fm->GetFocusedElement(getter_AddRefs(focusedElement));
-      if (SameCOMIdentity(static_cast<nsIDOMNode*>(this), focusedElement)) {
-        // Now Select all the text!
-        SelectAll(presContext);
-      }
-    }
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLTextAreaElement::SelectAll(nsPresContext* aPresContext)
-{
-  nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
-
-  if (formControlFrame) {
-    formControlFrame->SetFormProperty(nsGkAtoms::select, EmptyString());
-  }
-
-  return NS_OK;
-}
-
-bool
-nsHTMLTextAreaElement::IsHTMLFocusable(bool aWithMouse,
-                                       bool *aIsFocusable, int32_t *aTabIndex)
-{
-  if (nsGenericHTMLFormElement::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex)) {
-    return true;
-  }
-
-  // disabled textareas are not focusable
-  *aIsFocusable = !IsDisabled();
-  return false;
-}
-
-NS_IMPL_BOOL_ATTR(nsHTMLTextAreaElement, Autofocus, autofocus)
-NS_IMPL_UINT_ATTR_NON_ZERO_DEFAULT_VALUE(nsHTMLTextAreaElement, Cols, cols, DEFAULT_COLS)
-NS_IMPL_BOOL_ATTR(nsHTMLTextAreaElement, Disabled, disabled)
-NS_IMPL_NON_NEGATIVE_INT_ATTR(nsHTMLTextAreaElement, MaxLength, maxlength)
-NS_IMPL_STRING_ATTR(nsHTMLTextAreaElement, Name, name)
-NS_IMPL_BOOL_ATTR(nsHTMLTextAreaElement, ReadOnly, readonly)
-NS_IMPL_BOOL_ATTR(nsHTMLTextAreaElement, Required, required)
-NS_IMPL_UINT_ATTR_NON_ZERO_DEFAULT_VALUE(nsHTMLTextAreaElement, Rows, rows, DEFAULT_ROWS_TEXTAREA)
-NS_IMPL_STRING_ATTR(nsHTMLTextAreaElement, Wrap, wrap)
-NS_IMPL_STRING_ATTR(nsHTMLTextAreaElement, Placeholder, placeholder)
-  
-int32_t
-nsHTMLTextAreaElement::TabIndexDefault()
-{
-  return 0;
-}
-
-NS_IMETHODIMP 
-nsHTMLTextAreaElement::GetType(nsAString& aType)
-{
-  aType.AssignLiteral("textarea");
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP 
-nsHTMLTextAreaElement::GetValue(nsAString& aValue)
-{
-  GetValueInternal(aValue, true);
-  return NS_OK;
-}
-
-void
-nsHTMLTextAreaElement::GetValueInternal(nsAString& aValue, bool aIgnoreWrap) const
-{
-  mState.GetValue(aValue, aIgnoreWrap);
-}
-
-NS_IMETHODIMP_(nsIEditor*)
-nsHTMLTextAreaElement::GetTextEditor()
-{
-  return mState.GetEditor();
-}
-
-NS_IMETHODIMP_(nsISelectionController*)
-nsHTMLTextAreaElement::GetSelectionController()
-{
-  return mState.GetSelectionController();
-}
-
-NS_IMETHODIMP_(nsFrameSelection*)
-nsHTMLTextAreaElement::GetConstFrameSelection()
-{
-  return mState.GetConstFrameSelection();
-}
-
-NS_IMETHODIMP
-nsHTMLTextAreaElement::BindToFrame(nsTextControlFrame* aFrame)
-{
-  return mState.BindToFrame(aFrame);
-}
-
-NS_IMETHODIMP_(void)
-nsHTMLTextAreaElement::UnbindFromFrame(nsTextControlFrame* aFrame)
-{
-  if (aFrame) {
-    mState.UnbindFromFrame(aFrame);
-  }
-}
-
-NS_IMETHODIMP
-nsHTMLTextAreaElement::CreateEditor()
-{
-  return mState.PrepareEditor();
-}
-
-NS_IMETHODIMP_(nsIContent*)
-nsHTMLTextAreaElement::GetRootEditorNode()
-{
-  return mState.GetRootNode();
-}
-
-NS_IMETHODIMP_(nsIContent*)
-nsHTMLTextAreaElement::CreatePlaceholderNode()
-{
-  NS_ENSURE_SUCCESS(mState.CreatePlaceholderNode(), nullptr);
-  return mState.GetPlaceholderNode();
-}
-
-NS_IMETHODIMP_(nsIContent*)
-nsHTMLTextAreaElement::GetPlaceholderNode()
-{
-  return mState.GetPlaceholderNode();
-}
-
-NS_IMETHODIMP_(void)
-nsHTMLTextAreaElement::UpdatePlaceholderVisibility(bool aNotify)
-{
-  mState.UpdatePlaceholderVisibility(aNotify);
-}
-
-NS_IMETHODIMP_(bool)
-nsHTMLTextAreaElement::GetPlaceholderVisibility()
-{
-  return mState.GetPlaceholderVisibility();
-}
-
-nsresult
-nsHTMLTextAreaElement::SetValueInternal(const nsAString& aValue,
-                                        bool aUserInput)
-{
-  // Need to set the value changed flag here, so that
-  // nsTextControlFrame::UpdateValueDisplay retrieves the correct value
-  // if needed.
-  SetValueChanged(true);
-  mState.SetValue(aValue, aUserInput, true);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP 
-nsHTMLTextAreaElement::SetValue(const nsAString& aValue)
-{
-  // If the value has been set by a script, we basically want to keep the
-  // current change event state. If the element is ready to fire a change
-  // event, we should keep it that way. Otherwise, we should make sure the
-  // element will not fire any event because of the script interaction.
-  //
-  // NOTE: this is currently quite expensive work (too much string
-  // manipulation). We should probably optimize that.
-  nsAutoString currentValue;
-  GetValueInternal(currentValue, true);
-
-  SetValueInternal(aValue, false);
-
-  if (mFocusedValue.Equals(currentValue)) {
-    GetValueInternal(mFocusedValue, true);
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP 
-nsHTMLTextAreaElement::SetUserInput(const nsAString& aValue)
-{
-  if (!nsContentUtils::IsCallerChrome()) {
-    return NS_ERROR_DOM_SECURITY_ERR;
-  }
-  SetValueInternal(aValue, true);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLTextAreaElement::SetValueChanged(bool aValueChanged)
-{
-  bool previousValue = mValueChanged;
-
-  mValueChanged = aValueChanged;
-
-  if (mValueChanged != previousValue) {
-    UpdateState(true);
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLTextAreaElement::GetDefaultValue(nsAString& aDefaultValue)
-{
-  nsContentUtils::GetNodeTextContent(this, false, aDefaultValue);
-  return NS_OK;
-}  
-
-NS_IMETHODIMP
-nsHTMLTextAreaElement::SetDefaultValue(const nsAString& aDefaultValue)
-{
-  nsresult rv = nsContentUtils::SetNodeTextContent(this, aDefaultValue, true);
-  if (NS_SUCCEEDED(rv) && !mValueChanged) {
-    Reset();
-  }
-  return rv;
-}
-
-bool
-nsHTMLTextAreaElement::ParseAttribute(int32_t aNamespaceID,
-                                      nsIAtom* aAttribute,
-                                      const nsAString& aValue,
-                                      nsAttrValue& aResult)
-{
-  if (aNamespaceID == kNameSpaceID_None) {
-    if (aAttribute == nsGkAtoms::maxlength) {
-      return aResult.ParseNonNegativeIntValue(aValue);
-    } else if (aAttribute == nsGkAtoms::cols ||
-               aAttribute == nsGkAtoms::rows) {
-      return aResult.ParsePositiveIntValue(aValue);
-    }
-  }
-  return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
-                                              aResult);
-}
-
-static void
-MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
-                      nsRuleData* aData)
-{
-  nsGenericHTMLFormElement::MapDivAlignAttributeInto(aAttributes, aData);
-  nsGenericHTMLFormElement::MapCommonAttributesInto(aAttributes, aData);
-}
-
-nsChangeHint
-nsHTMLTextAreaElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
-                                              int32_t aModType) const
-{
-  nsChangeHint retval =
-      nsGenericHTMLFormElement::GetAttributeChangeHint(aAttribute, aModType);
-  if (aAttribute == nsGkAtoms::rows ||
-      aAttribute == nsGkAtoms::cols) {
-    NS_UpdateHint(retval, NS_STYLE_HINT_REFLOW);
-  } else if (aAttribute == nsGkAtoms::wrap) {
-    NS_UpdateHint(retval, nsChangeHint_ReconstructFrame);
-  } else if (aAttribute == nsGkAtoms::placeholder) {
-    NS_UpdateHint(retval, NS_STYLE_HINT_FRAMECHANGE);
-  }
-  return retval;
-}
-
-NS_IMETHODIMP_(bool)
-nsHTMLTextAreaElement::IsAttributeMapped(const nsIAtom* aAttribute) const
-{
-  static const MappedAttributeEntry* const map[] = {
-    sDivAlignAttributeMap,
-    sCommonAttributeMap,
-  };
-
-  return FindAttributeDependence(aAttribute, map);
-}
-
-nsMapRuleToAttributesFunc
-nsHTMLTextAreaElement::GetAttributeMappingFunction() const
-{
-  return &MapAttributesIntoRule;
-}
-
-bool
-nsHTMLTextAreaElement::IsDisabledForEvents(uint32_t aMessage)
-{
-  nsIFormControlFrame* formControlFrame = GetFormControlFrame(false);
-  nsIFrame* formFrame = NULL;
-  if (formControlFrame) {
-    formFrame = do_QueryFrame(formControlFrame);
-  }
-  return IsElementDisabledForEvents(aMessage, formFrame);
-}
-
-nsresult
-nsHTMLTextAreaElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
-{
-  aVisitor.mCanHandle = false;
-  if (IsDisabledForEvents(aVisitor.mEvent->message)) {
-    return NS_OK;
-  }
-
-  // Don't dispatch a second select event if we are already handling
-  // one.
-  if (aVisitor.mEvent->message == NS_FORM_SELECTED) {
-    if (mHandlingSelect) {
-      return NS_OK;
-    }
-    mHandlingSelect = true;
-  }
-
-  // If noContentDispatch is true we will not allow content to handle
-  // this event.  But to allow middle mouse button paste to work we must allow 
-  // middle clicks to go to text fields anyway.
-  if (aVisitor.mEvent->mFlags.mNoContentDispatch) {
-    aVisitor.mItemFlags |= NS_NO_CONTENT_DISPATCH;
-  }
-  if (aVisitor.mEvent->message == NS_MOUSE_CLICK &&
-      aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT &&
-      static_cast<nsMouseEvent*>(aVisitor.mEvent)->button ==
-        nsMouseEvent::eMiddleButton) {
-    aVisitor.mEvent->mFlags.mNoContentDispatch = false;
-  }
-
-  // Fire onchange (if necessary), before we do the blur, bug 370521.
-  if (aVisitor.mEvent->message == NS_BLUR_CONTENT) {
-    FireChangeEventIfNeeded();
-  }
-
-  return nsGenericHTMLFormElement::PreHandleEvent(aVisitor);
-}
-
-void
-nsHTMLTextAreaElement::FireChangeEventIfNeeded()
-{
-  nsString value;
-  GetValueInternal(value, true);
-
-  if (mFocusedValue.Equals(value)) {
-    return;
-  }
-
-  // Dispatch the change event.
-  mFocusedValue = value;
-  nsContentUtils::DispatchTrustedEvent(OwnerDoc(),
-                                       static_cast<nsIContent*>(this),
-                                       NS_LITERAL_STRING("change"), true,
-                                       false);
-}
-
-nsresult
-nsHTMLTextAreaElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
-{
-  if (aVisitor.mEvent->message == NS_FORM_SELECTED) {
-    mHandlingSelect = false;
-  }
-
-  if (aVisitor.mEvent->message == NS_FOCUS_CONTENT ||
-      aVisitor.mEvent->message == NS_BLUR_CONTENT) {
-    if (aVisitor.mEvent->message == NS_FOCUS_CONTENT) {
-      // If the invalid UI is shown, we should show it while focusing (and
-      // update). Otherwise, we should not.
-      GetValueInternal(mFocusedValue, true);
-      mCanShowInvalidUI = !IsValid() && ShouldShowValidityUI();
-
-      // If neither invalid UI nor valid UI is shown, we shouldn't show the valid
-      // UI while typing.
-      mCanShowValidUI = ShouldShowValidityUI();
-    } else { // NS_BLUR_CONTENT
-      mCanShowInvalidUI = true;
-      mCanShowValidUI = true;
-    }
-
-    UpdateState(true);
-  }
-
-  // Reset the flag for other content besides this text field
-  aVisitor.mEvent->mFlags.mNoContentDispatch =
-    ((aVisitor.mItemFlags & NS_NO_CONTENT_DISPATCH) != 0);
-
-  return NS_OK;
-}
-
-void
-nsHTMLTextAreaElement::DoneAddingChildren(bool aHaveNotified)
-{
-  if (!mValueChanged) {
-    if (!mDoneAddingChildren) {
-      // Reset now that we're done adding children if the content sink tried to
-      // sneak some text in without calling AppendChildTo.
-      Reset();
-    }
-    if (!mInhibitStateRestoration) {
-      RestoreFormControlState(this, this);
-    }
-  }
-
-  mDoneAddingChildren = true;
-}
-
-bool
-nsHTMLTextAreaElement::IsDoneAddingChildren()
-{
-  return mDoneAddingChildren;
-}
-
-// Controllers Methods
-
-NS_IMETHODIMP
-nsHTMLTextAreaElement::GetControllers(nsIControllers** aResult)
-{
-  NS_ENSURE_ARG_POINTER(aResult);
-
-  if (!mControllers)
-  {
-    nsresult rv;
-    mControllers = do_CreateInstance(kXULControllersCID, &rv);
-    NS_ENSURE_SUCCESS(rv, rv);
-
-    nsCOMPtr<nsIController> controller = do_CreateInstance("@mozilla.org/editor/editorcontroller;1", &rv);
-    if (NS_FAILED(rv))
-      return rv;
-
-    mControllers->AppendController(controller);
-
-    controller = do_CreateInstance("@mozilla.org/editor/editingcontroller;1", &rv);
-    if (NS_FAILED(rv))
-      return rv;
-
-    mControllers->AppendController(controller);
-  }
-
-  *aResult = mControllers;
-  NS_IF_ADDREF(*aResult);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLTextAreaElement::GetTextLength(int32_t *aTextLength)
-{
-  NS_ENSURE_ARG_POINTER(aTextLength);
-  nsAutoString val;
-  nsresult rv = GetValue(val);
-  *aTextLength = val.Length();
-
-  return rv;
-}
-
-NS_IMETHODIMP
-nsHTMLTextAreaElement::GetSelectionStart(int32_t *aSelectionStart)
-{
-  NS_ENSURE_ARG_POINTER(aSelectionStart);
-
-  int32_t selEnd;
-  nsresult rv = GetSelectionRange(aSelectionStart, &selEnd);
-
-  if (NS_FAILED(rv) && mState.IsSelectionCached()) {
-    *aSelectionStart = mState.GetSelectionProperties().mStart;
-    return NS_OK;
-  }
-  return rv;
-}
-
-NS_IMETHODIMP
-nsHTMLTextAreaElement::SetSelectionStart(int32_t aSelectionStart)
-{
-  if (mState.IsSelectionCached()) {
-    mState.GetSelectionProperties().mStart = aSelectionStart;
-    return NS_OK;
-  }
-
-  nsAutoString direction;
-  nsresult rv = GetSelectionDirection(direction);
-  NS_ENSURE_SUCCESS(rv, rv);
-  int32_t start, end;
-  rv = GetSelectionRange(&start, &end);
-  NS_ENSURE_SUCCESS(rv, rv);
-  start = aSelectionStart;
-  if (end < start) {
-    end = start;
-  }
-  return SetSelectionRange(start, end, direction);
-}
-
-NS_IMETHODIMP
-nsHTMLTextAreaElement::GetSelectionEnd(int32_t *aSelectionEnd)
-{
-  NS_ENSURE_ARG_POINTER(aSelectionEnd);
-
-  int32_t selStart;
-  nsresult rv = GetSelectionRange(&selStart, aSelectionEnd);
-
-  if (NS_FAILED(rv) && mState.IsSelectionCached()) {
-    *aSelectionEnd = mState.GetSelectionProperties().mEnd;
-    return NS_OK;
-  }
-  return rv;
-}
-
-NS_IMETHODIMP
-nsHTMLTextAreaElement::SetSelectionEnd(int32_t aSelectionEnd)
-{
-  if (mState.IsSelectionCached()) {
-    mState.GetSelectionProperties().mEnd = aSelectionEnd;
-    return NS_OK;
-  }
-
-  nsAutoString direction;
-  nsresult rv = GetSelectionDirection(direction);
-  NS_ENSURE_SUCCESS(rv, rv);
-  int32_t start, end;
-  rv = GetSelectionRange(&start, &end);
-  NS_ENSURE_SUCCESS(rv, rv);
-  end = aSelectionEnd;
-  if (start > end) {
-    start = end;
-  }
-  return SetSelectionRange(start, end, direction);
-}
+} // namespace dom
+} // namespace mozilla
 
-nsresult
-nsHTMLTextAreaElement::GetSelectionRange(int32_t* aSelectionStart,
-                                      int32_t* aSelectionEnd)
-{
-  nsresult rv = NS_ERROR_FAILURE;
-  nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
-
-  if (formControlFrame) {
-    nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
-    if (textControlFrame)
-      rv = textControlFrame->GetSelectionRange(aSelectionStart, aSelectionEnd);
-  }
-
-  return rv;
-}
-
-static void
-DirectionToName(nsITextControlFrame::SelectionDirection dir, nsAString& aDirection)
-{
-  if (dir == nsITextControlFrame::eNone) {
-    aDirection.AssignLiteral("none");
-  } else if (dir == nsITextControlFrame::eForward) {
-    aDirection.AssignLiteral("forward");
-  } else if (dir == nsITextControlFrame::eBackward) {
-    aDirection.AssignLiteral("backward");
-  } else {
-    NS_NOTREACHED("Invalid SelectionDirection value");
-  }
-}
-
-nsresult
-nsHTMLTextAreaElement::GetSelectionDirection(nsAString& aDirection)
-{
-  nsresult rv = NS_ERROR_FAILURE;
-  nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
-
-  if (formControlFrame) {
-    nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
-    if (textControlFrame) {
-      nsITextControlFrame::SelectionDirection dir;
-      rv = textControlFrame->GetSelectionRange(nullptr, nullptr, &dir);
-      if (NS_SUCCEEDED(rv)) {
-        DirectionToName(dir, aDirection);
-      }
-    }
-  }
-
-  if (NS_FAILED(rv)) {
-    if (mState.IsSelectionCached()) {
-      DirectionToName(mState.GetSelectionProperties().mDirection, aDirection);
-      return NS_OK;
-    }
-  }
-
-  return rv;
-}
-
-NS_IMETHODIMP
-nsHTMLTextAreaElement::SetSelectionDirection(const nsAString& aDirection) {
-  if (mState.IsSelectionCached()) {
-    nsITextControlFrame::SelectionDirection dir = nsITextControlFrame::eNone;
-    if (aDirection.EqualsLiteral("forward")) {
-      dir = nsITextControlFrame::eForward;
-    } else if (aDirection.EqualsLiteral("backward")) {
-      dir = nsITextControlFrame::eBackward;
-    }
-    mState.GetSelectionProperties().mDirection = dir;
-    return NS_OK;
-  }
-
-  int32_t start, end;
-  nsresult rv = GetSelectionRange(&start, &end);
-  if (NS_SUCCEEDED(rv)) {
-    rv = SetSelectionRange(start, end, aDirection);
-  }
-
-  return rv;
-}
-
-NS_IMETHODIMP
-nsHTMLTextAreaElement::SetSelectionRange(int32_t aSelectionStart,
-                                         int32_t aSelectionEnd,
-                                         const nsAString& aDirection)
-{ 
-  nsresult rv = NS_ERROR_FAILURE;
-  nsIFormControlFrame* formControlFrame = GetFormControlFrame(true);
-
-  if (formControlFrame) {
-    nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
-    if (textControlFrame) {
-      // Default to forward, even if not specified.
-      // Note that we don't currently support directionless selections, so
-      // "none" is treated like "forward".
-      nsITextControlFrame::SelectionDirection dir = nsITextControlFrame::eForward;
-      if (aDirection.EqualsLiteral("backward")) {
-        dir = nsITextControlFrame::eBackward;
-      }
-
-      rv = textControlFrame->SetSelectionRange(aSelectionStart, aSelectionEnd, dir);
-      if (NS_SUCCEEDED(rv)) {
-        rv = textControlFrame->ScrollSelectionIntoView();
-      }
-    }
-  }
-
-  return rv;
-} 
-
-nsresult
-nsHTMLTextAreaElement::Reset()
-{
-  nsresult rv;
-
-  // To get the initial spellchecking, reset value to
-  // empty string before setting the default value.
-  SetValue(EmptyString());
-  nsAutoString resetVal;
-  GetDefaultValue(resetVal);
-  rv = SetValue(resetVal);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  SetValueChanged(false);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLTextAreaElement::SubmitNamesValues(nsFormSubmission* aFormSubmission)
-{
-  // Disabled elements don't submit
-  if (IsDisabled()) {
-    return NS_OK;
-  }
-
-  //
-  // Get the name (if no name, no submit)
-  //
-  nsAutoString name;
-  GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
-  if (name.IsEmpty()) {
-    return NS_OK;
-  }
-
-  //
-  // Get the value
-  //
-  nsAutoString value;
-  GetValueInternal(value, false);
-
-  //
-  // Submit
-  //
-  return aFormSubmission->AddNameValuePair(name, value);
-}
-
-NS_IMETHODIMP
-nsHTMLTextAreaElement::SaveState()
-{
-  nsresult rv = NS_OK;
-
-  // Only save if value != defaultValue (bug 62713)
-  nsPresState *state = nullptr;
-  if (mValueChanged) {
-    rv = GetPrimaryPresState(this, &state);
-    if (state) {
-      nsAutoString value;
-      GetValueInternal(value, true);
-
-      rv = nsLinebreakConverter::ConvertStringLineBreaks(
-               value,
-               nsLinebreakConverter::eLinebreakPlatform,
-               nsLinebreakConverter::eLinebreakContent);
-      NS_ASSERTION(NS_SUCCEEDED(rv), "Converting linebreaks failed!");
-
-      nsCOMPtr<nsISupportsString> pState =
-        do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID);
-      if (!pState) {
-        return NS_ERROR_OUT_OF_MEMORY;
-      }
-      pState->SetData(value);
-      state->SetStateProperty(pState);
-    }
-  }
-
-  if (mDisabledChanged) {
-    if (!state) {
-      rv = GetPrimaryPresState(this, &state);
-    }
-    if (state) {
-      // We do not want to save the real disabled state but the disabled
-      // attribute.
-      state->SetDisabled(HasAttr(kNameSpaceID_None, nsGkAtoms::disabled));
-    }
-  }
-  return rv;
-}
-
-bool
-nsHTMLTextAreaElement::RestoreState(nsPresState* aState)
-{
-  nsCOMPtr<nsISupportsString> state
-    (do_QueryInterface(aState->GetStateProperty()));
-  
-  if (state) {
-    nsAutoString data;
-    state->GetData(data);
-    SetValue(data);
-  }
-
-  if (aState->IsDisabledSet()) {
-    SetDisabled(aState->GetDisabled());
-  }
-
-  return false;
-}
-
-nsEventStates
-nsHTMLTextAreaElement::IntrinsicState() const
-{
-  nsEventStates state = nsGenericHTMLFormElement::IntrinsicState();
-
-  if (HasAttr(kNameSpaceID_None, nsGkAtoms::required)) {
-    state |= NS_EVENT_STATE_REQUIRED;
-  } else {
-    state |= NS_EVENT_STATE_OPTIONAL;
-  }
-
-  if (IsCandidateForConstraintValidation()) {
-    if (IsValid()) {
-      state |= NS_EVENT_STATE_VALID;
-    } else {
-      state |= NS_EVENT_STATE_INVALID;
-      // :-moz-ui-invalid always apply if the element suffers from a custom
-      // error and never applies if novalidate is set on the form owner.
-      if ((!mForm || !mForm->HasAttr(kNameSpaceID_None, nsGkAtoms::novalidate)) &&
-          (GetValidityState(VALIDITY_STATE_CUSTOM_ERROR) ||
-           (mCanShowInvalidUI && ShouldShowValidityUI()))) {
-        state |= NS_EVENT_STATE_MOZ_UI_INVALID;
-      }
-    }
-
-    // :-moz-ui-valid applies if all the following are true:
-    // 1. The element is not focused, or had either :-moz-ui-valid or
-    //    :-moz-ui-invalid applying before it was focused ;
-    // 2. The element is either valid or isn't allowed to have
-    //    :-moz-ui-invalid applying ;
-    // 3. The element has no form owner or its form owner doesn't have the
-    //    novalidate attribute set ;
-    // 4. The element has already been modified or the user tried to submit the
-    //    form owner while invalid.
-    if ((!mForm || !mForm->HasAttr(kNameSpaceID_None, nsGkAtoms::novalidate)) &&
-        (mCanShowValidUI && ShouldShowValidityUI() &&
-         (IsValid() || (state.HasState(NS_EVENT_STATE_MOZ_UI_INVALID) &&
-                        !mCanShowInvalidUI)))) {
-      state |= NS_EVENT_STATE_MOZ_UI_VALID;
-    }
-  }
-
-  return state;
-}
-
-nsresult
-nsHTMLTextAreaElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
-                                  nsIContent* aBindingParent,
-                                  bool aCompileEventHandlers)
-{
-  nsresult rv = nsGenericHTMLFormElement::BindToTree(aDocument, aParent,
-                                                     aBindingParent,
-                                                     aCompileEventHandlers);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  // If there is a disabled fieldset in the parent chain, the element is now
-  // barred from constraint validation and can't suffer from value missing.
-  UpdateValueMissingValidityState();
-  UpdateBarredFromConstraintValidation();
-
-  // And now make sure our state is up to date
-  UpdateState(false);
-
-  return rv;
-}
-
-void
-nsHTMLTextAreaElement::UnbindFromTree(bool aDeep, bool aNullParent)
-{
-  nsGenericHTMLFormElement::UnbindFromTree(aDeep, aNullParent);
-
-  // We might be no longer disabled because of parent chain changed.
-  UpdateValueMissingValidityState();
-  UpdateBarredFromConstraintValidation();
-
-  // And now make sure our state is up to date
-  UpdateState(false);
-}
-
-nsresult
-nsHTMLTextAreaElement::BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
-                                     const nsAttrValueOrString* aValue,
-                                     bool aNotify)
-{
-  if (aNotify && aName == nsGkAtoms::disabled &&
-      aNameSpaceID == kNameSpaceID_None) {
-    mDisabledChanged = true;
-  }
-
-  return nsGenericHTMLFormElement::BeforeSetAttr(aNameSpaceID, aName,
-                                                 aValue, aNotify);
-}
-
-void
-nsHTMLTextAreaElement::CharacterDataChanged(nsIDocument* aDocument,
-                                            nsIContent* aContent,
-                                            CharacterDataChangeInfo* aInfo)
-{
-  ContentChanged(aContent);
-}
+#endif
 
-void
-nsHTMLTextAreaElement::ContentAppended(nsIDocument* aDocument,
-                                       nsIContent* aContainer,
-                                       nsIContent* aFirstNewContent,
-                                       int32_t /* unused */)
-{
-  ContentChanged(aFirstNewContent);
-}
-
-void
-nsHTMLTextAreaElement::ContentInserted(nsIDocument* aDocument,
-                                       nsIContent* aContainer,
-                                       nsIContent* aChild,
-                                       int32_t /* unused */)
-{
-  ContentChanged(aChild);
-}
-
-void
-nsHTMLTextAreaElement::ContentRemoved(nsIDocument* aDocument,
-                                      nsIContent* aContainer,
-                                      nsIContent* aChild,
-                                      int32_t aIndexInContainer,
-                                      nsIContent* aPreviousSibling)
-{
-  ContentChanged(aChild);
-}
-
-void
-nsHTMLTextAreaElement::ContentChanged(nsIContent* aContent)
-{
-  if (!mValueChanged && mDoneAddingChildren &&
-      nsContentUtils::IsInSameAnonymousTree(this, aContent)) {
-    // Hard to say what the reset can trigger, so be safe pending
-    // further auditing.
-    nsCOMPtr<nsIMutationObserver> kungFuDeathGrip(this);
-    Reset();
-  }
-}
-
-nsresult
-nsHTMLTextAreaElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
-                                    const nsAttrValue* aValue, bool aNotify)
-{
-  if (aNameSpaceID == kNameSpaceID_None) {
-    if (aName == nsGkAtoms::required || aName == nsGkAtoms::disabled ||
-        aName == nsGkAtoms::readonly) {
-      UpdateValueMissingValidityState();
-
-      // This *has* to be called *after* validity has changed.
-      if (aName == nsGkAtoms::readonly || aName == nsGkAtoms::disabled) {
-        UpdateBarredFromConstraintValidation();
-      }
-    } else if (aName == nsGkAtoms::maxlength) {
-      UpdateTooLongValidityState();
-    }
-
-    UpdateState(aNotify);
-  }
-
-  return nsGenericHTMLFormElement::AfterSetAttr(aNameSpaceID, aName, aValue,
-                                                aNotify);
-}
-
-nsresult
-nsHTMLTextAreaElement::CopyInnerTo(Element* aDest)
-{
-  nsresult rv = nsGenericHTMLFormElement::CopyInnerTo(aDest);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  if (aDest->OwnerDoc()->IsStaticDocument()) {
-    nsAutoString value;
-    GetValueInternal(value, true);
-    static_cast<nsHTMLTextAreaElement*>(aDest)->SetValue(value);
-  }
-  return NS_OK;
-}
-
-bool
-nsHTMLTextAreaElement::IsMutable() const
-{
-  return (!HasAttr(kNameSpaceID_None, nsGkAtoms::readonly) && !IsDisabled());
-}
-
-bool
-nsHTMLTextAreaElement::IsValueEmpty() const
-{
-  nsAutoString value;
-  GetValueInternal(value, true);
-
-  return value.IsEmpty();
-}
-
-// nsIConstraintValidation
-
-NS_IMETHODIMP
-nsHTMLTextAreaElement::SetCustomValidity(const nsAString& aError)
-{
-  nsIConstraintValidation::SetCustomValidity(aError);
-
-  UpdateState(true);
-
-  return NS_OK;
-}
-
-bool
-nsHTMLTextAreaElement::IsTooLong()
-{
-  if (!HasAttr(kNameSpaceID_None, nsGkAtoms::maxlength) || !mValueChanged) {
-    return false;
-  }
-
-  int32_t maxLength = -1;
-  GetMaxLength(&maxLength);
-
-  // Maxlength of -1 means parsing error.
-  if (maxLength == -1) {
-    return false;
-  }
-
-  int32_t textLength = -1;
-  GetTextLength(&textLength);
-
-  return textLength > maxLength;
-}
-
-bool
-nsHTMLTextAreaElement::IsValueMissing() const
-{
-  if (!HasAttr(kNameSpaceID_None, nsGkAtoms::required) || !IsMutable()) {
-    return false;
-  }
-
-  return IsValueEmpty();
-}
-
-void
-nsHTMLTextAreaElement::UpdateTooLongValidityState()
-{
-  // TODO: this code will be re-enabled with bug 613016 and bug 613019.
-#if 0
-  SetValidityState(VALIDITY_STATE_TOO_LONG, IsTooLong());
-#endif
-}
-
-void
-nsHTMLTextAreaElement::UpdateValueMissingValidityState()
-{
-  SetValidityState(VALIDITY_STATE_VALUE_MISSING, IsValueMissing());
-}
-
-void
-nsHTMLTextAreaElement::UpdateBarredFromConstraintValidation()
-{
-  SetBarredFromConstraintValidation(HasAttr(kNameSpaceID_None,
-                                            nsGkAtoms::readonly) ||
-                                    IsDisabled());
-}
-
-nsresult
-nsHTMLTextAreaElement::GetValidationMessage(nsAString& aValidationMessage,
-                                            ValidityStateType aType)
-{
-  nsresult rv = NS_OK;
-
-  switch (aType)
-  {
-    case VALIDITY_STATE_TOO_LONG:
-      {
-        nsXPIDLString message;
-        int32_t maxLength = -1;
-        int32_t textLength = -1;
-        nsAutoString strMaxLength;
-        nsAutoString strTextLength;
-
-        GetMaxLength(&maxLength);
-        GetTextLength(&textLength);
-
-        strMaxLength.AppendInt(maxLength);
-        strTextLength.AppendInt(textLength);
-
-        const PRUnichar* params[] = { strMaxLength.get(), strTextLength.get() };
-        rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
-                                                   "FormValidationTextTooLong",
-                                                   params, message);
-        aValidationMessage = message;
-      }
-      break;
-    case VALIDITY_STATE_VALUE_MISSING:
-      {
-        nsXPIDLString message;
-        rv = nsContentUtils::GetLocalizedString(nsContentUtils::eDOM_PROPERTIES,
-                                                "FormValidationValueMissing",
-                                                message);
-        aValidationMessage = message;
-      }
-      break;
-    default:
-      rv = nsIConstraintValidation::GetValidationMessage(aValidationMessage, aType);
-  }
-
-  return rv;
-}
-
-NS_IMETHODIMP_(bool)
-nsHTMLTextAreaElement::IsSingleLineTextControl() const
-{
-  return false;
-}
-
-NS_IMETHODIMP_(bool)
-nsHTMLTextAreaElement::IsTextArea() const
-{
-  return true;
-}
-
-NS_IMETHODIMP_(bool)
-nsHTMLTextAreaElement::IsPlainTextControl() const
-{
-  // need to check our HTML attribute and/or CSS.
-  return true;
-}
-
-NS_IMETHODIMP_(bool)
-nsHTMLTextAreaElement::IsPasswordTextControl() const
-{
-  return false;
-}
-
-NS_IMETHODIMP_(int32_t)
-nsHTMLTextAreaElement::GetCols()
-{
-  const nsAttrValue* attr = GetParsedAttr(nsGkAtoms::cols);
-  if (attr) {
-    int32_t cols = attr->Type() == nsAttrValue::eInteger ?
-                   attr->GetIntegerValue() : 0;
-    // XXX why a default of 1 char, why hide it
-    return (cols <= 0) ? 1 : cols;
-  }
-
-  return DEFAULT_COLS;
-}
-
-NS_IMETHODIMP_(int32_t)
-nsHTMLTextAreaElement::GetWrapCols()
-{
-  // wrap=off means -1 for wrap width no matter what cols is
-  nsHTMLTextWrap wrapProp;
-  nsITextControlElement::GetWrapPropertyEnum(this, wrapProp);
-  if (wrapProp == nsITextControlElement::eHTMLTextWrap_Off) {
-    // do not wrap when wrap=off
-    return -1;
-  }
-
-  // Otherwise we just wrap at the given number of columns
-  return GetCols();
-}
-
-
-NS_IMETHODIMP_(int32_t)
-nsHTMLTextAreaElement::GetRows()
-{
-  const nsAttrValue* attr = GetParsedAttr(nsGkAtoms::rows);
-  if (attr && attr->Type() == nsAttrValue::eInteger) {
-    int32_t rows = attr->GetIntegerValue();
-    return (rows <= 0) ? DEFAULT_ROWS_TEXTAREA : rows;
-  }
-
-  return DEFAULT_ROWS_TEXTAREA;
-}
-
-NS_IMETHODIMP_(bool)
-nsHTMLTextAreaElement::ValueChanged() const
-{
-  return mValueChanged;
-}
-
-NS_IMETHODIMP_(void)
-nsHTMLTextAreaElement::GetTextEditorValue(nsAString& aValue,
-                                          bool aIgnoreWrap) const
-{
-  mState.GetValue(aValue, aIgnoreWrap);
-}
-
-NS_IMETHODIMP_(void)
-nsHTMLTextAreaElement::InitializeKeyboardEventListeners()
-{
-  mState.InitializeKeyboardEventListeners();
-}
-
-NS_IMETHODIMP_(void)
-nsHTMLTextAreaElement::OnValueChanged(bool aNotify)
-{
-  // Update the validity state
-  bool validBefore = IsValid();
-  UpdateTooLongValidityState();
-  UpdateValueMissingValidityState();
-
-  if (validBefore != IsValid()) {
-    UpdateState(aNotify);
-  }
-}
-
-NS_IMETHODIMP_(bool)
-nsHTMLTextAreaElement::HasCachedSelection()
-{
-  return mState.IsSelectionCached();
-}
-
-void
-nsHTMLTextAreaElement::FieldSetDisabledChanged(bool aNotify)
-{
-  UpdateValueMissingValidityState();
-  UpdateBarredFromConstraintValidation();
-
-  nsGenericHTMLFormElement::FieldSetDisabledChanged(aNotify);
-}
--- a/content/html/content/src/Makefile.in
+++ b/content/html/content/src/Makefile.in
@@ -66,16 +66,17 @@ EXPORTS_mozilla/dom = \
 		HTMLSpanElement.h \
 		HTMLStyleElement.h \
 		HTMLTableCaptionElement.h \
 		HTMLTableCellElement.h \
 		HTMLTableColElement.h \
 		HTMLTableElement.h \
 		HTMLTableRowElement.h \
 		HTMLTableSectionElement.h \
+		HTMLTextAreaElement.h \
 		HTMLTitleElement.h \
 		HTMLUnknownElement.h \
 		UndoManager.h \
 		ValidityState.h \
 		$(NULL)
 
 CPPSRCS		= \
 		HTMLPropertiesCollection.cpp \
@@ -129,17 +130,17 @@ CPPSRCS		= \
 		HTMLSpanElement.cpp \
 		HTMLStyleElement.cpp \
 		HTMLTableElement.cpp \
 		HTMLTableCaptionElement.cpp \
 		HTMLTableCellElement.cpp \
 		HTMLTableColElement.cpp \
 		HTMLTableRowElement.cpp \
 		HTMLTableSectionElement.cpp \
-		nsHTMLTextAreaElement.cpp \
+		HTMLTextAreaElement.cpp \
 		HTMLTitleElement.cpp \
 		HTMLUnknownElement.cpp \
 		ValidityState.cpp \
 		nsIConstraintValidation.cpp \
 		nsRadioVisitor.cpp \
 		nsDOMStringMap.cpp \
 		UndoManager.cpp \
 		$(NULL)