Make ParseAttribute handle namespaced attributes too, since SVG needs to

ParseAttribute things like xlink:href.  Bug 314568, r=sicking, sr=jst
This commit is contained in:
bzbarsky%mit.edu 2005-11-29 16:37:15 +00:00
Родитель 4e9db4350c
Коммит 010b56ee8f
39 изменённых файлов: 687 добавлений и 532 удалений

Просмотреть файл

@ -4033,8 +4033,7 @@ nsGenericElement::SetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
NS_ENSURE_SUCCESS(rv, rv);
nsAttrValue attrValue;
if (aNamespaceID != kNameSpaceID_None ||
!ParseAttribute(aName, aValue, attrValue)) {
if (!ParseAttribute(aNamespaceID, aName, aValue, attrValue)) {
attrValue.SetTo(aValue);
}
@ -4131,11 +4130,13 @@ nsGenericElement::SetAttrAndNotify(PRInt32 aNamespaceID,
}
PRBool
nsGenericElement::ParseAttribute(nsIAtom* aAttribute,
nsGenericElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aAttribute == GetIDAttributeName() && !aValue.IsEmpty()) {
if (aNamespaceID == kNameSpaceID_None &&
aAttribute == GetIDAttributeName() && !aValue.IsEmpty()) {
// Store id as an atom. id="" means that the element has no id,
// not that it has an emptystring as the id.
aResult.ParseAtom(aValue);

Просмотреть файл

@ -727,12 +727,14 @@ protected:
* attribute. Called by SetAttr(). Note that at the moment we only do this
* for attributes in the null namespace (kNameSpaceID_None).
*
* @param aNamespaceID the namespace of the attribute to convert
* @param aAttribute the attribute to convert
* @param aValue the string value to convert
* @param aResult the nsAttrValue [OUT]
* @return PR_TRUE if the parsing was successful, PR_FALSE otherwise
*/
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);

Просмотреть файл

@ -2027,10 +2027,12 @@ nsGenericHTMLElement::IsContentOfType(PRUint32 aFlags) const
PRBool
nsGenericHTMLElement::ParseAttribute(nsIAtom* aAttribute,
nsGenericHTMLElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsHTMLAtoms::dir) {
return aResult.ParseEnumValue(aValue, kDirTable);
}
@ -2055,8 +2057,10 @@ nsGenericHTMLElement::ParseAttribute(nsIAtom* aAttribute,
aResult.ParseAtom(aValue);
return PR_TRUE;
}
}
return nsGenericElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
PRBool

Просмотреть файл

@ -245,18 +245,8 @@ public:
NS_IMETHOD SetInlineStyleRule(nsICSSStyleRule* aStyleRule, PRBool aNotify);
already_AddRefed<nsIURI> GetBaseURI() const;
//----------------------------------------
/**
* Convert an attribute string value to attribute type based on the type of
* attribute. Called by SetAttr().
*
* @param aAttribute to attribute to convert
* @param aValue the string value to convert
* @param aResult the nsAttrValue [OUT]
* @return PR_TRUE if the parsing was successful, PR_FALSE otherwise
* @see nsGenericHTMLElement::SetAttr
*/
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);

Просмотреть файл

@ -96,7 +96,8 @@ public:
nsIAtom* aPrefix, const nsAString& aValue,
PRBool aNotify);
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
@ -191,10 +192,12 @@ NS_IMPL_STRING_ATTR(nsHTMLAppletElement, Width, width)
NS_IMPL_INT_ATTR(nsHTMLAppletElement, TabIndex, tabindex)
PRBool
nsHTMLAppletElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLAppletElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsHTMLAtoms::align) {
return nsGenericHTMLElement::ParseAlignValue(aValue, aResult);
}
@ -202,8 +205,10 @@ nsHTMLAppletElement::ParseAttribute(nsIAtom* aAttribute,
aValue, aResult)) {
return PR_TRUE;
}
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static void

Просмотреть файл

@ -65,7 +65,8 @@ public:
// nsIDOMHTMLBRElement
NS_DECL_NSIDOMHTMLBRELEMENT
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
@ -110,15 +111,17 @@ static const nsAttrValue::EnumTable kClearTable[] = {
};
PRBool
nsHTMLBRElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLBRElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aAttribute == nsHTMLAtoms::clear) {
if (aAttribute == nsHTMLAtoms::clear && aNamespaceID == kNameSpaceID_None) {
return aResult.ParseEnumValue(aValue, kClearTable);
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static void

Просмотреть файл

@ -106,7 +106,8 @@ public:
// nsIDOMHTMLBodyElement
NS_DECL_NSIDOMHTMLBODYELEMENT
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
@ -387,10 +388,12 @@ nsHTMLBodyElement::SetBgColor(const nsAString& aBgColor)
}
PRBool
nsHTMLBodyElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLBodyElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsHTMLAtoms::bgcolor ||
aAttribute == nsHTMLAtoms::text ||
aAttribute == nsHTMLAtoms::link ||
@ -406,8 +409,10 @@ nsHTMLBodyElement::ParseAttribute(nsIAtom* aAttribute,
aAttribute == nsHTMLAtoms::rightmargin) {
return aResult.ParseIntWithBounds(aValue, 0);
}
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
void

Просмотреть файл

@ -98,7 +98,8 @@ public:
// nsIContent overrides...
virtual void SetFocus(nsPresContext* aPresContext);
virtual PRBool IsFocusable(PRInt32 *aTabIndex = nsnull);
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
virtual nsresult HandleDOMEvent(nsPresContext* aPresContext,
@ -262,11 +263,12 @@ static const nsAttrValue::EnumTable kButtonTypeTable[] = {
};
PRBool
nsHTMLButtonElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLButtonElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aAttribute == nsHTMLAtoms::type) {
if (aAttribute == nsHTMLAtoms::type && kNameSpaceID_None == aNamespaceID) {
// XXX ARG!! This is major evilness. ParseAttribute
// shouldn't set members. Override SetAttr instead
PRBool res = aResult.ParseEnumValue(aValue, kButtonTypeTable);
@ -276,7 +278,8 @@ nsHTMLButtonElement::ParseAttribute(nsIAtom* aAttribute,
return res;
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
nsresult

Просмотреть файл

@ -89,7 +89,10 @@ public:
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
PRBool ParseAttribute(nsIAtom* aAttribute, const nsAString& aValue, nsAttrValue& aResult);
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute, PRInt32 aModType) const;
// SetAttr override. C++ is stupid, so have to override both
@ -238,10 +241,13 @@ nsHTMLCanvasElement::IsAttributeMapped(const nsIAtom* aAttribute) const
}
PRBool
nsHTMLCanvasElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLCanvasElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None)
{
if ((aAttribute == nsHTMLAtoms::width) ||
(aAttribute == nsHTMLAtoms::height))
{
@ -249,9 +255,13 @@ nsHTMLCanvasElement::ParseAttribute(nsIAtom* aAttribute,
}
if (ParseImageAttribute(aAttribute, aValue, aResult))
{
return PR_TRUE;
}
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}

Просмотреть файл

@ -64,7 +64,8 @@ public:
// nsIDOMHTMLDivElement
NS_DECL_NSIDOMHTMLDIVELEMENT
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
@ -104,10 +105,12 @@ NS_IMPL_STRING_ATTR(nsHTMLDivElement, Align, align)
PRBool
nsHTMLDivElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLDivElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (mNodeInfo->Equals(nsHTMLAtoms::marquee)) {
if ((aAttribute == nsHTMLAtoms::width) ||
(aAttribute == nsHTMLAtoms::height)) {
@ -122,11 +125,14 @@ nsHTMLDivElement::ParseAttribute(nsIAtom* aAttribute,
}
}
if (mNodeInfo->Equals(nsHTMLAtoms::div) && aAttribute == nsHTMLAtoms::align) {
if (mNodeInfo->Equals(nsHTMLAtoms::div) &&
aAttribute == nsHTMLAtoms::align) {
return ParseDivAlignValue(aValue, aResult);
}
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static void

Просмотреть файл

@ -69,7 +69,8 @@ public:
// nsIDOMHTMLFontElement
NS_DECL_NSIDOMHTMLFONTELEMENT
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
@ -135,10 +136,12 @@ static const nsAttrValue::EnumTable kRelFontSizeTable[] = {
PRBool
nsHTMLFontElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLFontElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsHTMLAtoms::size) {
nsAutoString tmp(aValue);
tmp.CompressWhitespace(PR_TRUE, PR_TRUE);
@ -157,8 +160,10 @@ nsHTMLFontElement::ParseAttribute(nsIAtom* aAttribute,
if (aAttribute == nsHTMLAtoms::color) {
return aResult.ParseColor(aValue, GetOwnerDoc());
}
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static void

Просмотреть файл

@ -199,7 +199,8 @@ public:
nsIFormControl* aRadio);
// nsIContent
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
virtual nsresult HandleDOMEvent(nsPresContext* aPresContext,
@ -646,18 +647,22 @@ static const nsAttrValue::EnumTable kFormEnctypeTable[] = {
};
PRBool
nsHTMLFormElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLFormElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsHTMLAtoms::method) {
return aResult.ParseEnumValue(aValue, kFormMethodTable);
}
if (aAttribute == nsHTMLAtoms::enctype) {
return aResult.ParseEnumValue(aValue, kFormEnctypeTable);
}
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
nsresult

Просмотреть файл

@ -66,7 +66,8 @@ public:
NS_DECL_NSIDOMHTMLFRAMEELEMENT
// nsIContent
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
@ -119,12 +120,14 @@ nsHTMLFrameElement::GetContentDocument(nsIDOMDocument** aContentDocument)
}
PRBool
nsHTMLFrameElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLFrameElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsHTMLAtoms::bordercolor) {
return aResult.ParseColor(aValue, nsGenericHTMLFrameElement::GetOwnerDoc());
return aResult.ParseColor(aValue, GetOwnerDoc());
}
if (aAttribute == nsHTMLAtoms::frameborder) {
return ParseFrameborderValue(aValue, aResult);
@ -138,8 +141,10 @@ nsHTMLFrameElement::ParseAttribute(nsIAtom* aAttribute,
if (aAttribute == nsHTMLAtoms::scrolling) {
return ParseScrollingValue(aValue, aResult);
}
}
return nsGenericHTMLFrameElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLFrameElement::ParseAttribute(aNamespaceID, aAttribute,
aValue, aResult);
}
static void

Просмотреть файл

@ -82,7 +82,8 @@ public:
NS_IMETHOD GetRowSpec(PRInt32 *aNumValues, const nsFramesetSpec** aSpecs);
NS_IMETHOD GetColSpec(PRInt32 *aNumValues, const nsFramesetSpec** aSpecs);
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
@ -258,10 +259,12 @@ nsHTMLFrameSetElement::GetColSpec(PRInt32 *aNumValues,
PRBool
nsHTMLFrameSetElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLFrameSetElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsHTMLAtoms::bordercolor) {
return aResult.ParseColor(aValue, GetOwnerDoc());
}
@ -271,8 +274,10 @@ nsHTMLFrameSetElement::ParseAttribute(nsIAtom* aAttribute,
if (aAttribute == nsHTMLAtoms::border) {
return aResult.ParseIntWithBounds(aValue, 0, 100);
}
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
nsChangeHint

Просмотреть файл

@ -70,7 +70,8 @@ public:
// nsIDOMNSHTMLHRElement
NS_DECL_NSIDOMNSHTMLHRELEMENT
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
@ -120,10 +121,12 @@ static const nsAttrValue::EnumTable kAlignTable[] = {
};
PRBool
nsHTMLHRElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLHRElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aAttribute == kNameSpaceID_None) {
if (aAttribute == nsHTMLAtoms::width) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
}
@ -136,8 +139,10 @@ nsHTMLHRElement::ParseAttribute(nsIAtom* aAttribute,
if (aAttribute == nsHTMLAtoms::color) {
return aResult.ParseColor(aValue, GetOwnerDoc());
}
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static void

Просмотреть файл

@ -65,7 +65,8 @@ public:
// nsIDOMHTMLHeadingElement
NS_DECL_NSIDOMHTMLHEADINGELEMENT
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
@ -104,15 +105,17 @@ NS_IMPL_STRING_ATTR(nsHTMLHeadingElement, Align, align)
PRBool
nsHTMLHeadingElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLHeadingElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aAttribute == nsHTMLAtoms::align) {
if (aAttribute == nsHTMLAtoms::align && aNamespaceID == kNameSpaceID_None) {
return ParseDivAlignValue(aValue, aResult);
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static void

Просмотреть файл

@ -67,7 +67,8 @@ public:
NS_DECL_NSIDOMHTMLIFRAMEELEMENT
// nsIContent
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
@ -119,10 +120,12 @@ nsHTMLIFrameElement::GetContentDocument(nsIDOMDocument** aContentDocument)
}
PRBool
nsHTMLIFrameElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLIFrameElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsHTMLAtoms::marginwidth) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
}
@ -144,8 +147,10 @@ nsHTMLIFrameElement::ParseAttribute(nsIAtom* aAttribute,
if (aAttribute == nsHTMLAtoms::align) {
return ParseAlignValue(aValue, aResult);
}
}
return nsGenericHTMLFrameElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLFrameElement::ParseAttribute(aNamespaceID, aAttribute,
aValue, aResult);
}
static void

Просмотреть файл

@ -113,7 +113,8 @@ public:
PRUint32 argc, jsval *argv);
// nsIContent
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
@ -421,10 +422,12 @@ nsHTMLImageElement::SetWidth(PRInt32 aWidth)
}
PRBool
nsHTMLImageElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLImageElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsHTMLAtoms::align) {
return ParseAlignValue(aValue, aResult);
}
@ -436,8 +439,10 @@ nsHTMLImageElement::ParseAttribute(nsIAtom* aAttribute,
if (ParseImageAttribute(aAttribute, aValue, aResult)) {
return PR_TRUE;
}
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static void

Просмотреть файл

@ -180,7 +180,8 @@ public:
virtual void SetFocus(nsPresContext* aPresContext);
virtual PRBool IsFocusable(PRInt32 *aTabIndex = nsnull);
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
@ -1728,10 +1729,12 @@ static const nsAttrValue::EnumTable kInputTypeTable[] = {
};
PRBool
nsHTMLInputElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLInputElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsHTMLAtoms::type) {
// XXX ARG!! This is major evilness. ParseAttribute
// shouldn't set members. Override SetAttr instead
@ -1776,8 +1779,10 @@ nsHTMLInputElement::ParseAttribute(nsIAtom* aAttribute,
// 214077.
return PR_TRUE;
}
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
NS_IMETHODIMP

Просмотреть файл

@ -65,7 +65,8 @@ public:
// nsIDOMHTMLLIElement
NS_DECL_NSIDOMHTMLLIELEMENT
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
@ -122,19 +123,24 @@ static const nsAttrValue::EnumTable kOrderedListItemTypeTable[] = {
};
PRBool
nsHTMLLIElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLLIElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsHTMLAtoms::type) {
return aResult.ParseEnumValue(aValue, kOrderedListItemTypeTable, PR_TRUE) ||
return aResult.ParseEnumValue(aValue, kOrderedListItemTypeTable,
PR_TRUE) ||
aResult.ParseEnumValue(aValue, kUnorderedListItemTypeTable);
}
if (aAttribute == nsHTMLAtoms::value) {
return aResult.ParseIntWithBounds(aValue, 0);
}
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static void

