Skip to content

Prepare some code for future derivation 🌊 - #17774

Merged
bors-servo merged 3 commits into
masterfrom
derive-all-the-things
Jul 19, 2017
Merged

bors-servo merged 3 commits into
masterfrom
derive-all-the-things

Conversation

@nox

@nox nox commented Jul 18, 2017 •

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/values/generics/text.rs, components/style/values/computed/text.rs, components/style/values/computed/background.rs, components/style/values/specified/transform.rs, components/style/values/animated/effects.rs and 11 more
  • @canaltinova: components/style/values/generics/text.rs, components/style/values/computed/text.rs, components/style/values/computed/background.rs, components/style/values/specified/transform.rs, components/style/values/animated/effects.rs and 11 more
  • @emilio: components/style/values/generics/text.rs, components/style/values/computed/text.rs, components/style/values/computed/background.rs, ports/geckolib/glue.rs, components/style/values/specified/transform.rs and 12 more

@highfive

Copy link
Copy Markdown

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

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

nox commented Jul 18, 2017 •

Copy link
Copy Markdown
Contributor Author

@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.

r=me


impl TimingKeyword {
/// Returns this timing keyword as a pair of `cubic-bezier()` points.
/// Returns the keyword as a quadruplet of Bezier point coordinates.

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.

Maybe worth pointing out that they're returned as x1, y1, x2, y2?


impl ToAnimatedZero for Percentage {
#[inline]
fn to_animated_zero(&self) -> Result<Self, ()> {

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.

nit: I think we have a Percentage::zero() function, not a big deal though.

match *self {
LengthOrPercentageOrAuto::Length(_) |
LengthOrPercentageOrAuto::Percentage(_) |
LengthOrPercentageOrAuto::Calc(_) => {

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.

I guess this one seems somewhat weird, in the sense of it converts foo% into 0px, but since it's preserving it it's probably not a big deal.

}

impl ToAnimatedZero for MaxLength {
#[inline]

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.

These ones seem... dubious. Mind checking with @hiikezoe or @BorisChiou to see if it's worth to open issues about this? (or do so directly)

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.

Yeah, it seems to me that we should return Length(Au(0)) here. But, in the first place, MaxLength does not have get_zero_value(), so I think it's a different issue. (I also suspect we should return Length(Au(0)) for MozLength)

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.

impl ToAnimatedZero for TransformList {
#[inline]
fn get_zero_value(&self) -> Result<Self, ()> { Ok(TransformList(None)) }
fn to_animated_zero(&self) -> Result<Self, ()> {

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.

Hmm... So we return ok for a TransformList, but not for any other kind of lists? huh.

impl ToAnimatedZero for T {
#[inline]
fn to_animated_zero(&self) -> Result<Self, ()> {
Err(())

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 one seems also dubious.


impl ToAnimatedZero for T {
#[inline]
fn to_animated_zero(&self) -> Result<Self, ()> { Err(()) }

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.

And this one.

impl ToAnimatedZero for BackgroundSize {
#[inline]
fn to_animated_zero(&self) -> Result<Self, ()> {
Err(())

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.

And this one.


impl ToAnimatedZero for LineHeight {
#[inline]
fn to_animated_zero(&self) -> Result<Self, ()> { Err(()) }

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.

And this one.

Comment thread ports/geckolib/glue.rs
{
let value_to_match = AnimationValue::as_arc(&value_to_match);
if let Ok(zero_value) = value_to_match.get_zero_value() {
if let Ok(zero_value) = value_to_match.to_animated_zero() {

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 should probably use match, but it's pre-existing.

@nox
nox force-pushed the derive-all-the-things branch from 8c088a2 to 98bf832 Compare July 19, 2017 08:19
@nox

nox commented Jul 19, 2017

Copy link
Copy Markdown
Contributor Author

@bors-servo r=emilio

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 98bf832 has been approved by emilio

@highfive highfive assigned emilio and unassigned pcwalton Jul 19, 2017
@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 19, 2017
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 98bf832 with merge d76d097...

bors-servo pushed a commit that referenced this pull request Jul 19, 2017
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev
Approved by: emilio
Pushing d76d097 to master...

@bors-servo
bors-servo merged commit 98bf832 into master Jul 19, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jul 19, 2017
@emilio
emilio deleted the derive-all-the-things branch July 19, 2017 11:37
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