Skip to content

Add @keyframes and animation-* support. - #11766

Merged
bors-servo merged 28 commits into
servo:masterfrom
emilio:keyframes-parsing
Jun 28, 2016
Merged

bors-servo merged 28 commits into
servo:masterfrom
emilio:keyframes-parsing

Conversation

@emilio

@emilio emilio commented Jun 17, 2016 •

Copy link
Copy Markdown
Member
  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • There are tests for these changes

This adds support for parsing @keyframes rules, and animation properties. Stylo will need it sometime soonish, plus I want to make animations work in Servo.

The remaining part is doin the math and trigger the animations correctly from servo. I don't expect it to be that hard, but probaby I'll need to learn a bit more about the current animation infra (e.g. why the heck is the new_animations_sender guarded by a Mutex?).

I'd expect to land this, since this is already a bunch of work, this is the part exclusively required by stylo (at least if we don't use Servo's machinery), the media query parsing is tested, and the properties land after a flag, but if you prefer to wait until I finish this up it's fine for me too.

r? @SimonSapin

cc @pcwalton @bholley


This change is Reviewable

@highfive

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @bholley: components/style/selector_impl.rs, components/style/properties/data.py, components/style/traversal.rs, components/style/stylesheets.rs, components/style/lib.rs, components/style/selector_matching.rs, components/style/properties/properties.mako.rs, components/style/values.rs, components/style/properties/helpers.mako.rs, components/style/keyframes.rs, components/style/properties/longhand/box.mako.rs, components/style/animation.rs, components/style/viewport.rs, components/style/matching.rs
  • @KiChjang: components/script/dom/webidls/CSSStyleDeclaration.webidl

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jun 17, 2016
@emilio

emilio commented Jun 17, 2016

Copy link
Copy Markdown
Member Author

@bors-servo: try

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit 2682a02 with merge b53ce7f...

bors-servo pushed a commit that referenced this pull request Jun 17, 2016
Add `@keyframes` and `animation-*` rule parsing

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [x] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

This adds support for parsing `@keyframes` rules, and animation properties. Stylo will need it sometime soonish, plus I want to make animations work in Servo.

The remaining part is doin the math and trigger the animations correctly from servo. I don't expect it to be *that* hard, but probaby I'll need to learn a bit more about the current animation infra (e.g. why the heck is the `new_animations_sender` guarded by a `Mutex`?).

I'd expect to land this, since this is already a bunch of work, this is the part exclusively required by stylo (at least if we don't use Servo's machinery), the media query parsing is tested, and the properties land after a flag, but if you prefer to wait until I finish this up it's fine for me too.

r? @SimonSapin

cc @pcwalton @bholley
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - android

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Jun 17, 2016
@emilio

emilio commented Jun 17, 2016

Copy link
Copy Markdown
Member Author

@bors-servo: retry

  • I/O failure building openssl, wtf?

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit 2682a02 with merge a233079...

bors-servo pushed a commit that referenced this pull request Jun 17, 2016
Add `@keyframes` and `animation-*` rule parsing

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [x] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

This adds support for parsing `@keyframes` rules, and animation properties. Stylo will need it sometime soonish, plus I want to make animations work in Servo.

The remaining part is doin the math and trigger the animations correctly from servo. I don't expect it to be *that* hard, but probaby I'll need to learn a bit more about the current animation infra (e.g. why the heck is the `new_animations_sender` guarded by a `Mutex`?).

I'd expect to land this, since this is already a bunch of work, this is the part exclusively required by stylo (at least if we don't use Servo's machinery), the media query parsing is tested, and the properties land after a flag, but if you prefer to wait until I finish this up it's fine for me too.

r? @SimonSapin

cc @pcwalton @bholley

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11766)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - android

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Jun 17, 2016
@emilio

emilio commented Jun 17, 2016

Copy link
Copy Markdown
Member Author

@bors-servo: retry

bors-servo pushed a commit that referenced this pull request Jun 17, 2016
Add `@keyframes` and `animation-*` rule parsing

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [x] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

This adds support for parsing `@keyframes` rules, and animation properties. Stylo will need it sometime soonish, plus I want to make animations work in Servo.

The remaining part is doin the math and trigger the animations correctly from servo. I don't expect it to be *that* hard, but probaby I'll need to learn a bit more about the current animation infra (e.g. why the heck is the `new_animations_sender` guarded by a `Mutex`?).

I'd expect to land this, since this is already a bunch of work, this is the part exclusively required by stylo (at least if we don't use Servo's machinery), the media query parsing is tested, and the properties land after a flag, but if you prefer to wait until I finish this up it's fine for me too.

r? @SimonSapin

cc @pcwalton @bholley

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11766)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit 2682a02 with merge 35924d9...

@jdm

jdm commented Jun 17, 2016

Copy link
Copy Markdown
Member

The android builder is out of space. We won't be able to merge anything until that's fixed.

@emilio

emilio commented Jun 17, 2016

Copy link
Copy Markdown
Member Author

@pcwalton: Do you know if there's a specific reason to have new_animations_sender guarded by a Mutex? We only lock it for sending...

@jdm

jdm commented Jun 17, 2016 •

Copy link
Copy Markdown
Member

I assume because it can be used from multiple worker threads, and Senders aren't Sync.

@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt, windows

@emilio

emilio commented Jun 17, 2016

Copy link
Copy Markdown
Member Author

@jdm: but you can clone it and move it, right?

@highfive highfive removed the S-tests-failed The changes caused existing tests to fail. label Jun 17, 2016
@emilio

emilio commented Jun 17, 2016

Copy link
Copy Markdown
Member Author

