зеркало из https://github.com/mozilla/pjs.git
Bug 236873: Let more elements share classes to save codesize.
r/sr=jst
This commit is contained in:
Родитель
e978e5d6f0
Коммит
db35ca6d16
|
@ -64,12 +64,9 @@ CPPSRCS = \
|
|||
nsHTMLAppletElement.cpp \
|
||||
nsHTMLAreaElement.cpp \
|
||||
nsHTMLBRElement.cpp \
|
||||
nsHTMLBaseFontElement.cpp \
|
||||
nsHTMLBodyElement.cpp \
|
||||
nsHTMLButtonElement.cpp \
|
||||
nsHTMLDListElement.cpp \
|
||||
nsHTMLDelElement.cpp \
|
||||
nsHTMLDirectoryElement.cpp \
|
||||
nsHTMLDivElement.cpp \
|
||||
nsHTMLFieldSetElement.cpp \
|
||||
nsHTMLFontElement.cpp \
|
||||
|
@ -83,13 +80,11 @@ CPPSRCS = \
|
|||
nsHTMLIFrameElement.cpp \
|
||||
nsHTMLImageElement.cpp \
|
||||
nsHTMLInputElement.cpp \
|
||||
nsHTMLInsElement.cpp \
|
||||
nsHTMLLIElement.cpp \
|
||||
nsHTMLLabelElement.cpp \
|
||||
nsHTMLLegendElement.cpp \
|
||||
nsHTMLLinkElement.cpp \
|
||||
nsHTMLMapElement.cpp \
|
||||
nsHTMLMenuElement.cpp \
|
||||
nsHTMLMetaElement.cpp \
|
||||
nsHTMLOListElement.cpp \
|
||||
nsHTMLObjectElement.cpp \
|
||||
|
@ -97,10 +92,9 @@ CPPSRCS = \
|
|||
nsHTMLOptGroupElement.cpp \
|
||||
nsHTMLParagraphElement.cpp \
|
||||
nsHTMLPreElement.cpp \
|
||||
nsHTMLQuoteElement.cpp \
|
||||
nsHTMLScriptElement.cpp \
|
||||
nsHTMLSelectElement.cpp \
|
||||
nsHTMLSharedLeafElement.cpp \
|
||||
nsHTMLSharedElement.cpp \
|
||||
nsHTMLSpanElement.cpp \
|
||||
nsHTMLStyleElement.cpp \
|
||||
nsHTMLTableElement.cpp \
|
||||
|
@ -111,8 +105,6 @@ CPPSRCS = \
|
|||
nsHTMLTableSectionElement.cpp \
|
||||
nsHTMLTextAreaElement.cpp \
|
||||
nsHTMLTitleElement.cpp \
|
||||
nsHTMLUListElement.cpp \
|
||||
nsHTMLUnknownElement.cpp \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS = \
|
||||
|
|
|
@ -2141,27 +2141,11 @@ nsGenericHTMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
|||
return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle attributes on the BDO element
|
||||
*/
|
||||
static void
|
||||
MapBdoAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
nsRuleData* aData)
|
||||
{
|
||||
if (aData->mSID == eStyleStruct_TextReset &&
|
||||
aData->mTextData->mUnicodeBidi.GetUnit() == eCSSUnit_Null) {
|
||||
aData->mTextData->mUnicodeBidi.SetIntValue(NS_STYLE_UNICODE_BIDI_OVERRIDE, eCSSUnit_Enumerated);
|
||||
}
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericHTMLElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const
|
||||
{
|
||||
if (mNodeInfo->Equals(nsHTMLAtoms::bdo))
|
||||
aMapRuleFunc = &MapBdoAttributesInto;
|
||||
else
|
||||
aMapRuleFunc = &MapCommonAttributesInto;
|
||||
aMapRuleFunc = &MapCommonAttributesInto;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -1029,10 +1029,8 @@ protected:
|
|||
|
||||
|
||||
#define NS_INTERFACE_MAP_ENTRY_IF_TAG(_interface, _tag) \
|
||||
if (mNodeInfo->Equals(nsHTMLAtoms::_tag) && \
|
||||
aIID.Equals(NS_GET_IID(_interface))) \
|
||||
foundInterface = NS_STATIC_CAST(_interface *, this); \
|
||||
else
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(_interface, \
|
||||
mNodeInfo->Equals(nsHTMLAtoms::_tag))
|
||||
|
||||
|
||||
#define NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(_class, _tag) \
|
||||
|
@ -1051,7 +1049,7 @@ protected:
|
|||
// Element class factory methods
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLSharedLeafElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
NS_NewHTMLSharedElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLAnchorElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
@ -1065,9 +1063,6 @@ NS_NewHTMLAreaElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
|||
nsresult
|
||||
NS_NewHTMLBRElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLBaseFontElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLBodyElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
||||
|
@ -1075,13 +1070,7 @@ nsresult
|
|||
NS_NewHTMLButtonElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLDListElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLDelElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLDirectoryElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
NS_NewHTMLModElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLDivElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
@ -1123,9 +1112,6 @@ nsresult
|
|||
NS_NewHTMLInputElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLInsElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLLIElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
||||
|
@ -1141,14 +1127,11 @@ NS_NewHTMLLinkElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
|||
nsresult
|
||||
NS_NewHTMLMapElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLMenuElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLMetaElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLOListElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
NS_NewHTMLSharedListElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLObjectElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
@ -1165,9 +1148,6 @@ NS_NewHTMLParagraphElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
|||
nsresult
|
||||
NS_NewHTMLPreElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLQuoteElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLScriptElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
||||
|
@ -1214,9 +1194,6 @@ NS_NewHTMLTheadElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
|||
nsresult
|
||||
NS_NewHTMLTitleElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLUListElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLUnknownElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo);
|
||||
|
||||
|
|
|
@ -74,6 +74,7 @@ HTML_ATOM(autocheck, "autocheck")
|
|||
HTML_ATOM(axis, "axis")
|
||||
HTML_ATOM(background, "background")
|
||||
HTML_ATOM(base, "base")
|
||||
HTML_ATOM(basefont, "basefont")
|
||||
HTML_ATOM(below, "below")
|
||||
HTML_ATOM(bdo, "bdo")
|
||||
HTML_ATOM(bgcolor, "bgcolor")
|
||||
|
@ -119,12 +120,12 @@ HTML_ATOM(defaultselected, "defaultselected")
|
|||
HTML_ATOM(defaultvalue, "defaultvalue")
|
||||
HTML_ATOM(declare, "declare")
|
||||
HTML_ATOM(defer, "defer")
|
||||
HTML_ATOM(del, "del")
|
||||
HTML_ATOM(dir, "dir")
|
||||
HTML_ATOM(div, "div")
|
||||
HTML_ATOM(disabled, "disabled")
|
||||
HTML_ATOM(dl, "dl")
|
||||
HTML_ATOM(dt, "dt")
|
||||
|
||||
HTML_ATOM(datetime, "datetime")
|
||||
HTML_ATOM(data, "data")
|
||||
HTML_ATOM(dfn, "dfn")
|
||||
|
@ -172,6 +173,7 @@ HTML_ATOM(ilayer, "ilayer")
|
|||
HTML_ATOM(img, "img")
|
||||
HTML_ATOM(index, "index")
|
||||
HTML_ATOM(input, "input")
|
||||
HTML_ATOM(ins, "ins")
|
||||
HTML_ATOM(isindex, "isindex")
|
||||
HTML_ATOM(ismap, "ismap")
|
||||
HTML_ATOM(label, "label")
|
||||
|
@ -222,6 +224,7 @@ HTML_ATOM(pointSize, "point-size")
|
|||
HTML_ATOM(pre, "pre")
|
||||
HTML_ATOM(profile, "profile")
|
||||
HTML_ATOM(prompt, "prompt")
|
||||
HTML_ATOM(q, "q")
|
||||
HTML_ATOM(readonly, "readonly")
|
||||
HTML_ATOM(refresh, "refresh")
|
||||
HTML_ATOM(rel, "rel")
|
||||
|
|
|
@ -44,12 +44,12 @@
|
|||
#include "nsIPresContext.h"
|
||||
|
||||
|
||||
class nsHTMLDelElement : public nsGenericHTMLElement,
|
||||
class nsHTMLModElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLModElement
|
||||
{
|
||||
public:
|
||||
nsHTMLDelElement();
|
||||
virtual ~nsHTMLDelElement();
|
||||
nsHTMLModElement();
|
||||
virtual ~nsHTMLModElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
@ -68,12 +68,12 @@ public:
|
|||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLDelElement(nsIHTMLContent** aInstancePtrResult,
|
||||
NS_NewHTMLModElement(nsIHTMLContent** aInstancePtrResult,
|
||||
nsINodeInfo *aNodeInfo)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
|
||||
|
||||
nsHTMLDelElement* it = new nsHTMLDelElement();
|
||||
nsHTMLModElement* it = new nsHTMLModElement();
|
||||
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -94,33 +94,35 @@ NS_NewHTMLDelElement(nsIHTMLContent** aInstancePtrResult,
|
|||
}
|
||||
|
||||
|
||||
nsHTMLDelElement::nsHTMLDelElement()
|
||||
nsHTMLModElement::nsHTMLModElement()
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLDelElement::~nsHTMLDelElement()
|
||||
nsHTMLModElement::~nsHTMLModElement()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLDelElement, nsGenericElement)
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLDelElement, nsGenericElement)
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLModElement, nsGenericElement)
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLModElement, nsGenericElement)
|
||||
|
||||
|
||||
// QueryInterface implementation for nsHTMLDelElement
|
||||
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLDelElement, nsGenericHTMLElement)
|
||||
// QueryInterface implementation for nsHTMLModElement
|
||||
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLModElement, nsGenericHTMLElement)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLModElement)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLDelElement)
|
||||
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLDelElement, del)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLInsElement, ins)
|
||||
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||
|
||||
|
||||
nsresult
|
||||
nsHTMLDelElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
nsHTMLModElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aReturn);
|
||||
*aReturn = nsnull;
|
||||
|
||||
nsHTMLDelElement* it = new nsHTMLDelElement();
|
||||
nsHTMLModElement* it = new nsHTMLModElement();
|
||||
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -143,5 +145,5 @@ nsHTMLDelElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
|||
}
|
||||
|
||||
|
||||
NS_IMPL_STRING_ATTR(nsHTMLDelElement, Cite, cite)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLDelElement, DateTime, datetime)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLModElement, Cite, cite)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLModElement, DateTime, datetime)
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#include "nsIDOMHTMLOListElement.h"
|
||||
#include "nsIDOMHTMLDListElement.h"
|
||||
#include "nsIDOMHTMLUListElement.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
|
@ -45,12 +47,14 @@
|
|||
#include "nsMappedAttributes.h"
|
||||
#include "nsRuleNode.h"
|
||||
|
||||
class nsHTMLOListElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLOListElement
|
||||
class nsHTMLSharedListElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLOListElement,
|
||||
public nsIDOMHTMLDListElement,
|
||||
public nsIDOMHTMLUListElement
|
||||
{
|
||||
public:
|
||||
nsHTMLOListElement();
|
||||
virtual ~nsHTMLOListElement();
|
||||
nsHTMLSharedListElement();
|
||||
virtual ~nsHTMLSharedListElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
@ -67,6 +71,12 @@ public:
|
|||
// nsIDOMHTMLOListElement
|
||||
NS_DECL_NSIDOMHTMLOLISTELEMENT
|
||||
|
||||
// nsIDOMHTMLDListElement
|
||||
// fully declared by NS_DECL_NSIDOMHTMLOLISTELEMENT
|
||||
|
||||
// nsIDOMHTMLUListElement
|
||||
// fully declared by NS_DECL_NSIDOMHTMLOLISTELEMENT
|
||||
|
||||
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult);
|
||||
|
@ -78,12 +88,12 @@ public:
|
|||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLOListElement(nsIHTMLContent** aInstancePtrResult,
|
||||
nsINodeInfo *aNodeInfo)
|
||||
NS_NewHTMLSharedListElement(nsIHTMLContent** aInstancePtrResult,
|
||||
nsINodeInfo *aNodeInfo)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
|
||||
|
||||
nsHTMLOListElement* it = new nsHTMLOListElement();
|
||||
nsHTMLSharedListElement* it = new nsHTMLSharedListElement();
|
||||
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -104,39 +114,45 @@ NS_NewHTMLOListElement(nsIHTMLContent** aInstancePtrResult,
|
|||
}
|
||||
|
||||
|
||||
nsHTMLOListElement::nsHTMLOListElement()
|
||||
nsHTMLSharedListElement::nsHTMLSharedListElement()
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLOListElement::~nsHTMLOListElement()
|
||||
nsHTMLSharedListElement::~nsHTMLSharedListElement()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLOListElement, nsGenericElement)
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLOListElement, nsGenericElement)
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLSharedListElement, nsGenericElement)
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLSharedListElement, nsGenericElement)
|
||||
|
||||
|
||||
// QueryInterface implementation for nsHTMLOListElement
|
||||
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLOListElement, nsGenericHTMLElement)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLOListElement)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLOListElement)
|
||||
// QueryInterface implementation for nsHTMLSharedListElement
|
||||
NS_HTML_CONTENT_INTERFACE_MAP_AMBIGOUS_BEGIN(nsHTMLSharedListElement,
|
||||
nsGenericHTMLElement,
|
||||
nsIDOMHTMLOListElement)
|
||||
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLOListElement, ol)
|
||||
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLDListElement, dl)
|
||||
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLUListElement, ul)
|
||||
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLOListElement, ol)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLDListElement, dl)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLUListElement, ul)
|
||||
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||
|
||||
|
||||
nsresult
|
||||
nsHTMLOListElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
nsHTMLSharedListElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aReturn);
|
||||
*aReturn = nsnull;
|
||||
|
||||
nsHTMLOListElement* it = new nsHTMLOListElement();
|
||||
nsHTMLSharedListElement* it = new nsHTMLSharedListElement();
|
||||
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> kungFuDeathGrip(it);
|
||||
nsCOMPtr<nsIDOMHTMLOListElement> kungFuDeathGrip(it);
|
||||
|
||||
nsresult rv = it->Init(mNodeInfo);
|
||||
|
||||
|
@ -145,7 +161,7 @@ nsHTMLOListElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
|||
|
||||
CopyInnerTo(it, aDeep);
|
||||
|
||||
*aReturn = NS_STATIC_CAST(nsIDOMNode *, it);
|
||||
*aReturn = NS_STATIC_CAST(nsIDOMHTMLOListElement *, it);
|
||||
|
||||
NS_ADDREF(*aReturn);
|
||||
|
||||
|
@ -153,9 +169,9 @@ nsHTMLOListElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
|||
}
|
||||
|
||||
|
||||
NS_IMPL_BOOL_ATTR(nsHTMLOListElement, Compact, compact)
|
||||
NS_IMPL_INT_ATTR(nsHTMLOListElement, Start, start)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLOListElement, Type, type)
|
||||
NS_IMPL_BOOL_ATTR(nsHTMLSharedListElement, Compact, compact)
|
||||
NS_IMPL_INT_ATTR(nsHTMLSharedListElement, Start, start)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedListElement, Type, type)
|
||||
|
||||
|
||||
nsHTMLValue::EnumTable kListTypeTable[] = {
|
||||
|
@ -182,27 +198,32 @@ nsHTMLValue::EnumTable kOldListTypeTable[] = {
|
|||
};
|
||||
|
||||
PRBool
|
||||
nsHTMLOListElement::ParseAttribute(nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
nsHTMLSharedListElement::ParseAttribute(nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::type) {
|
||||
return aResult.ParseEnumValue(aValue, kListTypeTable) ||
|
||||
aResult.ParseEnumValue(aValue, kOldListTypeTable, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsHTMLAtoms::start) {
|
||||
return aResult.ParseIntValue(aValue);
|
||||
if (mNodeInfo->Equals(nsHTMLAtoms::ol) ||
|
||||
mNodeInfo->Equals(nsHTMLAtoms::ul)) {
|
||||
if (aAttribute == nsHTMLAtoms::type) {
|
||||
return aResult.ParseEnumValue(aValue, kListTypeTable) ||
|
||||
aResult.ParseEnumValue(aValue, kOldListTypeTable, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsHTMLAtoms::start) {
|
||||
return aResult.ParseIntValue(aValue);
|
||||
}
|
||||
}
|
||||
|
||||
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLOListElement::AttributeToString(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
nsAString& aResult) const
|
||||
nsHTMLSharedListElement::AttributeToString(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
nsAString& aResult) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::type) {
|
||||
if (aAttribute == nsHTMLAtoms::type &&
|
||||
(mNodeInfo->Equals(nsHTMLAtoms::ol) ||
|
||||
mNodeInfo->Equals(nsHTMLAtoms::ul))) {
|
||||
PRInt32 v = aValue.GetIntValue();
|
||||
switch (v) {
|
||||
case NS_STYLE_LIST_STYLE_OLD_DECIMAL:
|
||||
|
@ -244,25 +265,35 @@ MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP_(PRBool)
|
||||
nsHTMLOListElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
nsHTMLSharedListElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
{
|
||||
static const MappedAttributeEntry attributes[] = {
|
||||
{ &nsHTMLAtoms::type },
|
||||
{ nsnull }
|
||||
};
|
||||
if (mNodeInfo->Equals(nsHTMLAtoms::ol) ||
|
||||
mNodeInfo->Equals(nsHTMLAtoms::ul)) {
|
||||
static const MappedAttributeEntry attributes[] = {
|
||||
{ &nsHTMLAtoms::type },
|
||||
{ nsnull }
|
||||
};
|
||||
|
||||
static const MappedAttributeEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
static const MappedAttributeEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
||||
return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
|
||||
return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
|
||||
}
|
||||
|
||||
return nsGenericHTMLElement::IsAttributeMapped(aAttribute);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLOListElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const
|
||||
nsHTMLSharedListElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const
|
||||
{
|
||||
aMapRuleFunc = &MapAttributesIntoRule;
|
||||
if (mNodeInfo->Equals(nsHTMLAtoms::ol) ||
|
||||
mNodeInfo->Equals(nsHTMLAtoms::ul)) {
|
||||
aMapRuleFunc = &MapAttributesIntoRule;
|
||||
}
|
||||
else {
|
||||
nsGenericHTMLElement::GetAttributeMappingFunction(aMapRuleFunc);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -39,6 +39,10 @@
|
|||
#include "nsIDOMHTMLIsIndexElement.h"
|
||||
#include "nsIDOMHTMLParamElement.h"
|
||||
#include "nsIDOMHTMLBaseElement.h"
|
||||
#include "nsIDOMHTMLDirectoryElement.h"
|
||||
#include "nsIDOMHTMLMenuElement.h"
|
||||
#include "nsIDOMHTMLQuoteElement.h"
|
||||
#include "nsIDOMHTMLBaseFontElement.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIHTMLContent.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
|
@ -50,17 +54,23 @@
|
|||
#include "nsMappedAttributes.h"
|
||||
#include "nsStyleContext.h"
|
||||
|
||||
// XXX nav4 has type= start= (same as OL/UL)
|
||||
extern nsHTMLValue::EnumTable kListTypeTable[];
|
||||
|
||||
class nsHTMLSharedLeafElement : public nsGenericHTMLElement,
|
||||
public nsImageLoadingContent,
|
||||
public nsIDOMHTMLEmbedElement,
|
||||
public nsIDOMHTMLIsIndexElement,
|
||||
public nsIDOMHTMLParamElement,
|
||||
public nsIDOMHTMLBaseElement
|
||||
class nsHTMLSharedElement : public nsGenericHTMLElement,
|
||||
public nsImageLoadingContent,
|
||||
public nsIDOMHTMLEmbedElement,
|
||||
public nsIDOMHTMLIsIndexElement,
|
||||
public nsIDOMHTMLParamElement,
|
||||
public nsIDOMHTMLBaseElement,
|
||||
public nsIDOMHTMLDirectoryElement,
|
||||
public nsIDOMHTMLMenuElement,
|
||||
public nsIDOMHTMLQuoteElement,
|
||||
public nsIDOMHTMLBaseFontElement
|
||||
{
|
||||
public:
|
||||
nsHTMLSharedLeafElement();
|
||||
virtual ~nsHTMLSharedLeafElement();
|
||||
nsHTMLSharedElement();
|
||||
virtual ~nsHTMLSharedElement();
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
@ -84,7 +94,6 @@ public:
|
|||
// NS_DECL_NSIDOMHTMLPARAMELEMENT since some of the methods in
|
||||
// nsIDOMHTMLParamElement clashes with methods in
|
||||
// nsIDOMHTMLEmbedElement
|
||||
|
||||
NS_IMETHOD GetValue(nsAString& aValue);
|
||||
NS_IMETHOD SetValue(const nsAString& aValue);
|
||||
NS_IMETHOD GetValueType(nsAString& aValueType);
|
||||
|
@ -93,6 +102,18 @@ public:
|
|||
// nsIDOMHTMLBaseElement
|
||||
NS_DECL_NSIDOMHTMLBASEELEMENT
|
||||
|
||||
// nsIDOMHTMLDirectoryElement
|
||||
NS_DECL_NSIDOMHTMLDIRECTORYELEMENT
|
||||
|
||||
// nsIDOMHTMLMenuElement
|
||||
// Same as directoryelement
|
||||
|
||||
// nsIDOMHTMLQuoteElement
|
||||
NS_DECL_NSIDOMHTMLQUOTEELEMENT
|
||||
|
||||
// nsIDOMHTMLBaseFontElement
|
||||
NS_DECL_NSIDOMHTMLBASEFONTELEMENT
|
||||
|
||||
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult);
|
||||
|
@ -104,12 +125,12 @@ public:
|
|||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLSharedLeafElement(nsIHTMLContent** aInstancePtrResult,
|
||||
nsINodeInfo *aNodeInfo)
|
||||
NS_NewHTMLSharedElement(nsIHTMLContent** aInstancePtrResult,
|
||||
nsINodeInfo *aNodeInfo)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
|
||||
|
||||
nsHTMLSharedLeafElement* it = new nsHTMLSharedLeafElement();
|
||||
nsHTMLSharedElement* it = new nsHTMLSharedElement();
|
||||
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -130,30 +151,34 @@ NS_NewHTMLSharedLeafElement(nsIHTMLContent** aInstancePtrResult,
|
|||
}
|
||||
|
||||
|
||||
nsHTMLSharedLeafElement::nsHTMLSharedLeafElement()
|
||||
nsHTMLSharedElement::nsHTMLSharedElement()
|
||||
{
|
||||
}
|
||||
|
||||
nsHTMLSharedLeafElement::~nsHTMLSharedLeafElement()
|
||||
nsHTMLSharedElement::~nsHTMLSharedElement()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLSharedLeafElement, nsGenericElement)
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLSharedLeafElement, nsGenericElement)
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLSharedElement, nsGenericElement)
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLSharedElement, nsGenericElement)
|
||||
|
||||
|
||||
// QueryInterface implementation for nsHTMLSharedLeafElement
|
||||
NS_HTML_CONTENT_INTERFACE_MAP_AMBIGOUS_BEGIN(nsHTMLSharedLeafElement,
|
||||
// QueryInterface implementation for nsHTMLSharedElement
|
||||
NS_HTML_CONTENT_INTERFACE_MAP_AMBIGOUS_BEGIN(nsHTMLSharedElement,
|
||||
nsGenericHTMLElement,
|
||||
nsIDOMHTMLEmbedElement)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMHTMLElement, nsIDOMHTMLEmbedElement)
|
||||
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLEmbedElement, embed)
|
||||
NS_INTERFACE_MAP_ENTRY_IF_TAG(imgIDecoderObserver, embed)
|
||||
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIImageLoadingContent, embed)
|
||||
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLParamElement, param)
|
||||
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLIsIndexElement, isindex)
|
||||
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLBaseElement, base)
|
||||
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLDirectoryElement, dir)
|
||||
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLMenuElement, menu)
|
||||
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLQuoteElement, q)
|
||||
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLQuoteElement, blockquote)
|
||||
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLBaseFontElement, basefont)
|
||||
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLEmbedElement, embed)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLParamElement, param)
|
||||
|
@ -161,16 +186,20 @@ NS_HTML_CONTENT_INTERFACE_MAP_AMBIGOUS_BEGIN(nsHTMLSharedLeafElement,
|
|||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLIsIndexElement, isindex)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLBaseElement, base)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLSpacerElement, spacer)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLDirectoryElement, dir)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLMenuElement, menu)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLQuoteElement, q)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLQuoteElement, blockquote)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_IF_TAG(HTMLBaseFontElement, basefont)
|
||||
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||
|
||||
|
||||
nsresult
|
||||
nsHTMLSharedLeafElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
nsHTMLSharedElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aReturn);
|
||||
*aReturn = nsnull;
|
||||
|
||||
nsHTMLSharedLeafElement* it = new nsHTMLSharedLeafElement();
|
||||
nsHTMLSharedElement* it = new nsHTMLSharedElement();
|
||||
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -195,23 +224,36 @@ nsHTMLSharedLeafElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
|||
|
||||
/////////////////////////////////////////////
|
||||
// Implement nsIDOMHTMLEmbedElement interface
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Align, align)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Height, height)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Width, width)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Name, name)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Type, type)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Src, src)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Align, align)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Height, height)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Width, width)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Name, name)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Type, type)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Src, src)
|
||||
|
||||
// nsIDOMHTMLParamElement
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Value, value)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, ValueType, valuetype)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Value, value)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedElement, ValueType, valuetype)
|
||||
|
||||
// nsIDOMHTMLIsIndexElement
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Prompt, prompt)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Prompt, prompt)
|
||||
|
||||
// nsIDOMHTMLDirectoryElement
|
||||
NS_IMPL_BOOL_ATTR(nsHTMLSharedElement, Compact, compact)
|
||||
|
||||
// nsIDOMHTMLMenuElement
|
||||
//NS_IMPL_BOOL_ATTR(nsHTMLSharedElement, Compact, compact)
|
||||
|
||||
// nsIDOMHTMLQuoteElement
|
||||
NS_IMPL_URI_ATTR(nsHTMLSharedElement, Cite, cite)
|
||||
|
||||
// nsIDOMHTMLBaseFontElement
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Color, color)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Face, face)
|
||||
NS_IMPL_INT_ATTR(nsHTMLSharedElement, Size, size)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLSharedLeafElement::GetForm(nsIDOMHTMLFormElement** aForm)
|
||||
nsHTMLSharedElement::GetForm(nsIDOMHTMLFormElement** aForm)
|
||||
{
|
||||
*aForm = FindForm().get();
|
||||
|
||||
|
@ -219,15 +261,15 @@ nsHTMLSharedLeafElement::GetForm(nsIDOMHTMLFormElement** aForm)
|
|||
}
|
||||
|
||||
// nsIDOMHTMLBaseElement
|
||||
NS_IMPL_URI_ATTR(nsHTMLSharedLeafElement, Href, href)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedLeafElement, Target, target)
|
||||
NS_IMPL_URI_ATTR(nsHTMLSharedElement, Href, href)
|
||||
NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Target, target)
|
||||
|
||||
// spacer element code
|
||||
|
||||
PRBool
|
||||
nsHTMLSharedLeafElement::ParseAttribute(nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
nsHTMLSharedElement::ParseAttribute(nsIAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult)
|
||||
{
|
||||
if (mNodeInfo->Equals(nsHTMLAtoms::embed)) {
|
||||
if (aAttribute == nsHTMLAtoms::align) {
|
||||
|
@ -236,7 +278,8 @@ nsHTMLSharedLeafElement::ParseAttribute(nsIAtom* aAttribute,
|
|||
if (ParseImageAttribute(aAttribute, aValue, aResult)) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
} else if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) {
|
||||
}
|
||||
else if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) {
|
||||
if (aAttribute == nsHTMLAtoms::size) {
|
||||
return aResult.ParseIntWithBounds(aValue, 0);
|
||||
}
|
||||
|
@ -248,14 +291,28 @@ nsHTMLSharedLeafElement::ParseAttribute(nsIAtom* aAttribute,
|
|||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
|
||||
}
|
||||
}
|
||||
else if (mNodeInfo->Equals(nsHTMLAtoms::dir) ||
|
||||
mNodeInfo->Equals(nsHTMLAtoms::menu)) {
|
||||
if (aAttribute == nsHTMLAtoms::type) {
|
||||
return aResult.ParseEnumValue(aValue, kListTypeTable);
|
||||
}
|
||||
if (aAttribute == nsHTMLAtoms::start) {
|
||||
return aResult.ParseIntWithBounds(aValue, 1);
|
||||
}
|
||||
}
|
||||
else if (mNodeInfo->Equals(nsHTMLAtoms::basefont)) {
|
||||
if (aAttribute == nsHTMLAtoms::size) {
|
||||
return aResult.ParseIntValue(aValue);
|
||||
}
|
||||
}
|
||||
|
||||
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLSharedLeafElement::AttributeToString(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
nsAString& aResult) const
|
||||
nsHTMLSharedElement::AttributeToString(nsIAtom* aAttribute,
|
||||
const nsHTMLValue& aValue,
|
||||
nsAString& aResult) const
|
||||
{
|
||||
if (mNodeInfo->Equals(nsHTMLAtoms::embed)) {
|
||||
if (aAttribute == nsHTMLAtoms::align) {
|
||||
|
@ -264,7 +321,8 @@ nsHTMLSharedLeafElement::AttributeToString(nsIAtom* aAttribute,
|
|||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
}
|
||||
} else if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) {
|
||||
}
|
||||
else if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) {
|
||||
if (aAttribute == nsHTMLAtoms::align) {
|
||||
if (eHTMLUnit_Enumerated == aValue.GetUnit()) {
|
||||
AlignValueToString(aValue, aResult);
|
||||
|
@ -272,6 +330,13 @@ nsHTMLSharedLeafElement::AttributeToString(nsIAtom* aAttribute,
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (mNodeInfo->Equals(nsHTMLAtoms::dir) ||
|
||||
mNodeInfo->Equals(nsHTMLAtoms::menu)) {
|
||||
if (aAttribute == nsHTMLAtoms::type) {
|
||||
aValue.EnumValueToString(kListTypeTable, aResult);
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
return nsGenericHTMLElement::AttributeToString(aAttribute, aValue, aResult);
|
||||
}
|
||||
|
@ -365,9 +430,6 @@ static void
|
|||
EmbedMapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
nsRuleData* aData)
|
||||
{
|
||||
if (!aData)
|
||||
return;
|
||||
|
||||
nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
|
||||
|
@ -375,17 +437,29 @@ EmbedMapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
PlainMapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
nsRuleData* aData)
|
||||
DirectoryMenuMapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
nsRuleData* aData)
|
||||
{
|
||||
if (aData->mSID == eStyleStruct_List) {
|
||||
if (aData->mListData->mType.GetUnit() == eCSSUnit_Null) {
|
||||
nsHTMLValue value;
|
||||
// type: enum
|
||||
if (aAttributes->GetAttribute(nsHTMLAtoms::type, value) !=
|
||||
NS_CONTENT_ATTR_NOT_THERE) {
|
||||
if (value.GetUnit() == eHTMLUnit_Enumerated)
|
||||
aData->mListData->mType.SetIntValue(value.GetIntValue(), eCSSUnit_Enumerated);
|
||||
else
|
||||
aData->mListData->mType.SetIntValue(NS_STYLE_LIST_STYLE_DISC, eCSSUnit_Enumerated);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP_(PRBool)
|
||||
nsHTMLSharedLeafElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
nsHTMLSharedElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||
{
|
||||
if (mNodeInfo->Equals(nsHTMLAtoms::embed)) {
|
||||
static const MappedAttributeEntry* const map[] = {
|
||||
|
@ -394,7 +468,7 @@ nsHTMLSharedLeafElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
|||
sImageAlignAttributeMap,
|
||||
sImageBorderAttributeMap
|
||||
};
|
||||
|
||||
|
||||
return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
|
||||
}
|
||||
|
||||
|
@ -413,7 +487,22 @@ nsHTMLSharedLeafElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
|||
sImageMarginSizeAttributeMap,
|
||||
sImageBorderAttributeMap,
|
||||
};
|
||||
|
||||
|
||||
return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
|
||||
}
|
||||
|
||||
if (mNodeInfo->Equals(nsHTMLAtoms::dir)) {
|
||||
static const MappedAttributeEntry attributes[] = {
|
||||
{ &nsHTMLAtoms::type },
|
||||
// { &nsHTMLAtoms::compact }, // XXX
|
||||
{ nsnull}
|
||||
};
|
||||
|
||||
static const MappedAttributeEntry* const map[] = {
|
||||
attributes,
|
||||
sCommonAttributeMap,
|
||||
};
|
||||
|
||||
return FindAttributeDependence(aAttribute, map, NS_ARRAY_LENGTH(map));
|
||||
}
|
||||
|
||||
|
@ -421,15 +510,21 @@ nsHTMLSharedLeafElement::IsAttributeMapped(const nsIAtom* aAttribute) const
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLSharedLeafElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const
|
||||
nsHTMLSharedElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const
|
||||
{
|
||||
if (mNodeInfo->Equals(nsHTMLAtoms::embed)) {
|
||||
aMapRuleFunc = &EmbedMapAttributesIntoRule;
|
||||
} else if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) {
|
||||
aMapRuleFunc = &SpacerMapAttributesIntoRule;
|
||||
} else {
|
||||
aMapRuleFunc = &PlainMapAttributesIntoRule;
|
||||
}
|
||||
|
||||
else if (mNodeInfo->Equals(nsHTMLAtoms::spacer)) {
|
||||
aMapRuleFunc = &SpacerMapAttributesIntoRule;
|
||||
}
|
||||
else if (mNodeInfo->Equals(nsHTMLAtoms::dir) ||
|
||||
mNodeInfo->Equals(nsHTMLAtoms::menu)) {
|
||||
aMapRuleFunc = &DirectoryMenuMapAttributesIntoRule;
|
||||
}
|
||||
else {
|
||||
nsGenericHTMLElement::GetAttributeMappingFunction(aMapRuleFunc);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "nsStyleConsts.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsRuleNode.h"
|
||||
|
||||
class nsHTMLSpanElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLElement
|
||||
|
@ -63,6 +64,7 @@ public:
|
|||
// nsIDOMHTMLElement
|
||||
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
|
||||
|
||||
NS_IMETHOD GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const;
|
||||
virtual nsresult GetInnerHTML(nsAString& aInnerHTML);
|
||||
virtual nsresult SetInnerHTML(const nsAString& aInnerHTML);
|
||||
};
|
||||
|
@ -141,6 +143,30 @@ nsHTMLSpanElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
BdoMapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
nsRuleData* aData)
|
||||
{
|
||||
if (aData->mSID == eStyleStruct_TextReset &&
|
||||
aData->mTextData->mUnicodeBidi.GetUnit() == eCSSUnit_Null) {
|
||||
aData->mTextData->mUnicodeBidi.SetIntValue(NS_STYLE_UNICODE_BIDI_OVERRIDE, eCSSUnit_Enumerated);
|
||||
}
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLSpanElement::GetAttributeMappingFunction(nsMapRuleToAttributesFunc& aMapRuleFunc) const
|
||||
{
|
||||
if (mNodeInfo->Equals(nsHTMLAtoms::bdo)) {
|
||||
aMapRuleFunc = &BdoMapAttributesIntoRule;
|
||||
}
|
||||
else {
|
||||
nsGenericHTMLElement::GetAttributeMappingFunction(aMapRuleFunc);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLSpanElement::GetInnerHTML(nsAString& aInnerHTML)
|
||||
{
|
||||
|
@ -162,3 +188,66 @@ nsHTMLSpanElement::SetInnerHTML(const nsAString& aInnerHTML)
|
|||
|
||||
return nsGenericHTMLElement::SetInnerHTML(aInnerHTML);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
class nsHTMLUnknownElement : public nsHTMLSpanElement
|
||||
{
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
|
||||
};
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsHTMLUnknownElement)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLUnknownElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsHTMLSpanElement)
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLUnknownElement(nsIHTMLContent** aInstancePtrResult,
|
||||
nsINodeInfo *aNodeInfo)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aInstancePtrResult);
|
||||
|
||||
nsHTMLUnknownElement* it = new nsHTMLUnknownElement();
|
||||
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsresult rv = it->Init(aNodeInfo);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
delete it;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_ADDREF(*aInstancePtrResult = it);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLUnknownElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aReturn);
|
||||
*aReturn = nsnull;
|
||||
|
||||
nsHTMLUnknownElement* it = new nsHTMLUnknownElement();
|
||||
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> kungFuDeathGrip(it);
|
||||
|
||||
nsresult rv = it->Init(mNodeInfo);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
CopyInnerTo(it, aDeep);
|
||||
|
||||
NS_ADDREF(*aReturn = it);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ nsPluginDocument::CreateSyntheticPluginDocument()
|
|||
kNameSpaceID_None,
|
||||
getter_AddRefs(nodeInfo));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = NS_NewHTMLSharedLeafElement(getter_AddRefs(mPluginContent), nodeInfo);
|
||||
rv = NS_NewHTMLSharedElement(getter_AddRefs(mPluginContent), nodeInfo);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -74,6 +74,7 @@ HTML_ATOM(autocheck, "autocheck")
|
|||
HTML_ATOM(axis, "axis")
|
||||
HTML_ATOM(background, "background")
|
||||
HTML_ATOM(base, "base")
|
||||
HTML_ATOM(basefont, "basefont")
|
||||
HTML_ATOM(below, "below")
|
||||
HTML_ATOM(bdo, "bdo")
|
||||
HTML_ATOM(bgcolor, "bgcolor")
|
||||
|
@ -119,12 +120,12 @@ HTML_ATOM(defaultselected, "defaultselected")
|
|||
HTML_ATOM(defaultvalue, "defaultvalue")
|
||||
HTML_ATOM(declare, "declare")
|
||||
HTML_ATOM(defer, "defer")
|
||||
HTML_ATOM(del, "del")
|
||||
HTML_ATOM(dir, "dir")
|
||||
HTML_ATOM(div, "div")
|
||||
HTML_ATOM(disabled, "disabled")
|
||||
HTML_ATOM(dl, "dl")
|
||||
HTML_ATOM(dt, "dt")
|
||||
|
||||
HTML_ATOM(datetime, "datetime")
|
||||
HTML_ATOM(data, "data")
|
||||
HTML_ATOM(dfn, "dfn")
|
||||
|
@ -172,6 +173,7 @@ HTML_ATOM(ilayer, "ilayer")
|
|||
HTML_ATOM(img, "img")
|
||||
HTML_ATOM(index, "index")
|
||||
HTML_ATOM(input, "input")
|
||||
HTML_ATOM(ins, "ins")
|
||||
HTML_ATOM(isindex, "isindex")
|
||||
HTML_ATOM(ismap, "ismap")
|
||||
HTML_ATOM(label, "label")
|
||||
|
@ -222,6 +224,7 @@ HTML_ATOM(pointSize, "point-size")
|
|||
HTML_ATOM(pre, "pre")
|
||||
HTML_ATOM(profile, "profile")
|
||||
HTML_ATOM(prompt, "prompt")
|
||||
HTML_ATOM(q, "q")
|
||||
HTML_ATOM(readonly, "readonly")
|
||||
HTML_ATOM(refresh, "refresh")
|
||||
HTML_ATOM(rel, "rel")
|
||||
|
|
|
@ -71,13 +71,13 @@ HTML_TAG(address, Span)
|
|||
HTML_TAG(applet, Applet)
|
||||
HTML_TAG(area, Area)
|
||||
HTML_TAG(b, Span)
|
||||
HTML_TAG(base, SharedLeaf)
|
||||
HTML_TAG(basefont, BaseFont)
|
||||
HTML_TAG(base, Shared)
|
||||
HTML_TAG(basefont, Shared)
|
||||
HTML_TAG(bdo, Span)
|
||||
HTML_TAG(bgsound, Span)
|
||||
HTML_TAG(big, Span)
|
||||
HTML_TAG(blink, Span)
|
||||
HTML_TAG(blockquote, Quote)
|
||||
HTML_TAG(blockquote, Shared)
|
||||
HTML_TAG(body, Body)
|
||||
HTML_TAG(br, BR)
|
||||
HTML_TAG(button, Button)
|
||||
|
@ -89,14 +89,14 @@ HTML_TAG(col, TableCol)
|
|||
HTML_TAG(colgroup, TableCol)
|
||||
HTML_TAG(counter, Span)
|
||||
HTML_TAG(dd, Span)
|
||||
HTML_TAG(del, Del)
|
||||
HTML_TAG(del, Mod)
|
||||
HTML_TAG(dfn, Span)
|
||||
HTML_TAG(dir, Directory)
|
||||
HTML_TAG(dir, Shared)
|
||||
HTML_TAG(div, Div)
|
||||
HTML_TAG(dl, DList)
|
||||
HTML_TAG(dl, SharedList)
|
||||
HTML_TAG(dt, Span)
|
||||
HTML_TAG(em, Span)
|
||||
HTML_TAG(embed, SharedLeaf)
|
||||
HTML_TAG(embed, Shared)
|
||||
HTML_TAG(endnote, Span)
|
||||
HTML_TAG(fieldset, FieldSet)
|
||||
HTML_TAG(font, Font)
|
||||
|
@ -117,8 +117,8 @@ HTML_TAG(iframe, IFrame)
|
|||
HTML_TAG(image, Span)
|
||||
HTML_TAG(img, Image)
|
||||
HTML_TAG(input, NOTUSED)
|
||||
HTML_TAG(ins, Ins)
|
||||
HTML_TAG(isindex, SharedLeaf)
|
||||
HTML_TAG(ins, Mod)
|
||||
HTML_TAG(isindex, Shared)
|
||||
HTML_TAG(kbd, Span)
|
||||
HTML_TAG(keygen, Span)
|
||||
HTML_TAG(label, Label)
|
||||
|
@ -128,7 +128,7 @@ HTML_TAG(link, Link)
|
|||
HTML_TAG(listing, Span)
|
||||
HTML_TAG(map, Map)
|
||||
HTML_TAG(marquee, Div)
|
||||
HTML_TAG(menu, Menu)
|
||||
HTML_TAG(menu, Shared)
|
||||
HTML_TAG(meta, Meta)
|
||||
HTML_TAG(multicol, Span)
|
||||
HTML_TAG(nobr, Span)
|
||||
|
@ -136,15 +136,15 @@ HTML_TAG(noembed, Div)
|
|||
HTML_TAG(noframes, Div)
|
||||
HTML_TAG(noscript, Div)
|
||||
HTML_TAG(object, Object)
|
||||
HTML_TAG(ol, OList)
|
||||
HTML_TAG(ol, SharedList)
|
||||
HTML_TAG(optgroup, OptGroup)
|
||||
HTML_TAG(option, Option)
|
||||
HTML_TAG(p, Paragraph)
|
||||
HTML_TAG(param, SharedLeaf)
|
||||
HTML_TAG(param, Shared)
|
||||
HTML_TAG(parsererror, Div)
|
||||
HTML_TAG(plaintext, Span)
|
||||
HTML_TAG(pre, Pre)
|
||||
HTML_TAG(q, Quote)
|
||||
HTML_TAG(q, Shared)
|
||||
HTML_TAG(s, Span)
|
||||
HTML_TAG(samp, Span)
|
||||
HTML_TAG(script, Script)
|
||||
|
@ -153,7 +153,7 @@ HTML_TAG(server, Span)
|
|||
HTML_TAG(small, Span)
|
||||
HTML_TAG(sound, Span)
|
||||
HTML_TAG(sourcetext, Div)
|
||||
HTML_TAG(spacer, SharedLeaf)
|
||||
HTML_TAG(spacer, Shared)
|
||||
HTML_TAG(span, Span)
|
||||
HTML_TAG(strike, Span)
|
||||
HTML_TAG(strong, Span)
|
||||
|
@ -171,9 +171,9 @@ HTML_TAG(title, Title)
|
|||
HTML_TAG(tr, TableRow)
|
||||
HTML_TAG(tt, Span)
|
||||
HTML_TAG(u, Span)
|
||||
HTML_TAG(ul, UList)
|
||||
HTML_TAG(ul, SharedList)
|
||||
HTML_TAG(var, Span)
|
||||
HTML_TAG(wbr, SharedLeaf)
|
||||
HTML_TAG(wbr, Shared)
|
||||
HTML_TAG(xmp, Span)
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче