Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restyle should reflect animations and transitions #26331

Merged
merged 2 commits into from Apr 29, 2020

Conversation

@mrobinson
Copy link
Member

mrobinson commented Apr 27, 2020

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.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #20116
  • There are tests for these changes OR
  • These changes do not require tests because ___
@mrobinson mrobinson requested review from jdm and emilio Apr 27, 2020
@highfive
Copy link

highfive commented Apr 27, 2020

Heads up! This PR modifies the following files:

  • @emilio: components/layout/animation.rs, components/style/animation.rs, components/style/matching.rs
@mrobinson mrobinson force-pushed the mrobinson:animation-update-on-restyle branch from 73462ea to 3321960 Apr 27, 2020
@nox
Copy link
Member

nox commented Apr 27, 2020

r? @jdm

I don't know anything about animations yet and I'm taking the week off starting tomorrow.

@highfive highfive assigned jdm and unassigned nox Apr 27, 2020
@emilio
emilio approved these changes Apr 27, 2020
Copy link
Member

emilio left a comment

This looks fine but it'd be nice to avoid cloning the style unconditionally. Maybe just wrapping the relevant blocks in an if !animation_state.is_empty() or such would work.

@@ -445,7 +445,10 @@ trait PrivateMatchMethods: TElement {
let mut animation_state = animation_states.remove(&this_opaque).unwrap_or_default();

if let Some(ref mut old_values) = *old_values {
animation_state.compute_before_change_style::<Self>(
// We convert old values into `before-change-style` here.
let old_values = Arc::make_mut(old_values);

This comment has been minimized.

Copy link
@emilio

emilio Apr 27, 2020

Member

So, this will copy the style almost surely, right? It'd be nice to not do that if there are no animations running.

This comment has been minimized.

Copy link
@mrobinson

mrobinson Apr 27, 2020

Author Member

Oh, nice catch! I've modified this so that the methods now take an Arc which will ensure that callers don't accidentally clone the style like I did in this version of the change.

@@ -475,6 +478,20 @@ trait PrivateMatchMethods: TElement {
.cancel_transitions_with_nontransitioning_properties(&transitioning_properties);
}

{
let new_values = Arc::make_mut(new_values);

This comment has been minimized.

Copy link
@emilio

emilio Apr 27, 2020

Member

Same, it seems this will disable all sorts of style sharing optimizations.

This comment has been minimized.

Copy link
@mrobinson

mrobinson Apr 27, 2020

Author Member

Same here. I originally went with an is_empty() check, but ended up doing this in the methods themselves to enable more fine-grained control over when the style is cloned.

@mrobinson mrobinson force-pushed the mrobinson:animation-update-on-restyle branch from 3321960 to 08fd1af Apr 27, 2020
@jdm
jdm approved these changes Apr 27, 2020
@mrobinson
Copy link
Member Author

mrobinson commented Apr 27, 2020

Thanks for the reviews! I'm about to push a new version of this change which switches back to using Arc<ComputedValues> everywhere so that callers of new methods don't accidentally clone styles. It will also eliminate one more use of eager Arc::make_mut that existed prior to this change.

@mrobinson mrobinson force-pushed the mrobinson:animation-update-on-restyle branch from 08fd1af to c89f448 Apr 27, 2020
@mrobinson
Copy link
Member Author

mrobinson commented Apr 28, 2020

@bors-servo r=jdm,emilio

@bors-servo
Copy link
Contributor

bors-servo commented Apr 28, 2020

📌 Commit c89f448 has been approved by jdm,emilio

@bors-servo
Copy link
Contributor

bors-servo commented Apr 28, 2020

Testing commit c89f448 with merge 1274980...

bors-servo added a commit that referenced this pull request Apr 28, 2020
…milio

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.

<!-- 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 #20116

<!-- 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. -->
@bors-servo
Copy link
Contributor

bors-servo commented Apr 28, 2020

💔 Test failed - status-taskcluster

@jdm
Copy link
Member

jdm commented Apr 28, 2020

So many new passing tests!

@mrobinson mrobinson force-pushed the mrobinson:animation-update-on-restyle branch from c89f448 to 95adeee Apr 29, 2020
@mrobinson
Copy link
Member Author

mrobinson commented Apr 29, 2020

@bors-servo r=jdm,emilio

Trying this again with updated expectations, but this might take a couple rounds.

@jdm
Copy link
Member

jdm commented Apr 29, 2020

There's an ini file with a problem:

ParseError: Token 'group_start' doesn't equal expected type 'group_end':  line 28
  File "/repo/python/servo/testing_commands.py", line 342, in test_tidy
    tidy_failed = tidy.scan(not all_files, not no_progress, stylo=stylo, no_wpt=no_wpt)
  File "/repo/python/tidy/servo_tidy/tidy.py", line 1141, in scan
    for error in errors:
  File "/repo/python/tidy/servo_tidy/tidy.py", line 517, in check_manifest_dirs
    p = parser.parse(lines)
  File "/repo/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/parser.py", line 789, in parse
    return p.parse(stream)
  File "/repo/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/parser.py", line 540, in parse
    self.manifest()
  File "/repo/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/parser.py", line 564, in manifest
    self.data_block()
  File "/repo/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/parser.py", line 585, in data_block
    self.data_block()
  File "/repo/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/parser.py", line 586, in data_block
    self.eof_or_end_group()
  File "/repo/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/parser.py", line 591, in eof_or_end_group
    self.expect(token_types.group_end)
  File "/repo/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/wptmanifest/parser.py", line 555, in expect
    "Token '{}' doesn't equal expected type '{}'".format(self.token[0], type))
These are all going to be flaky until we get further along with the
transition and animation improvements. The flakiness is due to the fact
that it is more likely that these tests pass now.
@@ -19,20 +19,34 @@ skip: true
skip: false
[CSS2]
skip: false
[linebox]
skip:false

This comment has been minimized.

Copy link
@jdm

jdm Apr 29, 2020

Member

Possibly the missing space here?

This comment has been minimized.

Copy link
@mrobinson

mrobinson Apr 29, 2020

Author Member

Looks like I had an extra level of indentation in the css-align and css-color sections. Should be fixed now.

@mrobinson mrobinson force-pushed the mrobinson:animation-update-on-restyle branch from 44f306e to fb9c352 Apr 29, 2020
@mrobinson
Copy link
Member Author

mrobinson commented Apr 29, 2020

@bors-servo try=wpt-mac

It looked like the tidy precheck passed without issues, so I feel a bit safer about triggering this now.

@bors-servo
Copy link
Contributor

bors-servo commented Apr 29, 2020

Trying commit fb9c352 with merge 258654e...

bors-servo added a commit that referenced this pull request Apr 29, 2020
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.

<!-- 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 #20116

<!-- 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. -->
@bors-servo
Copy link
Contributor

bors-servo commented Apr 29, 2020

💔 Test failed - status-taskcluster

@mrobinson
Copy link
Member Author

mrobinson commented Apr 29, 2020

@bors-servo r=jdm,emilio

The WPT failure is:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 58: ordinal not in range(128)
@bors-servo
Copy link
Contributor

bors-servo commented Apr 29, 2020

📌 Commit fb9c352 has been approved by jdm,emilio

@jdm
Copy link
Member

jdm commented Apr 29, 2020

@mrobinson For future reference, look at the filtered-wpt-errorsummary.log file instead of the live log.

@mrobinson
Copy link
Member Author

mrobinson commented Apr 29, 2020

@jdm Thanks for the pointer. Looks like the real failure during the try was #25513.

@bors-servo
Copy link
Contributor

bors-servo commented Apr 29, 2020

Testing commit fb9c352 with merge 5925d42...

bors-servo added a commit that referenced this pull request Apr 29, 2020
…milio

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.

<!-- 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 #20116

<!-- 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. -->
@bors-servo
Copy link
Contributor

bors-servo commented Apr 29, 2020

💔 Test failed - status-taskcluster

@jdm
Copy link
Member

jdm commented Apr 29, 2020

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented Apr 29, 2020

Testing commit fb9c352 with merge d1279eb...

@bors-servo
Copy link
Contributor

bors-servo commented Apr 29, 2020

☀️ Test successful - status-taskcluster
Approved by: jdm,emilio
Pushing d1279eb to master...

@bors-servo bors-servo merged commit d1279eb into servo:master Apr 29, 2020
2 checks passed
2 checks passed
Community-TC (pull_request) TaskGroup: success
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

6 participants
You can’t perform that action at this time.