зеркало из https://github.com/mozilla/gecko-dev.git
Bug 824823 part 10. Rename nsHTMLParagraphElement to mozilla::dom::HTMLParagraphElement and move the class declaration into a header. r=peterv
--HG-- rename : content/html/content/src/nsHTMLParagraphElement.cpp => content/html/content/src/HTMLParagraphElement.cpp rename : content/html/content/src/nsHTMLParagraphElement.cpp => content/html/content/src/HTMLParagraphElement.h
This commit is contained in:
Родитель
0e716a09d7
Коммит
fd1ec7eb71
|
@ -0,0 +1,78 @@
|
|||
/* -*- 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/HTMLParagraphElement.h"
|
||||
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsRuleData.h"
|
||||
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Paragraph)
|
||||
DOMCI_NODE_DATA(HTMLParagraphElement, mozilla::dom::HTMLParagraphElement)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
HTMLParagraphElement::~HTMLParagraphElement()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(HTMLParagraphElement, Element)
|
||||
NS_IMPL_RELEASE_INHERITED(HTMLParagraphElement, Element)
|
||||
|
||||
// QueryInterface implementation for nsHTMLParagraphElement
|
||||
NS_INTERFACE_TABLE_HEAD(HTMLParagraphElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE1(HTMLParagraphElement,
|
||||
nsIDOMHTMLParagraphElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLParagraphElement,
|
||||
nsGenericHTMLElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLParagraphElement)
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(HTMLParagraphElement)
|
||||
|
||||
NS_IMPL_STRING_ATTR(HTMLParagraphElement, Align, align)
|
||||
|
||||
bool
|
||||
HTMLParagraphElement::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)
|
||||
HTMLParagraphElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
{
|
||||
static const MappedAttributeEntry* const map[] = {
|
||||
sDivAlignAttributeMap,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
||||
return FindAttributeDependence(aAttribute, map);
|
||||
}
|
||||
|
||||
|
||||
nsMapRuleToAttributesFunc
|
||||
HTMLParagraphElement::GetAttributeMappingFunction() const
|
||||
{
|
||||
return &MapAttributesIntoRule;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
|
@ -0,0 +1,59 @@
|
|||
/* -*- 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_HTMLParagraphElement_h
|
||||
#define mozilla_dom_HTMLParagraphElement_h
|
||||
|
||||
#include "mozilla/Util.h"
|
||||
|
||||
#include "nsIDOMHTMLParagraphElement.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class HTMLParagraphElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLParagraphElement
|
||||
{
|
||||
public:
|
||||
HTMLParagraphElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo)
|
||||
{
|
||||
}
|
||||
virtual ~HTMLParagraphElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIDOMNode
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
|
||||
// nsIDOMElement
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLParagraphElement
|
||||
NS_DECL_NSIDOMHTMLPARAGRAPHELEMENT
|
||||
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult);
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_HTMLParagraphElement_h
|
|
@ -40,6 +40,7 @@ EXPORTS_mozilla/dom = \
|
|||
HTMLImageElement.h \
|
||||
HTMLLabelElement.h \
|
||||
HTMLLIElement.h \
|
||||
HTMLParagraphElement.h \
|
||||
HTMLSharedListElement.h \
|
||||
HTMLTitleElement.h \
|
||||
HTMLUnknownElement.h
|
||||
|
@ -86,7 +87,7 @@ CPPSRCS = \
|
|||
nsHTMLOptionElement.cpp \
|
||||
nsHTMLOptGroupElement.cpp \
|
||||
nsHTMLOutputElement.cpp \
|
||||
nsHTMLParagraphElement.cpp \
|
||||
HTMLParagraphElement.cpp \
|
||||
nsHTMLPreElement.cpp \
|
||||
nsHTMLProgressElement.cpp \
|
||||
nsHTMLScriptElement.cpp \
|
||||
|
|
|
@ -1,128 +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 "nsIDOMHTMLParagraphElement.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsRuleData.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
// XXX missing nav attributes
|
||||
|
||||
class nsHTMLParagraphElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLParagraphElement
|
||||
{
|
||||
public:
|
||||
nsHTMLParagraphElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~nsHTMLParagraphElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIDOMNode
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
|
||||
// nsIDOMElement
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT_TO_GENERIC
|
||||
|
||||
// nsIDOMHTMLParagraphElement
|
||||
NS_DECL_NSIDOMHTMLPARAGRAPHELEMENT
|
||||
|
||||
virtual bool ParseAttribute(int32_t aNamespaceID,
|
||||
nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult);
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
virtual 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(Paragraph)
|
||||
|
||||
|
||||
nsHTMLParagraphElement::nsHTMLParagraphElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo)
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLParagraphElement::~nsHTMLParagraphElement()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLParagraphElement, Element)
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLParagraphElement, Element)
|
||||
|
||||
DOMCI_NODE_DATA(HTMLParagraphElement, nsHTMLParagraphElement)
|
||||
|
||||
// QueryInterface implementation for nsHTMLParagraphElement
|
||||
NS_INTERFACE_TABLE_HEAD(nsHTMLParagraphElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLParagraphElement,
|
||||
nsIDOMHTMLParagraphElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLParagraphElement,
|
||||
nsGenericHTMLElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLParagraphElement)
|
||||
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(nsHTMLParagraphElement)
|
||||
|
||||
|
||||
NS_IMPL_STRING_ATTR(nsHTMLParagraphElement, Align, align)
|
||||
|
||||
|
||||
bool
|
||||
nsHTMLParagraphElement::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)
|
||||
nsHTMLParagraphElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
{
|
||||
static const MappedAttributeEntry* const map[] = {
|
||||
sDivAlignAttributeMap,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
||||
return FindAttributeDependence(aAttribute, map);
|
||||
}
|
||||
|
||||
|
||||
nsMapRuleToAttributesFunc
|
||||
nsHTMLParagraphElement::GetAttributeMappingFunction() const
|
||||
{
|
||||
return &MapAttributesIntoRule;
|
||||
}
|
Загрузка…
Ссылка в новой задаче