Bug 839056 - Rename nsHTMLOptGroupElement to HTMLOptGroupElement. r=Ms2ger

--HG--
rename : content/html/content/src/nsHTMLOptGroupElement.cpp => content/html/content/src/HTMLOptGroupElement.cpp
rename : content/html/content/src/nsHTMLOptGroupElement.h => content/html/content/src/HTMLOptGroupElement.h
This commit is contained in:
Andrea Marchesini 2013-02-08 11:34:48 -05:00
parent 9c0fe725fe
commit d8e0d71402
6 changed files with 50 additions and 37 deletions

View File

@ -2,7 +2,8 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsHTMLOptGroupElement.h"
#include "mozilla/dom/HTMLOptGroupElement.h"
#include "nsIDOMEventTarget.h" #include "nsIDOMEventTarget.h"
#include "nsGkAtoms.h" #include "nsGkAtoms.h"
#include "nsStyleConsts.h" #include "nsStyleConsts.h"
@ -13,51 +14,53 @@
#include "nsEventDispatcher.h" #include "nsEventDispatcher.h"
#include "nsHTMLSelectElement.h" #include "nsHTMLSelectElement.h"
using namespace mozilla::dom; NS_IMPL_NS_NEW_HTML_ELEMENT(OptGroup)
DOMCI_NODE_DATA(HTMLOptGroupElement, mozilla::dom::HTMLOptGroupElement)
namespace mozilla {
namespace dom {
/** /**
* The implementation of <optgroup> * The implementation of <optgroup>
*/ */
NS_IMPL_NS_NEW_HTML_ELEMENT(OptGroup)
nsHTMLOptGroupElement::nsHTMLOptGroupElement(already_AddRefed<nsINodeInfo> aNodeInfo) HTMLOptGroupElement::HTMLOptGroupElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericHTMLElement(aNodeInfo) : nsGenericHTMLElement(aNodeInfo)
{ {
// We start off enabled // We start off enabled
AddStatesSilently(NS_EVENT_STATE_ENABLED); AddStatesSilently(NS_EVENT_STATE_ENABLED);
} }
nsHTMLOptGroupElement::~nsHTMLOptGroupElement() HTMLOptGroupElement::~HTMLOptGroupElement()
{ {
} }
NS_IMPL_ADDREF_INHERITED(nsHTMLOptGroupElement, Element) NS_IMPL_ADDREF_INHERITED(HTMLOptGroupElement, Element)
NS_IMPL_RELEASE_INHERITED(nsHTMLOptGroupElement, Element) NS_IMPL_RELEASE_INHERITED(HTMLOptGroupElement, Element)
DOMCI_NODE_DATA(HTMLOptGroupElement, nsHTMLOptGroupElement)
// QueryInterface implementation for nsHTMLOptGroupElement // QueryInterface implementation for HTMLOptGroupElement
NS_INTERFACE_TABLE_HEAD(nsHTMLOptGroupElement) NS_INTERFACE_TABLE_HEAD(HTMLOptGroupElement)
NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLOptGroupElement, NS_HTML_CONTENT_INTERFACE_TABLE1(HTMLOptGroupElement,
nsIDOMHTMLOptGroupElement) nsIDOMHTMLOptGroupElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLOptGroupElement, NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLOptGroupElement,
nsGenericHTMLElement) nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLOptGroupElement) NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLOptGroupElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLOptGroupElement) NS_IMPL_ELEMENT_CLONE(HTMLOptGroupElement)
NS_IMPL_BOOL_ATTR(nsHTMLOptGroupElement, Disabled, disabled) NS_IMPL_BOOL_ATTR(HTMLOptGroupElement, Disabled, disabled)
NS_IMPL_STRING_ATTR(nsHTMLOptGroupElement, Label, label) NS_IMPL_STRING_ATTR(HTMLOptGroupElement, Label, label)
nsresult nsresult
nsHTMLOptGroupElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor) HTMLOptGroupElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
{ {
aVisitor.mCanHandle = false; aVisitor.mCanHandle = false;
// Do not process any DOM events if the element is disabled // Do not process any DOM events if the element is disabled
@ -79,7 +82,7 @@ nsHTMLOptGroupElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
} }
nsIContent* nsIContent*
nsHTMLOptGroupElement::GetSelect() HTMLOptGroupElement::GetSelect()
{ {
nsIContent* parent = this; nsIContent* parent = this;
while ((parent = parent->GetParent()) && parent->IsHTML()) { while ((parent = parent->GetParent()) && parent->IsHTML()) {
@ -95,9 +98,9 @@ nsHTMLOptGroupElement::GetSelect()
} }
nsresult nsresult
nsHTMLOptGroupElement::InsertChildAt(nsIContent* aKid, HTMLOptGroupElement::InsertChildAt(nsIContent* aKid,
uint32_t aIndex, uint32_t aIndex,
bool aNotify) bool aNotify)
{ {
nsSafeOptionListMutation safeMutation(GetSelect(), this, aKid, aIndex, aNotify); nsSafeOptionListMutation safeMutation(GetSelect(), this, aKid, aIndex, aNotify);
nsresult rv = nsGenericHTMLElement::InsertChildAt(aKid, aIndex, aNotify); nsresult rv = nsGenericHTMLElement::InsertChildAt(aKid, aIndex, aNotify);
@ -108,7 +111,7 @@ nsHTMLOptGroupElement::InsertChildAt(nsIContent* aKid,
} }
void void
nsHTMLOptGroupElement::RemoveChildAt(uint32_t aIndex, bool aNotify) HTMLOptGroupElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
{ {
nsSafeOptionListMutation safeMutation(GetSelect(), this, nullptr, aIndex, nsSafeOptionListMutation safeMutation(GetSelect(), this, nullptr, aIndex,
aNotify); aNotify);
@ -116,8 +119,8 @@ nsHTMLOptGroupElement::RemoveChildAt(uint32_t aIndex, bool aNotify)
} }
nsresult nsresult
nsHTMLOptGroupElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName, HTMLOptGroupElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
const nsAttrValue* aValue, bool aNotify) const nsAttrValue* aValue, bool aNotify)
{ {
if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::disabled) { if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::disabled) {
// All our children <option> have their :disabled state depending on our // All our children <option> have their :disabled state depending on our
@ -136,7 +139,7 @@ nsHTMLOptGroupElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
} }
nsEventStates nsEventStates
nsHTMLOptGroupElement::IntrinsicState() const HTMLOptGroupElement::IntrinsicState() const
{ {
nsEventStates state = nsGenericHTMLElement::IntrinsicState(); nsEventStates state = nsGenericHTMLElement::IntrinsicState();
@ -150,3 +153,6 @@ nsHTMLOptGroupElement::IntrinsicState() const
return state; return state;
} }
} // namespace dom
} // namespace mozilla

View File

@ -3,18 +3,21 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsGenericHTMLElement_h #ifndef mozilla_dom_HTMLOptGroupElement_h
#define nsGenericHTMLElement_h #define mozilla_dom_HTMLOptGroupElement_h
#include "nsIDOMHTMLOptGroupElement.h" #include "nsIDOMHTMLOptGroupElement.h"
#include "nsGenericHTMLElement.h" #include "nsGenericHTMLElement.h"
class nsHTMLOptGroupElement : public nsGenericHTMLElement, namespace mozilla {
public nsIDOMHTMLOptGroupElement namespace dom {
class HTMLOptGroupElement : public nsGenericHTMLElement,
public nsIDOMHTMLOptGroupElement
{ {
public: public:
nsHTMLOptGroupElement(already_AddRefed<nsINodeInfo> aNodeInfo); HTMLOptGroupElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~nsHTMLOptGroupElement(); virtual ~HTMLOptGroupElement();
// nsISupports // nsISupports
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
@ -41,7 +44,7 @@ public:
virtual nsEventStates IntrinsicState() const; virtual nsEventStates IntrinsicState() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; virtual nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const;
virtual nsXPCClassInfo* GetClassInfo(); virtual nsXPCClassInfo* GetClassInfo();
@ -62,4 +65,7 @@ protected:
nsIContent* GetSelect(); nsIContent* GetSelect();
}; };
#endif /* nsGenericHTMLElement_h */ } // namespace dom
} // namespace mozilla
#endif /* mozilla_dom_HTMLOptGroupElement_h */

View File

@ -49,6 +49,7 @@ EXPORTS_mozilla/dom = \
HTMLMetaElement.h \ HTMLMetaElement.h \
HTMLMeterElement.h \ HTMLMeterElement.h \
HTMLModElement.h \ HTMLModElement.h \
HTMLOptGroupElement.h \
HTMLParagraphElement.h \ HTMLParagraphElement.h \
HTMLPreElement.h \ HTMLPreElement.h \
HTMLScriptElement.h \ HTMLScriptElement.h \
@ -108,7 +109,7 @@ CPPSRCS = \
HTMLObjectElement.cpp \ HTMLObjectElement.cpp \
nsHTMLSharedObjectElement.cpp \ nsHTMLSharedObjectElement.cpp \
nsHTMLOptionElement.cpp \ nsHTMLOptionElement.cpp \
nsHTMLOptGroupElement.cpp \ HTMLOptGroupElement.cpp \
nsHTMLOutputElement.cpp \ nsHTMLOutputElement.cpp \
HTMLParagraphElement.cpp \ HTMLParagraphElement.cpp \
HTMLPreElement.cpp \ HTMLPreElement.cpp \

View File

@ -23,7 +23,7 @@
#include "nsIComponentManager.h" #include "nsIComponentManager.h"
#include "nsCheapSets.h" #include "nsCheapSets.h"
#include "nsError.h" #include "nsError.h"
#include "nsHTMLOptGroupElement.h" #include "HTMLOptGroupElement.h"
#include "nsHTMLOptionElement.h" #include "nsHTMLOptionElement.h"
#include "nsHTMLFormElement.h" #include "nsHTMLFormElement.h"
#include "mozilla/ErrorResult.h" #include "mozilla/ErrorResult.h"

View File

@ -1287,7 +1287,7 @@ def addExternalHTMLElement(element):
addExternalHTMLElement('HTMLFormElement') addExternalHTMLElement('HTMLFormElement')
addExternalHTMLElement('HTMLMenuElement') addExternalHTMLElement('HTMLMenuElement')
addExternalHTMLElement('HTMLOptionElement') addExternalHTMLElement('HTMLOptionElement')
addExternalHTMLElement('HTMLOptGroupElement') addExternalIface('HTMLOptGroupElement', nativeType='mozilla::dom::HTMLOptGroupElement', headerFile='HTMLOptGroupElement.h')
addExternalHTMLElement('HTMLVideoElement') addExternalHTMLElement('HTMLVideoElement')
addExternalIface('Attr') addExternalIface('Attr')
addExternalIface('CanvasGradient', headerFile='nsIDOMCanvasRenderingContext2D.h') addExternalIface('CanvasGradient', headerFile='nsIDOMCanvasRenderingContext2D.h')

View File

@ -11,7 +11,7 @@
#include "nsHTMLFormElement.h" #include "nsHTMLFormElement.h"
#include "mozilla/dom/HTMLImageElement.h" #include "mozilla/dom/HTMLImageElement.h"
#include "nsHTMLOptionElement.h" #include "nsHTMLOptionElement.h"
#include "nsHTMLOptGroupElement.h" #include "HTMLOptGroupElement.h"
#include "nsHTMLVideoElement.h" #include "nsHTMLVideoElement.h"
#include "nsHTMLDocument.h" #include "nsHTMLDocument.h"
#include "nsICSSDeclaration.h" #include "nsICSSDeclaration.h"
@ -171,7 +171,7 @@ xpc_qsUnwrapArg<_clazz>(JSContext *cx, jsval v, _clazz **ppArg, \
DEFINE_UNWRAP_CAST_HTML(canvas, mozilla::dom::HTMLCanvasElement) DEFINE_UNWRAP_CAST_HTML(canvas, mozilla::dom::HTMLCanvasElement)
DEFINE_UNWRAP_CAST_HTML(form, nsHTMLFormElement) DEFINE_UNWRAP_CAST_HTML(form, nsHTMLFormElement)
DEFINE_UNWRAP_CAST_HTML(img, mozilla::dom::HTMLImageElement) DEFINE_UNWRAP_CAST_HTML(img, mozilla::dom::HTMLImageElement)
DEFINE_UNWRAP_CAST_HTML(optgroup, nsHTMLOptGroupElement) DEFINE_UNWRAP_CAST_HTML(optgroup, mozilla::dom::HTMLOptGroupElement)
DEFINE_UNWRAP_CAST_HTML(option, nsHTMLOptionElement) DEFINE_UNWRAP_CAST_HTML(option, nsHTMLOptionElement)
DEFINE_UNWRAP_CAST_HTML(video, nsHTMLVideoElement) DEFINE_UNWRAP_CAST_HTML(video, nsHTMLVideoElement)