зеркало из https://github.com/mozilla/gecko-dev.git
Fix for bug 21122. Don't capitalize the value of the type attribute of list elements for cases in which the case is significant. Fix for bug 20677. Temporary fix that ensures that SetDocument calls percolate down the entire subtree. a=dagley r=nisheeth
This commit is contained in:
Родитель
d8c5f3cd3f
Коммит
9e76aeb0ba
|
@ -449,33 +449,37 @@ nsGenericHTMLElement::InNavQuirksMode() const
|
|||
nsresult
|
||||
nsGenericHTMLElement::SetDocument(nsIDocument* aDocument, PRBool aDeep)
|
||||
{
|
||||
PRBool doNothing = PR_FALSE;
|
||||
if (aDocument == mDocument) {
|
||||
return NS_OK; // short circuit useless work
|
||||
doNothing = PR_TRUE; // short circuit useless work
|
||||
}
|
||||
|
||||
nsresult result = nsGenericElement::SetDocument(aDocument, aDeep);
|
||||
|
||||
if (NS_OK != result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
nsIHTMLContent* htmlContent;
|
||||
if (!doNothing) {
|
||||
nsIHTMLContent* htmlContent;
|
||||
|
||||
result = mContent->QueryInterface(kIHTMLContentIID, (void **)&htmlContent);
|
||||
if (NS_OK != result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if ((nsnull != mDocument) && (nsnull != mAttributes)) {
|
||||
ReparseStyleAttribute();
|
||||
nsIHTMLStyleSheet* sheet = GetAttrStyleSheet(mDocument);
|
||||
if (nsnull != sheet) {
|
||||
mAttributes->SetStyleSheet(sheet);
|
||||
// sheet->SetAttributesFor(htmlContent, mAttributes); // sync attributes with sheet
|
||||
NS_RELEASE(sheet);
|
||||
result = mContent->QueryInterface(kIHTMLContentIID, (void **)&htmlContent);
|
||||
if (NS_OK != result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if ((nsnull != mDocument) && (nsnull != mAttributes)) {
|
||||
ReparseStyleAttribute();
|
||||
nsIHTMLStyleSheet* sheet = GetAttrStyleSheet(mDocument);
|
||||
if (nsnull != sheet) {
|
||||
mAttributes->SetStyleSheet(sheet);
|
||||
// sheet->SetAttributesFor(htmlContent, mAttributes); // sync attributes with sheet
|
||||
NS_RELEASE(sheet);
|
||||
}
|
||||
}
|
||||
|
||||
NS_RELEASE(htmlContent);
|
||||
}
|
||||
|
||||
NS_RELEASE(htmlContent);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1340,7 +1344,8 @@ nsGenericHTMLElement::ParseCaseSensitiveEnumValue(const nsString& aValue,
|
|||
PRBool
|
||||
nsGenericHTMLElement::EnumValueToString(const nsHTMLValue& aValue,
|
||||
EnumTable* aTable,
|
||||
nsString& aResult)
|
||||
nsString& aResult,
|
||||
PRBool aFoldCase)
|
||||
{
|
||||
aResult.Truncate(0);
|
||||
if (aValue.GetUnit() == eHTMLUnit_Enumerated) {
|
||||
|
@ -1348,7 +1353,9 @@ nsGenericHTMLElement::EnumValueToString(const nsHTMLValue& aValue,
|
|||
while (nsnull != aTable->tag) {
|
||||
if (aTable->value == v) {
|
||||
aResult.Append(aTable->tag);
|
||||
aResult.SetCharAt(nsCRT::ToUpper(aResult[0]), 0);
|
||||
if (aFoldCase) {
|
||||
aResult.SetCharAt(nsCRT::ToUpper(aResult[0]), 0);
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
aTable++;
|
||||
|
|
|
@ -159,7 +159,8 @@ public:
|
|||
|
||||
static PRBool EnumValueToString(const nsHTMLValue& aValue,
|
||||
EnumTable* aTable,
|
||||
nsString& aResult);
|
||||
nsString& aResult,
|
||||
PRBool aFoldCase=PR_TRUE);
|
||||
|
||||
static PRBool ParseValueOrPercent(const nsString& aString,
|
||||
nsHTMLValue& aResult,
|
||||
|
|
|
@ -172,8 +172,17 @@ nsHTMLLIElement::AttributeToString(nsIAtom* aAttribute,
|
|||
nsString& aResult) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::type) {
|
||||
nsGenericHTMLElement::EnumValueToString(aValue, kListItemTypeTable,
|
||||
aResult);
|
||||
PRInt32 v = aValue.GetIntValue();
|
||||
switch (v) {
|
||||
case NS_STYLE_LIST_STYLE_OLD_LOWER_ALPHA:
|
||||
case NS_STYLE_LIST_STYLE_OLD_LOWER_ROMAN:
|
||||
nsGenericHTMLElement::EnumValueToString(aValue, kListItemTypeTable,
|
||||
aResult, PR_FALSE);
|
||||
break;
|
||||
default:
|
||||
nsGenericHTMLElement::EnumValueToString(aValue, kListItemTypeTable,
|
||||
aResult, PR_TRUE);
|
||||
}
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
return mInner.AttributeToString(aAttribute, aValue, aResult);
|
||||
|
|
|
@ -196,7 +196,7 @@ nsHTMLOListElement::AttributeToString(nsIAtom* aAttribute,
|
|||
case NS_STYLE_LIST_STYLE_OLD_LOWER_ALPHA:
|
||||
case NS_STYLE_LIST_STYLE_OLD_UPPER_ALPHA:
|
||||
nsGenericHTMLElement::EnumValueToString(aValue, kOldListTypeTable,
|
||||
aResult);
|
||||
aResult, PR_FALSE);
|
||||
break;
|
||||
default:
|
||||
nsGenericHTMLElement::EnumValueToString(aValue, kListTypeTable,
|
||||
|
|
|
@ -172,7 +172,7 @@ nsHTMLUListElement::AttributeToString(nsIAtom* aAttribute,
|
|||
case NS_STYLE_LIST_STYLE_OLD_LOWER_ALPHA:
|
||||
case NS_STYLE_LIST_STYLE_OLD_UPPER_ALPHA:
|
||||
nsGenericHTMLElement::EnumValueToString(aValue, kOldListTypeTable,
|
||||
aResult);
|
||||
aResult, PR_FALSE);
|
||||
break;
|
||||
default:
|
||||
nsGenericHTMLElement::EnumValueToString(aValue, kListTypeTable,
|
||||
|
|
|
@ -449,33 +449,37 @@ nsGenericHTMLElement::InNavQuirksMode() const
|
|||
nsresult
|
||||
nsGenericHTMLElement::SetDocument(nsIDocument* aDocument, PRBool aDeep)
|
||||
{
|
||||
PRBool doNothing = PR_FALSE;
|
||||
if (aDocument == mDocument) {
|
||||
return NS_OK; // short circuit useless work
|
||||
doNothing = PR_TRUE; // short circuit useless work
|
||||
}
|
||||
|
||||
nsresult result = nsGenericElement::SetDocument(aDocument, aDeep);
|
||||
|
||||
if (NS_OK != result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
nsIHTMLContent* htmlContent;
|
||||
if (!doNothing) {
|
||||
nsIHTMLContent* htmlContent;
|
||||
|
||||
result = mContent->QueryInterface(kIHTMLContentIID, (void **)&htmlContent);
|
||||
if (NS_OK != result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if ((nsnull != mDocument) && (nsnull != mAttributes)) {
|
||||
ReparseStyleAttribute();
|
||||
nsIHTMLStyleSheet* sheet = GetAttrStyleSheet(mDocument);
|
||||
if (nsnull != sheet) {
|
||||
mAttributes->SetStyleSheet(sheet);
|
||||
// sheet->SetAttributesFor(htmlContent, mAttributes); // sync attributes with sheet
|
||||
NS_RELEASE(sheet);
|
||||
result = mContent->QueryInterface(kIHTMLContentIID, (void **)&htmlContent);
|
||||
if (NS_OK != result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if ((nsnull != mDocument) && (nsnull != mAttributes)) {
|
||||
ReparseStyleAttribute();
|
||||
nsIHTMLStyleSheet* sheet = GetAttrStyleSheet(mDocument);
|
||||
if (nsnull != sheet) {
|
||||
mAttributes->SetStyleSheet(sheet);
|
||||
// sheet->SetAttributesFor(htmlContent, mAttributes); // sync attributes with sheet
|
||||
NS_RELEASE(sheet);
|
||||
}
|
||||
}
|
||||
|
||||
NS_RELEASE(htmlContent);
|
||||
}
|
||||
|
||||
NS_RELEASE(htmlContent);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1340,7 +1344,8 @@ nsGenericHTMLElement::ParseCaseSensitiveEnumValue(const nsString& aValue,
|
|||
PRBool
|
||||
nsGenericHTMLElement::EnumValueToString(const nsHTMLValue& aValue,
|
||||
EnumTable* aTable,
|
||||
nsString& aResult)
|
||||
nsString& aResult,
|
||||
PRBool aFoldCase)
|
||||
{
|
||||
aResult.Truncate(0);
|
||||
if (aValue.GetUnit() == eHTMLUnit_Enumerated) {
|
||||
|
@ -1348,7 +1353,9 @@ nsGenericHTMLElement::EnumValueToString(const nsHTMLValue& aValue,
|
|||
while (nsnull != aTable->tag) {
|
||||
if (aTable->value == v) {
|
||||
aResult.Append(aTable->tag);
|
||||
aResult.SetCharAt(nsCRT::ToUpper(aResult[0]), 0);
|
||||
if (aFoldCase) {
|
||||
aResult.SetCharAt(nsCRT::ToUpper(aResult[0]), 0);
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
aTable++;
|
||||
|
|
|
@ -159,7 +159,8 @@ public:
|
|||
|
||||
static PRBool EnumValueToString(const nsHTMLValue& aValue,
|
||||
EnumTable* aTable,
|
||||
nsString& aResult);
|
||||
nsString& aResult,
|
||||
PRBool aFoldCase=PR_TRUE);
|
||||
|
||||
static PRBool ParseValueOrPercent(const nsString& aString,
|
||||
nsHTMLValue& aResult,
|
||||
|
|
|
@ -172,8 +172,17 @@ nsHTMLLIElement::AttributeToString(nsIAtom* aAttribute,
|
|||
nsString& aResult) const
|
||||
{
|
||||
if (aAttribute == nsHTMLAtoms::type) {
|
||||
nsGenericHTMLElement::EnumValueToString(aValue, kListItemTypeTable,
|
||||
aResult);
|
||||
PRInt32 v = aValue.GetIntValue();
|
||||
switch (v) {
|
||||
case NS_STYLE_LIST_STYLE_OLD_LOWER_ALPHA:
|
||||
case NS_STYLE_LIST_STYLE_OLD_LOWER_ROMAN:
|
||||
nsGenericHTMLElement::EnumValueToString(aValue, kListItemTypeTable,
|
||||
aResult, PR_FALSE);
|
||||
break;
|
||||
default:
|
||||
nsGenericHTMLElement::EnumValueToString(aValue, kListItemTypeTable,
|
||||
aResult, PR_TRUE);
|
||||
}
|
||||
return NS_CONTENT_ATTR_HAS_VALUE;
|
||||
}
|
||||
return mInner.AttributeToString(aAttribute, aValue, aResult);
|
||||
|
|
|
@ -196,7 +196,7 @@ nsHTMLOListElement::AttributeToString(nsIAtom* aAttribute,
|
|||
case NS_STYLE_LIST_STYLE_OLD_LOWER_ALPHA:
|
||||
case NS_STYLE_LIST_STYLE_OLD_UPPER_ALPHA:
|
||||
nsGenericHTMLElement::EnumValueToString(aValue, kOldListTypeTable,
|
||||
aResult);
|
||||
aResult, PR_FALSE);
|
||||
break;
|
||||
default:
|
||||
nsGenericHTMLElement::EnumValueToString(aValue, kListTypeTable,
|
||||
|
|
|
@ -172,7 +172,7 @@ nsHTMLUListElement::AttributeToString(nsIAtom* aAttribute,
|
|||
case NS_STYLE_LIST_STYLE_OLD_LOWER_ALPHA:
|
||||
case NS_STYLE_LIST_STYLE_OLD_UPPER_ALPHA:
|
||||
nsGenericHTMLElement::EnumValueToString(aValue, kOldListTypeTable,
|
||||
aResult);
|
||||
aResult, PR_FALSE);
|
||||
break;
|
||||
default:
|
||||
nsGenericHTMLElement::EnumValueToString(aValue, kListTypeTable,
|
||||
|
|
Загрузка…
Ссылка в новой задаче