Skip to content

style: Move mask-size outside of mako - #19470

Closed
CYBAI wants to merge 1 commit into
servo:masterfrom
CYBAI:mask-size-out-of-mako
Closed

CYBAI wants to merge 1 commit into
servo:masterfrom
CYBAI:mask-size-out-of-mako

Conversation

@CYBAI

@CYBAI CYBAI commented Dec 3, 2017 •

Copy link
Copy Markdown
Member

This is a sub-PR of #19015
r? emilio



This change is Reviewable

@highfive

highfive commented Dec 3, 2017

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @bholley: components/style/properties/longhand/background.mako.rs, components/style/properties/gecko.mako.rs, components/style/values/computed/background.rs, components/style/properties/longhand/svg.mako.rs, components/style/properties/helpers.mako.rs
  • @canaltinova: components/style/properties/longhand/background.mako.rs, components/style/properties/gecko.mako.rs, components/style/values/computed/background.rs, components/style/properties/longhand/svg.mako.rs, components/style/properties/helpers.mako.rs
  • @emilio: components/style/properties/longhand/background.mako.rs, components/style/properties/gecko.mako.rs, components/style/values/computed/background.rs, components/style/properties/longhand/svg.mako.rs, components/style/properties/helpers.mako.rs

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Dec 3, 2017
@highfive

highfive commented Dec 3, 2017

Copy link
Copy Markdown

warning Warning warning

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

@emilio emilio left a comment

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.

Code looks good, but let's way for @BorisChiou to ensure that this can be removed or help testing it.

fn from_animated_value(animated: Self::AnimatedValue) -> Self {
use values::computed::{Length, Percentage};
let clamp_animated_value = |value: LengthOrPercentageOrAuto| -> LengthOrPercentageOrAuto {
match value {

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.

So, as we discussed on IRC, this works, but this removes the clamping behavior on BackgroundSize... I just pushed this to try (https://treeherder.mozilla.org/#/jobs?repo=try&revision=d7479f22e46b38c6103a46045e1bf83186927b18&selectedJob=149390573) and it looks green.

@BorisChiou, you added this code in ebedea5 (#17783).

Can we remove this? If not, could you write guidance on how to write a test for this?

@BorisChiou BorisChiou Dec 4, 2017 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Unfortunately, Gecko doesn't test this [1]. I added this because we may use a negative cubic timing function [2] for animations/transitions. If you want to verify your patch, you could try to run this: https://jsfiddle.net/borischiou/w5yqs437/. If the console output is "0px 0px", it works. However, if you see something like "calc(-68.3px) calc(-68.3px)", please fix it because the size property should always be 0 or any positive number. :)

[1] https://searchfox.org/mozilla-central/rev/477ac066b565ae0eb3519875581a62dfb1430e98/layout/style/test/test_transitions_per_property.html#109-113
[2] cubic-bezier(0.25, -2, 0.75, 1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

And I guess you may get the negative value (i.e. unclamped value) if animation_value_type == "ComputedValue" for background-size. mask-size has the similar problem, I think. Therefore, It's better not to remove this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@BorisChiou After trying to access the jsfiddle link, I found it logged with 0px 0px in my local. However, it got an error of ERROR:script::dom::bindings::error: Error at https://jsfiddle.net/js/_dist-editor.js?update_24_11_2017_2:1:228763 Ao(...).getBoundingClientRect is not a function so I cannot see the jsfiddle UI.
Not sure if it means updated in this PR works?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Really? Oh, I used Firefox to verify this jsfiddle test. Sorry, I will try Servo browser again.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hmm... I got after 500ms: -68.7001px -68.7001px when I ran it locally second time.
I'll check it more detail tomorrow.

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.

@BorisChiou mask-size was already bogus here, wasn't it? In particular, it was using animation_value_size="ComputedValue".

Could we get that stuff tested pretty please?

@BorisChiou BorisChiou Dec 11, 2017 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes..we have to do that. We have to update the test cases in test_transitions_per_property.html for background-size and mask-size (so at least we test it on Firefox), and fix the problem of mask-size. I have to file a bug for it.

FIled Bug 1424671.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@BorisChiou Thanks for the update! I think we can merge this PR and let's fix the issue in another PR?

cc @emilio

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

But the problem is: this PR makes background-size be buggy for animation. At least now we have to make sure background-size is correct for animation.

@CYBAI
CYBAI force-pushed the mask-size-out-of-mako branch from f833fe4 to 41cbd40 Compare December 9, 2017 14:58
@bors-servo

Copy link
Copy Markdown
Contributor

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

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Jan 23, 2018
@CYBAI
CYBAI force-pushed the mask-size-out-of-mako branch from 41cbd40 to 9be9ebd Compare January 24, 2018 12:36
@CYBAI
CYBAI force-pushed the mask-size-out-of-mako branch from 9be9ebd to 10b4a19 Compare January 25, 2018 02:32
@bors-servo

Copy link
Copy Markdown
Contributor

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

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Mar 7, 2018
@emilio

emilio commented Jun 1, 2018

Copy link
Copy Markdown
Member

I fixed this in https://bugzilla.mozilla.org/show_bug.cgi?id=1462829. Thanks @CYBAI!

@emilio emilio closed this Jun 1, 2018
@CYBAI

CYBAI commented Jun 1, 2018

Copy link
Copy Markdown
Member Author

@emilio Cheers that this is fixed! Thanks a lot! 😆

@BorisChiou

Copy link
Copy Markdown
Contributor

Cool! Thanks~

@CYBAI
CYBAI deleted the mask-size-out-of-mako branch June 2, 2018 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed. S-needs-rebase There are merge conflict errors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move mask-size outside of mako.

5 participants