Commit graph

432 commits

Author SHA1 Message Date
Utsav Oza
7883718c12 Query layout to resolve canvas font property value 2020-06-10 22:10:42 +05:30
Josh Matthews
abc689e034 Remove unecessary webrender document from layout. 2020-06-09 13:05:16 -04:00
Martin Robinson
83fa1b9eaa Cache animation computed values when animations change
Instead of recalculating the animation style every tick of an animation,
cache the computed values when animations change. In addition to being
more efficient, this will allow us to return animation rules as property
declarations because we don't need to consult the final style to produce
them.
2020-06-05 13:21:19 +02:00
Simon Sapin
0abe90647f Remove support for energy profiling 2020-06-04 16:39:08 +02:00
Anthony Ramine
036f123c4e Implement concept of dirty root 2020-05-19 16:26:36 +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
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
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
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
bors-servo
610991bdfc
Auto merge of #26244 - mrobinson:animation-cancel, r=jdm
Add support for canceling CSS transitions

This change adds support for canceling CSS transitions when a property is
no longer transitionable. 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.

<!-- 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 fix #15079.

<!-- 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-04-22 15:34:06 -04: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
Anthony Ramine
7f54d14904 Make the rule tree actually threadsafe
RuleTree::gc is now a safe method that any thread can call
at any time, and StrongRuleNode values can all be dropped
whenever their owner want to, on any thread.
2020-04-20 17:39:19 +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
bors-servo
57fe27a4ef
Auto merge of #26110 - servo:layout-2020-rm-note-dirty-descendant, r=emilio
Kill ServoLayoutElement::note_dirty_descendant
2020-04-04 09:51:19 -04:00
Anthony Ramine
8a0775fc89 Kill ServoLayoutElement::note_dirty_descendant
There is no need to set the dirty descendants flag unsafely from the layout side
for elements with pending restyles, we can do that on the DOM side when draining
the restyles from the Document.
2020-04-04 15:00:04 +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
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
60ca98b753 Pass pending restyles instead of draining them from layout 2020-03-28 15:37:56 +01:00
Anthony Ramine
04af32128c Add a 'dom lifetime to GetLayoutData 2020-03-26 13:17:46 +01:00
Iulian Gabriel Radu
68c40da64a Remove unnecessary .clone() calls 2020-03-04 20:09:56 +02: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
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
Josh Matthews
edcdcf7c13 layout: Inform webrender about new pipeline as early as possible. 2019-11-13 11:54:51 -05: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
Josh Matthews
81a67aed9e Double key image cache by requesting origin, and store CORS status with cached images. 2019-10-04 09:22:21 -04:00
Emilio Cobos Álvarez
cd3b0c23fa
style: Fix Servo build, and rustfmt recent changes. 2019-09-12 23:04:56 +02:00
Simon Sapin
e9f7079c70 Replace DisplayList::is_contentful with tracking during conversion to WR display lists 2019-09-06 17:15:53 +02:00
Simon Sapin
526619a78a Replace the WebRenderDisplayItemConverter trait with an inherent method 2019-09-06 16:59:11 +02:00
Gregory Terzian
8482d2e781 restructure content process shutdown ack with threaded sender, without layout 2019-08-17 16:03:07 +02:00
Emilio Cobos Álvarez
3d57c22e9c Update euclid.
There are a few canvas2d-related dependencies that haven't updated, but they
only use euclid internally so that's not blocking landing the rest of the
changes.

Given the size of this patch, I think it's useful to get this landed as-is.
2019-07-23 23:09:55 +02:00
Josh Matthews
10ab466e5d Create a solid rectangle display list entry for the page background. 2019-07-09 10:51:56 -04:00
Patrick Walton
6b9924bec4 Stop storing display lists in an Arc 2019-07-09 10:50:29 -04:00
Patrick Walton
2f9c9cefdb WebRender units are no longer reexported. 2019-07-09 10:50:27 -04:00
Josh Matthews
43a75011be Upgrade to rustc 1.37.0-nightly (088b98730 2019-07-03) 2019-07-05 16:53:02 +02:00
Simon Sapin
1d38bc0419 Fix some new warnings 2019-06-22 14:59:09 +02:00
oneturkmen
810f5abae6 Layout_thread: removed all possible opts::get() 2019-06-04 17:36:14 -06:00
Fernando Jiménez Moreno
2674a3e717 Flush shadow roots stylesheets only if they changed 2019-04-26 11:31:17 +02:00
Fernando Jiménez Moreno
a841c713d6 Minor layout thread cleanups:
- lifetime naming
- unrequired reference removal
- containing_shadow_host getter simplification
- use stylist.device getter where possible
2019-04-26 11:31:17 +02:00
Fernando Jiménez Moreno
519cc2c317 Invalidate and flush shadow tree stylesheets where needed 2019-04-26 10:17:47 +02:00
pylbrecht
4fd9fea7a6 fixup! Measure layout queries blocked by ongoing layout 2019-04-17 17:23:17 +02:00
Philipp Albrecht
858011c513 Measure layout queries blocked by ongoing layout 2019-04-13 07:42:07 +02:00
Peter Hall
8bfd4dc1e2 #8539 Config preferences backend restructure 2019-03-20 15:01:26 +00:00
bors-servo
2e439fa7cb
Auto merge of #22396 - jdm:no-spam-iframe-size, r=asajeffrey
Reduce unnecessary iframe size messages

This should be an improvement on pages that include iframes, since we currently run two layout jobs for every display-oriented layout request. When building the display list, we send a message to the constellation that includes the sizes of all iframes present, and the constellation sends resize messages to the script thread. This results in a mouse event on the outer page causing all frames to be re-laid out even if no changes occurred to the iframe sizes, which is ridiculous.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22394
- [x] These changes do not require tests because there is no way to test this internal detail.

<!-- 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/22396)
<!-- Reviewable:end -->
2019-01-14 19:12:59 -05:00