Commit d8b6beba authored by David Tseng's avatar David Tseng Committed by Commit Bot

Reland Use tree path based recovery by default

This reverts commit 697307bb.

TBR=dmazzoni,chrishall

Bug: 885244,893396
Change-Id: I54ea0a3a8e71e7da39078245318608cc66c28c93
Reviewed-on: https://chromium-review.googlesource.com/c/1286815
Commit-Queue: David Tseng <dtseng@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600586}
parent deb11af0
...@@ -1764,7 +1764,12 @@ TEST_F('BackgroundTest', 'TabSwitchAndRefreshRecovery', function() { ...@@ -1764,7 +1764,12 @@ TEST_F('BackgroundTest', 'TabSwitchAndRefreshRecovery', function() {
.expectSpeech('tab2') .expectSpeech('tab2')
.clearPendingOutput() .clearPendingOutput()
.call(press(82 /* R */, {ctrl: true})) .call(press(82 /* R */, {ctrl: true}))
.expectSpeech('tab2')
// ChromeVox stays on the same node due to tree path recovery.
.call(() => {
assertEquals('tab2',
ChromeVoxState.instance.currentRange.start.node.name);
})
.replay(); .replay();
}); });
}); });
...@@ -1797,3 +1802,31 @@ TEST_F('BackgroundTest', 'LayoutTable', function() { ...@@ -1797,3 +1802,31 @@ TEST_F('BackgroundTest', 'LayoutTable', function() {
.replay(); .replay();
}); });
}); });
TEST_F('BackgroundTest', 'ReinsertedNodeRecovery', function() {
var mockFeedback = this.createMockFeedback();
this.runWithLoadedTree(function(root) {/*
<div>
<button id="start">start</button>
<button id="hot">hot</button>
</div>
<button id="end">end</button>
<script>
var div = document.body.firstElementChild;
var start = document.getElementById('start');
document.getElementById('hot').addEventListener('focus', (evt) => {
var hot = evt.target;
hot.remove();
div.insertAfter(hot, start);
});
</script>
*/}, function(root) {
mockFeedback.expectSpeech('start')
.clearPendingOutput()
.call(doCmd('nextObject'))
.call(doCmd('nextObject'))
.call(doCmd('nextObject'))
.expectSpeech('end', 'Button')
.replay();
});
});
...@@ -103,7 +103,7 @@ cursors.Cursor = function(node, index) { ...@@ -103,7 +103,7 @@ cursors.Cursor = function(node, index) {
/** @type {number} @private */ /** @type {number} @private */
this.index_ = index; this.index_ = index;
/** @type {RecoveryStrategy} */ /** @type {RecoveryStrategy} */
this.recovery_ = new AncestryRecoveryStrategy(node); this.recovery_ = new TreePathRecoveryStrategy(node);
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment