aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/textinput.rs
diff options
context:
space:
mode:
authorConnor Brewster <connor.brewster@eagles.oc.edu>2016-07-06 16:14:32 -0600
committerConnor Brewster <connor.brewster@eagles.oc.edu>2016-07-06 16:14:32 -0600
commit8e5d5a45efb5211420e75d075fe427021542cada (patch)
treedb36ef26abc2bfa9b0253ed85743e17db8658630 /components/script/textinput.rs
parent7da28b7ca63c7b4538aa1b81b7ad1182415c32f2 (diff)
downloadservo-8e5d5a45efb5211420e75d075fe427021542cada.tar.gz
servo-8e5d5a45efb5211420e75d075fe427021542cada.zip
Take selection direction into account when setting selection
Diffstat (limited to 'components/script/textinput.rs')
-rw-r--r--components/script/textinput.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/components/script/textinput.rs b/components/script/textinput.rs
index 871af9637c0..5beee247f96 100644
--- a/components/script/textinput.rs
+++ b/components/script/textinput.rs
@@ -651,8 +651,17 @@ impl<T: ClipboardProvider> TextInput<T> {
start = end;
}
- self.selection_begin = Some(self.get_text_point_for_absolute_point(start));
- self.edit_point = self.get_text_point_for_absolute_point(end);
+ match self.selection_direction {
+ SelectionDirection::None |
+ SelectionDirection::Forward => {
+ self.selection_begin = Some(self.get_text_point_for_absolute_point(start));
+ self.edit_point = self.get_text_point_for_absolute_point(end);
+ },
+ SelectionDirection::Backward => {
+ self.selection_begin = Some(self.get_text_point_for_absolute_point(end));
+ self.edit_point = self.get_text_point_for_absolute_point(start);
+ }
+ }
self.assert_ok_selection();
}