mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +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
|
@ -45,7 +45,7 @@ pub trait LayoutHTMLTextAreaElementHelpers {
|
|||
#[allow(unsafe_code)]
|
||||
unsafe fn get_value_for_layout(self) -> String;
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn get_absolute_insertion_point_for_layout(self) -> usize;
|
||||
unsafe fn get_absolute_insertion_point_for_layout(self) -> Option<usize>;
|
||||
#[allow(unsafe_code)]
|
||||
fn get_cols(self) -> u32;
|
||||
#[allow(unsafe_code)]
|
||||
|
@ -61,8 +61,13 @@ impl LayoutHTMLTextAreaElementHelpers for LayoutJS<HTMLTextAreaElement> {
|
|||
|
||||
#[allow(unrooted_must_root)]
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn get_absolute_insertion_point_for_layout(self) -> usize {
|
||||
(*self.unsafe_get()).textinput.borrow_for_layout().get_absolute_insertion_point()
|
||||
unsafe fn get_absolute_insertion_point_for_layout(self) -> Option<usize> {
|
||||
if (*self.unsafe_get()).upcast::<Element>().get_focus_state() {
|
||||
Some((*self.unsafe_get()).textinput.borrow_for_layout()
|
||||
.get_absolute_insertion_point())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue