Commit graph

347 commits

Author SHA1 Message Date
Martin Robinson
3230162fd0
Try to use WebRender types more
The newer versions of WebRender move types around between `webrender` and
`webrender_api` and this will reduce the churn during the upgrade.
2023-07-10 17:35:50 +02:00
Martin Robinson
2f4c47bfe7 Start the transition to workspace dependencies
This will ultimately make it simpler to update crate dependencies and
reduce duplicate when specifying requirements. Generally, this change
does not touch dependencies that are only used by a single crate. We
could consider moving them to workspace dependencies in the future.
2023-05-17 11:59:35 +02:00
Martin Robinson
72b5fcd0b6 Combine DOM-related concepts in Layout 2020 into dom.rs 2023-05-13 11:52:59 +02:00
Martin Robinson
ab4bd2a133 Remove DangerousThreadSafeLayoutNode
Remove this trait and replace it by two non-public functions on
ServoThreadSafeLayoutNode. This requires making the iterator not
generic, which simplifies things a little bit as well.
2023-05-12 08:18:31 +02:00
Oriol Brufau
ab2ba273e3 Simplify our setup for font metric queries from style
This is a backport of https://phabricator.services.mozilla.com/D157589,
by Emilio Cobos Álvarez, plus some additions so that Servo compiles,
and some parts from https://phabricator.services.mozilla.com/D144455.

Should have no change in behavior.
2023-05-11 21:02:15 +02:00
Martin Robinson
2d31d4301d Eliminate duplicate Layout DOM wrappers
There are duplicate sets of Layout DOM wrappers: one for Layout 2013 and
one for Layout 2020. As part of cleaning up and simplifying the
wrappers, this change parameterizes them on the specific layout data
they contain. This allows them to be shared again. In addition, various
small cleanups are included.

Fixes #29691.
2023-05-05 17:16:38 +02:00
Martin Robinson
72302e2dae Detect body elements during layout
During layout it is often useful, for various specification reasons, to
know if an element is the `<body>` element of an `<html>` element root. There
are a couple places where a brittle heuristic is used to detect `<body>`
elements. This information is going to be even more important to
properly handle `<html>` elements that inherit their overflow property from
their `<body>` children.

Implementing this properly requires updating the DOM wrapper interface.
This check does reach up to the parent of thread-safe nodes, but this is
essentially the same kind of operation that `parent_style()` does, so is
ostensibly safe.

This change should not change any behavior and is just a preparation
step for properly handle `<body>` overflow.
2023-05-04 10:46:27 +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
Federico Mena Quintero
8a0810ee74 */Cargo.toml: use the shmem feature for the dependency on the selectors cratre 2023-02-14 13:05:59 -06:00
Martin Robinson
423cc34cb0 Bump euclid to 0.22
- Also updates raqote to latest with an upgrade of font-kit to 0.11
  applied on as a patch
- Update lyon_geom to the latest version

Major change:

- All matrices are now stored in row major order. This means that
  parameters to rotation functions no longer should be negated.
- `post_...()` functions are now named `then()`. `pre_transform()` is removed,
  so `then()` is used and the order of operations changed.
2023-01-26 08:59:21 +01:00
Josh Matthews
9eaa27c946 Update html5ever/xml5ever. 2022-04-01 01:43:26 -04:00
Josh Matthews
a24a4f0608 Update parking_lot. 2022-04-01 01:33:17 -04:00
Gregory Terzian
44ebca72da ensure clean shutdown of all threads running JS 2020-06-30 13:22:38 +08:00
bors-servo
ba5568a0a6
Auto merge of #26921 - mrobinson:animation-set-key, r=jdm
Add DocumentAnimationSet and AnimationSetKey

This will be used in order to hold animations for pseudo elements in the
DocumentAnimationSet. Also no longer store the OpaqueNode in the
animation and transition data structures. This is already part of the
DocumentAnimationSet key.

---
<!-- 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. -->
2020-06-16 03:25:29 -04:00
Martin Robinson
4a3995bb37 Add DocumentAnimationSet and AnimationSetKey
This will be used in order to hold animations for pseudo elements in the
DocumentAnimationSet. Also no longer store the OpaqueNode in the
animation and transition data structures. This is already part of the
DocumentAnimationSet key.
2020-06-15 10:28:30 +02: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
7883718c12 Query layout to resolve canvas font property value 2020-06-10 22:10:42 +05:30
atouchet
77f7fa552d More Cargo.toml updates 2020-05-30 18:18:57 -07:00
Josh Matthews
1da40b59af Remove use of nightly features in parking_lot. Update many uses from 0.9 to 0.10. 2020-05-26 09:34:50 -04:00
Anthony Ramine
036f123c4e Implement concept of dirty root 2020-05-19 16:26:36 +02:00
Simon Sapin
1f6efbf9e9 Correctly paint the CSS canvas’ background
https://drafts.csswg.org/css-backgrounds/#special-backgrounds

Fixes https://github.com/servo/servo/issues/25559
Closes https://github.com/servo/servo/pull/26121, as it is an alternative.
2020-05-15 13:37:09 +02:00
Martin Robinson
3b0619aedd Move most animation processing to script
This is preparation for sharing this code with layout_2020 and
implementing selective off-the-main-thread animations.

We still look for nodes not in the flow tree in the layout thread.
2020-05-12 10:22:14 +02:00
Martin Robinson
3a74013abc Start having animations conform to the HTML spec
This is a small step toward fixing #19242. The main idea is that the
clock for animations should advance as the event loop ticks. We
accomplish this by moving the clock from layout and naming it the
"animation timeline" which is the spec language. This should fix
flakiness with animations and transitions tests where a reflow could
move animations forward while script was running.

This change also starts to break out transition and animation events
into their own data structure, because it's quite likely that the next
step in fixing #19242 is to no longer send these events through a
channel.
2020-05-05 20:08:44 +02:00
Martin Robinson
b585ce5b1f Use a restyle for animation ticks
This change corrects synchronization issues with animations, by
reworking the animation processing model to do a quick restyle and
incremental layout when ticking animations.

While this change adds overhead to animation ticks, the idea is that
this will be the fallback when synchronous behavior is required to
fulfill specification requirements. In the optimistic case, many
animations could be updated and applied off-the-main-thread and then
resynchronized when style information is queried by script.

Fixes #13865.
2020-05-05 15:13:35 +02:00
Martin Robinson
3903c1fb98 Add support for animationend event
This is triggered when an animation finishes. This is a high priority
because it allows us to start rooting nodes with animations in the
script thread.

This doesn't yet cause a lot of tests to pass because they rely on the
existence of `Document.getAnimations()` and the presence of
`animationstart` and animationiteration` events.
2020-05-01 15:29:57 +02:00
Simon Sapin
fbfe86fffe Remove unused #![feature(…)] attributes 2020-04-15 15:01:46 +02:00
Anthony Ramine
c10e839924 Don't go through the layout thread to retrieve a node's primary style 2020-04-07 14:34:47 +02:00
Anthony Ramine
030a1cf8fb Replace OpaqueStyleAndLayoutData by StyleAndOpaqueLayoutData 2020-04-06 23:06:13 +02:00
Anthony Ramine
e3be136c9b Rename a bunch of style/layout data items
GetLayoutData::get_style_and_layout_data becomes
GetOpaqueStyleAndLayoutData::get_opaque_style_and_layout_data.

GetRawData::get_raw_data becomes GetStyleAndLayoutData::get_style_and_layout_data.

LayoutNode::init_style_and_layout_data becomes
LayoutNode::init_opaque_style_and_layout_data.

LayoutNode::take_style_and_layout_data becomes
LayoutNode::take_opaque_style_and_layout_data.
2020-04-06 12:39:52 +02:00
Anthony Ramine
185a402d9c Make DOM own the style and layout data, in an UnsafeCell
The previous Cell was a lie.
2020-04-04 13:10:19 +02:00
Anthony Ramine
4c61baee30 Make OpaqueLayoutAndStyleData just a bit less opaque
It now stores a NonNull<dyn Any>.
2020-04-04 13:08:51 +02:00
Anthony Ramine
6fe294fa5b Make LayoutNodeHelpers::text_content return a cow 2020-03-31 15:02:13 +02:00
Anthony Ramine
60ca98b753 Pass pending restyles instead of draining them from layout 2020-03-28 15:37:56 +01:00
Anthony Ramine
df0118dd10 Move PendingRestyle to the style_layout_interface crate 2020-03-28 14:00:53 +01:00
Anthony Ramine
04af32128c Add a 'dom lifetime to GetLayoutData 2020-03-26 13:17:46 +01:00
Kunal Mohan
a05553f188
Make Background Hang Monitor Optional
This is done by wrapping all channels of communication
and related objects inside Option which are configured
using flag inside servo_config.
2020-02-23 01:45:52 +05:30
Josh Matthews
3fd3c23e17 Update ipc-channel and crossbeam-channel. 2020-02-20 11:15:13 -05:00
Kunal Mohan
4a3bf52a7c
remove option for origin and mirror changes to layout_thread_2020 2020-02-18 00:57:33 +05:30
Kunal Mohan
a5b43b7df1
Take origin from window instead of creating a new one in case of reflow
Everytime a new LayoutContext was created, it created a new origin which
caused endless stream of image loads to occur in case of reflow. The reason
for this was that the existing image, although cached successfully, was not
used because the entry in hashmap did not match because of different(new)
origin.
This is solved by storing the origin of a window in enum ScriptReflow and
used in creating new LayoutContext in case of reflow.
2020-02-15 23:51:26 +05:30
Martin Robinson
740211d191 Improve the name the NodeGeometryQuery
This query is used to get the clientTop, clientWidth, clientHeight,
clientLeft properties of DOM objects. "NodeGeometry" doesn't really
capture what these properties do as they often are returning the width
of element border.
2020-02-05 15:25:52 +01:00
Josh Matthews
564c16d754 Use non-IPC webrender API over explicit IPC channels. 2019-11-27 20:47:53 -05:00
Simon Sapin
94b19beefb Fix some warnings new in Rust Nightly 2019-11-08 11:45:16 +01:00
Josh Matthews
91dfa354b1 Ensure layout/script always have a correct viewport size when a new pipeline is created. 2019-11-06 16:13:55 -05:00
Josh Matthews
fd260f78c8 dom: Calculate the viewport size of iframes when they are first added to the tree. 2019-11-06 16:13:55 -05:00
Anthony Ramine
785a344e32 Update rand to 0.7 (fixes #24448) 2019-10-23 15:34:48 +02:00
Shotaro Yamada
b228d2700e Remove unused dependencies 2019-10-01 21:15:53 +09:00
Anthony Ramine
bceecddb64 Update html5ever to 0.24 2019-09-27 17:43:37 +02:00
bors-servo
9a4f90bf0c
Auto merge of #24058 - Eijebong:ipc-channel, r=jdm
Update ipc-channel and related dependencies

<!-- 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/24058)
<!-- Reviewable:end -->
2019-08-27 18:40:40 -04:00
Bastien Orivel
92161ecfbc Update ipc-channel and related dependencies 2019-08-27 23:44:04 +02:00