Commit graph

257 commits

Author SHA1 Message Date
Josh Matthews
dbff26bce0 Support arbitrary protos when wrapping DOM objects with constructors. 2023-05-28 23:23:12 -04:00
Vincent Ricard
ddfa9ca5b4 Implements HTMLDetailsElement toggle 2020-09-26 11:53:47 +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
Alan Jeffrey
c00eb62090 Add a dummy implementation of contentEditable 2020-04-21 19:12:52 -05:00
YUAN LYU
3ea6d87bcc
Add trait DomObjectWrap to provide WRAP function 2020-03-20 22:16:56 -04:00
Dmitry Kolupaev
25c5a4c045 Use map_or and fix manifest 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
edb940e613 Remove recursiveness from directionality search 2020-02-25 01:18:21 +03:00
Dmitry Kolupaev
7e2107b1a5 Simplify node#parent_directionality 2020-02-25 01:18:20 +03:00
Dmitry Kolupaev
7d6d1c09cb Rearrange directionality algorithm functions 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
bors-servo
e3a2301efe
Auto merge of #25629 - pshaughn:reflect_translate, r=jdm
Implement "translate" attribute

This attribute is almost a straightforward enumerated one, but the getter value inherits from parents when the content attribute is absent, even when the parents are non-HTML elements. This initial commit is using LocalName::from on a static string; once html5ever has a release with "translate" in the built-in local name list, a small change will be needed.

---
<!-- 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 #25628

<!-- Either: -->
- [X] 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. -->
2020-02-13 08:26:28 -05:00
Patrick Shaughnessy
3f8a9f6382 Translate attribute and its inheritance semantics 2020-02-12 20:54:41 -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
f043a3eee2 Error and resize get special getter/setters for reflection 2020-01-30 10:00:16 -05:00
Patrick Shaughnessy
036e8dabe2 Labels are a live list in tree order 2020-01-06 10:39:36 -05:00
Simon Sapin
c38c964f1b Upgrade to rustc 1.38.0-nightly (dddb7fca0 2019-07-30) 2019-07-31 13:34:01 +02: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
3ccd622c9b Introduce ShadowIncluding enum for tree traversals 2019-04-26 11:31:17 +02:00
Fernando Jiménez Moreno
2e5c058463 Implement concept of shadow including tree order 2019-04-26 10:17:46 +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
Jan Andre Ikenmeyer
a1a14459c1
Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
Simon Sapin
2012be4a8b cargo fix --edition-idioms 2018-11-08 09:28:00 +01:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
Pyfisch
cb07debcb6 Format remaining files 2018-11-06 22:30:31 +01:00
Simon Sapin
45f7199eee cargo fix --edition 2018-11-06 15:26:02 +01:00
chansuke
c37a345dc9 Format script component 2018-09-19 17:40:47 -04:00
csmoe
98fe118be4 introduce layout query timestamp 2018-03-18 11:45:15 +08:00
moe
df6b64181b extract querymsg from ReflowGoal 2018-03-17 00:39:11 +08:00
Fernando Jiménez Moreno
ff81707928 Minor cleanup of element.innerText 2018-02-20 13:50:53 +01:00
Fernando Jiménez Moreno
d64bf623f6 Implement element.innerText setter 2018-02-16 11:20:53 +01:00
Fernando Jiménez Moreno
2a4535f43e Implement element.innerText getter 2018-02-13 09:12:00 +01:00
Jon Leighton
05bfb8d07a Expand InputType to cover all possible types
This came out of a conversation with nox in IRC:
https://mozilla.logbot.info/servo/20171201#c13946454-c13946594

The code I was working on which motivated this change is here:
https://github.com/servo/servo/pull/19461

Previously, InputType::Text was used to represent several different
values of the type attribute on an input element.

If an input element doesn't have a type attribute, or its type attribute
doesn't contain a recognised value, then the input's type defaults to
"text".

Before this change, there were a number of checks in the code which
directly looked at the type attribute. If those checks matched against
the value "text", then they were potentially buggy, since an input with
type=invalid should also behave like an input with type=text.

Rather than have every conditional which cares about the input type also
have to deal with invalid input types, we can convert the type attribute
to an InputType enum once, and then match against the enum.

A secondary benefit is that the compiler can tell us whether we've
missed branches in a match expression. While working on this I
discovered that the HTMLInputElement::value_mode() method misses a case
for inputs with type=hidden (this resulted in a failing WPT test
passing).

I've also implemented the Default trait for InputType, so we now only
have one place in the code which knows that InputType::Text is the
default, where previously there were several.
2017-12-06 21:11:39 +01:00
Simon Sapin
793bebfc0e Upgrade to rustc 1.23.0-nightly (02004ef78 2017-11-08) 2017-11-09 16:56:39 +01:00
Vijay Hebbar
4a43dba8d7 Add implementation for itemprop and itemtype
Created test file

Added the stub methods for itemprop and itemscope

Resolved html5ever dependency, added ItemScope and ItemProp attr

Resolving dependency

Added pref override on metadata attributes

Resetting to original state due to change in requirement

Reverted adding attributes

1. add a customized implementation of parse_plain_attribute
2. add the following methods to HTMLElement.webidl

added itemprop and itemtype, enabled pref in test

Added initial implementation for getting itemprop property values

Adding the wireframe for testing

Implemented function to handle itemType

Corrected typo

Fixed typo bug in code

Handling duplicates for itemtype attribute values

Added the test suite structure

Added test for extra space

Added test for regular test values

Added test cases for Single property values

Test cases to check absence of itemtype and itemprop attributes

Added code to handle absence of itemtype or itemprop attributes

Added shell script to run all test cases

cleared up Cargo file

Tidying up

Removed the local test file

Removed new line for test-tidy

Ordered key in prefs.json

Fixes for test-tidy

Enabled test preferences

Created test using wpt

Creating WPT Tests for Regular and Single Prop Types

Fixed the Regular type test

Fixed tests

Removed old test case metadata

Incorporate review changes from PR

Updated MANIFEST to sync test cases

Making changed suggested in review

Removed editor folding

Removed unnecessary code

Resolving cargo conflicts

Updated PropertyNames and itemtypes implementation

Trying different data in test case

Updated manifest

Updated code based on reviews
2017-11-06 15:11:50 -05:00
Bastien Orivel
29b4eec141 Bump bitflags to 1.0 in every servo crate 2017-10-30 23:36:06 +01:00
Gecko Backout
11c64178d8 Backed out changeset e64e659c077d: servo PR #18809 and revendor for reftest failures, e.g. in layout/reftests/bugs/392435-1.html. r=backout on a CLOSED TREE
Backs out https://github.com/servo/servo/pull/18809
2017-10-19 21:26:51 +00:00
Bastien Orivel
e8e2d0a4b2 Update bitflags to 1.0 in every servo crate
It still needs dependencies update to remove all the other bitflags
versions.
2017-10-19 15:01:17 +02:00
Simon Sapin
aa15dc269f Remove use of unstable box syntax.
http://www.robohornet.org gives a score of 101.36 on master,
and 102.68 with this PR. The latter is slightly better,
but probably within noise level.
So it looks like this PR does not affect DOM performance.

This is expected since `Box::new` is defined as:

```rust
impl<T> Box<T> {
    #[inline(always)]
    pub fn new(x: T) -> Box<T> {
        box x
    }
}
```

With inlining, it should compile to the same as box syntax.
2017-10-16 17:16:20 +02:00
Simon Sapin
4ee8f56b9c Remove usage of unstable feature ascii_ctypes 2017-10-11 20:21:07 +02:00
Anthony Ramine
f87c2a8d76 Rename Root<T> to DomRoot<T>
In a later PR, DomRoot<T> will become a type alias of Root<Dom<T>>,
where Root<T> will be able to handle all the things that need to be
rooted that have a stable traceable address that doesn't move for the
whole lifetime of the root. Stay tuned.
2017-09-26 09:49:10 +02:00
Anthony Ramine
c52fd0a780 Rename MutNullableJS<T> to MutNullableDom<T> 2017-09-26 09:49:02 +02:00
Anthony Ramine
7be32fb237 Rename JS<T> to Dom<T> 2017-09-26 09:48:55 +02:00
Anthony Ramine
0e3c54c191 Rename dom::bindings::js to dom::bindings::root 2017-09-26 02:19:05 +02:00
Anthony Ramine
7875fea6cf Use absolute paths in the event handlers macros 2017-09-01 11:54:09 +02:00
Corey Farwell
6238035612 Minor refactorings for 'data-' attribute logic. 2017-07-29 09:58:03 +00:00