aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/element.rs
Commit message (Collapse)AuthorAgeFilesLines
* Replace .map_or(false with Option::is_some_and (#33468)Simon Wülker2024-09-161-6/+6
| | | Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
* Add `width` and `height` presentational hints for table-related elements ↵Oriol Brufau2024-09-121-0/+10
| | | | | | | | | | | | | | | (#33405) We were only parsing the `width` attribute as a presentation hint for `<table>`, `<td>` and `<th>`. This patch also handles `<colgroup>` and `<col>`. Also, we weren't parsing `height` at all, now we do it for `<table>`, `<td>`, `<th>`, `<tr>`, `<tbody>`, `<thead>` and `<tfoot>`. One test is now crashing, but this was an existing issue: #33423 Signed-off-by: Oriol Brufau <obrufau@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Make CanGc derive Copy and Clone (#33407)Taym Haddadi2024-09-121-2/+2
| | | Signed-off-by: Taym <haddadi.taym@gmail.com>
* Propagate `CanGc` from `Document::new()` (#33386)Andriy Sultanov2024-09-091-13/+25
| | | | | | | | | | | | | * Add canGc as a parameter to autogenerated trait methods Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com> * Propagate CanGc from Document::new() Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com> --------- Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com>
* Remove unused import (#33226)Oriol Brufau2024-08-281-1/+0
| | | Signed-off-by: Oriol Brufau <obrufau@igalia.com>
* Remove `width` and `height` presentational hints for `<canvas>` (#33211)Oriol Brufau2024-08-281-5/+1
| | | | | | | | According to HTML, the `width` and `height` attributes should only set the natural sizes and the aspect ratio. The `width` and `height` properties should stay as `initial` by default. Signed-off-by: Oriol Brufau <obrufau@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* script: Update list of non-TS pseudo classes supported by Servo (#33165)Martin Robinson2024-08-241-9/+23
| | | | | | Also remove some code duplication by moving some of the code into the `Element` impl. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
* Update stylo for latest changes. (#33079)Josh Matthews2024-08-161-2/+4
| | | Signed-off-by: Josh Matthews <josh@joshmatthews.net>
* Upgrade stylo to 2024-07-16 (#32812)Martin Robinson2024-07-241-1/+1
| | | | | | | | | | | | | | * Upgrade stylo to 2024-07-16 Signed-off-by: Martin Robinson <mrobinson@igalia.com> * Use the new `dom` crate from stylo Signed-off-by: Martin Robinson <mrobinson@igalia.com> --------- Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* clippy: Fix a bunch of warnings in `script` (#32680)Martin Robinson2024-07-041-8/+8
| | | This is just a portion of the errors that are remaining to be fixed.
* html: Parse a comma-separated list of faces in the `<font>` tag (#32622)Martin Robinson2024-06-261-4/+3
| | | | | | This change parses a comma-separated list of faces in the `<font>` tag and also moves the parsing code from `stylo` to Servo. This means that the servo-specific code can be removed from stylo decreasing the differences between Gecko and Servo's version of `stylo`.
* Move non-gfx things out of `gfx_traits` and create a `base` crate (#32296)Martin Robinson2024-05-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | For a long time, `gfx_traits` has held a lot of things unrelated to graphics and also unrelated to the `gfx` crate (which is mostly about fonts). This is a cleanup which does a few things: 1. Move non `gfx` crate things out of `gfx_traits`. This is important in order to prevent dependency cycles with a different integration between layout, script, and fonts. 2. Rename the `msg` crate to `base`. It didn't really contain anything to do with messages and instead mostly holds ids, which are used across many different crates in Servo. This new crate will hold the *rare* data types that are widely used. Details: - All BackgroundHangMonitor-related things from base to a new `background_hang_monitor_api` crate. - Moved `TraversalDirection` to `script_traits` - Moved `Epoch`-related things from `gfx_traits` to `base`. - Moved `PrintTree` to base. This should be widely useful in Servo. - Moved `WebrenderApi` from `base` to `webrender_traits` and renamed it to `WebRenderFontApi`.
* feat: implement ARIA string reflection on Element (#32080)Nolan Lawson2024-04-271-0/+375
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * feat: implement ARIA string reflection * Update components/script/dom/element.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> * fix: respond to PR comments * fix: make functions non-public * fix: use proper ARIAMixin mixin * fix: tidy issues * fix: double newline at end of file * fix: move role before aria-* to match spec order * fix: fix link to spec and format as spec does * fix: delete now-passing WPT tests * fix: remove legacy-layout test --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Upgrade Stylo to 2024-04-16 (#32128)Oriol Brufau2024-04-251-0/+6
| | | | | | | | | | | | | | | * Upgrade Stylo to 2024-04-16 * Fixup for https://phabricator.services.mozilla.com/D205051 * Fixup for https://phabricator.services.mozilla.com/D203153 * Fixup for https://phabricator.services.mozilla.com/D202460 * Fixup for https://phabricator.services.mozilla.com/D205718 * Fixup for https://phabricator.services.mozilla.com/D206428 * Update test expectations
* script_layout: Remove script to layout messages (#32081)Martin Robinson2024-04-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Instead of communicating with layout via messages, script can simply call methods on the layout trait. This simplifies the way that script communicates with layout and opens the path to sharing more data structures between the two systems. This is part of a continuing series of cleanups after removing the layout thread. <!-- 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 do not require tests because they should not change behavior. <!-- 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. -->
* clippy: fix several lint warns (#32126)Kitsu2024-04-221-9/+6
| | | | | | | | | | | | | | | As seems #31500 still remain opened here's the next partial fix. Fixed list: `unused_mut`, `clippy::needless_borrow`, `clippy::match_ref_pats`, `clippy::borrow_deref_ref`, `clippy::ptr_eq`, `clippy::unnecessary_cast`, `clippy::derivable_impls`, `clippy::collapsible_match`, `clippy::extra_unused_lifetimes`, `clippy::map_clone`, `clippy::manual_filter`. - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes are part of #31500. - [x] These changes do not require tests because are only cosmetic.
* Upgrade Stylo to 2024-03-01 (#32089)Oriol Brufau2024-04-161-9/+2
| | | | | | | * Upgrade Stylo to 2024-03-01 * Fixup for https://bugzil.la/1882754 * Update test expectations
* Implement form-associated custom elements and their ElementInternals (#31980)cathiechen2024-04-111-1/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * FACEs work, setFormValue test is awful so now has _mozilla backup * 1. Impl Validatable in ElementInternals instead of HTMLElement. 2. Reuse the code in Validatable trait. 3. The form associated custom element is not a customized built-in element. * add some comments * support readonly attribute and complete barred from constraint validation * Addressed the code review comments * Updated the legacy-layout results * Fixed the WPT failures in ElementInternals-validation.html * Addressed the code review comments * Review suggestions * Fixed silly mistakes and update the test result outside elementinternals * update the test results --------- Co-authored-by: Patrick Shaughnessy <pshaughn@comcast.net> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* clippy: Fix option_map_or_none warnings (#31983)Oluwatobi Sofela2024-04-031-1/+1
|
* script: Reduce the use of `unsafe` in LayoutDom (#31979)Martin Robinson2024-04-031-14/+7
| | | | | | | | | | | | | Remove the use of unsafe code in the layout wrappers of the DOM. The main change here is that `unsafe_get()` no longer needs to be an unsafe method, which allows us to transitively remove or reduce unsafe blocks from callers. The function itself is not renamed, because it's still a bit dangerous to start removing the layers of abstraction from actual DOM nodes. In addition `init_style_and_opaque_layout_data` can be merged into `initialize_data`, which removes one more unsafe method. Finally, a "Safety" section is added to some unsafe methods.
* Update Stylo to 2023-10-16 (#31932)Oriol Brufau2024-03-301-5/+5
| | | | | | | | | | | | | | | | | | | | | | | * Update Stylo to 2023-10-16 * Fixup for https://phabricator.services.mozilla.com/D185154 * Fixup for https://phabricator.services.mozilla.com/D188216 * Fixup for https://phabricator.services.mozilla.com/D185677 * Fixup for https://phabricator.services.mozilla.com/D188566 * Fixup for https://phabricator.services.mozilla.com/D188727 * Fixup for https://phabricator.services.mozilla.com/D189475 * Fixup for https://phabricator.services.mozilla.com/D189521 * Fixup for https://phabricator.services.mozilla.com/D188812 * Fixup for https://phabricator.services.mozilla.com/D189484 * Update test expectations
* clippy: Fix `match_like_matches` warnings (#31947)eri2024-03-301-24/+16
| | | | | | | | | * clippy: Fix `match_like_matches` warnings * Fix link to custom element state in specification. --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* clippy: Fix needless_borrow warnings in components/script (#31928)Azhar Ismagulova2024-03-291-1/+1
|
* clippy: remove unneeded return statements (#31923)Azhar Ismagulova2024-03-281-1/+1
|
* clippy: Fix manual_map warnings (#31922)Oluwatobi Sofela2024-03-281-5/+3
|
* clippy: Fix another set of clippy problems in `components/script/dom` (#31909)Rosemary Ajayi2024-03-281-5/+5
| | | | | | | | | * a reference to a reference * length comparison to zero * length comparison to zero * length comparison to zero
* fix redundant closures in component/script/dom (#31917)Ekta Siwach2024-03-281-6/+7
| | | | | | | | | | | | | * fixed unnecessary conversions * resolved conflicts * resolved conflicts * fix redundant closures in component/script/dom * resolved conflicts * fixed formatting
* fixed the `unneeded return` statement warnings. (#31863)Aarya Khandelwal2024-03-261-10/+10
|
* fixes dereferencing on an immutable reference (#31864)Aarya Khandelwal2024-03-261-2/+2
|
* clippy: Fix `explicit_auto_deref` warnings in `components/script` (#31837)Oluwatobi Sofela2024-03-231-11/+11
| | | | | | | | | * clippy: Fix explicit auto-deref warnings * clippy: Fix explicit auto-deref warnings * refactor: Tidy up code * refactor: Fix method not found errors
* clippy: Fix needless borrow warnings (#31813)Oluwatobi Sofela2024-03-211-8/+8
|
* clippy: Fix redundant field names warnings (#31793)Oluwatobi Sofela2024-03-201-11/+8
|
* Update Stylo to 2023-09-01 (#31609)Oriol Brufau2024-03-181-0/+29
| | | | | | | | | | | | | | | | | | | | | * Update Stylo to 2023-09-01 * Fixup for https://phabricator.services.mozilla.com/D184929 * Fixup for https://phabricator.services.mozilla.com/D184526 * Fixup for https://phabricator.services.mozilla.com/D184525 * Fixup for https://phabricator.services.mozilla.com/D185154 * Fixup for https://phabricator.services.mozilla.com/D184685 * Fixup for https://phabricator.services.mozilla.com/D185916 * Fixup for https://phabricator.services.mozilla.com/D185492 * Fixup for https://phabricator.services.mozilla.com/D186626 * Update test expectations
* layout: Add support for table rows, columns, rowgroups and colgroups (#31341)Martin Robinson2024-02-201-18/+18
| | | | | | | | | | | | | | This adds support for table rows, columns, rowgroups and colgroups. There are few additions here: 1. The createion of fragments, which allows script queries and hit testing to work properly. These fragments are empty as all cells are still direct descendants of the table fragment. 2. Properly handling size information from tracks and track groups as well as frustrating rules about reordering rowgroups. 3. Painting a background seemlessly across track groups and groups. This is a thing that isn't done in legacy layout (nor WebKit)! Co-authored-by: Oriol Brufau <obrufau@igalia.com>
* Check for XML and XMLS namespace during 'locating a namespace' (#31374)Keith Yeung2024-02-201-4/+21
| | | | | | | * Check for XML and XMLS namespace during 'locating a namespace' * Address review comments * Remove test expectation in legacy layout meta
* style: Remove dependency on servo_url (#31358)Martin Robinson2024-02-161-5/+11
| | | | | In order for stylo to be a separate crate, it needs to depend on less things from Servo. This change makes it so that stylo no longer depends on servo_url.
* Allow using cached client_rect() for paint-only reflow (#31219)Oriol Brufau2024-01-301-2/+7
| | | | PR #31210 avoided the cache for all kinds of reflow, but it's actually fine to use it for ReflowTriggerCondition::PaintPostponed.
* Don't use cached client_rect() when a reflow is needed (#31210)Oriol Brufau2024-01-291-12/+8
| | | | | | | | | | Fixes #31195: ```js element.style.width = "5px"; element.clientWidth; // 5 element.style.width = "15px"; element.clientWidth; // Was 5, now 15 ```
* Add support for cellpadding attribute (#31201)Oriol Brufau2024-01-291-0/+26
|
* rustdoc: Fix many rustdoc errors (#31147)Martin Robinson2024-01-221-1/+1
| | | | This fixes many rustdoc errors that occur due to raw URLs in rustdoc comments as well as unescaped Rust code that should be in backticks.
* Replace script_plugins with a clippy like rustc driver (named crown) (#30508)Samson2023-12-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove script_plugins * Use crown instead of script_plugins * crown_is_not_used * Use crown in command base * bootstrap crown * tidy happy * disable sccache * Bring crown in tree * Install crown from tree * fix windows ci * fix warning * fix mac libscript_plugins.dylib is not available anymore * Update components/script/lib.rs Co-authored-by: Martin Robinson <mrobinson@igalia.com> * Update for nightly-2023-03-18 Mostly just based off https://github.com/servo/servo/pull/30630 * Always install crown it's slow only when there is new version * Run crown test with `mach test-unit` * Small fixups; better trace_in_no_trace tests * Better doc * crown in config.toml * Fix tidy for real * no sccache on rustc_wrapper * document rustc overrides * fixup of compiletest * Make a few minor comment adjustments * Fix a typo in python/servo/platform/base.py Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com> * Proper test types * Ignore tidy on crown/tests --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* Further changes required by ServoOriol Brufau2023-11-241-3/+1
|
* Further changes required by ServoOriol Brufau2023-11-211-1/+1
|
* Further changes required by ServoOriol Brufau2023-11-211-6/+23
|
* Further changes required by ServoOriol Brufau2023-11-211-2/+10
|
* Further changes required by ServoOriol Brufau2023-10-021-0/+4
|
* Further changes required by ServoOriol Brufau2023-10-021-25/+18
|
* Use Foo_Binding instead of FooBinding for namespace modules (#30447)Samson2023-09-301-1/+1
| | | | | * Update Codegen.py to emit Foo_Binding instead of FooBinding * s/FooBinding/Foo_Binding/g
* Refactor the `translatable` attribute lightly (#30430)Ennui Langeweile2023-09-261-4/+3
|
* Refactor scrolls on the window object (#29680)Martin Robinson2023-09-151-4/+8
| | | | | | | | | | | | | | Refactor the scrolling and scrollable area calculation on the window object, to make it better match the specification. This has some mild changes to behavior, but in general things work the same as they did before. This is mainly preparation for properly handling viewport propagation of the `overflow` property but seems to fix a few issues as well. There is one new failure in Layout 2020 regarding `position: sticky`, but this isn't a big deal because there is no support for `position: sticky` in Layout 2020 yet. Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>