mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-21 17:59:34 +00:00
Implement the HTML5 algorithm for parsing a legacy color value: do loose color parsing in all modes. (Bug 121738) r=sicking
This commit is contained in:
parent
c52c114b11
commit
7d1e9ef96f
@ -1164,12 +1164,7 @@ nsAttrValue::ParseColor(const nsAString& aString, nsIDocument* aDocument)
|
||||
}
|
||||
}
|
||||
|
||||
if (aDocument->GetCompatibilityMode() != eCompatibility_NavQuirks) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// In compatibility mode, try LooseHexToRGB as a fallback for either
|
||||
// of the above two possibilities.
|
||||
// Use NS_LooseHexToRGB as a fallback if nothing above worked.
|
||||
if (NS_LooseHexToRGB(colorStr, &color)) {
|
||||
SetColorValue(color, aString);
|
||||
return PR_TRUE;
|
||||
|
@ -15,7 +15,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=493881
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body id="body">
|
||||
|
||||
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=493881"
|
||||
target="_blank" >Mozilla Bug 493881</a>
|
||||
|
@ -10,7 +10,7 @@ var legacyProps = ["fgColor", "bgColor", "linkColor", "vlinkColor", "alinkColor"
|
||||
var testColors = ["blue", "silver", "green", "orange", "red"];
|
||||
var rgbTestColors = ["rgb(255, 0, 0)", "rgb(192, 192, 192)", "rgb(0, 128, 0)", "rgb(255, 165, 0)", "rgb(255, 0, 0)"];
|
||||
var idPropList = [ {id: "plaintext", prop: "color"},
|
||||
{id: "plaintext", prop: "background-color"},
|
||||
{id: "body", prop: "background-color"},
|
||||
{id: "nonvisitedlink", prop: "color"},
|
||||
{id: "visitedlink", prop: "color"} ];
|
||||
var initialValues = [];
|
||||
@ -58,13 +58,13 @@ addLoadEvent( function() {
|
||||
"Unexpected value of " + legacyProps[i] + " after setting to undefined");
|
||||
}
|
||||
|
||||
// Verify that setting legacy color props to undefined did not affect rendering
|
||||
// (computed styles).
|
||||
// Verify that setting legacy color props to undefined led to result
|
||||
// of parsing undefined as a color.
|
||||
for (i = 0; i < idPropList.length; i++) {
|
||||
var style = window.getComputedStyle(document.getElementById(idPropList[i].id), null);
|
||||
var color = style.getPropertyValue(idPropList[i].prop);
|
||||
is(color, idPropList[i].initialComputedColor,
|
||||
"element's style changed by setting legacy prop to undefined");
|
||||
is(color, "rgb(0, 239, 14)",
|
||||
"element's style should get result of parsing undefined as a color");
|
||||
}
|
||||
|
||||
// Mark the test as finished.
|
||||
|
Loading…
x
Reference in New Issue
Block a user