Commit graph

789 commits

Author SHA1 Message Date
komuhangi
c3360df918
Fixed some clippy warnings in components/script (#31950)
* Fixd some clippy warnings in components/script

* Update node.rs

Removed the  ```# Safety ``` section.

* Update shadow_root.rs

Removed the ``` # Safety ``` section from components/script/layout_dom

* Updated fixes to some clippy warnings in components/script

* Revert "Updated fixes to some clippy warnings in components/script"

This reverts commit 2a37c3dec8.

* Updated fixes to clippy warnings in components/script

* Revert "Updated fixes to clippy warnings in components/script"

This reverts commit 5780dc3a0a.

* Revert "Revert "Updated fixes to some clippy warnings in components/script""

This reverts commit 98c411354a.

* Revert "Updated fixes to some clippy warnings in components/script"

This reverts commit 2a37c3dec8.

* Update shadow_root.rs (Ignore change)

* Update node.rs (Ignore changes)

* Updated fixes to clippy warnings in components/script

* Removed  trailing white space in componets/script/layout_dom_root.rs

* Revert "Removed  trailing white space in componets/script/layout_dom_root.rs"

This reverts commit 1976fd0405.

* Revert "Updated fixes to clippy warnings in components/script"

This reverts commit 5c71b925fb.

* Updated fixes to clippy warnings in components/script including review suggestions.
2024-03-31 19:51:16 +00:00
Martin Robinson
b7d089930e
layout: Remove LayoutRPC and query layout via the Layout trait (#31937)
Instead of the tricky `LayoutRPC` interface, query layout using the
`Layout` trait. This means that now queries will requires calling layout
and then running the query. During layout an enum is used to indicate
what kind of layout is necessary.

This change also removes the mutex-locked `rw_data` from both layout
threads. It's no longer necessary since layout runs synchronously. The
one downside here is that for resolved style queries, we now have to
create two StyleContexts. One for layout and one for the query itself.
The creation of this context should not be very expensive though.

`LayoutRPC` used to be necessary because layout used to run
asynchronously from script, but that no longer happens. With this
change, it becomes possible to safely pass nodes to layout from script
-- a cleanup that can happen in a followup change.
2024-03-29 16:25:47 +00:00
Azhar Ismagulova
ff95ce5abd
fix: omitted the let bindings (#31908) 2024-03-27 20:22:51 +00:00
Oluwatobi Sofela
a53632c0e5
clippy: Fix collapsible_if warnings (#31852) 2024-03-25 13:55:45 +00:00
Aarya Khandelwal
bd39e03eeb
changed match to 'matches!' (#31850) 2024-03-25 11:28:12 +00:00
Delan Azabani
8882507ad0
Rework “visible” to “throttled” in constellation + script + compositor (#31816) 2024-03-22 06:06:28 +00:00
Aarya Khandelwal
9b26dca141
Fixed the .clone() warnings. (#31819) 2024-03-22 05:41:17 +00:00
Rosemary Ajayi
ce0d456469
clipping: Fix some warnings in components/script/dom (#31799)
* fix clippy websocket errors

* fix clippy window errors

* fix clippy window errors

* fix clippy window errors
2024-03-21 11:46:18 +00:00
Richard Dushime
01ca220f83
clippy: Fix many warnings in components/script (#31717)
* Fix Several clippy warnings

* Fix Build errors

* Fix Unused import

* Fix requested changes

* Fix rustfmt

* Minor fixes

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-03-19 16:05:56 +00:00
Martin Robinson
9c0561536d
script: Do not run layout in a thread (#31346)
* script: Do not run layout in a thread

Instead of spawning a thread for layout that almost always runs
synchronously with script, simply run layout in the script thread.

This is a resurrection of #28708, taking just the bits that remove the
layout thread. It's a complex change and thus is just a first step
toward cleaning up the interface between script and layout. Messages are
still passed from script to layout via a `process()` method and script
proxies some messages to layout from other threads as well.

Big changes:

1. Layout is created in the script thread on Document load, thus every
   live document is guaranteed to have a layout. This isn't completely
   hidden in the interface, but we can safely `unwrap()` on a Document's
   layout.
2. Layout configuration is abstracted away into a LayoutConfig struct
   and the LayoutFactory is a struct passed around by the Constellation.
   This is to avoid having to monomorphize the entire script thread
   for each layout.
3. Instead of having the Constellation block on the layout thread to
   figure out the current epoch and whether there are pending web fonts
   loading, updates are sent synchronously to the Constellation when
   rendering to a screenshot. This practically only used by the WPT.

A couple tests start to fail, which is probably inevitable since removing
the layout thread has introduced timing changes in "exit after load" and
screenshot behavior.

Co-authored-by: Josh Matthews <josh@joshmatthews.net>

* Update test expectations

* Fix some issues found during review

* Clarify some comments

* Address review comments

---------

Co-authored-by: Josh Matthews <josh@joshmatthews.net>
2024-02-23 08:14:10 +00:00
Martin Robinson
9a6973d629
style: Remove dependency on servo_url (#31358)
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.
2024-02-16 11:56:35 +00:00
Delan Azabani
eb95703325
constellation: focusing and closing webviews (#30842)
* constellation: focusing, closing, and native window visibility

* rename “browser” to “webview”, “unfocus” to “blur”

* remove native window visibility from constellation

* rename more “browser” to “webview”

* guard clauses

* don’t automatically focus when no webviews are focused

* comment spec steps for window.close()

* use format interpolation

Co-authored-by: Martin Robinson <mrobinson@igalia.com>

* fix formatting

* rename “Webview” to “WebView” in types and type parameters

* remove unused method

* fix libsimpleservo

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-01-24 11:45:54 +00:00
Martin Robinson
5c1723c983
rustdoc: Fix many rustdoc errors (#31147)
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.
2024-01-22 13:13:48 +00:00
Gregory Terzian
90a9300f69
Script: ensure child JS runtimes are dropped before parent (#30896)
* clear js runtime of dedicated worker that immediately exits

* dedicated worker: clear js runtime if loading script fails

* when the script thread crashes, deallocate worker runtimes before dropping main runtime

* clear runtime if service worker script fails to load

* ensure worker enter their realm before executing script
2024-01-04 09:47:41 +00:00
Oriol Brufau
f1ae42678a Further changes required by Servo 2023-11-24 08:57:14 +01:00
Martin Robinson
50732b49c5
Remove Servo window.trap() extension (#30743)
This Servo-specific extension is unused by any code in the repository
and removing it allows us to remove use of nightly only reliance on
rust intrinsics. This is a step toward supporting stable rust.
2023-11-17 07:43:26 +00:00
Samson
ebd41d4101
Use Foo_Binding instead of FooBinding for namespace modules (#30447)
* Update Codegen.py to emit Foo_Binding instead of FooBinding

* s/FooBinding/Foo_Binding/g
2023-09-30 00:52:04 +00:00
Martin Robinson
abca586e0a
Refactor scrolls on the window object (#29680)
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>
2023-09-15 10:57:54 +00:00
Samson
aad2dccc9c
Strict import formatting (grouping and granularity) (#30325)
* strict imports formatting

* Reformat all imports
2023-09-11 19:16:54 +00:00
Samson
711dbbd4af
remove extern crate (#30311)
* remove extern crate

* Update components/script_plugins/lib.rs

Co-authored-by: Martin Robinson <mrobinson@igalia.com>

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-09-08 12:11:31 +00:00
Oriol Brufau
8a7fe40249
Remove unused import EventLoopWaker (#30110)
Seems a remnant from #30101
2023-08-17 05:15:52 +00:00
Atbrakhi
8255e8e318
Remove EventLoopWaker from Constellation (#30101)
* remove event_loop_waker that is always None

* remove None event_loop_waker form InitialScriptState

* fix formatting

* remove None event_loop_waker from ScriptThread

* remove None EventLoopWaker from Window

* remove None and use of wake_after_send in webgl code
2023-08-15 18:02:02 +00:00
Samson
9514f670d1
No tracing of nop traceable fields (#29926)
* Add `no_trace` option to JSTraceable derive

* NoTrace wrapper

* Port some types to no_trace schematics

* Fixing my unsafe mistakes (not tracing traceables)

* Add docs & safety guards for no_trace

Safety guards (trait shenanigans) guarantees safety usage of `no_trace`

* Port canvas_traits to no_trace

* Port servo_media to no_trace

* Port net_traits to no_trace

* Port style to no_trace

* Port webgpu to no_trace

* Port script_traits to no_trace

* Port canvas_traits, devtools_traits, embedder_traits, profile_traits to no_trace

* unrooted_must_root lint in seperate file

* Add trace_in_no_trace_lint as script_plugin

* Composable types in must_not_have_traceable

* Introduced HashMapTracedValues wrapper

* `HashMap<NoTrace<K>,V>`->`HashMapTracedValues<K,V>`

* Port rest of servo's types to no_trace

* Port html5ever, euclid, mime and http to no_trace

* Port remaining externals to no_trace

* Port webxr and Arc<Mutex<_>>

* Fix spelling in notrace doc
2023-08-04 10:17:43 +00:00
Tuna
4c8db6af87
bump base64 from 0.10 to 0.21 (#29804)
* bump base64 from 0.10 to 0.21

* Fix configuration of bitflags

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-08-02 21:25:37 +00:00
Martin Robinson
edeb24b30f Fix scrolling on root element
eca0acf459 uncovered a bug in the way that
the scrolling area of `window` was calculated and broke scrolling on the
root element. This change does two things in order to fix that:

1. Does a partial revert of eca0acf459 in
   order to get scrolling from script working again on the window
   object.
2. Has the compositor always generate a frame for scrolls starting from
   script and waits for them. This is speculative fix for flakiness in
   root scrolling tests on CI.
2023-05-05 12:42:02 +02:00
Martin Robinson
eca0acf459 Allow script to scroll overflow: scroll elements
Before the code was only allowing `overflow: hidden` elements to scroll.
This fixes that issue and also clean up the code that deals with
detecting whether the body is a "potentially scrollable" in quirks mode.
2023-04-25 21:25:00 +02:00
Martin Robinson
3ab5e2a188 Scroll from script should trigger a reflow
Scrolling from script should flow layout and send a display list to
WebRender. This allows all of the scroll nodes to exist in WebRender
before asking it to move the node.

See https://gist.github.com/paulirish/5d52fb081b3570c81e3a.
Fixes #29659.
2023-04-25 21:25:00 +02:00
Delan Azabani
dd905d8434 clean up spurious changes and todos with no action needed 2023-03-23 18:07:39 +08:00
Delan Azabani
1f74d4c75b revert: Introduce Untransplantable trait to indicate transplantability at the type level
(8f7b0cff87f0eab921e13e6990d76e12935e8675)
2023-03-23 18:06:17 +08:00
Delan Azabani
4c7f198ee2 apply yvt/servo/fix-named-window-getter 2023-03-23 18:02:35 +08:00
Delan Azabani
fd1de05592 apply pylbrecht/servo/named.window.getter (closes #27952) 2023-03-23 18:01:26 +08:00
Emilio Cobos Álvarez
31e8e418ea Miscellaneous build / tidy fixes. 2021-02-26 17:53:55 +01:00
teymour-aldridge
ff767b13a9 Remove unused arguments from methods. 2021-02-05 14:29:45 +00:00
Jonathan Kingston
0e1479cc84 Add creation url and Secure Contexts 2020-11-25 18:30:50 +00:00
Josh Matthews
4dd7387799 dom: Add Window.js_backtrace debugging extension method. 2020-07-14 22:39:59 -04:00
bors-servo
1cd78e78f6
Auto merge of #26998 - gterzian:improve_task_cancelling, r=jdm
Use a stronger atomic guarantee when cancelling tasks

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

In the context of https://github.com/servo/servo/issues/22507

Note that the "other side" of these operations is at 0b61cfc3ae/components/script/task.rs (L102)

---
<!-- 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. -->
2020-07-06 11:11:25 -04:00
Antoine Martin
36fbbea2b5 Return Option for Window's layout channel 2020-07-03 20:00:26 +02:00
Gregory Terzian
58259c199a use a stronger atomic guarantee when cancelling tasks 2020-06-20 13:35:24 +08:00
Kunal Mohan
71401e0855 Implement GPUSwapChain and GPUCanvasContext and interface with Webrender 2020-06-13 17:46:12 +05:30
Utsav Oza
15fd256302 Store resolved font style in canvas context state 2020-06-10 22:10:44 +05:30
Utsav Oza
f3cb7a1910 Add todos for missing steps while processing parse font query 2020-06-10 22:10:43 +05:30
Utsav Oza
7883718c12 Query layout to resolve canvas font property value 2020-06-10 22:10:42 +05:30
bors-servo
ff3d5c5125
Auto merge of #26628 - gterzian:shutdown_workers, r=asajeffrey
Improve worker shutdown

<!-- Please describe your changes on the following line: -->
FIX #26548
FIX #25212

and also  a step towards https://github.com/servo/servo/issues/26502

---
<!-- 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. -->
2020-06-03 13:44:09 -04:00
Gregory Terzian
6f34b52e39 properly shutdown dedicated workers when the owning scope shuts-down 2020-06-03 12:32:45 +08:00
skrzyp1
ee6906443f reading unminified scripts from disk 2020-06-02 21:23:45 +02:00
Martin Robinson
47642e0eee Have Animations struct handle rooting nodes
Instead of having `ScriptThread` handle rooting nodes, do this in
`Animations`. This makes it easier to know when it is appropriate to
root and unroot nodes instead of relying on a certain order of events.
This also allows reducing quite a bit the amount of unsafe code.
2020-05-26 20:24:28 +02:00
Martin Robinson
873cdd1336 Implement animationiteration event
This event is triggered when an animation iterates. This change also
moves iteration out of style calculation to an "update animations" which
is the next part of having animation event handling match the HTML spec.
2020-05-21 15:19:34 +02:00
Anthony Ramine
036f123c4e Implement concept of dirty root 2020-05-19 16:26:36 +02:00
Kunal Mohan
e5065c7eb2 Share single gpu_id_hub among all threads in a process 2020-05-15 01:15:01 +05:30
Josh Matthews
097a84671a dom: Implement current window event. 2020-05-13 14:36:32 -04:00