Auto merge of #20089 - paavininanda:RevertChanges, r=jdm

Revert previously merged code, better implementation for Default selectionStart and selectionEnd

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [x] There are tests for these changes

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20089)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-02-22 17:35:33 -05:00 committed by GitHub
commit 0fa3248723
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 85 additions and 98 deletions

View file

@ -27,7 +27,7 @@ fn test_set_content_ignores_max_length() {
Lines::Single, DOMString::from(""), DummyClipboardContext::new(""), Some(1), None, SelectionDirection::None
);
textinput.set_content(DOMString::from("mozilla rocks"), true);
textinput.set_content(DOMString::from("mozilla rocks"));
assert_eq!(textinput.get_content(), DOMString::from("mozilla rocks"));
}
@ -489,15 +489,16 @@ fn test_textinput_set_content() {
let mut textinput = text_input(Lines::Multiple, "abc\nde\nf");
assert_eq!(textinput.get_content(), "abc\nde\nf");
textinput.set_content(DOMString::from("abc\nf"), true);
textinput.set_content(DOMString::from("abc\nf"));
assert_eq!(textinput.get_content(), "abc\nf");
assert_eq!(textinput.edit_point().line, 0);
assert_eq!(textinput.edit_point().index, 0);
textinput.adjust_horizontal(3, Selection::Selected);
assert_eq!(textinput.edit_point().line, 0);
assert_eq!(textinput.edit_point().index, 3);
textinput.set_content(DOMString::from("de"), true);
textinput.set_content(DOMString::from("de"));
assert_eq!(textinput.get_content(), "de");
assert_eq!(textinput.edit_point().line, 0);
assert_eq!(textinput.edit_point().index, 2);