1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 * @fileoverview Objects used in spannables as annotations for ARIA values
10 goog.provide('cvox.ExtraCellsSpan');
11 goog.provide('cvox.ValueSelectionSpan');
12 goog.provide('cvox.ValueSpan');
14 goog.require('cvox.Spannable');
17 * Attached to the value region of a braille spannable.
18 * @param {number} offset The offset of the span into the value.
21 cvox.ValueSpan = function(offset) {
23 * The offset of the span into the value.
31 * Creates a value span from a json serializable object.
32 * @param {!Object} obj The json serializable object to convert.
33 * @return {!cvox.ValueSpan} The value span.
35 cvox.ValueSpan.fromJson = function(obj) {
36 return new cvox.ValueSpan(obj.offset);
41 * Converts this object to a json serializable object.
42 * @return {!Object} The JSON representation.
44 cvox.ValueSpan.prototype.toJson = function() {
49 cvox.Spannable.registerSerializableSpan(
52 cvox.ValueSpan.fromJson,
53 cvox.ValueSpan.prototype.toJson);
57 * Attached to the selected text within a value.
60 cvox.ValueSelectionSpan = function() {
64 cvox.Spannable.registerStatelessSerializableSpan(
65 cvox.ValueSelectionSpan,
66 'cvox.ValueSelectionSpan');
70 * Causes raw cells to be added when translating from text to braille.
71 * This is supported by the {@code cvox.ExpandingBrailleTranslator}
75 cvox.ExtraCellsSpan = function() {
76 /** @type {ArrayBuffer} */
77 this.cells = new Uint8Array(0).buffer;