Commit graph

31371 commits

Author SHA1 Message Date
Jon Leighton
e34f7c58c9 Don't fire select event when selection hasn't changed 2018-01-26 19:50:53 +01:00
Jon Leighton
648bfbeb02 Fix clearing the selection when value is changed
The implementation of adjust_horizontal_to_limit() is written with UI in
mind. As such, when there's a selection and we "adjust horizontal", the
selection will be cleared and the cursor will and up at the start/end of
the previous selection. This is what happens when you have a selection
and you press an arrow key on your keyboard, but it isn't the behaviour
we want when programmatically changing the value.

Instead, we need to first clear the selection, and then move the cursor
to the end. (We also need to reset the selection direction when clearing
the selection.)
2018-01-26 19:50:52 +01:00
Jon Leighton
02883a6f54 Fix selection{Start,End} when selectionDirection is "backward"
Per the spec, selectionStart and selectionEnd should return the same
values regardless of the selectionDirection. (That is, selectionStart is
always less than or equal to selectionEnd; the direction then implies
which of selectionStart or selectionEnd is the cursor position.)

There was no explicit WPT test for this, so I added one.

This bug was initially quite hard to wrap my head around, and I think
part of the problem is the code in TextInput. Therefore, in the process
of fixing it I have refactored the implementation of TextInput:

* Rename selection_begin to selection_origin. This value doesn't
  necessarily correspond directly to the selectionStart DOM value - in
  the case of a backward selection, it corresponds to selectionEnd.
  I feel that "origin" doesn't imply a specific ordering as strongly as
  "begin" (or "start" for that matter) does.

* In various other cases where "begin" is used as a synonym for "start",
  just use "start" for consistency.

* Implement selection_start() and selection_end() methods (and their
  _offset() variants) which directly correspond to their DOM
  equivalents.

* Rename other related methods to make them less wordy and more
  consistent / intention-revealing.

* Add assertions to assert_ok_selection() to ensure that our assumptions
  about the ordering of selection_origin and edit_point are met. This
  then revealed a bug in adjust_selection_for_horizontal_change() where
  the value of selection_direction was not maintained correctly (causing
  a unit test failure when the new assertion failed).
2018-01-26 19:50:50 +01:00
Jon Leighton
0148e9705b Support the select() method on input/textarea
Issue #19171
2018-01-26 19:50:45 +01:00
bors-servo
c9ba16f9fb Auto merge of #19868 - CYBAI:specific-assertion, r=emilio
Use specific assertions

Similar to #19865
r? jdm

Note: Should I squash all the commits into one commit?

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes do not require tests because it should not break anything

<!-- 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/19868)
<!-- Reviewable:end -->
2018-01-25 18:06:33 -06:00
bors-servo
fc3b178931 Auto merge of #19865 - servo:jdm-patch-6, r=KiChjang
Use more specific assertions for http tests.

<!-- 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/19865)
<!-- Reviewable:end -->
2018-01-25 17:11:42 -06:00
bors-servo
e9ab91d257 Auto merge of #19864 - nox:callbacks, r=Manishearth
Make some callback-related code unsafe

<!-- 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/19864)
<!-- Reviewable:end -->
2018-01-25 16:21:10 -06:00
bors-servo
8c1af9cce7 Auto merge of #19855 - asajeffrey:test-perf-git-progress, r=jdm
Added --progress flag to test-perf git commands

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

Adding a `--progress` flag to git commands in test-perf to try to avoid the timeouts we're seeing at http://build.servo.org/builders/linux-nightly/builds/581/steps/test/logs/stdio
---
<!-- 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 do not require tests because this is test infrastructure

<!-- 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/19855)
<!-- Reviewable:end -->
2018-01-25 15:30:22 -06:00
bors-servo
a2fca92881 Auto merge of #19849 - gterzian:update_wpt, r=jdm
WPT tests: Remove custom cache script, use trickle option instead

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

Follow up on https://github.com/servo/servo/pull/19350 @jdm

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

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- 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/19849)
<!-- Reviewable:end -->
2018-01-25 14:38:11 -06:00
bors-servo
e035f5a17f Auto merge of #19848 - glennw:update-wr-tcrt, r=jdm
Update WR (new capture API, render target cache optimization)

