Skip to content

Complete animations whether or not cascade needs done - #12623

Merged
bors-servo merged 2 commits into
servo:masterfrom
notriddle:master
Jul 28, 2016
Merged

bors-servo merged 2 commits into
servo:masterfrom
notriddle:master

Conversation

@notriddle

@notriddle notriddle commented Jul 27, 2016 •

Copy link
Copy Markdown
Contributor

This change is Reviewable

@highfive

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @bholley: components/style/traversal.rs

@highfive

Copy link
Copy Markdown

warning Warning warning

  • These commits modify style code, but no tests are modified. Please consider adding a test!

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jul 27, 2016
@jdm jdm added the S-needs-tests New tests have been requested by a reviewer. label Jul 27, 2016
Comment thread components/style/traversal.rs Outdated
if let Some(ref animations) = animations_to_expire {
for animation in *animations {
// NB: Expiring a keyframes animation is the same as not
// applying the keyframes style to it, so we're safe.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not quite true, could you make a note about supporting animation fill mode?

@notriddle notriddle removed the S-needs-tests New tests have been requested by a reviewer. label Jul 27, 2016
@emilio

emilio commented Jul 28, 2016

Copy link
Copy Markdown
Member

Reviewed 2 of 2 files at r2, 2 of 2 files at r3, 1 of 2 files at r5.
Review status: 1 of 4 files reviewed at latest revision, 2 unresolved discussions.


components/style/matching.rs, line 477 [r3] (raw file):

                for animation in *animations {
                    // TODO: support animation-fill-mode
                    if let Animation::Transition(_, _, ref frame, _) = *animation {

Can we factor this code out and use it in both situations?


components/style/traversal.rs, line 239 [r1] (raw file):

    } else {
        // Finish any expired transitions, without performing the cascade.
        let node_opaque = node.opaque();

I'm kind of worried this is a bit overkill in the common case there aren't transitions to expire. Also, I wonder if this will even work now #12563 has landed, where we won't process the nodes that aren't marked as needing a restyle. We also don't construct flows again for every node, so this might be fixed with that patch?

In case it's not: What about just layout marking nodes as dirty once it detects there's an animation to expire, and running the cascade then? Hmm... But layout only knows about OpaqueNodes, and by design these are not convertible back to a node... Maybe they should be from script?

Other way to do it is adding a flag to the node (IS_ANIMATED?) in start_transitions_if_applicable, but then we should have another flag, let's say HAS_ANIMATED_CHILDREN, and keep doing the traversal for these too.

Another solution that may actually work even better is updating the expired animation style from layout (in recalc_style_for_animations)?

We could remove the items in the expired animations map there if it's not needed from the cascade (haven't actually tested it), but even if it's needed, updating the style there should prevent it getting updated again until a proper restyle with cascade is done.


components/style/traversal.rs, line 252 [r1] (raw file):

Previously, emilio (Emilio Cobos Álvarez) wrote…

This is not quite true, could you make a note about supporting animation fill mode?

Thanks!

Comments from Reviewable

@emilio

emilio commented Jul 28, 2016

Copy link
Copy Markdown
Member

Review status: 1 of 4 files reviewed at latest revision, 2 unresolved discussions.


components/style/traversal.rs, line 239 [r1] (raw file):

Previously, emilio (Emilio Cobos Álvarez) wrote…

I'm kind of worried this is a bit overkill in the common case there aren't transitions to expire. Also, I wonder if this will even work now #12563 has landed, where we won't process the nodes that aren't marked as needing a restyle. We also don't construct flows again for every node, so this might be fixed with that patch?

In case it's not: What about just layout marking nodes as dirty once it detects there's an animation to expire, and running the cascade then? Hmm... But layout only knows about OpaqueNodes, and by design these are not convertible back to a node... Maybe they should be from script?

Other way to do it is adding a flag to the node (IS_ANIMATED?) in start_transitions_if_applicable, but then we should have another flag, let's say HAS_ANIMATED_CHILDREN, and keep doing the traversal for these too.

Another solution that may actually work even better is updating the expired animation style from layout (in recalc_style_for_animations)?

We could remove the items in the expired animations map there if it's not needed from the cascade (haven't actually tested it), but even if it's needed, updating the style there should prevent it getting updated again until a proper restyle with cascade is done.

Actually, thinking about it a bit more, this applies in the case an element isn't restyled, but its children are right? (i.e. the `HAS_DIRTY_DESCENDANTS` flag). In that case, I guess the overhead is not so much.

Comments from Reviewable

@notriddle

Copy link
Copy Markdown
Contributor Author

components/style/matching.rs, line 477 [r3] (raw file):

Previously, emilio (Emilio Cobos Álvarez) wrote…

Can we factor this code out and use it in both situations?

I've been thinking about it, and I'm pretty sure I can do that, yeah.

Comments from Reviewable

Comment thread components/style/traversal.rs Outdated
node.opaque(),
node.mutate_data().unwrap().style.as_mut().unwrap(),
context.shared_context()
);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't we doing this twice now in the cascade case?

@notriddle

Copy link
Copy Markdown
Contributor Author

components/style/traversal.rs, line 244 [r7] (raw file):

Previously, emilio (Emilio Cobos Álvarez) wrote…

Aren't we doing this twice now in the cascade case?

Oh, right, oops.

Comments from Reviewable

@emilio

emilio commented Jul 28, 2016

Copy link
Copy Markdown
Member

@bors-servo: try

Let's check if there's any other transition/animation test that could check this in wpt.

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit d908d52 with merge 8e3eafb...

bors-servo pushed a commit that referenced this pull request Jul 28, 2016
Complete animations whether or not cascade needs done

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #12554 (github issue number if applicable).
- [x] There are tests for these changes

<!-- 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/12623)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - linux-rel

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label Jul 28, 2016
@notriddle

Copy link
Copy Markdown
Contributor Author
  ▶ Unexpected subtest result in /_mozilla/mozilla/mozbrowser/iframe_visibility.html:
  │ FAIL [expected PASS] Requesting animation frame composites only when frame is visible
  │   → assert_true: expected true got false
  │ 
  │ iframe.onload</<@http://web-platform.test:8000/_mozilla/mozilla/mozbrowser/iframe_visibility.html:58:13
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1402:20
  └ Test.prototype.step_func/<@http://web-platform.test:8000/resources/testharness.js:1426:20

Other than that, no unexpected test results, including passes.

@emilio

emilio commented Jul 28, 2016

Copy link
Copy Markdown
Member

Cool, r=me then.

@bors-servo: r+

On 07/28/2016 11:14 AM, Michael Howell wrote:

|▶ Unexpected subtest result in
/_mozilla/mozilla/mozbrowser/iframe_visibility.html: │ FAIL [expected
PASS] Requesting animation frame composites only when frame is visible │
→ assert_true: expected true got false │ │
iframe.onload</<@http://web-platform.test:8000/_mozilla/mozilla/mozbrowser/iframe_visibility.html:58:13
│
Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1402:20
└
Test.prototype.step_func/<@http://web-platform.test:8000/resources/testharness.js:1426:20
|

Other than that, no unexpected test results, including passes.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#12623 (comment), or
mute the thread
https://github.com/notifications/unsubscribe-auth/ABQwuhcySOSOPd1ueQRC0SJ9sW6JTyzqks5qaPGbgaJpZM4JWcsF.

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit d908d52 has been approved by emilio

@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-tests-failed The changes caused existing tests to fail. labels Jul 28, 2016
@emilio

emilio commented Jul 28, 2016

Copy link
Copy Markdown
Member

@bors-servo: r-

Could you squash before, please?

@bors-servo: delegate+

@bors-servo

Copy link
Copy Markdown
Contributor

✌️ @notriddle can now approve this pull request

@notriddle

Copy link
Copy Markdown
Contributor Author

Is iframe_visibliity.html a known intermittent? Because there's no issue for it.

@jdm

jdm commented Jul 28, 2016

Copy link
Copy Markdown
Member

@notriddle: #11825

@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 Jul 28, 2016
@notriddle

Copy link
Copy Markdown
Contributor Author

@bors-servo r=emilio

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit f70b8c7 has been approved by emilio

@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 Jul 28, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit f70b8c7 with merge 27d8fb3...

bors-servo pushed a commit that referenced this pull request Jul 28, 2016
Complete animations whether or not cascade needs done

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #12554 (github issue number if applicable).
- [x] There are tests for these changes

<!-- 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/12623)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

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

@bors-servo
bors-servo merged commit f70b8c7 into servo:master Jul 28, 2016
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jul 28, 2016
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.

Width of container with IFrame inside resets when a link in the IFrame is clicked

6 participants