summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources/textfields.html
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-11-18 18:32:45 +0000
committerBen Murdoch <benm@google.com>2010-11-18 18:38:07 +0000
commit513209b27ff55e2841eac0e4120199c23acce758 (patch)
treeaeba30bb08c5f47c57003544e378a377c297eee6 /chrome/browser/resources/textfields.html
parent164f7496de0fbee436b385a79ead9e3cb81a50c1 (diff)
downloadexternal_chromium-513209b27ff55e2841eac0e4120199c23acce758.zip
external_chromium-513209b27ff55e2841eac0e4120199c23acce758.tar.gz
external_chromium-513209b27ff55e2841eac0e4120199c23acce758.tar.bz2
Merge Chromium at r65505: Initial merge by git.
Change-Id: I31d8f1d8cd33caaf7f47ffa7350aef42d5fbdb45
Diffstat (limited to 'chrome/browser/resources/textfields.html')
-rw-r--r--chrome/browser/resources/textfields.html49
1 files changed, 49 insertions, 0 deletions
diff --git a/chrome/browser/resources/textfields.html b/chrome/browser/resources/textfields.html
new file mode 100644
index 0000000..b716006
--- /dev/null
+++ b/chrome/browser/resources/textfields.html
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML>
+<html i18n-values='dir:textdirection;'>
+<style>
+
+html, body {
+ margin: 0;
+ overflow: hidden;
+}
+
+input {
+ bottom: 0;
+ left: 0;
+ margin: 0;
+ position: absolute;
+ right: 0;
+ top: 0;
+}
+
+</style>
+
+<body>
+ <input>
+</body>
+
+<script>
+
+var textfield = document.querySelector('input');
+textfield.addEventListener('input', sendTextfieldValueToBrowser);
+
+/**
+ * Sends the textfield value to the browser. Called whenever the user presses a
+ * key. We first check if the key-press has really changed the text, then send
+ * the new value to the browser if so.
+ */
+function sendTextfieldValueToBrowser() {
+ chrome.send('textfieldValue', [textfield.value]);
+}
+
+/**
+ * Sets textfield value
+ * @param {string} value
+ */
+function setTextfieldValue(value) {
+ textfield.value = value;
+ sendTextfieldValueToBrowser();
+}
+
+</script>
+</html>