Highlight selected text in input fields

Fixes #9993.  This does not yet allow stylesheets to set the selection colors;
instead it uses a hard-coded orange background and white foreground.
This commit is contained in:
Matt Brubeck 2016-03-18 16:38:17 -07:00
parent f2f05869d6
commit 6171000875
17 changed files with 229 additions and 62 deletions

View file

@ -2528,6 +2528,30 @@
"url": "/_mozilla/css/input_placeholder_ref.html"
}
],
"css/input_selection_a.html": [
{
"path": "css/input_selection_a.html",
"references": [
[
"/_mozilla/css/input_selection_ref.html",
"=="
]
],
"url": "/_mozilla/css/input_selection_a.html"
}
],
"css/input_selection_ref.html": [
{
"path": "css/input_selection_ref.html",
"references": [
[
"/_mozilla/css/input_selection_ref.html",
"=="
]
],
"url": "/_mozilla/css/input_selection_ref.html"
}
],
"css/input_whitespace.html": [
{
"path": "css/input_whitespace.html",
@ -8818,6 +8842,30 @@
"url": "/_mozilla/css/input_placeholder_ref.html"
}
],
"css/input_selection_a.html": [
{
"path": "css/input_selection_a.html",
"references": [
[
"/_mozilla/css/input_selection_ref.html",
"=="
]
],
"url": "/_mozilla/css/input_selection_a.html"
}
],
"css/input_selection_ref.html": [
{
"path": "css/input_selection_ref.html",
"references": [
[
"/_mozilla/css/input_selection_ref.html",
"=="
]
],
"url": "/_mozilla/css/input_selection_ref.html"
}
],
"css/input_whitespace.html": [
{
"path": "css/input_whitespace.html",

View file

@ -0,0 +1,28 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>input selection test</title>
<link rel="match" href="input_selection_ref.html">
<style>
input {
font: 16px sans-serif;
border: 0 none;
margin: 0;
padding: 0;
}
::selection {
color: white;
background: rgba(255, 127, 0, 1.0);
}
</style>
</head>
<body>
<input value="Hello">
<script>
var input = document.querySelector("input");
input.focus();
input.setSelectionRange(0, 5);
</script>
</body>
</html>

View file

@ -0,0 +1,18 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>input selection test</title>
<link rel="match" href="input_selection_ref.html">
<style>
span {
font: 16px sans-serif;
color: white;
background: rgba(255, 128, 0, 1.0);
}
</style>
</head>
<body>
<span>Hello</span>
</body>
</html>