diff options
author | Matt Brubeck <mbrubeck@limpet.net> | 2016-04-28 14:52:02 -0700 |
---|---|---|
committer | Matt Brubeck <mbrubeck@limpet.net> | 2016-04-28 14:54:07 -0700 |
commit | c4872d95445636ef4dec45cbfc5c2d643c4b9441 (patch) | |
tree | e264cb26ec0ff6ece0b5f503d5f438d33d755c00 /components/script/dom/htmlinputelement.rs | |
parent | 659305fe0a8f94e950ca64fab5ccef9949abd295 (diff) | |
download | servo-c4872d95445636ef4dec45cbfc5c2d643c4b9441.tar.gz servo-c4872d95445636ef4dec45cbfc5c2d643c4b9441.zip |
Replace range::Range with std::ops::Range in script
Diffstat (limited to 'components/script/dom/htmlinputelement.rs')
-rw-r--r-- | components/script/dom/htmlinputelement.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index a5bdacf44a4..e37d0ea4b9b 100644 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -31,13 +31,13 @@ use dom::nodelist::NodeList; use dom::validation::Validatable; use dom::virtualmethods::VirtualMethods; use msg::constellation_msg::ConstellationChan; -use range::Range; use script_runtime::CommonScriptMsg; use script_runtime::ScriptThreadEventCategory::InputEvent; use script_thread::Runnable; use script_traits::ScriptMsg as ConstellationMsg; use std::borrow::ToOwned; use std::cell::Cell; +use std::ops::Range; use string_cache::Atom; use style::element_state::*; use textinput::KeyReaction::{DispatchInput, Nothing, RedrawSelection, TriggerDefaultAction}; @@ -245,12 +245,11 @@ impl LayoutHTMLInputElementHelpers for LayoutJS<HTMLInputElement> { let sel = textinput.get_absolute_selection_range(); // Translate indices from the raw value to indices in the replacement value. - let char_start = text[.. sel.begin()].chars().count(); - let char_count = text[sel.begin() .. sel.end()].chars().count(); + let char_start = text[.. sel.start].chars().count(); + let char_end = char_start + text[sel].chars().count(); let bytes_per_char = PASSWORD_REPLACEMENT_CHAR.len_utf8(); - Some(Range::new(char_start * bytes_per_char, - char_count * bytes_per_char)) + Some(char_start * bytes_per_char .. char_end * bytes_per_char) } InputType::InputText => Some(textinput.get_absolute_selection_range()), _ => None |