Bug 839105 - Rename nsHTMLFieldSetElement to HTMLFieldSetElement. r=Ms2ger
authorAndrea Marchesini <amarchesini@mozilla.com>
Fri, 08 Feb 2013 11:34:47 -0500
changeset 131214 afeaf8f42c099a9a747d0133bbf27b997c2072b9
parent 131213 92f93ab32aec0dc915ee206ee27825aeeb15d82a
child 131215 f2ece1151f003665ade62a255f05c50223ef0f28
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMs2ger
bugs839105
milestone21.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 839105 - Rename nsHTMLFieldSetElement to HTMLFieldSetElement. r=Ms2ger
content/base/public/nsINode.h
content/html/content/src/HTMLFieldSetElement.cpp
content/html/content/src/HTMLFieldSetElement.h
content/html/content/src/Makefile.in
content/html/content/src/nsGenericHTMLElement.cpp
content/html/content/src/nsGenericHTMLElement.h
content/html/content/src/nsHTMLFieldSetElement.cpp
content/html/content/src/nsHTMLFieldSetElement.h
--- a/content/base/public/nsINode.h
+++ b/content/base/public/nsINode.h
@@ -274,17 +274,17 @@ public:
 
   // Among the sub-classes that inherit (directly or indirectly) from nsINode,
   // measurement of the following members may be added later if DMD finds it is
   // worthwhile:
   // - nsGenericHTMLElement:  mForm, mFieldSet
   // - nsGenericHTMLFrameElement: mFrameLoader (bug 672539), mTitleChangedListener
   // - HTMLBodyElement:       mContentStyleRule
   // - HTMLDataListElement:   mOptions
-  // - nsHTMLFieldSetElement: mElements, mDependentElements, mFirstLegend
+  // - HTMLFieldSetElement:   mElements, mDependentElements, mFirstLegend
   // - nsHTMLFormElement:     many!
   // - HTMLFrameSetElement:   mRowSpecs, mColSpecs
   // - nsHTMLInputElement:    mInputData, mFiles, mFileList, mStaticDocfileList
   // - nsHTMLMapElement:      mAreas
   // - nsHTMLMediaElement:    many!
   // - nsHTMLOutputElement:   mDefaultValue, mTokenList
   // - nsHTMLRowElement:      mCells
   // - nsHTMLSelectElement:   mOptions, mRestoreState
rename from content/html/content/src/nsHTMLFieldSetElement.cpp
rename to content/html/content/src/HTMLFieldSetElement.cpp
--- a/content/html/content/src/nsHTMLFieldSetElement.cpp
+++ b/content/html/content/src/HTMLFieldSetElement.cpp
@@ -1,107 +1,100 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "nsHTMLFieldSetElement.h"
-#include "nsIDOMHTMLFormElement.h"
-#include "nsIDOMEventTarget.h"
-#include "nsStyleConsts.h"
-#include "nsIForm.h"
-#include "nsIFormControl.h"
-#include "nsGUIEvent.h"
+#include "mozilla/dom/HTMLFieldSetElement.h"
 #include "nsEventDispatcher.h"
-#include "nsContentList.h"
-
-using namespace mozilla::dom;
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(FieldSet)
+DOMCI_NODE_DATA(HTMLFieldSetElement, mozilla::dom::HTMLFieldSetElement)
 
 
-nsHTMLFieldSetElement::nsHTMLFieldSetElement(already_AddRefed<nsINodeInfo> aNodeInfo)
+namespace mozilla {
+namespace dom {
+
+HTMLFieldSetElement::HTMLFieldSetElement(already_AddRefed<nsINodeInfo> aNodeInfo)
   : nsGenericHTMLFormElement(aNodeInfo)
   , mElements(nullptr)
   , mFirstLegend(nullptr)
 {
   // <fieldset> is always barred from constraint validation.
   SetBarredFromConstraintValidation(true);
 
   // We start out enabled
   AddStatesSilently(NS_EVENT_STATE_ENABLED);
 }
 
-nsHTMLFieldSetElement::~nsHTMLFieldSetElement()
+HTMLFieldSetElement::~HTMLFieldSetElement()
 {
   uint32_t length = mDependentElements.Length();
   for (uint32_t i = 0; i < length; ++i) {
     mDependentElements[i]->ForgetFieldSet(this);
   }
 }
 
 // nsISupports
 
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLFieldSetElement,
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLFieldSetElement,
                                                 nsGenericHTMLFormElement)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mValidity)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mElements)
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLFieldSetElement,
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLFieldSetElement,
                                                   nsGenericHTMLFormElement)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mValidity)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mElements)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
-NS_IMPL_ADDREF_INHERITED(nsHTMLFieldSetElement, Element)
-NS_IMPL_RELEASE_INHERITED(nsHTMLFieldSetElement, Element)
+NS_IMPL_ADDREF_INHERITED(HTMLFieldSetElement, Element)
+NS_IMPL_RELEASE_INHERITED(HTMLFieldSetElement, Element)
 
-DOMCI_NODE_DATA(HTMLFieldSetElement, nsHTMLFieldSetElement)
-
-// QueryInterface implementation for nsHTMLFieldSetElement
-NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsHTMLFieldSetElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE2(nsHTMLFieldSetElement,
+// QueryInterface implementation for HTMLFieldSetElement
+NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLFieldSetElement)
+  NS_HTML_CONTENT_INTERFACE_TABLE2(HTMLFieldSetElement,
                                    nsIDOMHTMLFieldSetElement,
                                    nsIConstraintValidation)
-  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLFieldSetElement,
+  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLFieldSetElement,
                                                nsGenericHTMLFormElement)
 NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLFieldSetElement)
 
-NS_IMPL_ELEMENT_CLONE(nsHTMLFieldSetElement)
+NS_IMPL_ELEMENT_CLONE(HTMLFieldSetElement)
 
 
-NS_IMPL_BOOL_ATTR(nsHTMLFieldSetElement, Disabled, disabled)
-NS_IMPL_STRING_ATTR(nsHTMLFieldSetElement, Name, name)
+NS_IMPL_BOOL_ATTR(HTMLFieldSetElement, Disabled, disabled)
+NS_IMPL_STRING_ATTR(HTMLFieldSetElement, Name, name)
 
 // nsIConstraintValidation
-NS_IMPL_NSICONSTRAINTVALIDATION(nsHTMLFieldSetElement)
+NS_IMPL_NSICONSTRAINTVALIDATION(HTMLFieldSetElement)
 
 bool
-nsHTMLFieldSetElement::IsDisabledForEvents(uint32_t aMessage)
+HTMLFieldSetElement::IsDisabledForEvents(uint32_t aMessage)
 {
   return IsElementDisabledForEvents(aMessage, nullptr);
 }
 
 // nsIContent
 nsresult
-nsHTMLFieldSetElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
+HTMLFieldSetElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
 {
   // Do not process any DOM events if the element is disabled.
   aVisitor.mCanHandle = false;
   if (IsDisabledForEvents(aVisitor.mEvent->message)) {
     return NS_OK;
   }
 
   return nsGenericHTMLFormElement::PreHandleEvent(aVisitor);
 }
 
 nsresult
-nsHTMLFieldSetElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
-                                    const nsAttrValue* aValue, bool aNotify)
+HTMLFieldSetElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
+                                  const nsAttrValue* aValue, bool aNotify)
 {
   if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::disabled &&
       nsINode::GetFirstChild()) {
     if (!mElements) {
       mElements = new nsContentList(this, MatchListedElements, nullptr, nullptr,
                                     true);
     }
 
@@ -114,66 +107,66 @@ nsHTMLFieldSetElement::AfterSetAttr(int3
 
   return nsGenericHTMLFormElement::AfterSetAttr(aNameSpaceID, aName,
                                                 aValue, aNotify);
 }
 
 // nsIDOMHTMLFieldSetElement
 
 NS_IMETHODIMP
-nsHTMLFieldSetElement::GetForm(nsIDOMHTMLFormElement** aForm)
+HTMLFieldSetElement::GetForm(nsIDOMHTMLFormElement** aForm)
 {
   return nsGenericHTMLFormElement::GetForm(aForm);
 }
 
 NS_IMETHODIMP
-nsHTMLFieldSetElement::GetType(nsAString& aType)
+HTMLFieldSetElement::GetType(nsAString& aType)
 {
   aType.AssignLiteral("fieldset");
   return NS_OK;
 }
 
 /* static */
 bool
-nsHTMLFieldSetElement::MatchListedElements(nsIContent* aContent, int32_t aNamespaceID,
-                                           nsIAtom* aAtom, void* aData)
+HTMLFieldSetElement::MatchListedElements(nsIContent* aContent, int32_t aNamespaceID,
+                                         nsIAtom* aAtom, void* aData)
 {
   nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(aContent);
   return formControl && formControl->GetType() != NS_FORM_LABEL;
 }
 
 NS_IMETHODIMP
-nsHTMLFieldSetElement::GetElements(nsIDOMHTMLCollection** aElements)
+HTMLFieldSetElement::GetElements(nsIDOMHTMLCollection** aElements)
 {
   if (!mElements) {
     mElements = new nsContentList(this, MatchListedElements, nullptr, nullptr,
                                   true);
   }
 
   NS_ADDREF(*aElements = mElements);
   return NS_OK;
 }
 
 // nsIFormControl
 
 nsresult
-nsHTMLFieldSetElement::Reset()
+HTMLFieldSetElement::Reset()
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHTMLFieldSetElement::SubmitNamesValues(nsFormSubmission* aFormSubmission)
+HTMLFieldSetElement::SubmitNamesValues(nsFormSubmission* aFormSubmission)
 {
   return NS_OK;
 }
 
 nsresult
-nsHTMLFieldSetElement::InsertChildAt(nsIContent* aChild, uint32_t aIndex,
-                                     bool aNotify)
+HTMLFieldSetElement::InsertChildAt(nsIContent* aChild, uint32_t aIndex,
+                                   bool aNotify)
 {
   bool firstLegendHasChanged = false;
 
   if (aChild->IsHTML(nsGkAtoms::legend)) {
     if (!mFirstLegend) {
       mFirstLegend = aChild;
       // We do not want to notify the first time mFirstElement is set.
     } else {
@@ -192,17 +185,17 @@ nsHTMLFieldSetElement::InsertChildAt(nsI
   if (firstLegendHasChanged) {
     NotifyElementsForFirstLegendChange(aNotify);
   }
 
   return rv;
 }
 
 void
-nsHTMLFieldSetElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
+HTMLFieldSetElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
 {
   bool firstLegendHasChanged = false;
 
   if (mFirstLegend && (GetChildAt(aIndex) == mFirstLegend)) {
     // If we are removing the first legend we have to found another one.
     nsIContent* child = mFirstLegend->GetNextSibling();
     mFirstLegend = nullptr;
     firstLegendHasChanged = true;
@@ -218,17 +211,17 @@ nsHTMLFieldSetElement::RemoveChildAt(uin
   nsGenericHTMLFormElement::RemoveChildAt(aIndex, aNotify);
 
   if (firstLegendHasChanged) {
     NotifyElementsForFirstLegendChange(aNotify);
   }
 }
 
 void
-nsHTMLFieldSetElement::NotifyElementsForFirstLegendChange(bool aNotify)
+HTMLFieldSetElement::NotifyElementsForFirstLegendChange(bool aNotify)
 {
   /**
    * NOTE: this could be optimized if only call when the fieldset is currently
    * disabled.
    * This should also make sure that mElements is set when we happen to be here.
    * However, this method shouldn't be called very often in normal use cases.
    */
   if (!mElements) {
@@ -238,8 +231,10 @@ nsHTMLFieldSetElement::NotifyElementsFor
 
   uint32_t length = mElements->Length(true);
   for (uint32_t i = 0; i < length; ++i) {
     static_cast<nsGenericHTMLFormElement*>(mElements->Item(i))
       ->FieldSetFirstLegendChanged(aNotify);
   }
 }
 
+} // namespace dom
+} // namespace mozilla
rename from content/html/content/src/nsHTMLFieldSetElement.h
rename to content/html/content/src/HTMLFieldSetElement.h
--- a/content/html/content/src/nsHTMLFieldSetElement.h
+++ b/content/html/content/src/HTMLFieldSetElement.h
@@ -1,32 +1,34 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
-#ifndef nsHTMLFieldSetElement_h___
-#define nsHTMLFieldSetElement_h___
+#ifndef mozilla_dom_HTMLFieldSetElement_h
+#define mozilla_dom_HTMLFieldSetElement_h
 
 #include "nsGenericHTMLElement.h"
 #include "nsIDOMHTMLFieldSetElement.h"
 #include "nsIConstraintValidation.h"
 
+namespace mozilla {
+namespace dom {
 
-class nsHTMLFieldSetElement : public nsGenericHTMLFormElement,
-                              public nsIDOMHTMLFieldSetElement,
-                              public nsIConstraintValidation
+class HTMLFieldSetElement : public nsGenericHTMLFormElement,
+                            public nsIDOMHTMLFieldSetElement,
+                            public nsIConstraintValidation
 {
 public:
   using nsIConstraintValidation::GetValidationMessage;
 
-  nsHTMLFieldSetElement(already_AddRefed<nsINodeInfo> aNodeInfo);
-  virtual ~nsHTMLFieldSetElement();
+  HTMLFieldSetElement(already_AddRefed<nsINodeInfo> aNodeInfo);
+  virtual ~HTMLFieldSetElement();
 
-  NS_IMPL_FROMCONTENT_HTML_WITH_TAG(nsHTMLFieldSetElement, fieldset)
+  NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLFieldSetElement, fieldset)
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE_TO_NSINODE
 
   // nsIDOMElement
@@ -61,17 +63,17 @@ public:
   void AddElement(nsGenericHTMLFormElement* aElement) {
     mDependentElements.AppendElement(aElement);
   }
 
   void RemoveElement(nsGenericHTMLFormElement* aElement) {
     mDependentElements.RemoveElement(aElement);
   }
 
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLFieldSetElement,
+  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLFieldSetElement,
                                            nsGenericHTMLFormElement)
 private:
 
   /**
    * Notify all elements (in mElements) that the first legend of the fieldset
    * has now changed.
    */
   void NotifyElementsForFirstLegendChange(bool aNotify);
@@ -84,10 +86,13 @@ private:
   nsRefPtr<nsContentList> mElements;
 
   // List of elements which have this fieldset as first fieldset ancestor.
   nsTArray<nsGenericHTMLFormElement*> mDependentElements;
 
   nsIContent* mFirstLegend;
 };
 
-#endif /* nsHTMLFieldSetElement_h___ */
+} // namespace dom
+} // namespace mozilla
 
+#endif /* mozilla_dom_HTMLFieldSetElement_h */
+
--- a/content/html/content/src/Makefile.in
+++ b/content/html/content/src/Makefile.in
@@ -31,16 +31,17 @@ EXPORTS_NAMESPACES = mozilla/dom
 
 EXPORTS_mozilla/dom = \
 		HTMLAnchorElement.h \
 		HTMLBodyElement.h \
 		HTMLBRElement.h \
 		HTMLButtonElement.h \
 		HTMLDataListElement.h \
 		HTMLDivElement.h \
+		HTMLFieldSetElement.h \
 		HTMLFontElement.h \
 		HTMLFrameSetElement.h \
 		HTMLHeadingElement.h \
 		HTMLHRElement.h \
 		HTMLImageElement.h \
 		HTMLLabelElement.h \
 		HTMLLIElement.h \
 		HTMLLinkElement.h \
@@ -79,17 +80,17 @@ CPPSRCS		= \
 		HTMLAnchorElement.cpp \
 		nsHTMLAreaElement.cpp \
 		HTMLBRElement.cpp \
 		HTMLBodyElement.cpp \
 		HTMLButtonElement.cpp \
 		HTMLCanvasElement.cpp \
 		HTMLDataListElement.cpp \
 		HTMLDivElement.cpp \
-		nsHTMLFieldSetElement.cpp \
+		HTMLFieldSetElement.cpp \
 		HTMLFontElement.cpp \
 		nsHTMLFormElement.cpp \
 		nsHTMLFrameElement.cpp \
 		HTMLFrameSetElement.cpp \
 		HTMLHRElement.cpp \
 		HTMLHeadingElement.cpp \
 		nsHTMLIFrameElement.cpp \
 		HTMLImageElement.cpp \
--- a/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/content/html/content/src/nsGenericHTMLElement.cpp
@@ -75,17 +75,17 @@
 #include "nsIEditor.h"
 #include "nsIEditorIMESupport.h"
 #include "nsEventDispatcher.h"
 #include "nsLayoutUtils.h"
 #include "mozAutoDocUpdate.h"
 #include "nsHtml5Module.h"
 #include "nsITextControlElement.h"
 #include "mozilla/dom/Element.h"
-#include "nsHTMLFieldSetElement.h"
+#include "HTMLFieldSetElement.h"
 #include "nsHTMLMenuElement.h"
 #include "nsAsyncDOMEvent.h"
 #include "nsDOMMutationObserver.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/FromParser.h"
 #include "mozilla/dom/UndoManager.h"
 #include "mozilla/BloomFilter.h"
 
@@ -2778,18 +2778,18 @@ nsGenericHTMLFormElement::UpdateFormOwne
 void
 nsGenericHTMLFormElement::UpdateFieldSet(bool aNotify)
 {
   nsIContent* parent = nullptr;
   nsIContent* prev = nullptr;
 
   for (parent = GetParent(); parent;
        prev = parent, parent = parent->GetParent()) {
-    nsHTMLFieldSetElement* fieldset =
-      nsHTMLFieldSetElement::FromContent(parent);
+    HTMLFieldSetElement* fieldset =
+      HTMLFieldSetElement::FromContent(parent);
     if (fieldset &&
         (!prev || fieldset->GetFirstLegend() != prev)) {
       if (mFieldSet == fieldset) {
         // We already have the right fieldset;
         return;
       }
 
       if (mFieldSet) {
--- a/content/html/content/src/nsGenericHTMLElement.h
+++ b/content/html/content/src/nsGenericHTMLElement.h
@@ -1011,17 +1011,21 @@ protected:
   bool IsEditableRoot() const;
 
   nsresult SetUndoScopeInternal(bool aUndoScope);
 
 private:
   void ChangeEditableState(int32_t aChange);
 };
 
-class nsHTMLFieldSetElement;
+namespace mozilla {
+namespace dom {
+class HTMLFieldSetElement;
+}
+}
 
 #define FORM_ELEMENT_FLAG_BIT(n_) NODE_FLAG_BIT(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + (n_))
 
 // Form element specific bits
 enum {
   // If this flag is set on an nsGenericHTMLFormElement, that means that we have
   // added ourselves to our mForm.  It's possible to have a non-null mForm, but
   // not have this flag set.  That happens when the form is set via the content
@@ -1192,17 +1196,17 @@ protected:
   // Get our focus state.  If this returns eInactiveWindow, it will set this
   // element as the focused element for that window.
   FocusTristate FocusState();
 
   /** The form that contains this control */
   nsHTMLFormElement* mForm;
 
   /* This is a pointer to our closest fieldset parent if any */
-  nsHTMLFieldSetElement* mFieldSet;
+  mozilla::dom::HTMLFieldSetElement* mFieldSet;
 };
 
 //----------------------------------------------------------------------
 
 /**
  * This macro is similar to NS_IMPL_STRING_ATTR except that the getter method
  * falls back to an alternative method if the content attribute isn't set.
  */