Make CSS namespace identifiers case sensitive to match change in spec. b=416106 r+sr=bzbarsky a=schrep

This commit is contained in:
dbaron%dbaron.org 2008-02-08 19:57:29 +00:00
Родитель 760c9daab3
Коммит f2d7f53a32
7 изменённых файлов: 125 добавлений и 4 удалений

Просмотреть файл

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Namespace identifiers should be case sensitive (bug 416106)</title>
</head>
<body>
<div style="color: green"><span>This should be green.</span></div>
<div style="color: green"><span>This should be green.</span></div>
<div style="color: green"><span>This should be green.</span></div>
<div style="color: green"><span>This should be green.</span></div>
<div style="color: green"><span>This should be green.</span></div>
<div style="color: green"><span>This should be green.</span></div>
<div>passpasspass</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Namespace identifiers should be case sensitive (bug 416106)</title>
<style type="text/css">
@namespace foo url(http://www.example.com/1);
@namespace Foo url(http://www.example.com/2);
@namespace fOO url(http://www.example.com/3);
foo|one { color: green; }
Foo|two { color: green; }
fOO|three { color: green; }
Foo|one { color: red; }
fOO|one { color: red; }
foo|two { color: red; }
fOO|two { color: red; }
foo|three { color: red; }
Foo|three { color: red; }
div[foo|one] { color: green; }
div[Foo|two] { color: green; }
div[fOO|three] { color: green; }
div[Foo|one] { color: red; }
div[fOO|one] { color: red; }
div[foo|two] { color: red; }
div[fOO|two] { color: red; }
div[foo|three] { color: red; }
div[Foo|three] { color: red; }
div#gencon { color: black; }
div#gencon:before { content: attr(foo|one) attr(Foo|two) attr(fOO|three); }
</style>
</head>
<body xmlns:one="http://www.example.com/1"
xmlns:two="http://www.example.com/2"
xmlns:three="http://www.example.com/3">
<div><one:one>This should be green.</one:one></div>
<div><two:two>This should be green.</two:two></div>
<div><three:three>This should be green.</three:three></div>
<div one:one="true">This should be green.</div>
<div two:two="true">This should be green.</div>
<div three:three="true">This should be green.</div>
<div id="gencon"
one:one="pass" one:two="fail" one:three="fail"
two:one="fail" two:two="pass" two:three="fail"
three:one="fail" three:two="fail" three:three="pass"></div>
</body>
</html>

Просмотреть файл

@ -690,3 +690,4 @@ random == 403134-1.html 403134-1-ref.html # bug 405377
== 413292-1.html 413292-1-ref.html
== 413361-1.html 413361-1-ref.html
== 414123.xhtml 414123-ref.xhtml
== 416106-1.xhtml 416106-1-ref.xhtml

Просмотреть файл

@ -0,0 +1,18 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US">
<head>
<title>Test that counter names are case sensitive (bug 416106)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div>1-5</div>
<div>1-7</div>
<div>1-7</div>
<div>2-7</div>
<div>2-9</div>
<div>2-9</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,26 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US">
<head>
<title>Test that counter names are case sensitive (bug 416106)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
body { counter-reset: foo 0 Foo 5; }
div:before { content: counters(foo, ".") "-" counters(Foo, "."); }
div.a { counter-increment: foo; }
div.b { counter-increment: Foo 2; }
</style>
</head>
<body>
<div class="a"></div>
<div class="b"></div>
<div></div>
<div class="a"></div>
<div class="b"></div>
<div></div>
</body>
</html>

Просмотреть файл

@ -1,3 +1,4 @@
== counter-name-case-sensitive.html counter-name-case-sensitive-ref.html
== t1202-counter-00-b-test.html t1202-counter-00-b-reference.html
== t1202-counter-01-b-test.html t1202-counter-01-b-reference.html
== t1202-counter-02-b-test.html t1202-counter-02-b-reference.html

Просмотреть файл

@ -1617,7 +1617,7 @@ PRBool CSSParserImpl::ParseNameSpaceRule(nsresult& aErrorCode,
if (eCSSToken_Ident == mToken.mType) {
prefix = mToken.mIdent;
ToLowerCase(prefix); // always case insensitive, since stays within CSS
// user-specified identifiers are case-sensitive (bug 416106)
if (! GetToken(aErrorCode, PR_TRUE)) {
REPORT_UNEXPECTED_EOF(PEAtNSURIEOF);
return PR_FALSE;
@ -2176,7 +2176,7 @@ CSSParserImpl::ParseTypeOrUniversalSelector(PRInt32& aDataMask,
aDataMask |= SEL_MASK_NSPACE;
PRInt32 nameSpaceID = kNameSpaceID_Unknown;
if (mNameSpaceMap) {
ToLowerCase(buffer); // always case insensitive, since stays within CSS
// user-specified identifiers are case-sensitive (bug 416106)
nsCOMPtr<nsIAtom> prefix = do_GetAtom(buffer);
nameSpaceID = mNameSpaceMap->FindNameSpaceID(prefix);
} // else, no declared namespaces
@ -2341,7 +2341,7 @@ CSSParserImpl::ParseAttributeSelector(PRInt32& aDataMask,
if (ExpectSymbol(aErrorCode, '|', PR_FALSE)) { // was a namespace
nameSpaceID = kNameSpaceID_Unknown;
if (mNameSpaceMap) {
ToLowerCase(attr); // always case insensitive, since stays within CSS
// user-specified identifiers are case-sensitive (bug 416106)
nsCOMPtr<nsIAtom> prefix = do_GetAtom(attr);
nameSpaceID = mNameSpaceMap->FindNameSpaceID(prefix);
} // else, no declared namespaces
@ -4012,7 +4012,7 @@ PRBool CSSParserImpl::ParseAttr(nsresult& aErrorCode, nsCSSValue& aValue)
if (ExpectSymbol(aErrorCode, '|', PR_FALSE)) { // namespace
PRInt32 nameSpaceID = kNameSpaceID_Unknown;
if (mNameSpaceMap) {
ToLowerCase(holdIdent); // always case insensitive, since stays within CSS
// user-specified identifiers are case-sensitive (bug 416106)
nsCOMPtr<nsIAtom> prefix = do_GetAtom(holdIdent);
nameSpaceID = mNameSpaceMap->FindNameSpaceID(prefix);
} // else, no declared namespaces