eww: support disabled and readonly text

* net/eww.el (eww-form-text): Support text form with disabled and readonly attributes.
This commit is contained in:
Kenjiro NAKAYAMA 2013-12-21 15:42:23 -05:00 committed by Ted Zlatanov
parent d49fbfd670
commit 5edcc2dc14
2 changed files with 12 additions and 6 deletions

View file

@ -4,6 +4,8 @@
(eww-history-browse, eww-history-quit, eww-history-kill)
(eww-history-mode-map, eww-history-mode): New command and
functions to list browser histories.
(eww-form-text): Support text form with disabled
and readonly attributes.
2013-12-21 Rüdiger Sonderfeld <ruediger@c-plusplus.de>

View file

@ -680,18 +680,22 @@ appears in a <link> or <a> tag."
(value (or (cdr (assq :value cont)) ""))
(width (string-to-number
(or (cdr (assq :size cont))
"40"))))
"40")))
(readonly-property (if (or (cdr (assq :disabled cont))
(cdr (assq :readonly cont)))
'read-only
'inhibit-read-only)))
(insert value)
(when (< (length value) width)
(insert (make-string (- width (length value)) ? )))
(put-text-property start (point) 'face 'eww-form-text)
(put-text-property start (point) 'local-map eww-text-map)
(put-text-property start (point) 'inhibit-read-only t)
(put-text-property start (point) readonly-property t)
(put-text-property start (point) 'eww-form
(list :eww-form eww-form
:value value
:type type
:name (cdr (assq :name cont))))
(list :eww-form eww-form
:value value
:type type
:name (cdr (assq :name cont))))
(insert " ")))
(defconst eww-text-input-types '("text" "password" "textarea"