Bug 839033 - Rename nsHTMLProgressElement to HTMLProgressElement. r=Ms2ger
authorAndrea Marchesini <amarchesini@mozilla.com>
Mon, 11 Feb 2013 13:56:31 -0500
changeset 121527 bcff3820f704e96d83f91ea6159ec7338aa2ff74
parent 121526 1d23d959dcf68c0ef86efa37bc45cfcf65bb8087
child 121528 ecbca463ce663f8b0daa0b27f6325511555b16c0
push id24296
push useremorley@mozilla.com
push dateTue, 12 Feb 2013 14:43:19 +0000
treeherdermozilla-central@860d7a47b675 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMs2ger
bugs839033
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 839033 - Rename nsHTMLProgressElement to HTMLProgressElement. r=Ms2ger
content/html/content/src/HTMLProgressElement.cpp
content/html/content/src/HTMLProgressElement.h
content/html/content/src/Makefile.in
content/html/content/src/nsHTMLProgressElement.cpp
rename from content/html/content/src/nsHTMLProgressElement.cpp
rename to content/html/content/src/HTMLProgressElement.cpp
--- a/content/html/content/src/nsHTMLProgressElement.cpp
+++ b/content/html/content/src/HTMLProgressElement.cpp
@@ -1,131 +1,79 @@
 /* -*- 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 "nsIDOMHTMLProgressElement.h"
-#include "nsGenericHTMLElement.h"
-#include "nsAttrValue.h"
-#include "nsAttrValueInlines.h"
-#include "nsEventStateManager.h"
-#include <algorithm>
-
-using namespace mozilla::dom;
-
-class nsHTMLProgressElement : public nsGenericHTMLElement,
-                              public nsIDOMHTMLProgressElement
-{
-public:
-  nsHTMLProgressElement(already_AddRefed<nsINodeInfo> aNodeInfo);
-  virtual ~nsHTMLProgressElement();
-
-  // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
-
-  // nsIDOMNode
-  NS_FORWARD_NSIDOMNODE_TO_NSINODE
-
-  // nsIDOMElement
-  NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
-
-  // nsIDOMHTMLElement
-  NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
-
-  // nsIDOMHTMLProgressElement
-  NS_DECL_NSIDOMHTMLPROGRESSELEMENT
-
-  nsEventStates IntrinsicState() const;
-
-  nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const;
-
-  bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute,
-                        const nsAString& aValue, nsAttrValue& aResult);
-
-  virtual nsXPCClassInfo* GetClassInfo();
-
-  virtual nsIDOMNode* AsDOMNode() { return this; }
-
-protected:
-  /**
-   * Returns whethem the progress element is in the indeterminate state.
-   * A progress element is in the indeterminate state if its value is ommited
-   * or is not a floating point number..
-   *
-   * @return whether the progress element is in the indeterminate state.
-   */
-  bool IsIndeterminate() const;
-
-  static const double kIndeterminatePosition;
-  static const double kDefaultValue;
-  static const double kDefaultMax;
-};
-
-const double nsHTMLProgressElement::kIndeterminatePosition = -1.0;
-const double nsHTMLProgressElement::kDefaultValue          =  0.0;
-const double nsHTMLProgressElement::kDefaultMax            =  1.0;
+#include "mozilla/dom/HTMLProgressElement.h"
 
 NS_IMPL_NS_NEW_HTML_ELEMENT(Progress)
+DOMCI_NODE_DATA(HTMLProgressElement, mozilla::dom::HTMLProgressElement)
+
+namespace mozilla {
+namespace dom {
+
+const double HTMLProgressElement::kIndeterminatePosition = -1.0;
+const double HTMLProgressElement::kDefaultValue          =  0.0;
+const double HTMLProgressElement::kDefaultMax            =  1.0;
 
 
-nsHTMLProgressElement::nsHTMLProgressElement(already_AddRefed<nsINodeInfo> aNodeInfo)
+HTMLProgressElement::HTMLProgressElement(already_AddRefed<nsINodeInfo> aNodeInfo)
   : nsGenericHTMLElement(aNodeInfo)
 {
   // We start out indeterminate
   AddStatesSilently(NS_EVENT_STATE_INDETERMINATE);
 }
 
-nsHTMLProgressElement::~nsHTMLProgressElement()
+HTMLProgressElement::~HTMLProgressElement()
 {
 }
 
-NS_IMPL_ADDREF_INHERITED(nsHTMLProgressElement, Element)
-NS_IMPL_RELEASE_INHERITED(nsHTMLProgressElement, Element)
+NS_IMPL_ADDREF_INHERITED(HTMLProgressElement, Element)
+NS_IMPL_RELEASE_INHERITED(HTMLProgressElement, Element)
 
-DOMCI_NODE_DATA(HTMLProgressElement, nsHTMLProgressElement)
 
-NS_INTERFACE_TABLE_HEAD(nsHTMLProgressElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLProgressElement,
+NS_INTERFACE_TABLE_HEAD(HTMLProgressElement)
+  NS_HTML_CONTENT_INTERFACE_TABLE1(HTMLProgressElement,
                                    nsIDOMHTMLProgressElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLProgressElement,
+  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLProgressElement,
                                                nsGenericHTMLElement)
 NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLProgressElement)
 
-NS_IMPL_ELEMENT_CLONE(nsHTMLProgressElement)
+NS_IMPL_ELEMENT_CLONE(HTMLProgressElement)
 
 
 nsEventStates
-nsHTMLProgressElement::IntrinsicState() const
+HTMLProgressElement::IntrinsicState() const
 {
   nsEventStates state = nsGenericHTMLElement::IntrinsicState();
 
   if (IsIndeterminate()) {
     state |= NS_EVENT_STATE_INDETERMINATE;
   }
 
   return state;
 }
 
 bool
-nsHTMLProgressElement::ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute,
-                                      const nsAString& aValue, nsAttrValue& aResult)
+HTMLProgressElement::ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute,
+                                    const nsAString& aValue, nsAttrValue& aResult)
 {
   if (aNamespaceID == kNameSpaceID_None) {
     if (aAttribute == nsGkAtoms::value || aAttribute == nsGkAtoms::max) {
       return aResult.ParseDoubleValue(aValue);
     }
   }
 
   return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute,
                                               aValue, aResult);
 }
 
 NS_IMETHODIMP
-nsHTMLProgressElement::GetValue(double* aValue)
+HTMLProgressElement::GetValue(double* aValue)
 {
   const nsAttrValue* attrValue = mAttrsAndChildren.GetAttr(nsGkAtoms::value);
   if (!attrValue || attrValue->Type() != nsAttrValue::eDoubleValue ||
       attrValue->GetDoubleValue() < 0.0) {
     *aValue = kDefaultValue;
     return NS_OK;
   }
 
@@ -135,43 +83,43 @@ nsHTMLProgressElement::GetValue(double* 
   GetMax(&max);
 
   *aValue = std::min(*aValue, max);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHTMLProgressElement::SetValue(double aValue)
+HTMLProgressElement::SetValue(double aValue)
 {
   return SetDoubleAttr(nsGkAtoms::value, aValue);
 }
 
 NS_IMETHODIMP
-nsHTMLProgressElement::GetMax(double* aValue)
+HTMLProgressElement::GetMax(double* aValue)
 {
   const nsAttrValue* attrMax = mAttrsAndChildren.GetAttr(nsGkAtoms::max);
   if (attrMax && attrMax->Type() == nsAttrValue::eDoubleValue &&
       attrMax->GetDoubleValue() > 0.0) {
     *aValue = attrMax->GetDoubleValue();
   } else {
     *aValue = kDefaultMax;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHTMLProgressElement::SetMax(double aValue)
+HTMLProgressElement::SetMax(double aValue)
 {
   return SetDoubleAttr(nsGkAtoms::max, aValue);
 }
 
 NS_IMETHODIMP
-nsHTMLProgressElement::GetPosition(double* aPosition)
+HTMLProgressElement::GetPosition(double* aPosition)
 {
   if (IsIndeterminate()) {
     *aPosition = kIndeterminatePosition;
     return NS_OK;
   }
 
   double value;
   double max;
@@ -179,14 +127,16 @@ nsHTMLProgressElement::GetPosition(doubl
   GetMax(&max);
 
   *aPosition = value / max;
 
   return NS_OK;
 }
 
 bool
-nsHTMLProgressElement::IsIndeterminate() const
+HTMLProgressElement::IsIndeterminate() const
 {
   const nsAttrValue* attrValue = mAttrsAndChildren.GetAttr(nsGkAtoms::value);
   return !attrValue || attrValue->Type() != nsAttrValue::eDoubleValue;
 }
 
+} // namespace dom
+} // namespace mozilla
copy from content/html/content/src/nsHTMLProgressElement.cpp
copy to content/html/content/src/HTMLProgressElement.h
--- a/content/html/content/src/nsHTMLProgressElement.cpp
+++ b/content/html/content/src/HTMLProgressElement.h
@@ -1,28 +1,32 @@
 /* -*- 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 mozilla_dom_HTMLProgressElement_h
+#define mozilla_dom_HTMLProgressElement_h
+
 #include "nsIDOMHTMLProgressElement.h"
 #include "nsGenericHTMLElement.h"
 #include "nsAttrValue.h"
 #include "nsAttrValueInlines.h"
 #include "nsEventStateManager.h"
 #include <algorithm>
 
-using namespace mozilla::dom;
+namespace mozilla {
+namespace dom {
 
-class nsHTMLProgressElement : public nsGenericHTMLElement,
-                              public nsIDOMHTMLProgressElement
+class HTMLProgressElement : public nsGenericHTMLElement,
+                            public nsIDOMHTMLProgressElement
 {
 public:
-  nsHTMLProgressElement(already_AddRefed<nsINodeInfo> aNodeInfo);
-  virtual ~nsHTMLProgressElement();
+  HTMLProgressElement(already_AddRefed<nsINodeInfo> aNodeInfo);
+  virtual ~HTMLProgressElement();
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIDOMNode
   NS_FORWARD_NSIDOMNODE_TO_NSINODE
 
   // nsIDOMElement
@@ -55,138 +59,12 @@ protected:
    */
   bool IsIndeterminate() const;
 
   static const double kIndeterminatePosition;
   static const double kDefaultValue;
   static const double kDefaultMax;
 };
 
-const double nsHTMLProgressElement::kIndeterminatePosition = -1.0;
-const double nsHTMLProgressElement::kDefaultValue          =  0.0;
-const double nsHTMLProgressElement::kDefaultMax            =  1.0;
-
-NS_IMPL_NS_NEW_HTML_ELEMENT(Progress)
-
-
-nsHTMLProgressElement::nsHTMLProgressElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-  : nsGenericHTMLElement(aNodeInfo)
-{
-  // We start out indeterminate
-  AddStatesSilently(NS_EVENT_STATE_INDETERMINATE);
-}
-
-nsHTMLProgressElement::~nsHTMLProgressElement()
-{
-}
-
-NS_IMPL_ADDREF_INHERITED(nsHTMLProgressElement, Element)
-NS_IMPL_RELEASE_INHERITED(nsHTMLProgressElement, Element)
-
-DOMCI_NODE_DATA(HTMLProgressElement, nsHTMLProgressElement)
-
-NS_INTERFACE_TABLE_HEAD(nsHTMLProgressElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLProgressElement,
-                                   nsIDOMHTMLProgressElement)
-  NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLProgressElement,
-                                               nsGenericHTMLElement)
-NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLProgressElement)
-
-NS_IMPL_ELEMENT_CLONE(nsHTMLProgressElement)
-
-
-nsEventStates
-nsHTMLProgressElement::IntrinsicState() const
-{
-  nsEventStates state = nsGenericHTMLElement::IntrinsicState();
-
-  if (IsIndeterminate()) {
-    state |= NS_EVENT_STATE_INDETERMINATE;
-  }
-
-  return state;
-}
-
-bool
-nsHTMLProgressElement::ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute,
-                                      const nsAString& aValue, nsAttrValue& aResult)
-{
-  if (aNamespaceID == kNameSpaceID_None) {
-    if (aAttribute == nsGkAtoms::value || aAttribute == nsGkAtoms::max) {
-      return aResult.ParseDoubleValue(aValue);
-    }
-  }
-
-  return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute,
-                                              aValue, aResult);
-}
+} // namespace dom
+} // namespace mozilla
 
