Bug 613249 - <output> should have :-moz-ui-invalid and :-moz-ui-valid applying. r=bz a=jst

--HG--
rename : layout/reftests/css-invalid/output/output-invalid.html => layout/reftests/css-ui-invalid/output/output-invalid.html
rename : layout/reftests/css-invalid/output/output-ref.html => layout/reftests/css-ui-invalid/output/output-ref.html
rename : layout/reftests/css-invalid/output/output-valid.html => layout/reftests/css-ui-invalid/output/output-valid.html
rename : layout/reftests/css-invalid/output/reftest.list => layout/reftests/css-ui-invalid/output/reftest.list
rename : layout/reftests/css-invalid/output/style.css => layout/reftests/css-ui-invalid/output/style.css
rename : layout/reftests/css-valid/output/output-invalid.html => layout/reftests/css-ui-valid/output/output-invalid.html
rename : layout/reftests/css-valid/output/output-ref.html => layout/reftests/css-ui-valid/output/output-ref.html
rename : layout/reftests/css-valid/output/output-valid.html => layout/reftests/css-ui-valid/output/output-valid.html
rename : layout/reftests/css-valid/output/reftest.list => layout/reftests/css-ui-valid/output/reftest.list
rename : layout/reftests/css-valid/output/style.css => layout/reftests/css-ui-valid/output/style.css
This commit is contained in:
Mounir Lamouri 2010-11-24 11:13:05 +01:00
parent 13ce15e741
commit 4de2de0492
19 changed files with 134 additions and 6 deletions

View File

@ -160,7 +160,9 @@ nsHTMLOutputElement::SetCustomValidity(const nsAString& aError)
if (doc) {
MOZ_AUTO_DOC_UPDATE(doc, UPDATE_CONTENT_STATE, PR_TRUE);
doc->ContentStatesChanged(this, nsnull, NS_EVENT_STATE_INVALID |
NS_EVENT_STATE_VALID);
NS_EVENT_STATE_VALID |
NS_EVENT_STATE_MOZ_UI_INVALID |
NS_EVENT_STATE_MOZ_UI_VALID);
}
return NS_OK;
@ -204,7 +206,8 @@ nsHTMLOutputElement::IntrinsicState() const
// We don't have to call IsCandidateForConstraintValidation()
// because <output> can't be barred from constraint validation.
states |= IsValid() ? NS_EVENT_STATE_VALID : NS_EVENT_STATE_INVALID;
states |= IsValid() ? NS_EVENT_STATE_VALID | NS_EVENT_STATE_MOZ_UI_VALID
: NS_EVENT_STATE_INVALID | NS_EVENT_STATE_MOZ_UI_INVALID;
return states;
}

View File

@ -37,7 +37,7 @@ function runTest()
ok(!select.mozMatchesSelector(":-moz-ui-valid"),
":-moz-ui-valid should not apply");
ok(!select.mozMatchesSelector(":-moz-ui-invalid"),
todo(!select.mozMatchesSelector(":-moz-ui-invalid"),
":-moz-ui-invalid should not apply");
SimpleTest.finish();

View File

@ -0,0 +1,7 @@
<!DOCTYPE>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<body>
<output class='invalid-ref'>foo</output>
</body>
</html>

View File

@ -0,0 +1,13 @@
<!DOCTYPE>
<html class="reftest-wait">
<script>
function onloadHandler()
{
document.getElementById('e').setCustomValidity('foo');
document.documentElement.className='';
}
</script>
<body onload="onloadHandler();">
<output id='e'>foo</output>
</body>
</html>

View File

@ -3,3 +3,4 @@
== textarea.html textarea-ref.html
== select.html select-ref.html
== fieldset.html fieldset-ref.html
== output.html output-ref.html

View File

@ -1,6 +1,10 @@
.invalid-ref {
:not(output).invalid-ref {
box-shadow: 0 0 1.5px 1px red;
}
output.invalid-ref {
color: red;
}
.barred-ref {
}

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html class="reftest-wait">
<!-- Test: if output has a custom error, it should be affected by
:-moz-ui-invalid pseudo-class. -->
<link rel='stylesheet' type='text/css' href='style.css'>
<body onload="document.getElementById('b').setCustomValidity('foo'); document.documentElement.className='';">
<output class='invalid' id='b'>foo</output>
</body>
</html>

View File

@ -0,0 +1,7 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<body>
<output class='ref'>foo</output>
</body>
</html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<!-- Test: if output has no custom error and is not barred from constraint
validation, it should not affected by :-moz-ui-invalid pseudo-class. -->
<link rel='stylesheet' type='text/css' href='style.css'>
<body>
<output class='notinvalid'>foo</output>
</body>
</html>

View File

@ -0,0 +1,2 @@
== output-valid.html output-ref.html
== output-invalid.html output-ref.html

View File

@ -0,0 +1,22 @@
/* Override default style */
output {
color: black;
}
output.notinvalid {
color: green;
}
output.notinvalid:-moz-ui-invalid {
color: red;
}
output.invalid {
color: red;
}
output.invalid:-moz-ui-invalid {
color: green;
}
output.ref {
color: green;
}

View File

@ -3,6 +3,7 @@ include button/reftest.list
include input/reftest.list
include select/reftest.list
include textarea/reftest.list
include output/reftest.list
# default :-moz-ui-invalid style
include default-style/reftest.list

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html class="reftest-wait">
<!-- Test: if output has a custom error, it should not be affected by :-moz-ui-valid
pseudo-class. -->
<link rel='stylesheet' type='text/css' href='style.css'>
<body onload="document.getElementById('b').setCustomValidity('foo'); document.documentElement.className='';">
<output class='notvalid' id='b'>foo</output>
</body>
</html>

View File

@ -0,0 +1,7 @@
<!DOCTYPE html>
<html>
<link rel='stylesheet' type='text/css' href='style.css'>
<body>
<output class='ref'>foo</output>
</body>
</html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<!-- Test: if output has no custom error and is not barred from constraint
validation, it should be affected by :-moz-ui-valid pseudo-class. -->
<link rel='stylesheet' type='text/css' href='style.css'>
<body>
<output class='valid'>foo</output>
</body>
</html>

View File

@ -0,0 +1,2 @@
== output-valid.html output-ref.html
== output-invalid.html output-ref.html

View File

@ -0,0 +1,22 @@
/* Override default style */
output {
color: black;
}
output.notvalid {
color: green;
}
output.notvalid:-moz-ui-valid {
color: red;
}
output.valid {
color: red;
}
output.valid:-moz-ui-valid {
color: green;
}
output.ref {
color: green;
}

View File

@ -3,3 +3,4 @@ include button/reftest.list
include input/reftest.list
include select/reftest.list
include textarea/reftest.list
include output/reftest.list

View File

@ -629,7 +629,7 @@ input[type="file"] > input[type="text"] {
box-shadow: 0 0 1.5px 1px red;
}
output:invalid {
output:-moz-ui-invalid {
color: red;
}