mirror of
https://github.com/servo/servo.git
synced 2025-07-30 10:40:27 +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
|
@ -954,18 +954,20 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
|||
let insertion_point = unsafe {
|
||||
input.get_insertion_point_for_layout()
|
||||
};
|
||||
let text = unsafe {
|
||||
input.get_value_for_layout()
|
||||
};
|
||||
if let Some(insertion_point) = insertion_point {
|
||||
let text = unsafe {
|
||||
input.get_value_for_layout()
|
||||
};
|
||||
|
||||
let mut character_count = 0;
|
||||
for (character_index, _) in text.char_indices() {
|
||||
if character_index == insertion_point.index {
|
||||
return Some(CharIndex(character_count))
|
||||
let mut character_count = 0;
|
||||
for (character_index, _) in text.char_indices() {
|
||||
if character_index == insertion_point.index {
|
||||
return Some(CharIndex(character_count))
|
||||
}
|
||||
character_count += 1
|
||||
}
|
||||
character_count += 1
|
||||
return Some(CharIndex(character_count))
|
||||
}
|
||||
return Some(CharIndex(character_count))
|
||||
}
|
||||
None
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue