Remember: always remove mapped attributes from hashtable before modifying them.

Fix bug 13589
This commit is contained in:
peterl%netscape.com 1999-09-23 03:54:12 +00:00
Родитель f15fddd967
Коммит 7b9a8f64d4
2 изменённых файлов: 40 добавлений и 76 удалений

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

@ -1137,28 +1137,19 @@ HTMLAttributesImpl::SetAttributeFor(nsIAtom* aAttrName, const nsString& aValue,
PRBool haveAttr;
result = SetAttributeName(aAttrName, haveAttr);
if (NS_SUCCEEDED(result)) {
if (haveAttr) {
HTMLAttribute* attr = nsnull;
if (aMappedToStyle) {
NS_ASSERTION(mMapped, "don't have mapped attributes");
if (mMapped) {
attr = HTMLAttribute::FindHTMLAttribute(aAttrName, &(mMapped->mFirst));
}
}
else {
attr = HTMLAttribute::FindHTMLAttribute(aAttrName, mFirstUnmapped);
}
NS_ASSERTION(attr, "failed to find attribute");
if (attr) {
attr->mValue.SetStringValue(aValue);
if (aMappedToStyle) {
result = EnsureSingleMappedFor(aContent, aSheet, PR_TRUE);
if (mMapped) {
result = mMapped->SetAttribute(aAttrName, aValue);
UniqueMapped(aSheet);
}
}
else {
if (aMappedToStyle) {
result = EnsureSingleMappedFor(aContent, aSheet, PR_TRUE);
if (mMapped) {
result = mMapped->SetAttribute(aAttrName, aValue);
UniqueMapped(aSheet);
if (haveAttr) {
HTMLAttribute* attr = HTMLAttribute::FindHTMLAttribute(aAttrName, mFirstUnmapped);
NS_ASSERTION(attr, "failed to find attribute");
if (attr) {
attr->mValue.SetStringValue(aValue);
}
}
else {
@ -1210,28 +1201,19 @@ HTMLAttributesImpl::SetAttributeFor(nsIAtom* aAttrName,
PRBool haveAttr;
result = SetAttributeName(aAttrName, haveAttr);
if (NS_SUCCEEDED(result)) {
if (haveAttr) {
HTMLAttribute* attr = nsnull;
if (aMappedToStyle) {
NS_ASSERTION(mMapped, "don't have mapped attributes");
if (mMapped) {
attr = HTMLAttribute::FindHTMLAttribute(aAttrName, &(mMapped->mFirst));
}
}
else {
attr = HTMLAttribute::FindHTMLAttribute(aAttrName, mFirstUnmapped);
}
NS_ASSERTION(attr, "failed to find attribute");
if (attr) {
attr->mValue = aValue;
if (aMappedToStyle) {
result = EnsureSingleMappedFor(aContent, aSheet, PR_TRUE);
if (mMapped) {
result = mMapped->SetAttribute(aAttrName, aValue);
UniqueMapped(aSheet);
}
}
else {
if (aMappedToStyle) {
result = EnsureSingleMappedFor(aContent, aSheet, PR_TRUE);
if (mMapped) {
result = mMapped->SetAttribute(aAttrName, aValue);
UniqueMapped(aSheet);
if (haveAttr) {
HTMLAttribute* attr = HTMLAttribute::FindHTMLAttribute(aAttrName, mFirstUnmapped);
NS_ASSERTION(attr, "failed to find attribute");
if (attr) {
attr->mValue = aValue;
}
}
else {

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

@ -1137,28 +1137,19 @@ HTMLAttributesImpl::SetAttributeFor(nsIAtom* aAttrName, const nsString& aValue,
PRBool haveAttr;
result = SetAttributeName(aAttrName, haveAttr);
if (NS_SUCCEEDED(result)) {
if (haveAttr) {
HTMLAttribute* attr = nsnull;
if (aMappedToStyle) {
NS_ASSERTION(mMapped, "don't have mapped attributes");
if (mMapped) {
attr = HTMLAttribute::FindHTMLAttribute(aAttrName, &(mMapped->mFirst));
}
}
else {
attr = HTMLAttribute::FindHTMLAttribute(aAttrName, mFirstUnmapped);
}
NS_ASSERTION(attr, "failed to find attribute");
if (attr) {
attr->mValue.SetStringValue(aValue);
if (aMappedToStyle) {
result = EnsureSingleMappedFor(aContent, aSheet, PR_TRUE);
if (mMapped) {
result = mMapped->SetAttribute(aAttrName, aValue);
UniqueMapped(aSheet);
}
}
else {
if (aMappedToStyle) {
result = EnsureSingleMappedFor(aContent, aSheet, PR_TRUE);
if (mMapped) {
result = mMapped->SetAttribute(aAttrName, aValue);
UniqueMapped(aSheet);
if (haveAttr) {
HTMLAttribute* attr = HTMLAttribute::FindHTMLAttribute(aAttrName, mFirstUnmapped);
NS_ASSERTION(attr, "failed to find attribute");
if (attr) {
attr->mValue.SetStringValue(aValue);
}
}
else {
@ -1210,28 +1201,19 @@ HTMLAttributesImpl::SetAttributeFor(nsIAtom* aAttrName,
PRBool haveAttr;
result = SetAttributeName(aAttrName, haveAttr);
if (NS_SUCCEEDED(result)) {
if (haveAttr) {
HTMLAttribute* attr = nsnull;
if (aMappedToStyle) {
NS_ASSERTION(mMapped, "don't have mapped attributes");
if (mMapped) {
attr = HTMLAttribute::FindHTMLAttribute(aAttrName, &(mMapped->mFirst));
}
}
else {
attr = HTMLAttribute::FindHTMLAttribute(aAttrName, mFirstUnmapped);
}
NS_ASSERTION(attr, "failed to find attribute");
if (attr) {
attr->mValue = aValue;
if (aMappedToStyle) {
result = EnsureSingleMappedFor(aContent, aSheet, PR_TRUE);
if (mMapped) {
result = mMapped->SetAttribute(aAttrName, aValue);
UniqueMapped(aSheet);
}
}
else {
if (aMappedToStyle) {
result = EnsureSingleMappedFor(aContent, aSheet, PR_TRUE);
if (mMapped) {
result = mMapped->SetAttribute(aAttrName, aValue);
UniqueMapped(aSheet);
if (haveAttr) {
HTMLAttribute* attr = HTMLAttribute::FindHTMLAttribute(aAttrName, mFirstUnmapped);
NS_ASSERTION(attr, "failed to find attribute");
if (attr) {
attr->mValue = aValue;
}
}
else {