Bug 824448 part 1. Rename nsHTMLHeadingElement to mozilla::dom::HTMLHeadingElement. r=peterv

--HG--
rename : content/html/content/src/nsHTMLHeadingElement.cpp => content/html/content/src/HTMLHeadingElement.cpp
This commit is contained in:
Boris Zbarsky 2012-12-26 13:40:44 -08:00
parent 05eeb23844
commit ae18157740
4 changed files with 139 additions and 126 deletions

View File

@ -0,0 +1,83 @@
/* -*- 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 "mozilla/dom/HTMLHeadingElement.h"
#include "mozilla/Util.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
#include "nsMappedAttributes.h"
#include "nsRuleData.h"
#include "mozAutoDocUpdate.h"
DOMCI_NODE_DATA(HTMLHeadingElement, mozilla::dom::HTMLHeadingElement)
NS_IMPL_NS_NEW_HTML_ELEMENT(Heading)
namespace mozilla {
namespace dom {
HTMLHeadingElement::~HTMLHeadingElement()
{
}
NS_IMPL_ADDREF_INHERITED(HTMLHeadingElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLHeadingElement, Element)
// QueryInterface implementation for HTMLHeadingElement
NS_INTERFACE_TABLE_HEAD(HTMLHeadingElement)
NS_HTML_CONTENT_INTERFACE_TABLE1(HTMLHeadingElement,
nsIDOMHTMLHeadingElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLHeadingElement,
nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLHeadingElement)
NS_IMPL_ELEMENT_CLONE(HTMLHeadingElement)
NS_IMPL_STRING_ATTR(HTMLHeadingElement, Align, align)
bool
HTMLHeadingElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aAttribute == nsGkAtoms::align && aNamespaceID == kNameSpaceID_None) {
return ParseDivAlignValue(aValue, aResult);
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData)
{
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
}
NS_IMETHODIMP_(bool)
HTMLHeadingElement::IsAttributeMapped(const nsIAtom* aAttribute) const
{
static const MappedAttributeEntry* const map[] = {
sDivAlignAttributeMap,
sCommonAttributeMap
};
return FindAttributeDependence(aAttribute, map);
}
nsMapRuleToAttributesFunc
HTMLHeadingElement::GetAttributeMappingFunction() const
{
return &MapAttributesIntoRule;
}
} // namespace dom
} // namespace mozilla

View File

@ -0,0 +1,54 @@
/* -*- 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_HTMLHeadingElement_h
#define mozilla_dom_HTMLHeadingElement_h
#include "nsIDOMHTMLHeadingElement.h"
#include "nsGenericHTMLElement.h"
namespace mozilla {
namespace dom {
class HTMLHeadingElement MOZ_FINAL : public nsGenericHTMLElement,
public nsIDOMHTMLHeadingElement
{
public:
HTMLHeadingElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)
{
}
virtual ~HTMLHeadingElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLHeadingElement
NS_DECL_NSIDOMHTMLHEADINGELEMENT
virtual bool ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
};
} // namespace mozilla
} // namespace dom
#endif // mozilla_dom_HTMLHeadingElement_h

View File

@ -33,6 +33,7 @@ EXPORTS_mozilla/dom = \
HTMLDivElement.h \
HTMLFontElement.h \
HTMLFrameSetElement.h \
HTMLHeadingElement.h \
HTMLLabelElement.h \
HTMLUnknownElement.h
@ -59,7 +60,7 @@ CPPSRCS = \
nsHTMLFrameElement.cpp \
HTMLFrameSetElement.cpp \
nsHTMLHRElement.cpp \
nsHTMLHeadingElement.cpp \
HTMLHeadingElement.cpp \
nsHTMLIFrameElement.cpp \
nsHTMLImageElement.cpp \
nsHTMLInputElement.cpp \

View File

@ -1,125 +0,0 @@
/* -*- 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 "mozilla/Util.h"
#include "nsIDOMHTMLHeadingElement.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
#include "nsMappedAttributes.h"
#include "nsRuleData.h"
#include "mozAutoDocUpdate.h"
using namespace mozilla;
using namespace mozilla::dom;
class nsHTMLHeadingElement : public nsGenericHTMLElement,
public nsIDOMHTMLHeadingElement
{
public:
nsHTMLHeadingElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~nsHTMLHeadingElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
// nsIDOMHTMLHeadingElement
NS_DECL_NSIDOMHTMLHEADINGELEMENT
virtual bool ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
};
NS_IMPL_NS_NEW_HTML_ELEMENT(Heading)
nsHTMLHeadingElement::nsHTMLHeadingElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)
{
}
nsHTMLHeadingElement::~nsHTMLHeadingElement()
{
}
NS_IMPL_ADDREF_INHERITED(nsHTMLHeadingElement, Element)
NS_IMPL_RELEASE_INHERITED(nsHTMLHeadingElement, Element)
DOMCI_NODE_DATA(HTMLHeadingElement, nsHTMLHeadingElement)
// QueryInterface implementation for nsHTMLHeadingElement
NS_INTERFACE_TABLE_HEAD(nsHTMLHeadingElement)
NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLHeadingElement,
nsIDOMHTMLHeadingElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLHeadingElement,
nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLHeadingElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLHeadingElement)
NS_IMPL_STRING_ATTR(nsHTMLHeadingElement, Align, align)
bool
nsHTMLHeadingElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aAttribute == nsGkAtoms::align && aNamespaceID == kNameSpaceID_None) {
return ParseDivAlignValue(aValue, aResult);
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static void
MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData)
{
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
}
NS_IMETHODIMP_(bool)
nsHTMLHeadingElement::IsAttributeMapped(const nsIAtom* aAttribute) const
{
static const MappedAttributeEntry* const map[] = {
sDivAlignAttributeMap,
sCommonAttributeMap
};
return FindAttributeDependence(aAttribute, map);
}
nsMapRuleToAttributesFunc
nsHTMLHeadingElement::GetAttributeMappingFunction() const
{
return &MapAttributesIntoRule;
}