diff options
author | Jon Leighton <j@jonathanleighton.com> | 2017-12-09 22:23:47 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2018-01-26 19:50:53 +0100 |
commit | e34f7c58c933494be4f4af3fdfa45601c225d75f (patch) | |
tree | 671646a37eeb0d9f11b30a899aa809add60159a4 /components/script/textinput.rs | |
parent | 648bfbeb022d02fca3fb6da14a6247390d0f070b (diff) | |
download | servo-e34f7c58c933494be4f4af3fdfa45601c225d75f.tar.gz servo-e34f7c58c933494be4f4af3fdfa45601c225d75f.zip |
Don't fire select event when selection hasn't changed
Diffstat (limited to 'components/script/textinput.rs')
-rw-r--r-- | components/script/textinput.rs | 6 |
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 { |