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.ValueSelectionSpan');
11 goog
.provide('cvox.ValueSpan');
13 goog
.require('cvox.Spannable');
16 * Attached to the value region of a braille spannable.
17 * @param {number} offset The offset of the span into the value.
20 cvox
.ValueSpan = function(offset
) {
22 * The offset of the span into the value.
30 * Creates a value span from a json serializable object.
31 * @param {!Object} obj The json serializable object to convert.
32 * @return {!cvox.ValueSpan} The value span.
34 cvox
.ValueSpan
.fromJson = function(obj
) {
35 return new cvox
.ValueSpan(obj
.offset
);
40 * Converts this object to a json serializable object.
41 * @return {!Object} The JSON representation.
43 cvox
.ValueSpan
.prototype.toJson = function() {
48 cvox
.Spannable
.registerSerializableSpan(
51 cvox
.ValueSpan
.fromJson
,
52 cvox
.ValueSpan
.prototype.toJson
);
56 * Attached to the selected text within a value.
59 cvox
.ValueSelectionSpan = function() {
63 cvox
.Spannable
.registerStatelessSerializableSpan(
64 cvox
.ValueSelectionSpan
,
65 'cvox.ValueSelectionSpan');