The last commit won't pass tidy, but it's a large-ish refactor of how computed properties are calculated, so I thought it could be worth it to push it for now, since I won't be able to work on it more today.

@emilio

emilio commented Jun 20, 2016

Copy link
Copy Markdown
Member Author

The latest commits actually get keyframes working to a decent extent \o/.

Probably part of the approach could/should be reviewed by @pcwalton.

Regarding the Mutex, it's because it's inside of SharedLayoutContext that can't just be cloned. This can be solved splitting the context, but that's another patch.

There are a few known shortcomings that must be solved before merging, read the last commit for details, but I think this approach is decent enough that I can get some feedback on it.

Also, a huge cleanup is needed, but with the following html file:

<!doctype html>
<meta charset="utf-8">
<style>
  @keyframes foo {
    from { transform: scale(0.5); }
    to { transform: scale(1.5) }
  }

  div {
    animation-name: foo;
    animation-duration: 1.5s;
    animation-timing-function: ease;
    animation-iteration-count: infinite;
    border-radius: 100px;
    width: 200px;
    height: 200px;
    line-height: 200px;
    margin: 100px;
    background-color: red;
    text-align: center;
    font-family: sans-serif;
    font-weight: bold;
    color: white;
  }

  /* See the last commit message to see why */
  div:hover { }
</style>
<div>Hello Servo!</div>

This is the output (after hovering the element), and sorry for the bad quality of the gif:

anim

@emilio emilio changed the title Add @keyframes and animation-* rule parsing Add @keyframes and animation-* support. Jun 20, 2016
@emilio
emilio force-pushed the keyframes-parsing branch from 798807d to 39973df Compare June 20, 2016 23:02
@bors-servo

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #11804) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Jun 21, 2016
@emilio
emilio force-pushed the keyframes-parsing branch from 39973df to 8f1cc1a Compare June 21, 2016 12:00
emilio added 2 commits June 28, 2016 15:28
Although we don't generate a "computed" keyframe animation, we're required to
shadow others.
@emilio
emilio force-pushed the keyframes-parsing branch from d7424af to 9fe0fdd Compare June 28, 2016 18:31
@SimonSapin

Copy link
Copy Markdown
Member

Let’s call it r=SimonSapin+pcwalton with a rebase.

@emilio
emilio force-pushed the keyframes-parsing branch 2 times, most recently from eab682b to d7e535a Compare June 28, 2016 22:21
@emilio

emilio commented Jun 28, 2016

Copy link
Copy Markdown
Member Author

Ok, rebased and squashed wip commits.

@bors-servo: r=SimonSapin,pcwalton

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit d7e535a has been approved by SimonSapin,pcwalton

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. S-needs-rebase There are merge conflict errors. labels Jun 28, 2016
@emilio
emilio force-pushed the keyframes-parsing branch from d7e535a to 392f243 Compare June 28, 2016 22:28
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Jun 28, 2016
@emilio

emilio commented Jun 28, 2016 •

Copy link
Copy Markdown
Member Author

@bors-servo: r=SimonSapin,pcwalton

Fixed geckolib build that was complaining after the rustup for a private type alias of a public type in a public member:

data.rs:34:39: 34:48 error: private type in public interface [E0446]
data.rs:34     pub new_animations_sender: Sender<Animation>,
                                                 ^~~~~~~~~
data.rs:34:39: 34:48 help: run `rustc --explain E0446` to see a detailed explanation
data.rs:35:43: 35:52 error: private type in public interface [E0446]
data.rs:35     pub new_animations_receiver: Receiver<Animation>,
                                                     ^~~~~~~~~
data.rs:35:43: 35:52 help: run `rustc --explain E0446` to see a detailed explanation
data.rs:36:64: 36:73 error: private type in public interface [E0446]
data.rs:36     pub running_animations: Arc<RwLock<HashMap<OpaqueNode, Vec<Animation>>>>,
                                                                          ^~~~~~~~~
data.rs:36:64: 36:73 help: run `rustc --explain E0446` to see a detailed explanation
data.rs:37:64: 37:73 error: private type in public interface [E0446]
data.rs:37     pub expired_animations: Arc<RwLock<HashMap<OpaqueNode, Vec<Animation>>>>,
                                                                          ^~~~~~~~~
data.rs:37:64: 37:73 help: run `rustc --explain E0446` to see a detailed explanation
error: aborting due to 4 previous errors
error: Could not compile `geckoservo`.

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 392f243 has been approved by SimonSapin,pcwalton

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jun 28, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

💡 This pull request was already approved, no need to approve it again.

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 392f243 has been approved by SimonSapin,pcwalton

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 392f243 with merge d3a8137...

bors-servo pushed a commit that referenced this pull request Jun 28, 2016
Add `@keyframes` and `animation-*` support.

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [x] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

This adds support for parsing `@keyframes` rules, and animation properties. Stylo will need it sometime soonish, plus I want to make animations work in Servo.

The remaining part is doin the math and trigger the animations correctly from servo. I don't expect it to be *that* hard, but probaby I'll need to learn a bit more about the current animation infra (e.g. why the heck is the `new_animations_sender` guarded by a `Mutex`?).

I'd expect to land this, since this is already a bunch of work, this is the part exclusively required by stylo (at least if we don't use Servo's machinery), the media query parsing is tested, and the properties land after a flag, but if you prefer to wait until I finish this up it's fine for me too.

r? @SimonSapin

cc @pcwalton @bholley

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11766)
<!-- Reviewable:end -->
@emilio emilio mentioned this pull request Jun 28, 2016
6 of 11 tasks
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt, windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants