Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(971)

Unified Diff: LayoutTests/fast/speech/input-appearance-speechbutton.html

Issue 100793006: Show speech button for x-webkit-speech only if the field is editable and focused/hovered. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/speech/input-appearance-speechbutton.html
diff --git a/LayoutTests/fast/speech/input-appearance-speechbutton.html b/LayoutTests/fast/speech/input-appearance-speechbutton.html
index 31c0b3be0eff69c74d2becdfd3be1415a3355a83..c12511a767c50884ca54af053d55bb9af8f1cb3f 100644
--- a/LayoutTests/fast/speech/input-appearance-speechbutton.html
+++ b/LayoutTests/fast/speech/input-appearance-speechbutton.html
@@ -2,6 +2,10 @@
<html>
<head>
<style>
+/* We'd like to check appearance of the button in various sizes. */
+input.always-show-button::-webkit-input-speech-button {
+ opacity: 1;
+}
</style>
</head>
<body>
@@ -11,14 +15,14 @@
<script>
var parent = document.createElement('div');
document.body.appendChild(parent);
-parent.innerHTML = '<table><tr><td id=p1><td id=p2><td id=p3></tr></table>';
+parent.innerHTML = '<table><tr><td id=p1><td id=p2><td id=p3></tr></table><input x-webkit-speech id="focus"><input x-webkit-speech id="hover">';
var cells = ["", "", ""];
var maxCellCount = [7, 5, 5];
var cellCount = 0;
var index = 0;
for (var size = 8; size < 24; size++) {
cells[index] += '<input style="font-size:' + size + 'px" value="A quick brown fox jumps over the lazy dog"><br>'
- + '<input style="font-size:' + size + 'px" value="A quick brown fox jumps over the lazy dog" x-webkit-speech><br>';
+ + '<input style="font-size:' + size + 'px" value="A quick brown fox jumps over the lazy dog" x-webkit-speech class="always-show-button"><br>';
if (++cellCount >= maxCellCount[index]) {
++index;
cellCount = 0;
@@ -30,14 +34,21 @@ for (var i = 0; i < cells.length; ++i) {
document.getElementById('p' + (i + 1)).appendChild(div);
}
+document.getElementById('focus').focus();
+var hoveredInput = document.getElementById('hover');
+if (window.eventSender)
+ eventSender.mouseMoveTo(hoveredInput.offsetLeft + hoveredInput.offsetWidth / 2, hoveredInput.offsetTop + hoveredInput.offsetHeight / 2);
+
// Also check that setting the attribute from script renders similarly.
var inputWithAttribute = document.createElement('input');
+inputWithAttribute.className = 'always-show-button';
document.body.appendChild(inputWithAttribute);
inputWithAttribute.setAttribute('x-webkit-speech', 'x-webkit-speech');
// Similar to above, check if removing the attribute with script renders an empty input field.
var inputWithoutAttribute = document.createElement('input');
inputWithoutAttribute.setAttribute('x-webkit-speech', 'x-webkit-speech');
+inputWithoutAttribute.className = 'always-show-button';
document.body.appendChild(inputWithoutAttribute);
inputWithoutAttribute.removeAttribute('x-webkit-speech');
« no previous file with comments | « LayoutTests/fast/speech/input-appearance-searchandspeech.html ('k') | LayoutTests/fast/speech/speech-bidi-rendering.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698