aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/textinput.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/textinput.rs')
-rw-r--r--components/script/textinput.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/components/script/textinput.rs b/components/script/textinput.rs
index d703ccee987..7883b471117 100644
--- a/components/script/textinput.rs
+++ b/components/script/textinput.rs
@@ -242,6 +242,12 @@ impl<T: ClipboardProvider> TextInput<T> {
self.selection_start_offset() .. self.selection_end_offset()
}
+ /// A tuple containing the (start, end, direction) of the current selection. Can be used to
+ /// compare whether selection state has changed.
+ pub fn selection_state(&self) -> (TextPoint, TextPoint, SelectionDirection) {
+ (self.selection_start(), self.selection_end(), self.selection_direction)
+ }
+
// Check that the selection is valid.
fn assert_ok_selection(&self) {
if let Some(begin) = self.selection_origin {