terminal: support setting line height for xterm.js

Note that line-height is a bit different from the existing
line-height-padding-size.

Bug: b/236205389
Change-Id: Ibc52735a7925029b6d341122ee38c512e80c199f
Reviewed-on: https://chromium-review.googlesource.com/c/apps/libapps/+/3949412
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Joel Hockey <joelhockey@chromium.org>
diff --git a/terminal/js/terminal_emulator.js b/terminal/js/terminal_emulator.js
index d02f39b..53752dc 100644
--- a/terminal/js/terminal_emulator.js
+++ b/terminal/js/terminal_emulator.js
@@ -12,8 +12,8 @@
 // TODO(b/236205389): support option smoothScrollDuration?
 
 import {LitElement, css, html} from './lit.js';
-import {FontManager, ORIGINAL_URL, TERMINAL_EMULATORS, delayedScheduler,
-  fontManager, getOSInfo, sleep} from './terminal_common.js';
+import {FontManager, ORIGINAL_URL, TERMINAL_EMULATORS, definePrefs,
+  delayedScheduler, fontManager, getOSInfo, sleep} from './terminal_common.js';
 import {ICON_COPY} from './terminal_icons.js';
 import {TerminalTooltip} from './terminal_tooltip.js';
 import {Terminal, Unicode11Addon, WebLinksAddon, WebglAddon}
@@ -326,6 +326,7 @@
     this.profileId_ = profileId;
     /** @type {!hterm.PreferenceManager} */
     this.prefs_ = new hterm.PreferenceManager(storage, profileId);
+    definePrefs(this.prefs_);
     this.enableWebGL_ = enableWebGL;
 
     // TODO: we should probably pass the initial prefs to the ctor.
@@ -708,6 +709,7 @@
         this.updateTheme_({foreground: v});
         setHtermColorCSSVariable('foreground-color', v);
       },
+      'line-height': (v) => this.updateOption_('lineHeight', v, true),
     });
 
     for (const name of ['keybindings-os-defaults', 'pass-ctrl-n', 'pass-ctrl-t',
@@ -1046,6 +1048,8 @@
   decorate(div) {
     super.decorate(div);
 
+    definePrefs(this.getPrefs());
+
     const fontManager = new FontManager(this.getDocument());
     fontManager.loadPowerlineCSS().then(() => {
       const prefs = this.getPrefs();