mirror of
https://github.com/servo/servo.git
synced 2025-06-18 22:34:30 +01:00
Auto merge of #7764 - j3parker:input-caret-only-for-text, r=pcwalton
Only display text carets in text inputs For #7756 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7764) <!-- Reviewable:end -->
This commit is contained in:
commit
0c64e4a2c9
5 changed files with 40 additions and 12 deletions
|
@ -143,7 +143,7 @@ pub trait LayoutHTMLInputElementHelpers {
|
|||
#[allow(unsafe_code)]
|
||||
unsafe fn get_size_for_layout(self) -> u32;
|
||||
#[allow(unsafe_code)]
|
||||
unsafe fn get_insertion_point_for_layout(self) -> TextPoint;
|
||||
unsafe fn get_insertion_point_for_layout(self) -> Option<TextPoint>;
|
||||
}
|
||||
|
||||
pub trait RawLayoutHTMLInputElementHelpers {
|
||||
|
@ -197,8 +197,12 @@ impl LayoutHTMLInputElementHelpers for LayoutJS<HTMLInputElement> {
|
|||
|
||||
#[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
|
||||
unsafe fn get_insertion_point_for_layout(self) -> Option<TextPoint> {
|
||||
match (*self.unsafe_get()).input_type.get() {
|
||||
InputType::InputText | InputType::InputPassword =>
|
||||
Some((*self.unsafe_get()).textinput.borrow_for_layout().edit_point),
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue