зеркало из https://github.com/mozilla/pjs.git
Remove remaining support for proportional length values (unused). b=341683 r+sr=dbaron r=sicking a=mtschrep
This commit is contained in:
Родитель
182de20d10
Коммит
563a1409f4
|
@ -340,14 +340,6 @@ nsAttrValue::ToString(nsAString& aResult) const
|
|||
|
||||
break;
|
||||
}
|
||||
case eProportional:
|
||||
{
|
||||
nsAutoString intStr;
|
||||
intStr.AppendInt(GetIntInternal());
|
||||
aResult = intStr + NS_LITERAL_STRING("*");
|
||||
|
||||
break;
|
||||
}
|
||||
case eEnum:
|
||||
{
|
||||
PRInt16 val = GetEnumValue();
|
||||
|
@ -865,8 +857,7 @@ nsAttrValue::ParseEnumValue(const nsAString& aValue,
|
|||
|
||||
PRBool
|
||||
nsAttrValue::ParseSpecialIntValue(const nsAString& aString,
|
||||
PRBool aCanBePercent,
|
||||
PRBool aCanBeProportional)
|
||||
PRBool aCanBePercent)
|
||||
{
|
||||
ResetIfSet();
|
||||
|
||||
|
@ -875,17 +866,6 @@ nsAttrValue::ParseSpecialIntValue(const nsAString& aString,
|
|||
PRInt32 val = tmp.ToInteger(&ec);
|
||||
|
||||
if (NS_FAILED(ec)) {
|
||||
if (aCanBeProportional) {
|
||||
// Even if the integer could not be parsed, it might just be "*"
|
||||
tmp.CompressWhitespace(PR_TRUE, PR_TRUE);
|
||||
if (tmp.Length() == 1 && tmp.Last() == '*') {
|
||||
// special case: HTML spec says a value '*' == '1*'
|
||||
// see http://www.w3.org/TR/html4/types.html#type-multi-length
|
||||
// bug 29061
|
||||
SetIntValueAndType(1, eProportional);
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
@ -902,13 +882,6 @@ nsAttrValue::ParseSpecialIntValue(const nsAString& aString,
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// * (proportional)
|
||||
// XXX RFindChar means that 5*x will be parsed!
|
||||
if (aCanBeProportional && tmp.RFindChar('*') >= 0) {
|
||||
SetIntValueAndType(val, eProportional);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// Straight number is interpreted as integer
|
||||
SetIntValueAndType(val, eInteger);
|
||||
return PR_TRUE;
|
||||
|
|
|
@ -64,7 +64,7 @@ template<class E> class nsTPtrArray;
|
|||
#define NS_ATTRVALUE_BASETYPE_MASK (PtrBits(3))
|
||||
#define NS_ATTRVALUE_POINTERVALUE_MASK (~NS_ATTRVALUE_BASETYPE_MASK)
|
||||
|
||||
#define NS_ATTRVALUE_INTEGERTYPE_BITS 5
|
||||
#define NS_ATTRVALUE_INTEGERTYPE_BITS 4
|
||||
#define NS_ATTRVALUE_INTEGERTYPE_MASK (PtrBits((1 << NS_ATTRVALUE_INTEGERTYPE_BITS) - 1))
|
||||
#define NS_ATTRVALUE_INTEGERTYPE_MULTIPLIER (1 << NS_ATTRVALUE_INTEGERTYPE_BITS)
|
||||
#define NS_ATTRVALUE_INTEGERTYPE_MAXVALUE ((1 << (31 - NS_ATTRVALUE_INTEGERTYPE_BITS)) - 1)
|
||||
|
@ -103,20 +103,19 @@ public:
|
|||
|
||||
// This has to be the same as in ValueBaseType
|
||||
enum ValueType {
|
||||
eString = 0x00, // 00
|
||||
// 01 this value indicates an 'misc' struct
|
||||
eAtom = 0x02, // 10
|
||||
eInteger = 0x03, // 00011
|
||||
eColor = 0x07, // 00111
|
||||
eProportional = 0x0B, // 01011
|
||||
eEnum = 0x0F, // 01111 This should eventually die
|
||||
ePercent = 0x13, // 10011
|
||||
eString = 0x00, // 00
|
||||
// 01 this value indicates an 'misc' struct
|
||||
eAtom = 0x02, // 10
|
||||
eInteger = 0x03, // 0011
|
||||
eColor = 0x07, // 0111
|
||||
eEnum = 0x0B, // 1011 This should eventually die
|
||||
ePercent = 0x0F, // 1111
|
||||
// Values below here won't matter, they'll be stored in the 'misc' struct
|
||||
// anyway
|
||||
eCSSStyleRule = 0x14,
|
||||
eAtomArray = 0x15
|
||||
eCSSStyleRule = 0x10,
|
||||
eAtomArray = 0x11
|
||||
#ifdef MOZ_SVG
|
||||
,eSVGValue = 0x16
|
||||
,eSVGValue = 0x12
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -143,7 +142,6 @@ public:
|
|||
inline nsIAtom* GetAtomValue() const;
|
||||
inline PRInt32 GetIntegerValue() const;
|
||||
PRBool GetColorValue(nscolor& aColor) const;
|
||||
inline PRInt32 GetProportionalValue() const;
|
||||
inline PRInt16 GetEnumValue() const;
|
||||
inline float GetPercentValue() const;
|
||||
inline nsCOMArray<nsIAtom>* GetAtomArrayValue() const;
|
||||
|
@ -205,18 +203,16 @@ public:
|
|||
PRBool aCaseSensitive = PR_FALSE);
|
||||
|
||||
/**
|
||||
* Parse a string into an integer. Can optionally parse percent (n%) and
|
||||
* proportional (n*). This method explicitly sets a lower bound of zero on
|
||||
* the element, whether it be proportional or percent or raw integer.
|
||||
* Parse a string into an integer. Can optionally parse percent (n%).
|
||||
* This method explicitly sets a lower bound of zero on the element,
|
||||
* whether it be percent or raw integer.
|
||||
*
|
||||
* @param aString the string to parse
|
||||
* @param aCanBePercent PR_TRUE if it can be a percent value (%)
|
||||
* @param aCanBeProportional PR_TRUE if it can be a proportional value (*)
|
||||
* @return whether the value could be parsed
|
||||
*/
|
||||
PRBool ParseSpecialIntValue(const nsAString& aString,
|
||||
PRBool aCanBePercent,
|
||||
PRBool aCanBeProportional);
|
||||
PRBool aCanBePercent);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -308,13 +304,6 @@ nsAttrValue::GetIntegerValue() const
|
|||
return GetIntInternal();
|
||||
}
|
||||
|
||||
inline PRInt32
|
||||
nsAttrValue::GetProportionalValue() const
|
||||
{
|
||||
NS_PRECONDITION(Type() == eProportional, "wrong type");
|
||||
return GetIntInternal();
|
||||
}
|
||||
|
||||
inline PRInt16
|
||||
nsAttrValue::GetEnumValue() const
|
||||
{
|
||||
|
|
|
@ -1819,7 +1819,7 @@ nsGenericHTMLElement::ParseImageAttribute(nsIAtom* aAttribute,
|
|||
{
|
||||
if ((aAttribute == nsGkAtoms::width) ||
|
||||
(aAttribute == nsGkAtoms::height)) {
|
||||
return aResult.ParseSpecialIntValue(aString, PR_TRUE, PR_FALSE);
|
||||
return aResult.ParseSpecialIntValue(aString, PR_TRUE);
|
||||
}
|
||||
else if ((aAttribute == nsGkAtoms::hspace) ||
|
||||
(aAttribute == nsGkAtoms::vspace) ||
|
||||
|
|
|
@ -74,7 +74,7 @@ nsHTMLDivElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
if (mNodeInfo->Equals(nsGkAtoms::marquee)) {
|
||||
if ((aAttribute == nsGkAtoms::width) ||
|
||||
(aAttribute == nsGkAtoms::height)) {
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::bgcolor) {
|
||||
return aResult.ParseColor(aValue, GetOwnerDoc());
|
||||
|
|
|
@ -91,10 +91,10 @@ nsHTMLFrameElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
return ParseFrameborderValue(aValue, aResult);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::marginwidth) {
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::marginheight) {
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::scrolling) {
|
||||
return ParseScrollingValue(aValue, aResult);
|
||||
|
|
|
@ -129,7 +129,7 @@ nsHTMLHRElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
{
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aAttribute == nsGkAtoms::width) {
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::size) {
|
||||
return aResult.ParseIntWithBounds(aValue, 1, 1000);
|
||||
|
|
|
@ -89,16 +89,16 @@ nsHTMLIFrameElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
{
|
||||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aAttribute == nsGkAtoms::marginwidth) {
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::marginheight) {
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::width) {
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::height) {
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::frameborder) {
|
||||
return ParseFrameborderValue(aValue, aResult);
|
||||
|
|
|
@ -2012,10 +2012,10 @@ nsHTMLInputElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
return success;
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::width) {
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::height) {
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::maxlength) {
|
||||
return aResult.ParseIntWithBounds(aValue, 0);
|
||||
|
|
|
@ -207,7 +207,7 @@ nsHTMLSharedElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
}
|
||||
if (aAttribute == nsGkAtoms::width ||
|
||||
aAttribute == nsGkAtoms::height) {
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
}
|
||||
else if (mNodeInfo->Equals(nsGkAtoms::dir) ||
|
||||
|
|
|
@ -303,10 +303,10 @@ nsHTMLTableCellElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
return res;
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::height) {
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::width) {
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::align) {
|
||||
return ParseTableCellHAlignValue(aValue, aResult);
|
||||
|
|
|
@ -124,14 +124,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, PR_FALSE);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
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, PR_FALSE);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::align) {
|
||||
return ParseTableCellHAlignValue(aValue, aResult);
|
||||
|
|
|
@ -926,7 +926,7 @@ nsHTMLTableElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
if (aNamespaceID == kNameSpaceID_None) {
|
||||
if (aAttribute == nsGkAtoms::cellspacing ||
|
||||
aAttribute == nsGkAtoms::cellpadding) {
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::cols) {
|
||||
return aResult.ParseIntWithBounds(aValue, 0);
|
||||
|
@ -940,10 +940,10 @@ nsHTMLTableElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
return PR_TRUE;
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::height) {
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::width) {
|
||||
if (aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE)) {
|
||||
if (aResult.ParseSpecialIntValue(aValue, PR_TRUE)) {
|
||||
// treat 0 width as auto
|
||||
nsAttrValue::ValueType type = aResult.Type();
|
||||
if ((type == nsAttrValue::eInteger &&
|
||||
|
|
|
@ -375,10 +375,10 @@ nsHTMLTableRowElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
return aResult.ParseIntWithBounds(aValue, 0);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::height) {
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::width) {
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::align) {
|
||||
return ParseTableCellHAlignValue(aValue, aResult);
|
||||
|
|
|
@ -248,7 +248,7 @@ nsHTMLTableSectionElement::ParseAttribute(PRInt32 aNamespaceID,
|
|||
return aResult.ParseIntWithBounds(aValue, 0);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::height) {
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
|
||||
return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
|
||||
}
|
||||
if (aAttribute == nsGkAtoms::align) {
|
||||
return ParseTableCellHAlignValue(aValue, aResult);
|
||||
|
|
Загрузка…
Ссылка в новой задаче