diff options
Diffstat (limited to 'layout/reftests/css-parsing')
19 files changed, 469 insertions, 0 deletions
diff --git a/layout/reftests/css-parsing/at-rule-013-ref.html b/layout/reftests/css-parsing/at-rule-013-ref.html new file mode 100644 index 000000000..6574ee5af --- /dev/null +++ b/layout/reftests/css-parsing/at-rule-013-ref.html @@ -0,0 +1,25 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<!-- + from the CSS 2.1 test suite, + http://test.csswg.org/suites/css2.1/20110111/html4/at-rule-013.htm + + See ../css3-namespace/LICENSE . + --> +<html> + <head> + <title>CSS Test: Ignoring at-rules inside @media blocks</title> + <link rel="author" title="L. David Baron" href="https://dbaron.org/"> + <style type="text/css"> + p { + color: green; + background: transparent; + } + </style> + </head> + <body> + <p>This sentence must be green.</p> + <p>This sentence must be green.</p> + <p>This sentence must be green.</p> + <p>This sentence must be green.</p> + </body> +</html> diff --git a/layout/reftests/css-parsing/at-rule-013.html b/layout/reftests/css-parsing/at-rule-013.html new file mode 100644 index 000000000..fa8981f05 --- /dev/null +++ b/layout/reftests/css-parsing/at-rule-013.html @@ -0,0 +1,68 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<!-- + from the CSS 2.1 test suite, + http://test.csswg.org/suites/css2.1/20110111/html4/at-rule-013.htm + + See ../css3-namespace/LICENSE . + --> +<html> + <head> + <title>CSS Test: Ignoring at-rules inside @media blocks</title> + <link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact"> + <link rel="help" href="http://www.w3.org/TR/CSS21/syndata.html#parsing-errors"> + <link rel="help" href="http://www.w3.org/TR/CSS21/media.html#at-media-rule"> + <meta name="flags" content="invalid"> + <meta name="assert" content="At-rules inside @media blocks are ignored up to up to the end of the block that contains the invalid at-keyword, or up to and including the next semicolon (;) or up to and including the next block ({...}), whichever comes first."> + <style type="text/css"> + p { + color: red; + background: red; + } + @media all { + #semicolon { background: transparent; } + @foo ] & | # $ % test-token \ + [; # { background: red; } ] + (; #semicolon { background: red; } } } } ) + '; #semicolon { background: red; } } } }', + "; #semicolon { background: red; }' } } }" + ; + #semicolon { color: green; } + } + @media all { + #block { background: transparent; } + @foo ] & | # $ % test-token \ + [; #block { background: red; } ] + (; #block { background: red; } ) + '; #block { background: red; }', + "; #block { background: red; }'" + {; #block { background: red; } + #block { background: red; } } + #block { color: green; } + } + @media all { + #eob { background: transparent; } + @import "support/import-red.css" + } + #eob { + color: green; + } + @media all { + #eob-complex { background: transparent; } + @import "support/import-red.css" + [; #eob-complex { background: red; } ] + (; #eob-complex { background: red; } ) + '; #eob-complex { background: red; }', + "; #eob-complex { background: red; }'" + } + #eob-complex { + color: green; + } + </style> + </head> + <body> + <p id="semicolon">This sentence must be green.</p> + <p id="block">This sentence must be green.</p> + <p id="eob">This sentence must be green.</p> + <p id="eob-complex">This sentence must be green.</p> + </body> +</html> diff --git a/layout/reftests/css-parsing/at-rule-error-handling-import-1.html b/layout/reftests/css-parsing/at-rule-error-handling-import-1.html new file mode 100644 index 000000000..5dc0acf94 --- /dev/null +++ b/layout/reftests/css-parsing/at-rule-error-handling-import-1.html @@ -0,0 +1,5 @@ +<!DOCTYPE HTML> +<title>Test for unexpected end of @import</title> +<style>div { color: red }</style> +<style>@import ; div { color: green; }</style> +<div>This should be green</div> diff --git a/layout/reftests/css-parsing/at-rule-error-handling-media-1.html b/layout/reftests/css-parsing/at-rule-error-handling-media-1.html new file mode 100644 index 000000000..349410129 --- /dev/null +++ b/layout/reftests/css-parsing/at-rule-error-handling-media-1.html @@ -0,0 +1,5 @@ +<!DOCTYPE HTML> +<title>Test for unexpected end of @import</title> +<style>div { color: red }</style> +<style>@media ; div { color: green; }</style> +<div>This should be green</div> diff --git a/layout/reftests/css-parsing/at-rule-error-handling-ref.html b/layout/reftests/css-parsing/at-rule-error-handling-ref.html new file mode 100644 index 000000000..73458df75 --- /dev/null +++ b/layout/reftests/css-parsing/at-rule-error-handling-ref.html @@ -0,0 +1,3 @@ +<!DOCTYPE HTML> +<title>Test for unexpected end of @import (reference)</title> +<div style="color: green">This should be green</div> diff --git a/layout/reftests/css-parsing/invalid-attr-1-ref.html b/layout/reftests/css-parsing/invalid-attr-1-ref.html new file mode 100644 index 000000000..fce005c46 --- /dev/null +++ b/layout/reftests/css-parsing/invalid-attr-1-ref.html @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<html> + <head> + <style> + p { color: green; } + </style> + <style> + div { color: green; } + </style> + </head> + <body> + <p>This text should be green.</p> + <div>This text should be green.</p> + </body> +</html> diff --git a/layout/reftests/css-parsing/invalid-attr-1.html b/layout/reftests/css-parsing/invalid-attr-1.html new file mode 100644 index 000000000..b418575bb --- /dev/null +++ b/layout/reftests/css-parsing/invalid-attr-1.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<html> + <head> + <style> + p { color: red; } + [ + p { color: red !important; } + p { color: red !important; } + ] p { color: red !important; } + p { color: green; } + </style> + <style> + div { color: red; } + :not([) + div { color: red !important; } + div { color: red !important; } + ]) div { color: red !important; } + div { color: green; } + </style> + </head> + <body> + <p>This text should be green.</p> + <div>This text should be green.</p> + </body> +</html> diff --git a/layout/reftests/css-parsing/invalid-font-face-descriptor-1-ref.html b/layout/reftests/css-parsing/invalid-font-face-descriptor-1-ref.html new file mode 100644 index 000000000..1e86fba7e --- /dev/null +++ b/layout/reftests/css-parsing/invalid-font-face-descriptor-1-ref.html @@ -0,0 +1,5 @@ +<!DOCTYPE html> +<style> + body { color: green! important; } +</style> +There should be no red diff --git a/layout/reftests/css-parsing/invalid-font-face-descriptor-1.html b/layout/reftests/css-parsing/invalid-font-face-descriptor-1.html new file mode 100644 index 000000000..43ab568f3 --- /dev/null +++ b/layout/reftests/css-parsing/invalid-font-face-descriptor-1.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<style> + body { color: red; } + @font-face { + src: url(bbb), + } + + body { color: green! important; } +</style> +There should be no red diff --git a/layout/reftests/css-parsing/invalid-url-handling-ref.xhtml b/layout/reftests/css-parsing/invalid-url-handling-ref.xhtml new file mode 100644 index 000000000..77dc50ba9 --- /dev/null +++ b/layout/reftests/css-parsing/invalid-url-handling-ref.xhtml @@ -0,0 +1,32 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title>CSS Test: handling of invalid url() functions (reference)</title> + <link rel="author" title="L. David Baron" href="https://dbaron.org/" /> + <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" /> + <style type="text/css"> + div { background-color: green } + </style> + </head> + <body> + <div id="one">This should have a green background</div> + <div id="two">This should have a green background</div> + <div id="three">This should have a green background</div> + <div id="four">This should have a green background</div> + <div id="five">This should have a green background</div> + <div id="six">This should have a green background</div> + <div id="seven">This should have a green background</div> + <div id="eight">This should have a green background</div> + <div id="nine">This should have a green background</div> + <div id="ten">This should have a green background</div> + <div id="eleven">This should have a green background</div> + <div id="twelve">This should have a green background</div> + <div id="thirteen">This should have a green background</div> + <div id="fourteen">This should have a green background</div> + <div id="fifteen">This should have a green background</div> + <div id="sixteen">This should have a green background</div> + <div id="seventeen">This should have a green background</div> + <div id="eighteen">This should have a green background</div> + <div id="nineteen">This should have a green background</div> + </body> +</html> diff --git a/layout/reftests/css-parsing/invalid-url-handling.xhtml b/layout/reftests/css-parsing/invalid-url-handling.xhtml new file mode 100644 index 000000000..da1709b01 --- /dev/null +++ b/layout/reftests/css-parsing/invalid-url-handling.xhtml @@ -0,0 +1,135 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title>CSS Test: handling of invalid url() functions</title> + <link rel="author" title="L. David Baron" href="https://dbaron.org/" /> + <link rel="author" title="Mozilla Corporation" href="http://mozilla.com/" /> + <link rel="help" href="http://www.w3.org/TR/CSS21/syndata.html#tokenization" /> + <link rel="help" href="http://www.w3.org/TR/CSS21/syndata.html#parsing-errors" /> + <meta name="flags" content="invalid" /> + <style type="text/css"> + div { background-color: red } + </style> + <style type="text/css"> + /* not a URI token, but handled according to rules for parsing errors */ + #one { background: url(foo"bar") } + #one { background-color: green; } + </style> + <style type="text/css"> + /* not a URI token, but handled according to rules for parsing errors */ + #foo { background: url(foo"bar + ) } + #two { background-color: green; } + </style> + <style type="text/css"> + /* not a URI token; the unterminated string ends at end of line, so + the brace never matches */ + #three { background-color: green; } + #foo { background: url(foo"bar) } + #three { background-color: red; } + </style> + <style type="text/css"> + /* not a URI token; the unterminated string ends at end of line */ + #foo { background: url(foo"bar) } + ) } + #four { background-color: green; } + </style> + <style type="text/css"> + /* not a URI token; the unterminated string ends at end of line, so + the brace never matches */ + #five { background-color: green; } + #foo { background: url("bar) } + #five { background-color: red; } + </style> + <style type="text/css"> + /* not a URI token; the unterminated string ends at end of line */ + #foo { background: url("bar) } + ) } + #six { background-color: green; } + </style> + <style type="text/css"> + /* not a URI token, but brace matching should work */ + #seven { background: url(()); background-color: green; } + </style> + <style type="text/css"> + /* not a URI token, but brace matching should work */ + #eight { background: url([{}]); background-color: green; } + </style> + <style type="text/css"> + /* not a URI token, but brace matching should work */ + #nine { background: url([)]); background-color: green; } + </style> + <style type="text/css"> + /* perfectly good URI token (image is a 404, though) */ + #ten { background: url({) green; } + </style> + <style type="text/css"> + /* perfectly good URI token (image is a 404, though) */ + #eleven { background: url([) green; } + </style> + <style type="text/css"> + /* not a URI token; brace matching should work only after invalid URI token */ + #twelve { background: url(}{""{)}); background-color: green; } + </style> + <style type="text/css"> + /* invalid URI token absorbs the [ */ + #thirteen { background: url([""); background-color: green; } + </style> + <style type="text/css"> + /* not a URI token; the opening ( is never matched */ + #fourteen { background-color: green; } + #foo { background: url(() } + #fourteen { background-color: red; } + </style> + <!-- The next three tests test that invalid URI tokens absorb [ and { --> + <style type="text/css"> + #foo { background: url(a()); } + #fifteen { background-color: green } + </style> + <style type="text/css"> + #foo { background: url([()); } + #sixteen { background-color: green } + </style> + <style type="text/css"> + #foo { background: url({()); } + #seventeen { background-color: green } + </style> + <!-- Test that url() starting with a quote and without its closing ')' eaten + by any of the tokens that come after the initial quote doesn't eat the rest of + the stylesheet. In particular, this checks whether, once we reach the end of + the string and discover garbage after it, we tokenize the garbage or just skip + to the nearest ')'. --> + <style type="text/css"> + #eighteen { background-color: red; } + #foo { background: url('('')'); } + #eighteen { background-color: green; } + </style> + <!-- And the same thing with double quotes --> + <style type="text/css"> + #nineteen { background-color: red; } + #foo { background: url("("')'); } + #nineteen { background-color: green; } + </style> + </head> + <body> + <div id="one">This should have a green background</div> + <div id="two">This should have a green background</div> + <div id="three">This should have a green background</div> + <div id="four">This should have a green background</div> + <div id="five">This should have a green background</div> + <div id="six">This should have a green background</div> + <div id="seven">This should have a green background</div> + <div id="eight">This should have a green background</div> + <div id="nine">This should have a green background</div> + <div id="ten">This should have a green background</div> + <div id="eleven">This should have a green background</div> + <div id="twelve">This should have a green background</div> + <div id="thirteen">This should have a green background</div> + <div id="fourteen">This should have a green background</div> + <div id="fifteen">This should have a green background</div> + <div id="sixteen">This should have a green background</div> + <div id="seventeen">This should have a green background</div> + <div id="eighteen">This should have a green background</div> + <div id="nineteen">This should have a green background</div> + </body> +</html> diff --git a/layout/reftests/css-parsing/pseudo-elements-1-ref.html b/layout/reftests/css-parsing/pseudo-elements-1-ref.html new file mode 100644 index 000000000..df626f9c6 --- /dev/null +++ b/layout/reftests/css-parsing/pseudo-elements-1-ref.html @@ -0,0 +1,22 @@ +<!doctype html><style> + div { color: green; float: left } +</style><div +><div>T</div +><div>h</div +><div>e</div +><div>r</div +><div>e</div +><div>s</div +><div>h</div +><div>o</div +><div>u</div +><div>l</div +><div>d</div +><div>b</div +><div>e</div +><div>n</div +><div>o</div +><div>r</div +><div>e</div +><div>d</div +></div> diff --git a/layout/reftests/css-parsing/pseudo-elements-1.html b/layout/reftests/css-parsing/pseudo-elements-1.html new file mode 100644 index 000000000..43690f862 --- /dev/null +++ b/layout/reftests/css-parsing/pseudo-elements-1.html @@ -0,0 +1,36 @@ +<!doctype html><style> + div { float: left } + /* Pseudo elements can appear only at the end of the selector. */ + .good { color: red } + .bad { color: green } + #good1::first-letter { color: green } + #good2::first-letter, #good3 { color: green } + #good4, #good5::first-letter { color: green } + div > #good6::first-letter, #good7 { color:green } + div #good7 > ::first-letter, #good8 { color:green } + + #bad1::first-letter *, #bad2 { color: red } + #bad4, #bad3::first-letter * { color: red } + div::first-line #bad5, #bad6 { color: red } + #bad7, div::first-line #bad8 { color: red } + #bad9, div ::first-line>#bad10 { color:red } +</style><div +><div class="good" id="good1">T</div +><div class="good" id="good2">h</div +><div class="good" id="good3">e</div +><div class="good" id="good4">r</div +><div class="good" id="good5">e</div +><div class="good" id="good6">s</div +><div class="good" id="good7">h</div +><div class="good" id="good8">o</div +><div class="bad" id="bad1" >u</div +><div class="bad" id="bad2" >l</div +><div class="bad" id="bad3" >d</div +><div class="bad" id="bad4" >b</div +><div class="bad" id="bad5" >e</div +><div class="bad" id="bad6" >n</div +><div class="bad" id="bad7" >o</div +><div class="bad" id="bad8" >r</div +><div class="bad" id="bad9" >e</div +><div class="bad" id="bad10">d</div +></div> diff --git a/layout/reftests/css-parsing/reftest-stylo.list b/layout/reftests/css-parsing/reftest-stylo.list new file mode 100644 index 000000000..4eaf3a490 --- /dev/null +++ b/layout/reftests/css-parsing/reftest-stylo.list @@ -0,0 +1,10 @@ +# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing +== at-rule-013.html at-rule-013.html +== invalid-url-handling.xhtml invalid-url-handling.xhtml +== pseudo-elements-1.html pseudo-elements-1.html +== invalid-attr-1.html invalid-attr-1.html +== at-rule-error-handling-import-1.html at-rule-error-handling-import-1.html +== at-rule-error-handling-media-1.html at-rule-error-handling-media-1.html +== invalid-font-face-descriptor-1.html invalid-font-face-descriptor-1.html +== two-dash-identifiers.html two-dash-identifiers.html +== supports-moz-bool-pref.html supports-moz-bool-pref.html diff --git a/layout/reftests/css-parsing/reftest.list b/layout/reftests/css-parsing/reftest.list new file mode 100644 index 000000000..0044b6150 --- /dev/null +++ b/layout/reftests/css-parsing/reftest.list @@ -0,0 +1,9 @@ +== at-rule-013.html at-rule-013-ref.html +== invalid-url-handling.xhtml invalid-url-handling-ref.xhtml +== pseudo-elements-1.html pseudo-elements-1-ref.html +== invalid-attr-1.html invalid-attr-1-ref.html +== at-rule-error-handling-import-1.html at-rule-error-handling-ref.html +== at-rule-error-handling-media-1.html at-rule-error-handling-ref.html +== invalid-font-face-descriptor-1.html invalid-font-face-descriptor-1-ref.html +== two-dash-identifiers.html two-dash-identifiers-ref.html +== supports-moz-bool-pref.html supports-moz-bool-pref-ref.html diff --git a/layout/reftests/css-parsing/supports-moz-bool-pref-ref.html b/layout/reftests/css-parsing/supports-moz-bool-pref-ref.html new file mode 100644 index 000000000..4f067bbbf --- /dev/null +++ b/layout/reftests/css-parsing/supports-moz-bool-pref-ref.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<!-- Any copyright is dedicated to the Public Domain. + - http://creativecommons.org/publicdomain/zero/1.0/ --> + +<html> + <body> + <p>This text should not have background color.</p> + </body> +</html> + diff --git a/layout/reftests/css-parsing/supports-moz-bool-pref.html b/layout/reftests/css-parsing/supports-moz-bool-pref.html new file mode 100644 index 000000000..fe58ab766 --- /dev/null +++ b/layout/reftests/css-parsing/supports-moz-bool-pref.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<!-- Any copyright is dedicated to the Public Domain. + - http://creativecommons.org/publicdomain/zero/1.0/ --> + +<html> + <style> + /* This is not a user agent style sheet, so the style will be ignored. + "testing.supports.moz-bool-pref" is set to true in + layout/tools/reftest/reftest-preferences.js. */ + @supports -moz-bool-pref("testing.supports.moz-bool-pref") { + p { + background-color: red; + } + } + </style> + <body> + <p>This text should not have background color.</p> + </body> +</html> + diff --git a/layout/reftests/css-parsing/two-dash-identifiers-ref.html b/layout/reftests/css-parsing/two-dash-identifiers-ref.html new file mode 100644 index 000000000..b6ffdbb01 --- /dev/null +++ b/layout/reftests/css-parsing/two-dash-identifiers-ref.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<style> + div { color: green; } +</style> +<div>This should be green.</div> +<div>This should be green.</div> +<div>This should be green.</div> +<div>This should be green.</div> +<div>This should be green.</div> +<div>This should be green.</div> +<div>This should be green.</div> +<div>This should be green.</div> diff --git a/layout/reftests/css-parsing/two-dash-identifiers.html b/layout/reftests/css-parsing/two-dash-identifiers.html new file mode 100644 index 000000000..9ea7854b9 --- /dev/null +++ b/layout/reftests/css-parsing/two-dash-identifiers.html @@ -0,0 +1,22 @@ +<!DOCTYPE html> +<style> + .ok { color: red; } + #-- { color: green; } + #-foo { color: green } + #--foo { color: green; } + .-- { color: green; } + .-foo { color: green; } + .--foo { color: green; } + + .fail { color: green; } + #- { color: red; } + .- { color: red; } +</style> +<div class="ok" id="--">This should be green.</div> +<div class="ok" id="-foo">This should be green.</div> +<div class="ok" id="--foo">This should be green.</div> +<div class="ok --">This should be green.</div> +<div class="ok -foo">This should be green.</div> +<div class="ok --foo">This should be green.</div> +<div class="fail" id="-">This should be green.</div> +<div class="fail -">This should be green.</div> |