diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs
index e02d43c8278..f96c89e7dfa 100644
--- a/components/script/dom/htmlinputelement.rs
+++ b/components/script/dom/htmlinputelement.rs
@@ -27,9 +27,9 @@ use dom::node::{Node, NodeDamage, NodeTypeId};
use dom::node::{document_from_node, window_from_node};
use dom::virtualmethods::VirtualMethods;
use msg::constellation_msg::ConstellationChan;
-use textinput::KeyReaction::{TriggerDefaultAction, DispatchInput, Nothing};
+use textinput::KeyReaction::{TriggerDefaultAction, DispatchInput, Nothing, RedrawSelection};
use textinput::Lines::Single;
-use textinput::TextInput;
+use textinput::{TextInput, TextPoint};
use string_cache::Atom;
use util::str::DOMString;
@@ -599,6 +599,9 @@ impl VirtualMethods for HTMLInputElement {
self.force_relayout();
event.PreventDefault();
}
+ RedrawSelection => {
+ self.force_relayout();
+ }
Nothing => (),
}
});
diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs
index f1682d2270b..fd1713057ee 100644
--- a/components/script/dom/htmltextareaelement.rs
+++ b/components/script/dom/htmltextareaelement.rs
@@ -350,6 +350,9 @@ impl VirtualMethods for HTMLTextAreaElement {
self.force_relayout();
}
+ KeyReaction::RedrawSelection => {
+ self.force_relayout();
+ }
KeyReaction::Nothing => (),
}
});
diff --git a/components/script/textinput.rs b/components/script/textinput.rs
index 8330b19f01f..0adffc77d34 100644
--- a/components/script/textinput.rs
+++ b/components/script/textinput.rs
@@ -49,6 +49,7 @@ pub struct TextInput {
pub enum KeyReaction {
TriggerDefaultAction,
DispatchInput,
+ RedrawSelection,
Nothing,
}
@@ -366,7 +367,7 @@ impl TextInput {
match key {
Key::A if is_control_key(mods) => {
self.select_all();
- KeyReaction::Nothing
+ KeyReaction::RedrawSelection
},
Key::C if is_control_key(mods) => {
if let Some(text) = self.get_selection_text() {
@@ -397,36 +398,36 @@ impl TextInput {
}
Key::Left => {
self.adjust_horizontal_by_one(Direction::Backward, maybe_select);
- KeyReaction::Nothing
+ KeyReaction::RedrawSelection
}
Key::Right => {
self.adjust_horizontal_by_one(Direction::Forward, maybe_select);
- KeyReaction::Nothing
+ KeyReaction::RedrawSelection
}
Key::Up => {
self.adjust_vertical(-1, maybe_select);
- KeyReaction::Nothing
+ KeyReaction::RedrawSelection
}
Key::Down => {
self.adjust_vertical(1, maybe_select);
- KeyReaction::Nothing
+ KeyReaction::RedrawSelection
}
Key::Enter | Key::KpEnter => self.handle_return(),
Key::Home => {
self.edit_point.index = 0;
- KeyReaction::Nothing
+ KeyReaction::RedrawSelection
}
Key::End => {
self.edit_point.index = self.current_line_length();
- KeyReaction::Nothing
+ KeyReaction::RedrawSelection
}
Key::PageUp => {
self.adjust_vertical(-28, maybe_select);
- KeyReaction::Nothing
+ KeyReaction::RedrawSelection
}
Key::PageDown => {
self.adjust_vertical(28, maybe_select);
- KeyReaction::Nothing
+ KeyReaction::RedrawSelection
}
Key::Tab => KeyReaction::TriggerDefaultAction,
_ => KeyReaction::Nothing,