Commit graph

518 commits

Author SHA1 Message Date
Maxim Tsoy
8194da2752 Implement HTMLFormElement.requestSubmit()Also includes a fix for reentrant form submission behavior 2020-07-02 12:33:21 +02:00
Josh Matthews
d55424e88f Update document focus when element focusability changes. 2020-06-15 11:22:28 -04:00
Josh Matthews
757371f4f0 Make clicking on an element request focus for focusable elements. 2020-06-15 11:22:28 -04:00
teapotd
779552ee7d Form constraints validation 2020-04-02 10:16:46 +02:00
Anthony Ramine
d9e4f7a0ba Introduce more layout helpers to make selection_for_layout be safe 2020-04-01 11:40:56 +02:00
Anthony Ramine
28e5abe606 Introduce <LayoutDom<Element>>::focus_state 2020-04-01 11:40:56 +02:00
Anthony Ramine
f8af8176de Introduce a bunch of LayoutDom<HTMLInputElement> private helpers
Those help contain the unsafety in most of the actual helpers used by layout.
2020-04-01 11:40:55 +02:00
Anthony Ramine
5ff931d171 Introduce <LayoutDom<Element>>::attrs()
This safe method is the basic block to access element attributes from layout.
We reuse it in the other attr-related layout methods to remove a pretty big
source of rampant unsafe code between script and layout.
2020-03-31 18:46:49 +02:00
Anthony Ramine
0bda174823 Merge RawLayoutElementHelpers into LayoutElementHelpers 2020-03-31 18:30:42 +02:00
Anthony Ramine
e1e913d33c Make LayoutHTMLInputElementHelpers::value_for_layout return a cow 2020-03-31 14:30:18 +02:00
Anthony Ramine
dba6a635e5 Give a lifetime parameter to LayoutDom 2020-03-28 15:37:57 +01:00
YUAN LYU
3ea6d87bcc
Add trait DomObjectWrap to provide WRAP function 2020-03-20 22:16:56 -04:00
Dmitry Kolupaev
6284795078 Accept only connected attributes for checkbox and radio activation behaviour 2020-03-11 22:55:37 +03:00
Dmitry Kolupaev
ab2aeb6d97 Implement step 5.13 for dirname correctly 2020-02-25 01:18:21 +03:00
Dmitry Kolupaev
6188116090 Add special case directionality of phone input 2020-02-25 01:18:21 +03:00
Dmitry Kolupaev
7d6d1c09cb Rearrange directionality algorithm functions 2020-02-25 01:18:20 +03:00
Dmitry Kolupaev
cb34e5c887 Move dirname collection to input 2020-02-25 01:18:20 +03:00
Dmitry Kolupaev
ef49f2e0eb Implement dirname for form submit and directionality for element 2020-02-25 01:18:20 +03:00
bors-servo
e697e6cca7
Auto merge of #25488 - pshaughn:clickactivate, r=jdm
Event dispatch rewritten to align to spec, activate on clicks better

I went over the changes to the event dispatch spec that had accumulated over the past few years, rewriting dispatch/invoke/inner-invoke almost completely and modifying other code where it was relevant. Most of the remaining obvious deviations from spec are things that will only come up when we start handling events in shadow DOM.

I am pushing now because I want to see CI test results, but please do not approve this PR just if automated test improvements look good. I may have broken some actual UI interactions in the course of fixing synthetic events, and some manual testing is needed, including checking that manual interactions with interactive content continue to fire the events they're supposed to.

---
<!-- 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 #25384 and fix #22783 and fix #25199

<!-- Either: -->
- [ ] There are automated tests for the synthetic-click parts of these changes, BUT the effects on real UI events need some manual testing before merging