-NS_IMETHODIMP
-nsHTMLProgressElement::GetValue(double* aValue)
-{
-  const nsAttrValue* attrValue = mAttrsAndChildren.GetAttr(nsGkAtoms::value);
-  if (!attrValue || attrValue->Type() != nsAttrValue::eDoubleValue ||
-      attrValue->GetDoubleValue() < 0.0) {
-    *aValue = kDefaultValue;
-    return NS_OK;
-  }
-
-  *aValue = attrValue->GetDoubleValue();
-
-  double max;
-  GetMax(&max);
-
-  *aValue = std::min(*aValue, max);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLProgressElement::SetValue(double aValue)
-{
-  return SetDoubleAttr(nsGkAtoms::value, aValue);
-}
-
-NS_IMETHODIMP
-nsHTMLProgressElement::GetMax(double* aValue)
-{
-  const nsAttrValue* attrMax = mAttrsAndChildren.GetAttr(nsGkAtoms::max);
-  if (attrMax && attrMax->Type() == nsAttrValue::eDoubleValue &&
-      attrMax->GetDoubleValue() > 0.0) {
-    *aValue = attrMax->GetDoubleValue();
-  } else {
-    *aValue = kDefaultMax;
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLProgressElement::SetMax(double aValue)
-{
-  return SetDoubleAttr(nsGkAtoms::max, aValue);
-}
-
-NS_IMETHODIMP
-nsHTMLProgressElement::GetPosition(double* aPosition)
-{
-  if (IsIndeterminate()) {
-    *aPosition = kIndeterminatePosition;
-    return NS_OK;
-  }
-
-  double value;
-  double max;
-  GetValue(&value);
-  GetMax(&max);
-
-  *aPosition = value / max;
-
-  return NS_OK;
-}
-
-bool
-nsHTMLProgressElement::IsIndeterminate() const
-{
-  const nsAttrValue* attrValue = mAttrsAndChildren.GetAttr(nsGkAtoms::value);
-  return !attrValue || attrValue->Type() != nsAttrValue::eDoubleValue;
-}
-
+#endif // mozilla_dom_HTMLProgressElement_h
--- a/content/html/content/src/Makefile.in
+++ b/content/html/content/src/Makefile.in
@@ -48,16 +48,17 @@ EXPORTS_mozilla/dom = \
 		HTMLLinkElement.h \
 		HTMLMapElement.h \
 		HTMLMetaElement.h \
 		HTMLMeterElement.h \
 		HTMLModElement.h \
 		HTMLOptGroupElement.h \
 		HTMLParagraphElement.h \
 		HTMLPreElement.h \
+		HTMLProgressElement.h \
 		HTMLScriptElement.h \
 		HTMLSharedElement.h \
 		HTMLSharedListElement.h \
 		HTMLSpanElement.h \
 		HTMLStyleElement.h \
 		HTMLTableCaptionElement.h \
 		HTMLTableCellElement.h \
 		HTMLTableColElement.h \
@@ -109,17 +110,17 @@ CPPSRCS		= \
 		HTMLModElement.cpp \
 		HTMLObjectElement.cpp \
 		nsHTMLSharedObjectElement.cpp \
 		nsHTMLOptionElement.cpp \
 		HTMLOptGroupElement.cpp \
 		nsHTMLOutputElement.cpp \
 		HTMLParagraphElement.cpp \
 		HTMLPreElement.cpp \
-		nsHTMLProgressElement.cpp \
+		HTMLProgressElement.cpp \
 		HTMLScriptElement.cpp \
 		nsHTMLSelectElement.cpp \
 		HTMLSharedElement.cpp \
 		HTMLSharedListElement.cpp \
 		HTMLSpanElement.cpp \
 		HTMLStyleElement.cpp \
 		HTMLTableElement.cpp \
 		HTMLTableCaptionElement.cpp \