Bug 623589 - Remove aCanBePercent parameter from nsAttrValue::ParseSpecialIntValue; r=peterv a=jst

--HG--
extra : rebase_source : 0347c1a1540267d64c09d27577f1c66c78d430c7
This commit is contained in:
Ms2ger 2011-02-04 14:46:16 -05:00
parent 1976742cd2
commit 5e3f85aa9c
14 changed files with 26 additions and 29 deletions

View File

@ -1054,8 +1054,7 @@ nsAttrValue::ParseEnumValue(const nsAString& aValue,
}
PRBool
nsAttrValue::ParseSpecialIntValue(const nsAString& aString,
PRBool aCanBePercent)
nsAttrValue::ParseSpecialIntValue(const nsAString& aString)
{
ResetIfSet();
@ -1063,7 +1062,7 @@ nsAttrValue::ParseSpecialIntValue(const nsAString& aString,
PRBool strict;
PRBool isPercent = PR_FALSE;
nsAutoString tmp(aString);
PRInt32 originalVal = StringToInteger(aString, &strict, &ec, aCanBePercent, &isPercent);
PRInt32 originalVal = StringToInteger(aString, &strict, &ec, PR_TRUE, &isPercent);
if (NS_FAILED(ec)) {
return PR_FALSE;
@ -1072,7 +1071,7 @@ nsAttrValue::ParseSpecialIntValue(const nsAString& aString,
PRInt32 val = NS_MAX(originalVal, 0);
// % (percent)
if (aCanBePercent && (isPercent || tmp.RFindChar('%') >= 0)) {
if (isPercent || tmp.RFindChar('%') >= 0) {
isPercent = PR_TRUE;
}

View File

@ -229,13 +229,11 @@ public:
* whether it be percent or raw integer.
*
* @param aString the string to parse
* @param aCanBePercent PR_TRUE if it can be a percent value (%)
* @return whether the value could be parsed
*
* @see http://www.whatwg.org/html/#rules-for-parsing-dimension-values
*/
PRBool ParseSpecialIntValue(const nsAString& aString,
PRBool aCanBePercent);
PRBool ParseSpecialIntValue(const nsAString& aString);
/**

View File

@ -1616,7 +1616,7 @@ nsGenericHTMLElement::ParseImageAttribute(nsIAtom* aAttribute,
{
if ((aAttribute == nsGkAtoms::width) ||
(aAttribute == nsGkAtoms::height)) {
return aResult.ParseSpecialIntValue(aString, PR_TRUE);
return aResult.ParseSpecialIntValue(aString);
}
else if ((aAttribute == nsGkAtoms::hspace) ||
(aAttribute == nsGkAtoms::vspace) ||

View File

@ -116,7 +116,7 @@ nsHTMLDivElement::ParseAttribute(PRInt32 aNamespaceID,
if (mNodeInfo->Equals(nsGkAtoms::marquee)) {
if ((aAttribute == nsGkAtoms::width) ||
(aAttribute == nsGkAtoms::height)) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::bgcolor) {
return aResult.ParseColor(aValue);

View File

@ -139,10 +139,10 @@ nsHTMLFrameElement::ParseAttribute(PRInt32 aNamespaceID,
return ParseFrameborderValue(aValue, aResult);
}
if (aAttribute == nsGkAtoms::marginwidth) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::marginheight) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::scrolling) {
return ParseScrollingValue(aValue, aResult);

View File

@ -134,7 +134,7 @@ nsHTMLHRElement::ParseAttribute(PRInt32 aNamespaceID,
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::width) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::size) {
return aResult.ParseIntWithBounds(aValue, 1, 1000);

View File

@ -162,16 +162,16 @@ nsHTMLIFrameElement::ParseAttribute(PRInt32 aNamespaceID,
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::marginwidth) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::marginheight) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::width) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::height) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::frameborder) {
return ParseFrameborderValue(aValue, aResult);

View File

@ -2698,10 +2698,10 @@ nsHTMLInputElement::ParseAttribute(PRInt32 aNamespaceID,
return success;
}
if (aAttribute == nsGkAtoms::width) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::height) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::maxlength) {
return aResult.ParseNonNegativeIntValue(aValue);

View File

@ -305,10 +305,10 @@ nsHTMLTableCellElement::ParseAttribute(PRInt32 aNamespaceID,
return res;
}
if (aAttribute == nsGkAtoms::height) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::width) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::align) {
return ParseTableCellHAlignValue(aValue, aResult);

View File

@ -128,14 +128,14 @@ nsHTMLTableColElement::ParseAttribute(PRInt32 aNamespaceID,
if (aNamespaceID == kNameSpaceID_None) {
/* ignore these attributes, stored simply as strings ch */
if (aAttribute == nsGkAtoms::charoff) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::span) {
/* protection from unrealistic large colspan values */
return aResult.ParseIntWithBounds(aValue, 1, MAX_COLSPAN);
}
if (aAttribute == nsGkAtoms::width) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::align) {
return ParseTableCellHAlignValue(aValue, aResult);

View File

@ -983,7 +983,7 @@ nsHTMLTableElement::ParseAttribute(PRInt32 aNamespaceID,
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::cellspacing ||
aAttribute == nsGkAtoms::cellpadding) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::cols) {
return aResult.ParseIntWithBounds(aValue, 0);
@ -997,10 +997,10 @@ nsHTMLTableElement::ParseAttribute(PRInt32 aNamespaceID,
return PR_TRUE;
}
if (aAttribute == nsGkAtoms::height) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::width) {
if (aResult.ParseSpecialIntValue(aValue, PR_TRUE)) {
if (aResult.ParseSpecialIntValue(aValue)) {
// treat 0 width as auto
nsAttrValue::ValueType type = aResult.Type();
if ((type == nsAttrValue::eInteger &&

View File

@ -383,10 +383,10 @@ nsHTMLTableRowElement::ParseAttribute(PRInt32 aNamespaceID,
return aResult.ParseIntWithBounds(aValue, 0);
}
if (aAttribute == nsGkAtoms::height) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::width) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::align) {
return ParseTableCellHAlignValue(aValue, aResult);

View File

@ -252,7 +252,7 @@ nsHTMLTableSectionElement::ParseAttribute(PRInt32 aNamespaceID,
return aResult.ParseIntWithBounds(aValue, 0);
}
if (aAttribute == nsGkAtoms::height) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
return aResult.ParseSpecialIntValue(aValue);
}
if (aAttribute == nsGkAtoms::align) {
return ParseTableCellHAlignValue(aValue, aResult);

View File

@ -124,7 +124,7 @@ nsHTMLVideoElement::ParseAttribute(PRInt32 aNamespaceID,
nsAttrValue& aResult)
{
if (aAttribute == nsGkAtoms::width || aAttribute == nsGkAtoms::height) {
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
return aResult.ParseSpecialIntValue(aValue);
}
return nsHTMLMediaElement::ParseAttribute(aNamespaceID, aAttribute, aValue,