Skip to content

Commit 7aa3f07

Browse files
Jacob FrancisChromium LUCI CQ
Jacob Francis
authored and
Chromium LUCI CQ
committed
Modularize LibLouis (Reworked)
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}
1 parent 52aebe2 commit 7aa3f07

14 files changed

+13
-12
lines changed

chrome/browser/resources/chromeos/accessibility/chromevox/BUILD.gn

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ chromevox_modules = [
2626
"../common/key_code.js",
2727
"../common/tree_walker.js",
2828
"background/braille/cursor_dots.js",
29-
"background/braille/liblouis.js",
3029
"background/braille/pan_strategy.js",
3130
"background/chromevox.js",
3231
"common/abstract_earcons.js",
@@ -70,6 +69,7 @@ chromevox_es6_modules = [
7069
"background/braille/braille_translator_manager.js",
7170
"background/braille/cursor_dots.js",
7271
"background/braille/expanding_braille_translator.js",
72+
"background/braille/liblouis.js",
7373
"background/braille/pan_strategy.js",
7474
"background/braille/spans.js",
7575
"background/chromevox_state.js",

chrome/browser/resources/chromeos/accessibility/chromevox/background/braille/braille_input_handler.js

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {StringUtil} from '../../../common/string_util.js';
1313

1414
import {BrailleTranslatorManager} from './braille_translator_manager.js';
1515
import {ExpandingBrailleTranslator} from './expanding_braille_translator.js';
16+
import {LibLouis} from './liblouis.js';
1617
import {ExtraCellsSpan, ValueSelectionSpan, ValueSpan} from './spans.js';
1718

1819
export class BrailleInputHandler {

chrome/browser/resources/chromeos/accessibility/chromevox/background/braille/braille_translator_manager.js

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import {BrailleTable} from '../../common/braille/braille_table.js';
99

1010
import {ExpandingBrailleTranslator} from './expanding_braille_translator.js';
11+
import {LibLouis} from './liblouis.js';
1112

1213
export class BrailleTranslatorManager {
1314
/**

chrome/browser/resources/chromeos/accessibility/chromevox/background/braille/expanding_braille_translator.js

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* @fileoverview Translates text to braille, optionally with some parts
77
* uncontracted.
88
*/
9+
import {LibLouis} from './liblouis.js';
910
import {BrailleTextStyleSpan, ExtraCellsSpan, ValueSelectionSpan, ValueSpan} from './spans.js';
1011

1112
/**

chrome/browser/resources/chromeos/accessibility/chromevox/background/braille/expanding_braille_translator_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ ChromeVoxExpandingBrailleTranslatorUnitTest =
1818
await importModule(
1919
['ExtraCellsSpan', 'ValueSelectionSpan', 'ValueSpan'],
2020
'/chromevox/background/braille/spans.js');
21+
await importModule('LibLouis', '/chromevox/background/braille/liblouis.js');
2122
}
2223
};
2324

@@ -26,7 +27,6 @@ ChromeVoxExpandingBrailleTranslatorUnitTest.prototype.extraLibraries = [
2627
'../../../common/testing/assert_additions.js',
2728
'../../testing/fake_dom.js',
2829
'../../common/spannable.js',
29-
'liblouis.js',
3030
];
3131

3232
/**

chrome/browser/resources/chromeos/accessibility/chromevox/background/braille/liblouis.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@
66
* @fileoverview JavaScript shim for the liblouis Web Assembly wrapper.
77
*/
88

9-
goog.provide('LibLouis');
10-
goog.provide('LibLouis.FormType');
11-
129
/** Encapsulates a liblouis Web Assembly instance in the page. */
13-
LibLouis = class {
10+
export class LibLouis {
1411
/**
1512
* @param {string} wasmPath Path to .wasm file for the module.
1613
* @param {string=} opt_tablesDir Path to tables directory.
@@ -162,7 +159,7 @@ LibLouis = class {
162159
this.onInstanceLoad_();
163160
});
164161
}
165-
};
162+
}
166163

167164

168165
/**

chrome/browser/resources/chromeos/accessibility/chromevox/background/braille/liblouis_test.js

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ ChromeVoxLibLouisTest = class extends ChromeVoxE2ETest {
1616
await super.setUpDeferred();
1717
await importModule(
1818
'BrailleTable', '/chromevox/common/braille/braille_table.js');
19+
await importModule('LibLouis', '/chromevox/background/braille/liblouis.js');
1920
}
2021

2122
createLiblouis() {

chrome/browser/resources/chromeos/accessibility/chromevox/background/braille/spans.js

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* and selections.
88
*/
99

10+
import {LibLouis} from './liblouis.js';
11+
1012
/** Attached to the value region of a braille spannable. */
1113
export class ValueSpan {
1214
/** @param {number} offset The offset of the span into the value. */

chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editable_line.js

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111
import {Cursor, CURSOR_NODE_INDEX, CursorMovement, CursorUnit} from '../../../common/cursors/cursor.js';
1212
import {CursorRange} from '../../../common/cursors/range.js';
13+
import {LibLouis} from '../braille/liblouis.js';
1314
import {Output} from '../output/output.js';
1415
import {OutputEventType, OutputNodeSpan} from '../output/output_types.js';
1516

chrome/browser/resources/chromeos/accessibility/chromevox/background/editing/editing.js

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {AbstractTts} from '../../common/abstract_tts.js';
1212
import {ChromeVoxEvent} from '../../common/custom_automation_event.js';
1313
import {Msgs} from '../../common/msgs.js';
1414
import {BrailleBackground} from '../braille/braille_background.js';
15+
import {LibLouis} from '../braille/liblouis.js';
1516
import {BrailleTextStyleSpan, ValueSelectionSpan, ValueSpan} from '../braille/spans.js';
1617
import {ChromeVoxState, ChromeVoxStateObserver} from '../chromevox_state.js';
1718
import {Color} from '../color.js';

chrome/browser/resources/chromeos/accessibility/chromevox/background/loader.js

-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ goog.require('ChromeVox');
2121
goog.require('EventLog');
2222
goog.require('JaPhoneticData');
2323
goog.require('KeyCode');
24-
goog.require('LibLouis');
25-
goog.require('LibLouis.FormType');
2624
goog.require('LogType');
2725
goog.require('NavBraille');
2826
goog.require('PanelNodeMenuData');

chrome/browser/resources/chromeos/accessibility/chromevox/common/log_types.js

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ goog.provide('TextLog');
1414
goog.provide('TreeLog');
1515

1616
goog.require('QueueMode');
17+
goog.require('TreeDumper');
1718

1819
/**
1920
* List of all types of logs supported.

chrome/browser/resources/chromeos/accessibility/chromevox/learn_mode/kbexplorer_loader.js

-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@ goog.require('BrailleKeyCommand');
1111
goog.require('BrailleKeyEvent');
1212
goog.require('ChromeVox');
1313
goog.require('KeyCode');
14-
goog.require('LibLouis');
1514
goog.require('NavBraille');
1615
goog.require('Spannable');

chrome/browser/resources/chromeos/accessibility/chromevox/options/options_loader.js

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ goog.require('BackgroundBridge');
1010
goog.require('BluetoothBrailleDisplayListener');
1111
goog.require('BluetoothBrailleDisplayManager');
1212
goog.require('ChromeVox');
13-
goog.require('LibLouis');
14-
goog.require('LibLouis.FormType');
1513
goog.require('Spannable');
1614
goog.require('SpeechLog');
1715
goog.require('TtsInterface');

0 commit comments

Comments
 (0)