Просмотреть файл

@ -84,7 +84,8 @@ public:
virtual void UnbindFromTree(PRBool aDeep = PR_TRUE,
PRBool aNullParent = PR_TRUE);
virtual void SetFocus(nsPresContext* aPresContext);
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
@ -154,15 +155,17 @@ static const nsAttrValue::EnumTable kAlignTable[] = {
};
PRBool
nsHTMLLegendElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLLegendElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aAttribute == nsHTMLAtoms::align) {
if (aAttribute == nsHTMLAtoms::align && aNamespaceID == kNameSpaceID_None) {
return aResult.ParseEnumValue(aValue, kAlignTable);
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
nsChangeHint

Просмотреть файл

@ -75,7 +75,8 @@ public:
// nsIDOMHTMLUListElement
// fully declared by NS_DECL_NSIDOMHTMLOLISTELEMENT
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
@ -147,10 +148,12 @@ nsAttrValue::EnumTable kOldListTypeTable[] = {
};
PRBool
nsHTMLSharedListElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLSharedListElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (mNodeInfo->Equals(nsHTMLAtoms::ol) ||
mNodeInfo->Equals(nsHTMLAtoms::ul)) {
if (aAttribute == nsHTMLAtoms::type) {
@ -161,8 +164,10 @@ nsHTMLSharedListElement::ParseAttribute(nsIAtom* aAttribute,
return aResult.ParseIntValue(aValue);
}
}
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static void

Просмотреть файл

@ -98,7 +98,8 @@ public:
virtual void DoneAddingChildren(PRBool aHaveNotified);
virtual PRBool IsDoneAddingChildren();
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
@ -365,18 +366,22 @@ nsHTMLObjectElement::GetContentDocument(nsIDOMDocument** aContentDocument)
}
PRBool
nsHTMLObjectElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLObjectElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsHTMLAtoms::align) {
return ParseAlignValue(aValue, aResult);
}
if (ParseImageAttribute(aAttribute, aValue, aResult)) {
return PR_TRUE;
}
}
return nsGenericHTMLFormElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLFormElement::ParseAttribute(aNamespaceID, aAttribute,
aValue, aResult);
}
static void

Просмотреть файл

@ -68,7 +68,8 @@ public:
// nsIDOMHTMLParagraphElement
NS_DECL_NSIDOMHTMLPARAGRAPHELEMENT
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
@ -108,15 +109,17 @@ NS_IMPL_STRING_ATTR(nsHTMLParagraphElement, Align, align)
PRBool
nsHTMLParagraphElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLParagraphElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aAttribute == nsHTMLAtoms::align) {
if (aAttribute == nsHTMLAtoms::align && aNamespaceID == kNameSpaceID_None) {
return ParseDivAlignValue(aValue, aResult);
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static void

Просмотреть файл

@ -70,7 +70,8 @@ public:
NS_IMETHOD GetWidth(PRInt32* aWidth);
NS_IMETHOD SetWidth(PRInt32 aWidth);
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const;
@ -109,18 +110,22 @@ NS_IMPL_INT_ATTR(nsHTMLPreElement, Width, width)
PRBool
nsHTMLPreElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLPreElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsHTMLAtoms::cols) {
return aResult.ParseIntWithBounds(aValue, 0);
}
if (aAttribute == nsHTMLAtoms::width) {
return aResult.ParseIntWithBounds(aValue, 0);
}
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static void

Просмотреть файл

@ -249,7 +249,8 @@ public:
virtual void DoneAddingChildren(PRBool aHaveNotified);
virtual PRBool IsDoneAddingChildren();
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
@ -1695,14 +1696,16 @@ nsHTMLSelectElement::DoneAddingChildren(PRBool aHaveNotified)
}
PRBool
nsHTMLSelectElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLSelectElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aAttribute == nsHTMLAtoms::size) {
if (aAttribute == nsHTMLAtoms::size && kNameSpaceID_None == aNamespaceID) {
return aResult.ParseIntWithBounds(aValue, 0);
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static void

Просмотреть файл

@ -133,7 +133,8 @@ public:
virtual PRBool IsFocusable(PRInt32 *aTabIndex = nsnull);
virtual PRUint32 GetDesiredIMEState();
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
@ -283,10 +284,12 @@ NS_IMPL_URI_ATTR(nsHTMLSharedElement, Href, href)
NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Target, target)
PRBool
nsHTMLSharedElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLSharedElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (mNodeInfo->Equals(nsHTMLAtoms::embed)) {
if (aAttribute == nsHTMLAtoms::align) {
return ParseAlignValue(aValue, aResult);
@ -321,8 +324,10 @@ nsHTMLSharedElement::ParseAttribute(nsIAtom* aAttribute,
return aResult.ParseIntValue(aValue);
}
}
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
// spacer element code

Просмотреть файл

@ -91,7 +91,8 @@ public:
NS_IMETHOD SaveState();
virtual PRBool RestoreState(nsPresState* aState);
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
@ -204,18 +205,22 @@ nsHTMLObjectElement::GetContentDocument(nsIDOMDocument** aContentDocument)
}
PRBool
nsHTMLObjectElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLObjectElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsHTMLAtoms::align) {
return ParseAlignValue(aValue, aResult);
}
if (ParseImageAttribute(aAttribute, aValue, aResult)) {
return PR_TRUE;
}
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static void

Просмотреть файл

@ -65,7 +65,8 @@ public:
// nsIDOMHTMLTableCaptionElement
NS_DECL_NSIDOMHTMLTABLECAPTIONELEMENT
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
@ -113,15 +114,17 @@ static const nsAttrValue::EnumTable kCaptionAlignTable[] = {
};
PRBool
nsHTMLTableCaptionElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLTableCaptionElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aAttribute == nsHTMLAtoms::align) {
if (aAttribute == nsHTMLAtoms::align && aNamespaceID == kNameSpaceID_None) {
return aResult.ParseEnumValue(aValue, kCaptionAlignTable);
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static

Просмотреть файл

@ -68,7 +68,8 @@ public:
// nsIDOMHTMLTableCellElement
NS_DECL_NSIDOMHTMLTABLECELLELEMENT
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
@ -261,10 +262,12 @@ static const nsAttrValue::EnumTable kCellScopeTable[] = {
#define MAX_COLSPAN 1000 // limit as IE and opera do
PRBool
nsHTMLTableCellElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLTableCellElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
/* ignore these attributes, stored simply as strings
abbr, axis, ch, headers
*/
@ -278,7 +281,8 @@ nsHTMLTableCellElement::ParseAttribute(nsIAtom* aAttribute,
PRInt32 val = aResult.GetIntegerValue();
// reset large colspan values as IE and opera do
// quirks mode does not honor the special html 4 value of 0
if (val > MAX_COLSPAN || val < 0 || (0 == val && InNavQuirksMode(GetOwnerDoc()))) {
if (val > MAX_COLSPAN || val < 0 ||
(0 == val && InNavQuirksMode(GetOwnerDoc()))) {
aResult.SetTo(1);
}
}
@ -313,8 +317,10 @@ nsHTMLTableCellElement::ParseAttribute(nsIAtom* aAttribute,
if (aAttribute == nsHTMLAtoms::valign) {
return ParseTableVAlignValue(aValue, aResult);
}
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static

Просмотреть файл

@ -69,7 +69,8 @@ public:
// nsIDOMHTMLTableColElement
NS_DECL_NSIDOMHTMLTABLECOLELEMENT
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
@ -114,10 +115,12 @@ NS_IMPL_STRING_ATTR(nsHTMLTableColElement, Width, width)
PRBool
nsHTMLTableColElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLTableColElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
/* ignore these attributes, stored simply as strings ch */
if (aAttribute == nsHTMLAtoms::charoff) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
@ -135,8 +138,10 @@ nsHTMLTableColElement::ParseAttribute(nsIAtom* aAttribute,
if (aAttribute == nsHTMLAtoms::valign) {
return ParseTableVAlignValue(aValue, aResult);
}
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static

Просмотреть файл

@ -81,7 +81,8 @@ public:
// nsIDOMHTMLTableElement
NS_DECL_NSIDOMHTMLTABLEELEMENT
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
@ -876,11 +877,13 @@ static const nsAttrValue::EnumTable kLayoutTable[] = {
PRBool
nsHTMLTableElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLTableElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
/* ignore summary, just a string */
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsHTMLAtoms::cellspacing ||
aAttribute == nsHTMLAtoms::cellpadding) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
@ -903,13 +906,16 @@ nsHTMLTableElement::ParseAttribute(nsIAtom* aAttribute,
if (aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE)) {
// treat 0 width as auto
nsAttrValue::ValueType type = aResult.Type();
if ((type == nsAttrValue::eInteger && aResult.GetIntegerValue() == 0) ||
(type == nsAttrValue::ePercent && aResult.GetPercentValue() == 0.0f)) {
if ((type == nsAttrValue::eInteger &&
aResult.GetIntegerValue() == 0) ||
(type == nsAttrValue::ePercent &&
aResult.GetPercentValue() == 0.0f)) {
return PR_FALSE;
}
}
return PR_TRUE;
}
if (aAttribute == nsHTMLAtoms::align) {
return ParseTableHAlignValue(aValue, aResult);
}
@ -930,8 +936,10 @@ nsHTMLTableElement::ParseAttribute(nsIAtom* aAttribute,
aAttribute == nsHTMLAtoms::vspace) {
return aResult.ParseIntWithBounds(aValue, 0);
}
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static void

Просмотреть файл

@ -76,7 +76,8 @@ public:
// nsIDOMHTMLTableRowElement
NS_DECL_NSIDOMHTMLTABLEROWELEMENT
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
@ -385,7 +386,8 @@ NS_IMPL_STRING_ATTR_DEFAULT_VALUE(nsHTMLTableRowElement, VAlign, valign, "middle
PRBool
nsHTMLTableRowElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLTableRowElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
@ -395,6 +397,7 @@ nsHTMLTableRowElement::ParseAttribute(nsIAtom* aAttribute,
* ch
*/
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsHTMLAtoms::charoff) {
return aResult.ParseIntWithBounds(aValue, 0);
}
@ -413,8 +416,10 @@ nsHTMLTableRowElement::ParseAttribute(nsIAtom* aAttribute,
if (aAttribute == nsHTMLAtoms::valign) {
return ParseTableVAlignValue(aValue, aResult);
}
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static

Просмотреть файл

@ -71,7 +71,8 @@ public:
// nsIDOMHTMLTableSectionElement
NS_DECL_NSIDOMHTMLTABLESECTIONELEMENT
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
@ -232,10 +233,12 @@ nsHTMLTableSectionElement::DeleteRow(PRInt32 aValue)
}
PRBool
nsHTMLTableSectionElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLTableSectionElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
/* ignore these attributes, stored simply as strings
ch
*/
@ -254,8 +257,10 @@ nsHTMLTableSectionElement::ParseAttribute(nsIAtom* aAttribute,
if (aAttribute == nsHTMLAtoms::valign) {
return ParseTableVAlignValue(aValue, aResult);
}
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static

Просмотреть файл

@ -121,7 +121,8 @@ public:
PRBool aNotify);
virtual nsresult AppendChildTo(nsIContent* aKid, PRBool aNotify);
virtual nsresult RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
@ -491,17 +492,21 @@ nsHTMLTextAreaElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
}
PRBool
nsHTMLTextAreaElement::ParseAttribute(nsIAtom* aAttribute,
nsHTMLTextAreaElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsHTMLAtoms::cols) {
return aResult.ParseIntWithBounds(aValue, 0);
}
if (aAttribute == nsHTMLAtoms::rows) {
return aResult.ParseIntWithBounds(aValue, 0);
}
return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
static void

Просмотреть файл

@ -165,13 +165,14 @@ nsSVGElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
}
PRBool
nsSVGElement::ParseAttribute(nsIAtom* aAttribute,
nsSVGElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
// Parse value
nsCOMPtr<nsISVGValue> svg_value;
const nsAttrValue* val = mAttrsAndChildren.GetAttr(aAttribute);
const nsAttrValue* val = mAttrsAndChildren.GetAttr(aAttribute, aNamespaceID);
if (val) {
// Found the attr in the list.
if (val->Type() == nsAttrValue::eSVGValue) {
@ -180,7 +181,7 @@ nsSVGElement::ParseAttribute(nsIAtom* aAttribute,
}
else {
// Could be a mapped attribute.
svg_value = GetMappedAttribute(kNameSpaceID_None, aAttribute);
svg_value = GetMappedAttribute(aNamespaceID, aAttribute);
}
if (svg_value) {
@ -208,12 +209,13 @@ nsSVGElement::ParseAttribute(nsIAtom* aAttribute,
return PR_TRUE;
}
if (aAttribute == nsSVGAtoms::style) {
if (aAttribute == nsSVGAtoms::style && aNamespaceID == kNameSpaceID_None) {
nsGenericHTMLElement::ParseStyleAttribute(this, PR_TRUE, aValue, aResult);
return PR_TRUE;
}
return nsGenericElement::ParseAttribute(aAttribute, aValue, aResult);
return nsGenericElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
}
nsresult

Просмотреть файл

@ -120,9 +120,8 @@ protected:
const nsAString* aValue, PRBool aNotify);
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, PRBool aNotify);
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);
virtual PRBool ParseAttribute(PRInt32 aNamespaceID, nsIAtom* aAttribute,
const nsAString& aValue, nsAttrValue& aResult);
// Hooks for subclasses
virtual PRBool IsEventName(nsIAtom* aName);

Просмотреть файл

@ -1237,7 +1237,8 @@ nsXULElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
}
PRBool
nsXULElement::ParseAttribute(nsIAtom* aAttribute,
nsXULElement::ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
@ -1246,6 +1247,7 @@ nsXULElement::ParseAttribute(nsIAtom* aAttribute,
// WARNING!!
// This code is largely duplicated in nsXULPrototypeElement::SetAttrAt.
// Any changes should be made to both functions.
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsXULAtoms::style) {
nsGenericHTMLElement::ParseStyleAttribute(this, PR_TRUE, aValue,
aResult);
@ -1256,8 +1258,10 @@ nsXULElement::ParseAttribute(nsIAtom* aAttribute,
aResult.ParseAtomArray(aValue);
return PR_TRUE;
}
}
if (!nsGenericElement::ParseAttribute(aAttribute, aValue, aResult)) {
if (!nsGenericElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult)) {
// Fall back to parsing as atom for short values
aResult.ParseStringOrAtom(aValue);
}

Просмотреть файл

@ -615,7 +615,8 @@ protected:
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
const nsAString* aValue, PRBool aNotify);
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult);