Auto merge of #8265 - fiji-flo:password_caret, r=eefriedman

add get_raw_layout_value (HTMLInputElementHelpers)

This resolves #8107
Previously the index of the insetion point for a password input was
calculated using the scrambled string based on the edit point in the
raw string. That could lead to a wrong position of the caret. This
commit changes this behavior to calculate the insertion point using
the raw string.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8265)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-11-04 05:29:59 +05:30
commit e91169c0e2
2 changed files with 31 additions and 21 deletions

View file

@ -1004,10 +1004,9 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
return Some(CharIndex(search_index(insertion_point, text.char_indices())));
}
if let Some(input) = this.downcast::<HTMLInputElement>() {
let insertion_point = unsafe { input.get_insertion_point_for_layout() };
if let Some(insertion_point) = insertion_point {
let text = unsafe { input.get_value_for_layout() };
return Some(CharIndex(search_index(insertion_point.index, text.char_indices())));
let insertion_point_index = unsafe { input.get_insertion_point_index_for_layout() };
if let Some(insertion_point_index) = insertion_point_index {
return Some(CharIndex(insertion_point_index));
}
}
None