layout: Query and maintain the position of the insertion point

throughout layout for input elements.
This commit is contained in:
Patrick Walton 2015-09-15 16:31:46 -07:00
parent 34d9a6091b
commit 357419dc8d
6 changed files with 152 additions and 41 deletions

View file

@ -144,6 +144,8 @@ pub trait LayoutHTMLInputElementHelpers {
unsafe fn get_value_for_layout(self) -> String;
#[allow(unsafe_code)]
unsafe fn get_size_for_layout(self) -> u32;
#[allow(unsafe_code)]
unsafe fn get_insertion_point_for_layout(self) -> TextPoint;
}
pub trait RawLayoutHTMLInputElementHelpers {
@ -194,6 +196,12 @@ impl LayoutHTMLInputElementHelpers for LayoutJS<HTMLInputElement> {
unsafe fn get_size_for_layout(self) -> u32 {
(*self.unsafe_get()).get_size_for_layout()
}
#[allow(unrooted_must_root)]
#[allow(unsafe_code)]
unsafe fn get_insertion_point_for_layout(self) -> TextPoint {
(*self.unsafe_get()).textinput.borrow_for_layout().edit_point
}
}
impl RawLayoutHTMLInputElementHelpers for HTMLInputElement {