<!-- 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/19848)
<!-- Reviewable:end -->
2018-01-25 13:48:24 -06:00
CYBAI
31631cdc47 Use specific negative assertion for gultin window 2018-01-26 02:24:30 +08:00
CYBAI
a13a9f8f8d Use specific negative assertion for cef window 2018-01-26 02:24:21 +08:00
CYBAI
6e4e318b24 Use specific negative assertion for ServoArc 2018-01-26 02:24:06 +08:00
CYBAI
5104d2947f Use specific negative assertion for DOM XMLHttpRequest 2018-01-26 02:23:49 +08:00
CYBAI
2a17230623 Use specific negative assertion for DOM Window Proxy 2018-01-26 02:23:39 +08:00
CYBAI
f372bc0f40 Use specific negative assertion for DOM HTMLCollection 2018-01-26 02:11:02 +08:00
CYBAI
1ba2b67b00 Use specific negative assertion for DOM globalscope 2018-01-26 02:08:11 +08:00
CYBAI
5475059df7 Use specific negative assertion for DOM document 2018-01-26 02:07:47 +08:00
CYBAI
1f9ce9e5d7 Use specific negative assertion for DOM bindings utils 2018-01-26 02:07:27 +08:00
CYBAI
86b876c52e Use specific negative assertion for unit tests of net trait pub_domain 2018-01-26 01:55:39 +08:00
CYBAI
baccc4eda2 Use specific negative assertion for layout floats 2018-01-26 01:55:24 +08:00
CYBAI
73bc7a81e9 Use specific negative assertion for hashglobe hash set 2018-01-26 01:55:12 +08:00
CYBAI
d4d32c9962 Use specific negative assertion for hashglobe hash map 2018-01-26 01:54:55 +08:00
CYBAI
4765b7b248 Use specific negative assertion for gfx platform macos font 2018-01-26 01:46:39 +08:00
CYBAI
8fedc3a188 Use specific negative assertion for gfx platform freetype font_list 2018-01-26 01:40:39 +08:00
CYBAI
08f9123065 Use specific negative assertion for config opts 2018-01-26 01:39:54 +08:00
CYBAI
0c6ada833b Use specific assertion for net hsts tests 2018-01-26 01:30:32 +08:00
CYBAI
7f5a1538d3 Use specific assertion for net fetch methods 2018-01-26 01:30:31 +08:00
CYBAI
775d6abb34 Use specific assertion for style logical geometry 2018-01-26 01:30:31 +08:00
CYBAI
9c7ff219d7 Use specific assertion for unit tests style viewport 2018-01-26 01:30:30 +08:00
CYBAI
9755e3b606 Use specific assertion for unit tests logical geometry 2018-01-26 01:19:01 +08:00
CYBAI
985ffa3342 Use specific assertion for webdriver server 2018-01-26 01:19:00 +08:00
CYBAI
e4799cc997 Use specific assertion for specified text 2018-01-26 01:18:59 +08:00
CYBAI
f81ba5e9dd Use specific assertion for ServoArc 2018-01-26 01:18:59 +08:00
CYBAI
40e40e0f8b Use specific assertion for DOM XMLHttpRequest 2018-01-26 01:18:58 +08:00
CYBAI
15a1faff03 Use specific assertion for DOM webgl shader 2018-01-26 01:18:58 +08:00
CYBAI
9a358014f9 Use specific assertion for DOM servoparser 2018-01-26 01:18:57 +08:00
CYBAI
0e6f446a61 Use specific assertion for DOM servoparser async_html 2018-01-26 01:18:56 +08:00
CYBAI
5486335708 Use specific assertion for DOM create 2018-01-26 01:18:56 +08:00
CYBAI
9ee27d62ae Use specific assertion for DOM binding refcounted 2018-01-26 01:18:55 +08:00
CYBAI
1c31370a08 Use specific assertion for DOM binding interface 2018-01-26 01:18:55 +08:00
CYBAI
34babb6dcf Use specific assertion for DOM attr 2018-01-26 01:18:54 +08:00
CYBAI
968976aba7 Use specific assertion for net fetch tests 2018-01-26 01:12:29 +08:00
CYBAI
909ff74f30 Use specific assertion for net cookie tests 2018-01-26 01:01:02 +08:00
CYBAI
0dda473146 Use specific assertion for net http_cache 2018-01-26 01:01:02 +08:00
CYBAI
bb7964a4bb Use specific assertion for layout multicol 2018-01-26 01:01:01 +08:00
CYBAI
da4a4475de Use specific assertion for layout layout_debug 2018-01-26 01:01:01 +08:00
CYBAI
1a6154197b Use specific assertion for gfx text shaping harfbuzz 2018-01-26 01:01:00 +08:00
CYBAI
11cedc7b94 Use specific assertion for gfx platform freetype font 2018-01-26 01:01:00 +08:00
CYBAI
befd7e4b44 Use specific assertion for compositing compositor 2018-01-26 01:00:59 +08:00