<!-- 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. -->
2020-02-13 17:37:12 -05:00
Patrick Shaughnessy
f29e22f131 Names should now be consistently atoms 2020-02-13 11:21:46 -05:00
Patrick Shaughnessy
01aba1fcc4 Event dispatch rewritten to resemble spec more often, activate on clicks better 2020-02-12 15:57:37 -05:00
Patrick Shaughnessy
9cc218d0b0 SubmitEvent and test changes 2020-01-30 17:37:33 -05:00
bors-servo
ae1758fec9
Auto merge of #25490 - teapotd:radio-group-iter, r=Manishearth
Simplify and fix iteration over radio button group

- Code for iterating over radio button group elements has been extracted to `radio_group_iter`
- `in_same_group` now checks if elements are in the same tree
- `radio_group_name` returns `None` if name is empty
- Radio buttons now group together in orphan trees (#25486)

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #25486
- [ ] There are tests for these changes
2020-01-23 16:56:57 -05:00
Kunal Mohan
f7db4b7f80
Modify script to prevent further violations of snake_case 2020-01-18 14:22:15 +05:30
teapotd
f6bcc1f954 Simplify and fix iteration over radio button group 2020-01-11 10:40:02 +01:00
Patrick Shaughnessy
87e86c81b9 stepUp, stepDown, valueAsNumber, valueAsDate, and list work and have tests 2020-01-10 20:09:51 -05:00
Patrick Shaughnessy
036e8dabe2 Labels are a live list in tree order 2020-01-06 10:39:36 -05:00
bors-servo
7d986a2eb1
Auto merge of #25397 - teapotd:input-cloning-steps, r=jdm
Implement HTMLInputElement cloning steps

This change adds missing [cloning steps for input elements](https://html.spec.whatwg.org/multipage/#the-input-element%3Aconcept-node-clone-ext).

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #25385
- [X] There are tests for these changes
2020-01-03 14:40:09 -05:00
Patrick Shaughnessy
b20881639e Radio button grouping is now case-sensitive 2019-12-31 17:57:59 -05:00
teapotd
386dc9fd75 Implement HTMLInputElement cloning steps 2019-12-26 17:53:18 +01:00
Patrick Shaughnessy
7f41b1b294 hidden field named _charset_ now appears in FormData as UTF-8 to fix #25150 2019-12-09 12:45:14 -05:00
bors-servo
7ba88e8237
Auto merge of #24626 - glowe:issue-21810/improve-validation-methods, r=jdm
Issue 21810/improve validation methods

<!-- Please describe your changes on the following line: -->
This is a start at addressing #21810. I'm putting these changes out early to get some feedback on the following items:

1. I added unit tests for the validation methods mentioned in #21810, because I couldn't tell whether any of the existing WPT tests covered them. Are these tests worthwhile? Are any of them unnecessary?
2. I changed the implementation for `is_valid_floating_point_number_string` so that it passed the tests. The previous version of the function wasn't restrictive enough (it allowed certain whitespace characters before the number string).
3. I changed the catch-all condition in `htmlinputelement.rs` to account for the remaining input types that don't have a value sanitization algorithm. This last change seems good to me since we won't be able to add a new input type without adding it to the case and checking the spec for an algorithm.
---
<!-- 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 #21810

<!-- 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. -->
2019-12-03 13:11:22 -05:00
glowe
23359c5868 Remove catch-all case for input sanitization
Replaced catch-all with explicit case for inputs that do not have
a value sanitization algorithm. This should prevent us from
forgetting to implement a sanitization for an input, since they
must all be accounted for in the match expression.
2019-11-30 21:53:53 -05:00
Simon Sapin
bea73951db Use #![register_tool] instead of #![register_attr]
CC https://github.com/rust-lang/rust/issues/66079
2019-11-15 17:24:42 +01:00
takumi
7ce40080bf [WIP] solve #22782
TODO: write tests for my change
2019-10-18 15:00:03 +09:00
Simon Sapin
98e4a53b72 Upgrade to rustc 1.39.0-nightly (f7af19c27 2019-08-15) 2019-08-23 08:23:21 +02:00
Simon Sapin
c38c964f1b Upgrade to rustc 1.38.0-nightly (dddb7fca0 2019-07-30) 2019-07-31 13:34:01 +02:00
ffwff
3508140929 Add value sanitization algorithm for input[type="email"]
Handle "Multiple" attribute for email value sanitization

Fix code formatting

Tests for email value sanitization should pass

Make failing wpt tests pass

Change new_value => sanitized
2019-05-29 23:07:17 +07:00
Thomas Delacour
14c8bbb49d
ISSUE-20455: introduce stronger types for textinput indexing 2019-05-16 15:33:24 -04:00
Fernando Jiménez Moreno
813b242419 Introduce BindContext with in_doc and connected flags
Fix some is_in_doc -> is_connected mistakes
2019-04-26 11:31:18 +02:00
Fernando Jiménez Moreno
441357b74e Add is_connected flag to node and use it to replace most uses of is_in_doc 2019-04-26 10:17:45 +02:00
Anthony Ramine
5fe5e5d6de Remove most RootedReference uses
We can replace all uses of RootedReference for Option<T> by Option::deref calls.
2019-03-10 17:51:35 +01:00
Anthony Ramine
3ccda7f90c Make a bunch of layout queries morally safer 2019-01-09 14:12:54 +01:00
Simon Sapin
be69f9c3e6 Rustfmt has changed its default style :/ 2018-12-28 13:17:47 +01:00
Dan Robertson
c46508e497
Update src/href attributes to be a USVString
The following IDLs have the src/href attributes typed as a DOMString
while in the spec the attribute has been updated to be a USVString:

 - HTMLIFrameElement
 - HTMLImageElement
 - HTMLInputElement
 - HTMLLinkElement
 - HTMLMediaElement
 - HTMLScriptElement
2018-12-17 15:28:42 +00:00
bors-servo
98527ddb8c
Auto merge of #22224 - pyfisch:composition-webdriver, r=nox
Forward WebDriver CompositionEvent

Dispatch composition events in JS.
Insert characters from composition events to text input.

CompositionEvents currently can only be
created by WebDriver and not by embedders.

<!-- 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
- [ ] 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/22224)
<!-- Reviewable:end -->
2018-11-20 03:32:25 -05:00
Pyfisch
b936fea79d Forward WebDriver CompositionEvent
Dispatch composition events in JS.
Insert characters from composition events to text input.

CompositionEvents currently can only be
created by WebDriver and not by embedders.
2018-11-19 22:07:05 +01:00
Jan Andre Ikenmeyer
a1a14459c1
Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
Agustin Chiappe Berrini
75eb94afca Unify the task source and task canceller API
I moved away from the `Window` struct all the logic to handle task
sources, into a new struct called `TaskManager`. In a happy world, I'd
be able to just have there two functions, of the types:

```rust
fn task_source<T: TaskSource>(&self, name: TaskSourceName) -> Box<T>
fn task_source_with_canceller<T: TaskSource>(&self, name: TaskSourceName)
  -> (Box<T>, TaskSourceCanceller)
```

And not so much duplicated code. However, because TaskSource can't be a
trait object (because it has generic type parameters), that's not
possible. Instead, I decided to reduce duplicated logic through macros.

For reasons[1], I have to pass both the name of the function with
canceller and the name of the function without, as I'm not able to
concatenate them in the macro itself. I could probably use
`concat_idents` to create both types already defined and reduce the
amount of arguments by one, but that macro is nightly only. At the same
time, not being able to declare macros inside `impl` forces me to pass
`self` as an argument.

All this makes this solution more verbose than it would be ideally. It
does reduce duplication, but it doesn't reduce the size of the file.

[1](https://github.com/rust-lang/rust/issues/29599)
2018-11-14 06:36:44 -05:00
Simon Sapin
9f977c5287 Remove useless use crate_name; imports.
A `crate_name::foo` path always works in 2018
2018-11-08 09:29:52 +01:00