Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2043)

Unified Diff: chrome/browser/resources/chromeos/chromevox/braille/spans.js

Issue 889593002: Refactorings to reduce dependencies in ChromeVox 2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix copyright year. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/chromeos/chromevox/braille/spans.js
diff --git a/chrome/browser/resources/chromeos/chromevox/braille/spans.js b/chrome/browser/resources/chromeos/chromevox/braille/spans.js
new file mode 100644
index 0000000000000000000000000000000000000000..560fa0fca67901cde043daf056cd42a409477015
--- /dev/null
+++ b/chrome/browser/resources/chromeos/chromevox/braille/spans.js
@@ -0,0 +1,65 @@
+// 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');

Powered by Google App Engine
This is Rietveld 408576698