servo/components/script
bors-servo 31c618895b
Auto merge of #22458 - denismerigoux:master, r=jdm
Fixed bug in textinput::adjust_vertical concerning selection_origin

<!-- Please describe your changes on the following line: -->
The `adjust_vertical` function of the `TextInput` module was forgetting to update the `selection_origin`.

I discovered the bug and figured out how it fix it using formal verification. More precisely, I manually translated the Rust code in a [F*](https://www.fstar-lang.org/) program that was functionally equivalent. Then I used the `assert_ok_selection` as a post-condition on the following functions :

* `select_all`
* `clear_selection`
* `adjust_selection_for_horizontal_change`
* `clear_selection_to_limit`
* `adjust_vertical`
* `perform_horizontal_adjustment`
* `adjust_horizontal`
* `adjust_horizontal_to_line_end`

I managed to prove automatically (using the Z3 backend of F*) that the post-condition held for all the functions except for `adjust_vertical`. I used the error messages from F* to infer the missing code so that the postcondition could hold and manually translated it to this PR diff.

I also added a simple unit test that would fail without this patch, and observed that the assertion failures noted in https://github.com/servo/servo/issues/22457 disappeared with this patch.

This verification work also allows me to say that the code of all the functions is now functionally correct in the sense that they all yield a valid selection in the sense of `asssert_ok_selection`, in all cases.

---
<!-- 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 #22457 (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/22458)
<!-- Reviewable:end -->
2018-12-23 01:00:12 -05:00
..
docs Replace http with https in docs 2018-11-06 11:39:09 +01:00
dom Auto merge of #22456 - dlrobertson:fix_src, r=ferjm 2018-12-22 23:50:40 -05:00
task_source Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
body.rs Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
build.rs Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
Cargo.toml Make the parser decode input from document's encoding 2018-12-12 13:50:27 +01:00
clipboard_provider.rs Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
CMakeLists.txt build(cmake): detect python binary for specified version 2018-03-13 09:25:06 -07:00
devtools.rs Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
document_loader.rs Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
fetch.rs Remove foreign service-workers mode 2018-12-23 01:48:45 +08:00
layout_image.rs refactored performance timing to align with updated spec 2018-11-20 16:21:32 +00:00
lib.rs Auto merge of #22225 - servo:webgl, r=emilio 2018-11-21 10:21:41 -05:00
mem.rs Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
microtask.rs Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
network_listener.rs refactored performance timing to align with updated spec 2018-11-20 16:21:32 +00:00
script_runtime.rs Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
script_thread.rs Auto merge of #22395 - jdm:initial-iframe-size, r=Manishearth 2018-12-18 08:51:26 -05:00
serviceworker_manager.rs Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
serviceworkerjob.rs Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
stylesheet_loader.rs refactored performance timing to align with updated spec 2018-11-20 16:21:32 +00:00
task.rs Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
task_manager.rs Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
task_queue.rs Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
test.rs Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
textinput.rs Fixed bug in textinput::adjust_vertical concerning selection_origin update 2018-12-22 17:50:24 +01:00
timers.rs Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
unpremultiplytable.rs Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
webdriver_handlers.rs Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00