Chromium Code Reviews| 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 480b444c698145795f5bd4540066957649fa0563..b19fb53548fa3932d691b4df9002be96e59215cc 100644 |
| --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js |
| +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js |
| @@ -142,7 +142,7 @@ cursors.Cursor.prototype = { |
| for (var i = 0; i < this.ancestry_.length; i++) { |
| var firstValidNode = this.ancestry_[i]; |
| if (firstValidNode != null && firstValidNode.role !== undefined && |
| - firstValidNode.root !== undefined) { |
| + firstValidNode.root != undefined) { |
|
hidehiko
2017/03/21 03:43:23
nit: looks unnecessary change? (Or any reasons to
David Tseng
2017/03/21 16:41:16
It actually is. There are some cases, particularly
hidehiko
2017/03/21 22:00:43
firstValidNode.root can be null, I think it's nice
|
| return firstValidNode; |
| } |
| // If we have to walk up to an ancestor, reset the index to NODE_INDEX. |
| @@ -176,9 +176,9 @@ cursors.Cursor.prototype = { |
| // Selections over line break nodes are broken. |
| var parent = adjustedNode.parent; |
| var grandparent = parent && parent.parent; |
| - if (parent.role == RoleType.LINE_BREAK) { |
| + if (parent && parent.role == RoleType.LINE_BREAK) { |
| adjustedNode = grandparent; |
| - } else if (grandparent.role == RoleType.LINE_BREAK) { |
| + } else if (grandparent && grandparent.role == RoleType.LINE_BREAK) { |
| adjustedNode = grandparent.parent; |
| } else if (this.index_ == cursors.NODE_INDEX || |
| adjustedNode.role == RoleType.INLINE_TEXT_BOX || |