Commit 099889e8 authored by plundblad's avatar plundblad Committed by Commit bot

Refactorings to reduce dependencies in ChromeVox 2.

Mainly, this breaks out braille span classes and the EditableTextBase
class into their own files.  This removes lots of dependencies on code that
should only run in the content script in ChromeVox classic from the
ChromeVox next background script.

BUG=

Review URL: https://codereview.chromium.org/889593002

Cr-Commit-Position: refs/heads/master@{#313895}
parent b64a083c
...@@ -133,9 +133,8 @@ cvox.BrailleInputHandler.prototype.init = function() { ...@@ -133,9 +133,8 @@ cvox.BrailleInputHandler.prototype.init = function() {
* spans. * spans.
*/ */
cvox.BrailleInputHandler.prototype.onDisplayContentChanged = function(text) { cvox.BrailleInputHandler.prototype.onDisplayContentChanged = function(text) {
var valueSpan = text.getSpanInstanceOf(cvox.BrailleUtil.ValueSpan); var valueSpan = text.getSpanInstanceOf(cvox.ValueSpan);
var selectionSpan = text.getSpanInstanceOf( var selectionSpan = text.getSpanInstanceOf(cvox.ValueSelectionSpan);
cvox.BrailleUtil.ValueSelectionSpan);
if (!(valueSpan && selectionSpan)) { if (!(valueSpan && selectionSpan)) {
return; return;
} }
......
...@@ -391,7 +391,6 @@ CvoxBrailleInputHandlerUnitTest.prototype = { ...@@ -391,7 +391,6 @@ CvoxBrailleInputHandlerUnitTest.prototype = {
closureModuleDeps: [ closureModuleDeps: [
'cvox.BrailleInputHandler', 'cvox.BrailleInputHandler',
'cvox.BrailleUtil', 'cvox.BrailleUtil',
'cvox.Spannable',
], ],
/** /**
......
...@@ -9,9 +9,10 @@ ...@@ -9,9 +9,10 @@
goog.provide('cvox.ExpandingBrailleTranslator'); goog.provide('cvox.ExpandingBrailleTranslator');
goog.require('cvox.BrailleUtil');
goog.require('cvox.LibLouis'); goog.require('cvox.LibLouis');
goog.require('cvox.Spannable'); goog.require('cvox.Spannable');
goog.require('cvox.ValueSelectionSpan');
goog.require('cvox.ValueSpan');
/** /**
...@@ -48,7 +49,7 @@ cvox.ExpandingBrailleTranslator = ...@@ -48,7 +49,7 @@ cvox.ExpandingBrailleTranslator =
/** /**
* What expansion to apply to the part of the translated string marked by the * What expansion to apply to the part of the translated string marked by the
* {@code cvox.BrailleUtil.ValueSpan} spannable. * {@code cvox.ValueSpan} spannable.
* @enum {number} * @enum {number}
*/ */
cvox.ExpandingBrailleTranslator.ExpansionType = { cvox.ExpandingBrailleTranslator.ExpansionType = {
...@@ -200,7 +201,7 @@ cvox.ExpandingBrailleTranslator.prototype.findExpandRanges_ = function( ...@@ -200,7 +201,7 @@ cvox.ExpandingBrailleTranslator.prototype.findExpandRanges_ = function(
var result = []; var result = [];
if (this.uncontractedTranslator_ && if (this.uncontractedTranslator_ &&
expansionType != cvox.ExpandingBrailleTranslator.ExpansionType.NONE) { expansionType != cvox.ExpandingBrailleTranslator.ExpansionType.NONE) {
var value = text.getSpanInstanceOf(cvox.BrailleUtil.ValueSpan); var value = text.getSpanInstanceOf(cvox.ValueSpan);
if (value) { if (value) {
// The below type casts are valid because the ranges must be valid when // The below type casts are valid because the ranges must be valid when
// the span is known to exist. // the span is known to exist.
...@@ -234,8 +235,7 @@ cvox.ExpandingBrailleTranslator.prototype.findExpandRanges_ = function( ...@@ -234,8 +235,7 @@ cvox.ExpandingBrailleTranslator.prototype.findExpandRanges_ = function(
*/ */
cvox.ExpandingBrailleTranslator.prototype.addRangesForSelection_ = function( cvox.ExpandingBrailleTranslator.prototype.addRangesForSelection_ = function(
text, valueStart, valueEnd, outRanges) { text, valueStart, valueEnd, outRanges) {
var selection = text.getSpanInstanceOf( var selection = text.getSpanInstanceOf(cvox.ValueSelectionSpan);
cvox.BrailleUtil.ValueSelectionSpan);
if (!selection) { if (!selection) {
return; return;
} }
......
...@@ -18,10 +18,11 @@ CvoxExpandingBrailleTranslatorUnitTest.prototype = { ...@@ -18,10 +18,11 @@ CvoxExpandingBrailleTranslatorUnitTest.prototype = {
/** @override */ /** @override */
closureModuleDeps: [ closureModuleDeps: [
'cvox.BrailleUtil',
'cvox.ExpandingBrailleTranslator', 'cvox.ExpandingBrailleTranslator',
'cvox.LibLouis', 'cvox.LibLouis',
'cvox.Spannable', 'cvox.Spannable',
'cvox.ValueSelectionSpan',
'cvox.ValueSpan',
] ]
}; };
...@@ -73,8 +74,8 @@ function assertArrayBufferMatches(expected, actual) { ...@@ -73,8 +74,8 @@ function assertArrayBufferMatches(expected, actual) {
TEST_F('CvoxExpandingBrailleTranslatorUnitTest', 'TranslationError', TEST_F('CvoxExpandingBrailleTranslatorUnitTest', 'TranslationError',
function() { function() {
var text = new cvox.Spannable('error ok', new cvox.BrailleUtil.ValueSpan()); var text = new cvox.Spannable('error ok', new cvox.ValueSpan());
text.setSpan(new cvox.BrailleUtil.ValueSelectionSpan, 0, 0); text.setSpan(new cvox.ValueSelectionSpan, 0, 0);
var contractedTranslator = new FakeTranslator('c'); var contractedTranslator = new FakeTranslator('c');
// Translator that always results in an error. // Translator that always results in an error.
var uncontractedTranslator = { var uncontractedTranslator = {
...@@ -199,11 +200,10 @@ function runTranslationTestVariants(testCase, contracted, valueExpansion) { ...@@ -199,11 +200,10 @@ function runTranslationTestVariants(testCase, contracted, valueExpansion) {
function createText(text, opt_selectionStart, opt_selectionEnd) { function createText(text, opt_selectionStart, opt_selectionEnd) {
var result = new cvox.Spannable(text); var result = new cvox.Spannable(text);
result.setSpan( result.setSpan(new cvox.ValueSpan, 0, text.length);
new cvox.BrailleUtil.ValueSpan, 0, text.length);
if (goog.isDef(opt_selectionStart)) { if (goog.isDef(opt_selectionStart)) {
result.setSpan( result.setSpan(
new cvox.BrailleUtil.ValueSelectionSpan, new cvox.ValueSelectionSpan,
opt_selectionStart, opt_selectionStart,
goog.isDef(opt_selectionEnd) ? opt_selectionEnd : opt_selectionStart); goog.isDef(opt_selectionEnd) ? opt_selectionEnd : opt_selectionStart);
} }
......
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @fileoverview Objects used in spannables as annotations for ARIA values
* and selections.
*/
goog.provide('cvox.ValueSelectionSpan');
goog.provide('cvox.ValueSpan');
goog.require('cvox.Spannable');
/**
* Attached to the value region of a braille spannable.
* @param {number} offset The offset of the span into the value.
* @constructor
*/
cvox.ValueSpan = function(offset) {
/**
* The offset of the span into the value.
* @type {number}
*/
this.offset = offset;
};
/**
* Creates a value span from a json serializable object.
* @param {!Object} obj The json serializable object to convert.
* @return {!cvox.ValueSpan} The value span.
*/
cvox.ValueSpan.fromJson = function(obj) {
return new cvox.ValueSpan(obj.offset);
};
/**
* Converts this object to a json serializable object.
* @return {!Object} The JSON representation.
*/
cvox.ValueSpan.prototype.toJson = function() {
return this;
};
cvox.Spannable.registerSerializableSpan(
cvox.ValueSpan,
'cvox.ValueSpan',
cvox.ValueSpan.fromJson,
cvox.ValueSpan.prototype.toJson);
/**
* Attached to the selected text within a value.
* @constructor
*/
cvox.ValueSelectionSpan = function() {
};
cvox.Spannable.registerStatelessSerializableSpan(
cvox.ValueSelectionSpan,
'cvox.ValueSelectionSpan');
...@@ -12,6 +12,7 @@ goog.provide('cvox.TabsApiHandler'); ...@@ -12,6 +12,7 @@ goog.provide('cvox.TabsApiHandler');
goog.require('cvox.AbstractEarcons'); goog.require('cvox.AbstractEarcons');
goog.require('cvox.AbstractTts'); goog.require('cvox.AbstractTts');
goog.require('cvox.BrailleInterface'); goog.require('cvox.BrailleInterface');
goog.require('cvox.ChromeVox');
goog.require('cvox.NavBraille'); goog.require('cvox.NavBraille');
......
...@@ -8,15 +8,16 @@ ...@@ -8,15 +8,16 @@
goog.provide('cvox.BrailleUtil'); goog.provide('cvox.BrailleUtil');
goog.provide('cvox.BrailleUtil.ValueSelectionSpan');
goog.provide('cvox.BrailleUtil.ValueSpan');
goog.require('cvox.ChromeVox'); goog.require('cvox.ChromeVox');
goog.require('cvox.DomUtil'); goog.require('cvox.DomUtil');
goog.require('cvox.EditableTextAreaShadow');
goog.require('cvox.Focuser'); goog.require('cvox.Focuser');
goog.require('cvox.NavBraille'); goog.require('cvox.NavBraille');
goog.require('cvox.NodeStateUtil'); goog.require('cvox.NodeStateUtil');
goog.require('cvox.Spannable'); goog.require('cvox.Spannable');
goog.require('cvox.ValueSelectionSpan');
goog.require('cvox.ValueSpan');
/** /**
...@@ -80,59 +81,6 @@ cvox.BrailleUtil.TEMPLATE = { ...@@ -80,59 +81,6 @@ cvox.BrailleUtil.TEMPLATE = {
}; };
/**
* Attached to the value region of a braille spannable.
* @param {number} offset The offset of the span into the value.
* @constructor
*/
cvox.BrailleUtil.ValueSpan = function(offset) {
/**
* The offset of the span into the value.
* @type {number}
*/
this.offset = offset;
};
/**
* Creates a value span from a json serializable object.
* @param {!Object} obj The json serializable object to convert.
* @return {!cvox.BrailleUtil.ValueSpan} The value span.
*/
cvox.BrailleUtil.ValueSpan.fromJson = function(obj) {
return new cvox.BrailleUtil.ValueSpan(obj.offset);
};
/**
* Converts this object to a json serializable object.
* @return {!Object} The JSON representation.
*/
cvox.BrailleUtil.ValueSpan.prototype.toJson = function() {
return this;
};
cvox.Spannable.registerSerializableSpan(
cvox.BrailleUtil.ValueSpan,
'cvox.BrailleUtil.ValueSpan',
cvox.BrailleUtil.ValueSpan.fromJson,
cvox.BrailleUtil.ValueSpan.prototype.toJson);
/**
* Attached to the selected text within a value.
* @constructor
*/
cvox.BrailleUtil.ValueSelectionSpan = function() {
};
cvox.Spannable.registerStatelessSerializableSpan(
cvox.BrailleUtil.ValueSelectionSpan,
'cvox.BrailleUtil.ValueSelectionSpan');
/** /**
* Gets the braille name for a node. * Gets the braille name for a node.
* See DomUtil for a more precise definition of 'name'. * See DomUtil for a more precise definition of 'name'.
...@@ -220,8 +168,8 @@ cvox.BrailleUtil.getContainer = function(prev, node) { ...@@ -220,8 +168,8 @@ cvox.BrailleUtil.getContainer = function(prev, node) {
/** /**
* Gets the braille value of a node. A cvox.BrailleUtil.ValueSpan will be * Gets the braille value of a node. A {@code cvox.ValueSpan} will be
* attached, along with (possibly) a cvox.BrailleUtil.ValueSelectionSpan. * attached, along with (possibly) a {@code cvox.ValueSelectionSpan}.
* @param {Node} node The node. * @param {Node} node The node.
* @return {!cvox.Spannable} The value spannable. * @return {!cvox.Spannable} The value spannable.
*/ */
...@@ -229,7 +177,7 @@ cvox.BrailleUtil.getValue = function(node) { ...@@ -229,7 +177,7 @@ cvox.BrailleUtil.getValue = function(node) {
if (!node) { if (!node) {
return new cvox.Spannable(); return new cvox.Spannable();
} }
var valueSpan = new cvox.BrailleUtil.ValueSpan(0 /* offset */); var valueSpan = new cvox.ValueSpan(0 /* offset */);
if (cvox.DomUtil.isInputTypeText(node)) { if (cvox.DomUtil.isInputTypeText(node)) {
var value = node.value; var value = node.value;
if (node.type === 'password') { if (node.type === 'password') {
...@@ -242,7 +190,7 @@ cvox.BrailleUtil.getValue = function(node) { ...@@ -242,7 +190,7 @@ cvox.BrailleUtil.getValue = function(node) {
node.selectionStart, 0, spannable.getLength()); node.selectionStart, 0, spannable.getLength());
var selectionEnd = cvox.BrailleUtil.clamp_( var selectionEnd = cvox.BrailleUtil.clamp_(
node.selectionEnd, 0, spannable.getLength()); node.selectionEnd, 0, spannable.getLength());
spannable.setSpan(new cvox.BrailleUtil.ValueSelectionSpan(), spannable.setSpan(new cvox.ValueSelectionSpan(),
Math.min(selectionStart, selectionEnd), Math.min(selectionStart, selectionEnd),
Math.max(selectionStart, selectionEnd)); Math.max(selectionStart, selectionEnd));
} }
...@@ -261,7 +209,7 @@ cvox.BrailleUtil.getValue = function(node) { ...@@ -261,7 +209,7 @@ cvox.BrailleUtil.getValue = function(node) {
node.selectionStart - lineStart, 0, spannable.getLength()); node.selectionStart - lineStart, 0, spannable.getLength());
var selectionEnd = cvox.BrailleUtil.clamp_( var selectionEnd = cvox.BrailleUtil.clamp_(
node.selectionEnd - lineStart, 0, spannable.getLength()); node.selectionEnd - lineStart, 0, spannable.getLength());
spannable.setSpan(new cvox.BrailleUtil.ValueSelectionSpan(), spannable.setSpan(new cvox.ValueSelectionSpan(),
Math.min(selectionStart, selectionEnd), Math.min(selectionStart, selectionEnd),
Math.max(selectionStart, selectionEnd)); Math.max(selectionStart, selectionEnd));
} }
...@@ -333,7 +281,7 @@ cvox.BrailleUtil.getTemplated = function(prev, node, opt_override) { ...@@ -333,7 +281,7 @@ cvox.BrailleUtil.getTemplated = function(prev, node, opt_override) {
if (!component.toString() && template[i + 1] == ' ' && if (!component.toString() && template[i + 1] == ' ' &&
(!(component instanceof cvox.Spannable) || (!(component instanceof cvox.Spannable) ||
!/**@type {cvox.Spannable}*/(component).getSpanInstanceOf( !/**@type {cvox.Spannable}*/(component).getSpanInstanceOf(
cvox.BrailleUtil.ValueSelectionSpan))) { cvox.ValueSelectionSpan))) {
i++; i++;
} }
} }
...@@ -343,8 +291,8 @@ cvox.BrailleUtil.getTemplated = function(prev, node, opt_override) { ...@@ -343,8 +291,8 @@ cvox.BrailleUtil.getTemplated = function(prev, node, opt_override) {
/** /**
* Creates a braille value from a string and, optionally, a selection range. * Creates a braille value from a string and, optionally, a selection range.
* A cvox.BrailleUtil.ValueSpan will be * A {@code cvox.ValueSpan} will be attached, along with a
* attached, along with a cvox.BrailleUtil.ValueSelectionSpan if applicable. * {@code cvox.ValueSelectionSpan} if applicable.
* @param {string} text The text to display as the value. * @param {string} text The text to display as the value.
* @param {number=} opt_selStart Selection start. * @param {number=} opt_selStart Selection start.
* @param {number=} opt_selEnd Selection end if different from selection start. * @param {number=} opt_selEnd Selection end if different from selection start.
...@@ -354,7 +302,7 @@ cvox.BrailleUtil.getTemplated = function(prev, node, opt_override) { ...@@ -354,7 +302,7 @@ cvox.BrailleUtil.getTemplated = function(prev, node, opt_override) {
cvox.BrailleUtil.createValue = function(text, opt_selStart, opt_selEnd, cvox.BrailleUtil.createValue = function(text, opt_selStart, opt_selEnd,
opt_textOffset) { opt_textOffset) {
var spannable = new cvox.Spannable( var spannable = new cvox.Spannable(
text, new cvox.BrailleUtil.ValueSpan(opt_textOffset || 0)); text, new cvox.ValueSpan(opt_textOffset || 0));
if (goog.isDef(opt_selStart)) { if (goog.isDef(opt_selStart)) {
opt_selEnd = goog.isDef(opt_selEnd) ? opt_selEnd : opt_selStart; opt_selEnd = goog.isDef(opt_selEnd) ? opt_selEnd : opt_selStart;
// TODO(plundblad): This looses the distinction between the selection // TODO(plundblad): This looses the distinction between the selection
...@@ -366,8 +314,7 @@ cvox.BrailleUtil.createValue = function(text, opt_selStart, opt_selEnd, ...@@ -366,8 +314,7 @@ cvox.BrailleUtil.createValue = function(text, opt_selStart, opt_selEnd,
opt_selEnd = temp; opt_selEnd = temp;
} }
spannable.setSpan(new cvox.BrailleUtil.ValueSelectionSpan(), spannable.setSpan(new cvox.ValueSelectionSpan(), opt_selStart, opt_selEnd);
opt_selStart, opt_selEnd);
} }
return spannable; return spannable;
}; };
...@@ -395,7 +342,7 @@ cvox.BrailleUtil.click = function(braille, opt_displayPosition) { ...@@ -395,7 +342,7 @@ cvox.BrailleUtil.click = function(braille, opt_displayPosition) {
node instanceof HTMLTextAreaElement)) { node instanceof HTMLTextAreaElement)) {
var valueSpan = spans.filter( var valueSpan = spans.filter(
function(s) { function(s) {
return s instanceof cvox.BrailleUtil.ValueSpan; return s instanceof cvox.ValueSpan;
})[0]; })[0];
if (valueSpan) { if (valueSpan) {
if (document.activeElement !== node) { if (document.activeElement !== node) {
......
...@@ -389,32 +389,32 @@ TEST_F('CvoxBrailleUtilUnitTest', 'CreateValue', function() { ...@@ -389,32 +389,32 @@ TEST_F('CvoxBrailleUtilUnitTest', 'CreateValue', function() {
// Value without a selection. // Value without a selection.
s = cvox.BrailleUtil.createValue('value'); s = cvox.BrailleUtil.createValue('value');
assertEquals('value', s.toString()); assertEquals('value', s.toString());
assertUndefined(s.getSpanInstanceOf(cvox.BrailleUtil.ValueSelectionSpan)); assertUndefined(s.getSpanInstanceOf(cvox.ValueSelectionSpan));
valueSpan = s.getSpanInstanceOf(cvox.BrailleUtil.ValueSpan); valueSpan = s.getSpanInstanceOf(cvox.ValueSpan);
assertEquals(0, s.getSpanStart(valueSpan)); assertEquals(0, s.getSpanStart(valueSpan));
assertEquals(s.getLength(), s.getSpanEnd(valueSpan)); assertEquals(s.getLength(), s.getSpanEnd(valueSpan));
// Value with a carret at the start of the text. // Value with a carret at the start of the text.
s = cvox.BrailleUtil.createValue('value', 0); s = cvox.BrailleUtil.createValue('value', 0);
selectionSpan = s.getSpanInstanceOf(cvox.BrailleUtil.ValueSelectionSpan); selectionSpan = s.getSpanInstanceOf(cvox.ValueSelectionSpan);
assertEquals(0, s.getSpanStart(selectionSpan)); assertEquals(0, s.getSpanStart(selectionSpan));
assertEquals(0, s.getSpanEnd(selectionSpan)); assertEquals(0, s.getSpanEnd(selectionSpan));
// Value with a carret inside the text. // Value with a carret inside the text.
s = cvox.BrailleUtil.createValue('value', 1); s = cvox.BrailleUtil.createValue('value', 1);
selectionSpan = s.getSpanInstanceOf(cvox.BrailleUtil.ValueSelectionSpan); selectionSpan = s.getSpanInstanceOf(cvox.ValueSelectionSpan);
assertEquals(1, s.getSpanStart(selectionSpan)); assertEquals(1, s.getSpanStart(selectionSpan));
assertEquals(1, s.getSpanEnd(selectionSpan)); assertEquals(1, s.getSpanEnd(selectionSpan));
// Value with a carret at the end of the text. // Value with a carret at the end of the text.
s = cvox.BrailleUtil.createValue('value', 5); s = cvox.BrailleUtil.createValue('value', 5);
selectionSpan = s.getSpanInstanceOf(cvox.BrailleUtil.ValueSelectionSpan); selectionSpan = s.getSpanInstanceOf(cvox.ValueSelectionSpan);
assertEquals(5, s.getSpanStart(selectionSpan)); assertEquals(5, s.getSpanStart(selectionSpan));
assertEquals(5, s.getSpanEnd(selectionSpan)); assertEquals(5, s.getSpanEnd(selectionSpan));
// All of the value selected selected with reversed start and end. // All of the value selected selected with reversed start and end.
s = cvox.BrailleUtil.createValue('value', 5, 0); s = cvox.BrailleUtil.createValue('value', 5, 0);
selectionSpan = s.getSpanInstanceOf(cvox.BrailleUtil.ValueSelectionSpan); selectionSpan = s.getSpanInstanceOf(cvox.ValueSelectionSpan);
assertEquals(0, s.getSpanStart(selectionSpan)); assertEquals(0, s.getSpanStart(selectionSpan));
assertEquals(5, s.getSpanEnd(selectionSpan)); assertEquals(5, s.getSpanEnd(selectionSpan));
}); });
...@@ -95,6 +95,7 @@ CvoxEditableTextUnitTest.prototype = { ...@@ -95,6 +95,7 @@ CvoxEditableTextUnitTest.prototype = {
/** @override */ /** @override */
closureModuleDeps: [ closureModuleDeps: [
'cvox.ChromeVoxEditableElement',
'cvox.ChromeVoxEditableHTMLInput', 'cvox.ChromeVoxEditableHTMLInput',
'cvox.ChromeVoxEditableTextBase', 'cvox.ChromeVoxEditableTextBase',
'cvox.ChromeVoxEventWatcher', 'cvox.ChromeVoxEventWatcher',
...@@ -275,7 +276,7 @@ TEST_F('CvoxEditableTextUnitTest', 'Selection', function() { ...@@ -275,7 +276,7 @@ TEST_F('CvoxEditableTextUnitTest', 'Selection', function() {
TEST_F('CvoxEditableTextUnitTest', 'MultiLineText', function() { TEST_F('CvoxEditableTextUnitTest', 'MultiLineText', function() {
var str = 'This string\nspans\nfive lines.\n \n'; var str = 'This string\nspans\nfive lines.\n \n';
var tts = new TestTts(); var tts = new TestTts();
var obj = new cvox.ChromeVoxEditableTextBase(str, 0, 0, false, tts); var obj = new cvox.ChromeVoxEditableElement(null, str, 0, 0, false, tts);
obj.multiline = true; obj.multiline = true;
obj.getLineIndex = function(index) { obj.getLineIndex = function(index) {
if (index >= 33) { if (index >= 33) {
......
...@@ -18,15 +18,6 @@ goog.require('cursors.Cursor'); ...@@ -18,15 +18,6 @@ goog.require('cursors.Cursor');
goog.require('cvox.ChromeVoxEditableTextBase'); goog.require('cvox.ChromeVoxEditableTextBase');
goog.require('cvox.TabsApiHandler'); goog.require('cvox.TabsApiHandler');
// Define types here due to editable_text.js's implicit dependency with
// ChromeVoxEventWatcher.
/** @type {Object} */
cvox.ChromeVoxEventWatcher;
/** @type {function(boolean)} */
cvox.ChromeVoxEventWatcher.handleTextChanged;
/** @type {function()} */
cvox.ChromeVoxEventWatcher.setUpTextHandler;
goog.scope(function() { goog.scope(function() {
var AutomationNode = chrome.automation.AutomationNode; var AutomationNode = chrome.automation.AutomationNode;
var Dir = AutomationUtil.Dir; var Dir = AutomationUtil.Dir;
......
...@@ -13,9 +13,9 @@ goog.require('AutomationUtil.Dir'); ...@@ -13,9 +13,9 @@ goog.require('AutomationUtil.Dir');
goog.require('cursors.Cursor'); goog.require('cursors.Cursor');
goog.require('cursors.Range'); goog.require('cursors.Range');
goog.require('cursors.Unit'); goog.require('cursors.Unit');
goog.require('cvox.BrailleUtil.ValueSelectionSpan');
goog.require('cvox.BrailleUtil.ValueSpan');
goog.require('cvox.Spannable'); goog.require('cvox.Spannable');
goog.require('cvox.ValueSelectionSpan');
goog.require('cvox.ValueSpan');
goog.scope(function() { goog.scope(function() {
var Dir = AutomationUtil.Dir; var Dir = AutomationUtil.Dir;
...@@ -338,9 +338,9 @@ Output.prototype = { ...@@ -338,9 +338,9 @@ Output.prototype = {
} else { } else {
startIndex = valueStart + selSpan.startIndex; startIndex = valueStart + selSpan.startIndex;
endIndex = valueStart + selSpan.endIndex; endIndex = valueStart + selSpan.endIndex;
this.brailleBuffer_.setSpan(new cvox.BrailleUtil.ValueSpan(valueStart), this.brailleBuffer_.setSpan(new cvox.ValueSpan(valueStart),
valueStart, valueEnd); valueStart, valueEnd);
this.brailleBuffer_.setSpan(new cvox.BrailleUtil.ValueSelectionSpan(), this.brailleBuffer_.setSpan(new cvox.ValueSelectionSpan(),
startIndex, endIndex); startIndex, endIndex);
} }
} }
......
...@@ -24,9 +24,10 @@ CvoxBrailleIntegrationUnitTest.prototype = { ...@@ -24,9 +24,10 @@ CvoxBrailleIntegrationUnitTest.prototype = {
'cvox.BrailleBackground', 'cvox.BrailleBackground',
'cvox.BrailleInputHandler', 'cvox.BrailleInputHandler',
'cvox.BrailleKeyCommand', 'cvox.BrailleKeyCommand',
'cvox.BrailleUtil',
'cvox.ChromeBraille', 'cvox.ChromeBraille',
'cvox.ExpandingBrailleTranslator', 'cvox.ExpandingBrailleTranslator',
'cvox.ValueSelectionSpan',
'cvox.ValueSpan',
], ],
/** @override */ /** @override */
...@@ -146,8 +147,8 @@ TEST_F('CvoxBrailleIntegrationUnitTest', 'Write', function() { ...@@ -146,8 +147,8 @@ TEST_F('CvoxBrailleIntegrationUnitTest', 'Write', function() {
}); });
TEST_F('CvoxBrailleIntegrationUnitTest', 'WriteWithSpans', function() { TEST_F('CvoxBrailleIntegrationUnitTest', 'WriteWithSpans', function() {
var selectionSpan = new cvox.BrailleUtil.ValueSelectionSpan(); var selectionSpan = new cvox.ValueSelectionSpan();
var valueSpan = new cvox.BrailleUtil.ValueSpan(20); var valueSpan = new cvox.ValueSpan(20);
var toSend = cvox.NavBraille.fromText( var toSend = cvox.NavBraille.fromText(
new cvox.Spannable('Hello', valueSpan)); new cvox.Spannable('Hello', valueSpan));
toSend.text.setSpan(selectionSpan, 0, 0); toSend.text.setSpan(selectionSpan, 0, 0);
......
...@@ -214,8 +214,7 @@ cvox.LayoutLineWalker.prototype.extend_ = function(start) { ...@@ -214,8 +214,7 @@ cvox.LayoutLineWalker.prototype.extend_ = function(start) {
cvox.LayoutLineWalker.prototype.appendBraille_ = function( cvox.LayoutLineWalker.prototype.appendBraille_ = function(
prevSel, sel, cur, braille) { prevSel, sel, cur, braille) {
var item = this.subWalker_.getBraille(prevSel, cur).text; var item = this.subWalker_.getBraille(prevSel, cur).text;
var valueSelectionSpan = item.getSpanInstanceOf( var valueSelectionSpan = item.getSpanInstanceOf(cvox.ValueSelectionSpan);
cvox.BrailleUtil.ValueSelectionSpan);
if (braille.text.getLength() > 0) { if (braille.text.getLength() > 0) {
braille.text.append(cvox.BrailleUtil.ITEM_SEPARATOR); braille.text.append(cvox.BrailleUtil.ITEM_SEPARATOR);
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
goog.provide('cvox.StructuralLineWalker'); goog.provide('cvox.StructuralLineWalker');
goog.require('cvox.AbstractSelectionWalker'); goog.require('cvox.AbstractSelectionWalker');
goog.require('cvox.BrailleUtil');
goog.require('cvox.TraverseContent'); goog.require('cvox.TraverseContent');
/** /**
......
...@@ -17,7 +17,6 @@ CvoxStructuralLineWalkerUnitTest.prototype = { ...@@ -17,7 +17,6 @@ CvoxStructuralLineWalkerUnitTest.prototype = {
/** @override */ /** @override */
closureModuleDeps: [ closureModuleDeps: [
'cvox.BrailleUtil',
'cvox.StructuralLineWalker', 'cvox.StructuralLineWalker',
'cvox.TestMsgs', 'cvox.TestMsgs',
], ],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment