| Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js
|
| diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js
|
| index 974e0a4f0d7313363085ca4bd8f2a114a191d849..074cbdac315723cea6103eacd38debeb5420d18d 100644
|
| --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js
|
| +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js
|
| @@ -97,6 +97,7 @@ cursors.Cursor.fromNode = function(node) {
|
| cursors.Cursor.prototype = {
|
| /**
|
| * Returns true if |rhs| is equal to this cursor.
|
| + * Use this for strict equality between cursors.
|
| * @param {!cursors.Cursor} rhs
|
| * @return {boolean}
|
| */
|
| @@ -106,6 +107,30 @@ cursors.Cursor.prototype = {
|
| },
|
|
|
| /**
|
| + * Returns true if |rhs| is equal to this cursor.
|
| + * Use this for loose equality between cursors where specific character-based
|
| + * indicies do not matter such as when processing node-targeted events.
|
| + * @param {!cursors.Cursor} rhs
|
| + * @return {boolean}
|
| + */
|
| + contentEquals: function(rhs) {
|
| + // First, normalize the two nodes so they both point to the first non-text
|
| + // node.
|
| + var lNode = this.node;
|
| + var rNode = rhs.node;
|
| + while (lNode && (lNode.role == RoleType.inlineTextBox ||
|
| + lNode.role == RoleType.staticText))
|
| + lNode = lNode.parent;
|
| + while (rNode && (rNode.role == RoleType.inlineTextBox ||
|
| + rNode.role == RoleType.staticText))
|
| + rNode = rNode.parent;
|
| +
|
| + // Ignore indicies for now.
|
| +
|
| + return lNode === rNode && lNode != undefined;
|
| + },
|
| +
|
| + /**
|
| * Returns the node. If the node is invalid since the last time it
|
| * was accessed, moves the cursor to the nearest valid ancestor first.
|
| * @return {AutomationNode}
|
| @@ -480,6 +505,7 @@ cursors.Range.getDirection = function(rangeA, rangeB) {
|
| cursors.Range.prototype = {
|
| /**
|
| * Returns true if |rhs| is equal to this range.
|
| + * Use this for strict equality between ranges.
|
| * @param {!cursors.Range} rhs
|
| * @return {boolean}
|
| */
|
| @@ -489,6 +515,17 @@ cursors.Range.prototype = {
|
| },
|
|
|
| /**
|
| + * Returns true if |rhs| is equal to this range.
|
| + * Use this for loose equality between ranges.
|
| + * @param {!cursors.Range} rhs
|
| + * @return {boolean}
|
| + */
|
| + contentEquals: function(rhs) {
|
| + return this.start_.contentEquals(rhs.start) &&
|
| + this.end_.contentEquals(rhs.end);
|
| + },
|
| +
|
| + /**
|
| * Gets a cursor bounding this range.
|
| * @param {Dir} dir Which endpoint cursor to return; Dir.FORWARD for end,
|
| * Dir.BACKWARD for start.
|
|
|