Skip to content

Commit

Permalink
Modularize LibLouis (Reworked)
Browse files Browse the repository at this point in the history
I decided to leave the Translator as a "Inner Class"
because it is not used outside of the file except
for types in JSDoc.

If we ever move to TS we could remove access to the
class and export a type only.

AX-RelNotes: N/A
Bug: 1301002
Change-Id: I8983dc294ef9dee3178bfe913b6c69520b36358c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3777332
Reviewed-by: Josiah Krutz <josiahk@google.com>
Commit-Queue: Jacob Francis <francisjp@google.com>
Reviewed-by: Anastasia Helfinstein <anastasi@google.com>
Cr-Commit-Position: refs/heads/main@{#1027018}
  • Loading branch information
Jacob Francis authored and Chromium LUCI CQ committed Jul 21, 2022
1 parent 52aebe2 commit 7aa3f07
Show file tree
Hide file tree
Showing 14 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ chromevox_modules = [
"../common/key_code.js",
"../common/tree_walker.js",
"background/braille/cursor_dots.js",
"background/braille/liblouis.js",
"background/braille/pan_strategy.js",
"background/chromevox.js",
"common/abstract_earcons.js",
Expand Down Expand Up @@ -70,6 +69,7 @@ chromevox_es6_modules = [
"background/braille/braille_translator_manager.js",
"background/braille/cursor_dots.js",
"background/braille/expanding_braille_translator.js",
"background/braille/liblouis.js",
"background/braille/pan_strategy.js",
"background/braille/spans.js",
"background/chromevox_state.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {StringUtil} from '../../../common/string_util.js';

import {BrailleTranslatorManager} from './braille_translator_manager.js';
import {ExpandingBrailleTranslator} from './expanding_braille_translator.js';
import {LibLouis} from './liblouis.js';
import {ExtraCellsSpan, ValueSelectionSpan, ValueSpan} from './spans.js';

export class BrailleInputHandler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import {BrailleTable} from '../../common/braille/braille_table.js';

import {ExpandingBrailleTranslator} from './expanding_braille_translator.js';
import {LibLouis} from './liblouis.js';

export class BrailleTranslatorManager {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* @fileoverview Translates text to braille, optionally with some parts
* uncontracted.
*/
import {LibLouis} from './liblouis.js';
import {BrailleTextStyleSpan, ExtraCellsSpan, ValueSelectionSpan, ValueSpan} from './spans.js';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ ChromeVoxExpandingBrailleTranslatorUnitTest =
await importModule(
['ExtraCellsSpan', 'ValueSelectionSpan', 'ValueSpan'],
'/chromevox/background/braille/spans.js');
await importModule('LibLouis', '/chromevox/background/braille/liblouis.js');
}
};

Expand All @@ -26,7 +27,6 @@ ChromeVoxExpandingBrailleTranslatorUnitTest.prototype.extraLibraries = [
'../../../common/testing/assert_additions.js',
'../../testing/fake_dom.js',
'../../common/spannable.js',
'liblouis.js',
];

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@
* @fileoverview JavaScript shim for the liblouis Web Assembly wrapper.
*/

goog.provide('LibLouis');
goog.provide('LibLouis.FormType');

/** Encapsulates a liblouis Web Assembly instance in the page. */
LibLouis = class {
export class LibLouis {
/**
* @param {string} wasmPath Path to .wasm file for the module.
* @param {string=} opt_tablesDir Path to tables directory.
Expand Down Expand Up @@ -162,7 +159,7 @@ LibLouis = class {
this.onInstanceLoad_();
});
}
};
}


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ChromeVoxLibLouisTest = class extends ChromeVoxE2ETest {
await super.setUpDeferred();
await importModule(
'BrailleTable', '/chromevox/common/braille/braille_table.js');
await importModule('LibLouis', '/chromevox/background/braille/liblouis.js');
}

createLiblouis() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* and selections.
*/

import {LibLouis} from './liblouis.js';

/** Attached to the value region of a braille spannable. */
export class ValueSpan {
/** @param {number} offset The offset of the span into the value. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/
import {Cursor, CURSOR_NODE_INDEX, CursorMovement, CursorUnit} from '../../../common/cursors/cursor.js';
import {CursorRange} from '../../../common/cursors/range.js';
import {LibLouis} from '../braille/liblouis.js';
import {Output} from '../output/output.js';
import {OutputEventType, OutputNodeSpan} from '../output/output_types.js';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {AbstractTts} from '../../common/abstract_tts.js';
import {ChromeVoxEvent} from '../../common/custom_automation_event.js';
import {Msgs} from '../../common/msgs.js';
import {BrailleBackground} from '../braille/braille_background.js';
import {LibLouis} from '../braille/liblouis.js';
import {BrailleTextStyleSpan, ValueSelectionSpan, ValueSpan} from '../braille/spans.js';
import {ChromeVoxState, ChromeVoxStateObserver} from '../chromevox_state.js';
import {Color} from '../color.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ goog.require('ChromeVox');
goog.require('EventLog');
goog.require('JaPhoneticData');
goog.require('KeyCode');
goog.require('LibLouis');
goog.require('LibLouis.FormType');
goog.require('LogType');
goog.require('NavBraille');
goog.require('PanelNodeMenuData');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ goog.provide('TextLog');
goog.provide('TreeLog');

goog.require('QueueMode');
goog.require('TreeDumper');

/**
* List of all types of logs supported.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ goog.require('BrailleKeyCommand');
goog.require('BrailleKeyEvent');
goog.require('ChromeVox');
goog.require('KeyCode');
goog.require('LibLouis');
goog.require('NavBraille');
goog.require('Spannable');
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ goog.require('BackgroundBridge');
goog.require('BluetoothBrailleDisplayListener');
goog.require('BluetoothBrailleDisplayManager');
goog.require('ChromeVox');
goog.require('LibLouis');
goog.require('LibLouis.FormType');
goog.require('Spannable');
goog.require('SpeechLog');
goog.require('TtsInterface');
Expand Down

0 comments on commit 7aa3f07

Please sign in to comment.