mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 462458. Update @charset detection to spec changes. r+sr=dbaron, a=beltzner
This commit is contained in:
parent
695687d1fe
commit
091edfd4c7
7
layout/reftests/css-charset/pass.html
Normal file
7
layout/reftests/css-charset/pass.html
Normal file
@ -0,0 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body style="color: green">
|
||||
This should be green
|
||||
</body>
|
||||
<html>
|
||||
|
10
layout/reftests/css-charset/reftest.list
Normal file
10
layout/reftests/css-charset/reftest.list
Normal file
@ -0,0 +1,10 @@
|
||||
== test-attribute.html pass.html
|
||||
== test-charset-quotes.html pass.html
|
||||
== test-charset-leading-space.html pass.html
|
||||
== test-charset-trailing-space.html pass.html
|
||||
== test-charset-utf-16-le-no-bom.html pass.html
|
||||
fails == test-charset-utf-16-le-bom.html pass.html
|
||||
== test-charset-utf-16-bom-le.html pass.html
|
||||
== test-charset-utf-16-be-no-bom.html pass.html
|
||||
fails == test-charset-utf-16-be-bom.html pass.html
|
||||
== test-charset-utf-16-bom-be.html pass.html
|
BIN
layout/reftests/css-charset/test-attribute.css
Normal file
BIN
layout/reftests/css-charset/test-attribute.css
Normal file
Binary file not shown.
14
layout/reftests/css-charset/test-attribute.html
Normal file
14
layout/reftests/css-charset/test-attribute.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
body { color: red; }
|
||||
</style>
|
||||
<link rel="stylesheet" type="text/css" charset="UTF-16BE"
|
||||
href="test-attribute.css">
|
||||
</head>
|
||||
<body>
|
||||
This should be green
|
||||
</body>
|
||||
<html>
|
||||
|
BIN
layout/reftests/css-charset/test-charset-leading-space.css
Normal file
BIN
layout/reftests/css-charset/test-charset-leading-space.css
Normal file
Binary file not shown.
14
layout/reftests/css-charset/test-charset-leading-space.html
Normal file
14
layout/reftests/css-charset/test-charset-leading-space.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
body { color: green; }
|
||||
</style>
|
||||
<link rel="stylesheet" type="text/css" charset="us-ascii"
|
||||
href="test-charset-leading-space.css">
|
||||
</head>
|
||||
<body>
|
||||
This should be green
|
||||
</body>
|
||||
<html>
|
||||
|
BIN
layout/reftests/css-charset/test-charset-quotes.css
Normal file
BIN
layout/reftests/css-charset/test-charset-quotes.css
Normal file
Binary file not shown.
14
layout/reftests/css-charset/test-charset-quotes.html
Normal file
14
layout/reftests/css-charset/test-charset-quotes.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
body { color: green; }
|
||||
</style>
|
||||
<link rel="stylesheet" type="text/css" charset="us-ascii"
|
||||
href="test-charset-quotes.css">
|
||||
</head>
|
||||
<body>
|
||||
This should be green
|
||||
</body>
|
||||
<html>
|
||||
|
BIN
layout/reftests/css-charset/test-charset-trailing-space.css
Normal file
BIN
layout/reftests/css-charset/test-charset-trailing-space.css
Normal file
Binary file not shown.
14
layout/reftests/css-charset/test-charset-trailing-space.html
Normal file
14
layout/reftests/css-charset/test-charset-trailing-space.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
body { color: green; }
|
||||
</style>
|
||||
<link rel="stylesheet" type="text/css" charset="us-ascii"
|
||||
href="test-charset-trailing-space.css">
|
||||
</head>
|
||||
<body>
|
||||
This should be green
|
||||
</body>
|
||||
<html>
|
||||
|
BIN
layout/reftests/css-charset/test-charset-utf-16-be-bom.css
Normal file
BIN
layout/reftests/css-charset/test-charset-utf-16-be-bom.css
Normal file
Binary file not shown.
14
layout/reftests/css-charset/test-charset-utf-16-be-bom.html
Normal file
14
layout/reftests/css-charset/test-charset-utf-16-be-bom.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
body { color: green; }
|
||||
</style>
|
||||
<link rel="stylesheet" type="text/css" charset="us-ascii"
|
||||
href="test-charset-utf-16-be-bom.css">
|
||||
</head>
|
||||
<body>
|
||||
This should be green
|
||||
</body>
|
||||
<html>
|
||||
|
BIN
layout/reftests/css-charset/test-charset-utf-16-be-no-bom.css
Normal file
BIN
layout/reftests/css-charset/test-charset-utf-16-be-no-bom.css
Normal file
Binary file not shown.
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
body { color: red; }
|
||||
</style>
|
||||
<link rel="stylesheet" type="text/css" charset="us-ascii"
|
||||
href="test-charset-utf-16-be-no-bom.css">
|
||||
</head>
|
||||
<body>
|
||||
This should be green
|
||||
</body>
|
||||
<html>
|
||||
|
BIN
layout/reftests/css-charset/test-charset-utf-16-bom-be.css
Normal file
BIN
layout/reftests/css-charset/test-charset-utf-16-bom-be.css
Normal file
Binary file not shown.
14
layout/reftests/css-charset/test-charset-utf-16-bom-be.html
Normal file
14
layout/reftests/css-charset/test-charset-utf-16-bom-be.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
body { color: red; }
|
||||
</style>
|
||||
<link rel="stylesheet" type="text/css" charset="us-ascii"
|
||||
href="test-charset-utf-16-bom-be.css">
|
||||
</head>
|
||||
<body>
|
||||
This should be green
|
||||
</body>
|
||||
<html>
|
||||
|
BIN
layout/reftests/css-charset/test-charset-utf-16-bom-le.css
Normal file
BIN
layout/reftests/css-charset/test-charset-utf-16-bom-le.css
Normal file
Binary file not shown.
14
layout/reftests/css-charset/test-charset-utf-16-bom-le.html
Normal file
14
layout/reftests/css-charset/test-charset-utf-16-bom-le.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
body { color: red; }
|
||||
</style>
|
||||
<link rel="stylesheet" type="text/css" charset="us-ascii"
|
||||
href="test-charset-utf-16-bom-le.css">
|
||||
</head>
|
||||
<body>
|
||||
This should be green
|
||||
</body>
|
||||
<html>
|
||||
|
BIN
layout/reftests/css-charset/test-charset-utf-16-le-bom.css
Normal file
BIN
layout/reftests/css-charset/test-charset-utf-16-le-bom.css
Normal file
Binary file not shown.
14
layout/reftests/css-charset/test-charset-utf-16-le-bom.html
Normal file
14
layout/reftests/css-charset/test-charset-utf-16-le-bom.html
Normal file
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
body { color: green; }
|
||||
</style>
|
||||
<link rel="stylesheet" type="text/css" charset="us-ascii"
|
||||
href="test-charset-utf-16-le-bom.css">
|
||||
</head>
|
||||
<body>
|
||||
This should be green
|
||||
</body>
|
||||
<html>
|
||||
|
BIN
layout/reftests/css-charset/test-charset-utf-16-le-no-bom.css
Normal file
BIN
layout/reftests/css-charset/test-charset-utf-16-le-no-bom.css
Normal file
Binary file not shown.
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
body { color: red; }
|
||||
</style>
|
||||
<link rel="stylesheet" type="text/css" charset="us-ascii"
|
||||
href="test-charset-utf-16-le-no-bom.css">
|
||||
</head>
|
||||
<body>
|
||||
This should be green
|
||||
</body>
|
||||
<html>
|
||||
|
@ -35,6 +35,9 @@ include canvas/reftest.list
|
||||
# css @import tests
|
||||
include css-import/reftest.list
|
||||
|
||||
# css character encoding tests
|
||||
include css-charset/reftest.list
|
||||
|
||||
# columns/
|
||||
include columns/reftest.list
|
||||
|
||||
|
@ -445,7 +445,7 @@ CSSLoaderImpl::RecycleParser(nsICSSParser* aParser)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static const char kCharsetSym[] = "@charset";
|
||||
static const char kCharsetSym[] = "@charset \"";
|
||||
|
||||
static nsresult GetCharsetFromData(const unsigned char* aStyleSheetData,
|
||||
PRUint32 aDataLength,
|
||||
@ -576,25 +576,9 @@ static nsresult GetCharsetFromData(const unsigned char* aStyleSheetData,
|
||||
pos += step;
|
||||
}
|
||||
|
||||
while (pos < aDataLength && nsCRT::IsAsciiSpace(aStyleSheetData[pos])) {
|
||||
pos += step;
|
||||
}
|
||||
|
||||
if (pos >= aDataLength ||
|
||||
(aStyleSheetData[pos] != '"' && aStyleSheetData[pos] != '\'')) {
|
||||
return aCharset.IsEmpty() ? NS_ERROR_NOT_AVAILABLE : NS_OK;
|
||||
}
|
||||
|
||||
char quote = aStyleSheetData[pos];
|
||||
pos += step;
|
||||
nsCAutoString charset;
|
||||
while (pos < aDataLength) {
|
||||
if (aStyleSheetData[pos] == '\\') {
|
||||
pos += step;
|
||||
if (pos >= aDataLength) {
|
||||
break;
|
||||
}
|
||||
} else if (aStyleSheetData[pos] == quote) {
|
||||
if (aStyleSheetData[pos] == '"') {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -605,10 +589,6 @@ static nsresult GetCharsetFromData(const unsigned char* aStyleSheetData,
|
||||
|
||||
// Check for the ending ';'
|
||||
pos += step;
|
||||
while (pos < aDataLength && nsCRT::IsAsciiSpace(aStyleSheetData[pos])) {
|
||||
pos += step;
|
||||
}
|
||||
|
||||
if (pos >= aDataLength || aStyleSheetData[pos] != ';') {
|
||||
return aCharset.IsEmpty() ? NS_ERROR_NOT_AVAILABLE : NS_OK;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user