зеркало из https://github.com/mozilla/pjs.git
Implement the HTML5 algorithm for parsing a legacy color value: reject 'transparent'. (Bug 227072) r=sicking
This commit is contained in:
Родитель
f7ae1bd614
Коммит
ed30e7c049
|
@ -1170,9 +1170,12 @@ nsAttrValue::ParseColor(const nsAString& aString, nsIDocument* aDocument)
|
|||
|
||||
// In compatibility mode, try LooseHexToRGB as a fallback for either
|
||||
// of the above two possibilities.
|
||||
NS_LooseHexToRGB(colorStr, &color);
|
||||
SetColorValue(color, aString);
|
||||
return PR_TRUE;
|
||||
if (NS_LooseHexToRGB(colorStr, &color)) {
|
||||
SetColorValue(color, aString);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool nsAttrValue::ParseFloatValue(const nsAString& aString)
|
||||
|
|
|
@ -274,7 +274,8 @@ public:
|
|||
PRBool ParsePositiveIntValue(const nsAString& aString);
|
||||
|
||||
/**
|
||||
* Parse a string into a color.
|
||||
* Parse a string into a color. This implements what HTML5 calls the
|
||||
* "rules for parsing a legacy color value".
|
||||
*
|
||||
* @param aString the string to parse
|
||||
* @param aDocument the document (to find out whether we're in quirks mode)
|
||||
|
|
|
@ -168,6 +168,10 @@ NS_GFX_(PRBool) NS_HexToRGB(const nsString& aColorSpec,
|
|||
// compatible with legacy Nav behavior
|
||||
NS_GFX_(PRBool) NS_LooseHexToRGB(const nsString& aColorSpec, nscolor* aResult)
|
||||
{
|
||||
if (aColorSpec.EqualsLiteral("transparent")) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
int nameLen = aColorSpec.Length();
|
||||
const PRUnichar* colorSpec = aColorSpec.get();
|
||||
if ('#' == colorSpec[0]) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче