mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Relayout text input elements on blur
This commit is contained in:
parent
1b0053f8b1
commit
23e7dfa57b
5 changed files with 33 additions and 6 deletions
|
@ -208,6 +208,9 @@ impl LayoutHTMLInputElementHelpers for LayoutJS<HTMLInputElement> {
|
|||
#[allow(unrooted_must_root)]
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn get_insertion_point_index_for_layout(self) -> Option<isize> {
|
||||
if !(*self.unsafe_get()).upcast::<Element>().get_focus_state() {
|
||||
return None;
|
||||
}
|
||||
match (*self.unsafe_get()).input_type.get() {
|
||||
InputType::InputText => {
|
||||
let raw = self.get_value_for_layout();
|
||||
|
@ -716,6 +719,13 @@ impl VirtualMethods for HTMLInputElement {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_blur(&self) {
|
||||
if let Some(s) = self.super_type() {
|
||||
s.handle_blur();
|
||||
}
|
||||
self.force_relayout();
|
||||
}
|
||||
}
|
||||
|
||||
impl FormControl for HTMLInputElement {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue