Commit graph

2975 commits

Author SHA1 Message Date
bors-servo
7eacfa4f0d
Auto merge of #26823 - jdm:single-renderapi, r=asajeffrey
Update webrender

These changes reflect changes in webrender's API that make RenderApiSender and RenderApi objects more challenging to share. This PR moves us to a model where:
* the compositor owns the main RenderApi object
* other threads that need to create transactions or manipulate fonts proxy those operations to the compositor (script/layout use IPC, while other threads use non-IPC channels)
* the webgl thread owns its own independent RenderApi
2020-06-09 19:34:08 -04:00
bors-servo
cb4e3cb16a
Auto merge of #26758 - jdm:stacking-context-transform-zero, r=mrobinson
Don't create empty stacking contexts in display lists

A recent change to euclid exposed that our display lists can contain Rects that contain NaN values. These NaNs originate from creating stacking contexts with transforms that scale the horizontal or vertical dimensions to 0. WebRender isn't prepared to handle these, so we need to not produce these empty stacking contexts when building the display list.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #26592 and fix #26590
- [x] There are tests for these changes
2020-06-09 13:37:30 -04:00
Josh Matthews
75efaa95f5 Proxy all WR interactions for layout/font/script/canvas threads to the compositor
thread. There is now a single RenderApi that is used, and all transactions are serialized
through the compositor.
2020-06-09 13:05:16 -04:00
Josh Matthews
08427ccee5 layout: Don't built stacking contexts or display lists for empty blocks. 2020-06-09 11:27:23 -04:00
Simon Sapin
d4227b5b0d Remove some unused dependency declarations
This is based on compiling with `RUSTFLAGS="-W unused_crate_dependencies"` (CC https://github.com/rust-lang/rust/pull/72342) in a recent Nightly (more so than used in the tree as of this writing, CC https://github.com/servo/servo/issues/26661 for work-arounds).

Only one crate is actually removed from the dependency graph, others are still dependended from other places.
2020-05-29 00:04:34 +02: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
Alex Touchet
d132866c5d
More Cargo.toml cleanups 2020-05-14 22:20:18 -07:00
bors-servo
ea4ae04655
Auto merge of #26335 - jdm:wrup, r=SimonSapin
Update webrender.
2020-05-12 14:56:19 -04:00
Josh Matthews
af05da574b Use new webrender rounded clip API. 2020-05-12 14:43:41 -04: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
Josh Matthews
8842250033 Update webrender. 2020-05-11 17:41:56 -04:00
Bastien Orivel
bdbfde9ec0 Don't send a load event when a loaded image is actually the placeholder
The image cache returns an `ImageCacheResult::ImageAvailable `the second
time you try getting the placeholder. This means that in some cases, the
loading of an image would fail, then the same image would get fetched
from the cache, the placeholder would be loaded from that but would be
seen as a normal image, firing a load event.

This made the tests in
`fetch/cross-origin-resource-policy/image-loads.html` fail depending on
their order.
2020-05-08 19:15:24 +02:00
Martin Robinson
b8874ad6ac Split animations and transitions into separate lists
This change splits the list of animations and transitions, which are
almost always handled differently. It also renames
`ElementAnimationState` to `ElementAnimationSet` and establishes an
`AnimationState` for every transition and animation. This allows us to
stop continually reallocating lists every time a transition or animation
needs to be canceled.

Fixes #14419.
2020-05-06 19:26:50 +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
bors-servo
73abf56e99
Auto merge of #26215 - dralley:fix-image-border, r=jdm
Fix combination of border and border-radius being drawn incorrectly

fixes #20922

Manual testcase in the attached issue

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #20922

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because ___
2020-05-02 10:24:16 -04: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
Martin Robinson
0ab4260d6b Split animation cancellation from update_style_for_animation
`update_style_for_animation` previously handled both canceling defunct
animations and also updating style to reflect current animation state.
This change splits those two concerns because we want to start handling
replaced or canceled animations and finished animations in two different
places.

This is a refactor, so ideally it shouldn't change any behavior.
2020-04-30 15:45:07 +02:00
Martin Robinson
5ca2e7ce91 Restyle should reflect animations and transitions
When doing a restyle, we should apply animations and transitions to the
new style so that it is reflected in `getComputedStyle()` and the new
style information properly cascades. This is the first part of properly
ticking animations and transitions.

This causes a couple new animations tests failures (along with many new
passes), but we currently don't have support for properly handling
animations after they have completed, so this isn't totally unexpected.
2020-04-29 15:31:31 +02:00
Martin Robinson
d386d6d1f1 Add support for transitionrun events
These events are triggered as soon as a transition is added to the list
of running transitions. This will allow better test coverage while
reworking the transitions and animations processing model.
2020-04-24 14:20:37 +02:00
Martin Robinson
8f988be18a Add ElementAnimationState and PossibleElementAnimationState
This refactor is preparation for implementing a specification
compliant transitions and animations processing model.

These data structures hold all the animation information about a single
node. Since adding, updating, and modifying animations for a single node
are all interdependent, it makes sense to start encapsulating animation
data and functionality into a single data structure. This also opens up
the possibility for easier concurrency in the future by more easily
allowing per-node mutexes.
2020-04-24 11:51:17 +02:00
Martin Robinson
453b252a65 Add support for canceling CSS transitions
This change adds support for canceling CSS transitions when a property
is no longer transitionable or when an element becomes styled with
display:none. Support for canceling and replacing CSS transitions when
the end value changes is still pending. This change also takes advantage
of updating the constellation message to fix a bug where transition
events could be sent for closed pipelines.

Fixes #15079.
2020-04-22 17:23:26 +02:00
bors-servo
3a1531f18f
Auto merge of #26214 - mrobinson:animation-eliminate-animation-frame, r=emilio
Eliminate `AnimationFrame`

This intermediate data structure doesn't really buy us anything and is a
bit confusing.

<!-- 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
- [x] These changes do not require tests because they do 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-04-18 10:34:44 -04:00
Martin Robinson
a0b495750e Eliminate AnimationFrame
This intermediate data structure doesn't really buy us anything and is a
bit confusing.
2020-04-18 13:48:52 +02:00
Daniel Alley
232df236a7 Fix combination of border and border-radius being drawn incorrectly
fixes #20922
2020-04-17 16:30:30 -04:00
bors-servo
c9480c8e07
Auto merge of #23661 - julientregoat:i-21289, r=jdm
Refactor ImageCache::find_image_or_metadata -> ImageCache::{get_image, track_image}

<!-- Please describe your changes on the following line: -->
Updated the `ImageCache` trait to replace `find_image_or_metadata` with two new functions `track_image` and `get_image`, as well as a new enum (`ImageCacheResult`).

As a result, I was able to refactor the functions that previously called `find_image_or_metadata` pretty cleanly. For a list of these functions, please see the commit information.

---
<!-- 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 #21289  (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because tests already exist for these components. I ran `cargo test` in `net`, `net_traits`, `layout`, and `script` successfully.

<!-- 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/23661)
<!-- Reviewable:end -->
2020-04-17 15:56:30 -04:00
Julien Tregoat
2742fd2bea Refactor ImageCache::find_image_or_metadata API. 2020-04-17 11:58:18 -04:00
Emilio Cobos Álvarez
848a6203de Some servo build fixes. 2020-04-16 18:29:30 +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
bors-servo
d64f7d427a
Auto merge of #26105 - servo:layout-2020-less-opaque, r=emilio
Make DOM own the style and layout data, in an UnsafeCell
2020-04-04 09:35:34 -04: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
516e8e0aa6 Don't expose any AtomicRefCell directly from style traits
This lets us experiment with how we store this data on the DOM side.
2020-04-04 13:08:51 +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
Daniel Alley
61fb84d6a0 Don't send empty canvases to WebRender
If any dimension of a canvas is 0, don't try to render it as it causes
problems inside webrender.
2020-04-03 11:34:04 -04:00
bors-servo
516279e24f
Auto merge of #26074 - jdm:transition-fix, r=SimonSapin
Avoid infinitely looping CSS transitions.

This change addresses the long-standing issue of CSS transitions not ending appropriately. It does not fundamentally change the way we process transitions/animations.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #20379
- [x] There are tests for these changes
2020-04-01 15:19:15 -04:00
Josh Matthews
2bb6ab4567 Avoid infinitely looping CSS transitions. 2020-04-01 12:13:52 -04:00
Anthony Ramine
6fe294fa5b Make LayoutNodeHelpers::text_content return a cow 2020-03-31 15:02:13 +02:00
Daniel Alley
3258bcaa8b Fix failing assertion -- failure to pop reference frame
closes #23438
2020-03-30 23:29:19 -04:00
Anthony Ramine
04af32128c Add a 'dom lifetime to GetLayoutData 2020-03-26 13:17:46 +01:00
Anthony Ramine
9996e48500 Remove syn 0.15 from our crate graph (fixes #24421)
This required bumps of:

* gleam
* image
* rust-webvr
* webrender
* webxr
2020-03-05 13:01:13 +01:00
bors-servo
9c6897c967
Auto merge of #25818 - mrobinson:transforms, r=SimonSapin
Add initial support for transforms to layout_2020

---
<!-- 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: -->
- [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-24 12:45:43 -05:00
Martin Robinson
80b29380f1 Add layout_2020 support for transformations 2020-02-21 17:07:09 +01:00
Josh Matthews
3fd3c23e17 Update ipc-channel and crossbeam-channel. 2020-02-20 11:15:13 -05:00
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
Simon Sapin
708d3737df Upgrade to rustc 1.43.0-nightly (5d04ce67f 2020-02-13) 2020-02-14 12:27:14 +01:00
Emilio Cobos Álvarez
f03026b869
layout: Resolve word_spacing ahead of time.
It's not possible anymore, in the presence of min() / max(), to split a
<length-percentage> value into a <length> and a <percentage> component.

Tweak word_spacing to do what Gecko does (resolving it in advance).
2020-02-12 02:43:23 +01:00
Emilio Cobos Álvarez
e227715aee
style: Miscellaneous Servo build fixes. 2020-02-12 02:43:23 +01:00