Skip to content

style: move list-style-image out of mako - #19570

Merged
bors-servo merged 1 commit into
servo:masterfrom
fenak:list-style-image-mako
Dec 15, 2017
Merged

bors-servo merged 1 commit into
servo:masterfrom
fenak:list-style-image-mako

Conversation

@fenak

@fenak fenak commented Dec 15, 2017 •

Copy link
Copy Markdown

Moving list-style-image out of mako.


  • There are tests for these changes OR
  • These changes do not require tests because refactoring

This change is Reviewable

@highfive

Copy link
Copy Markdown

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @pcwalton (or someone else) soon.

@highfive

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @bholley: components/style/values/computed/list.rs, components/style/properties/longhand/list.mako.rs, components/style/values/specified/mod.rs, components/style/values/computed/mod.rs, components/style/values/specified/list.rs
  • @canaltinova: components/style/values/computed/list.rs, components/style/properties/longhand/list.mako.rs, components/style/values/specified/mod.rs, components/style/values/computed/mod.rs, components/style/values/specified/list.rs
  • @emilio: components/style/values/computed/list.rs, components/style/properties/longhand/list.mako.rs, components/style/values/specified/mod.rs, components/style/values/computed/mod.rs, components/style/values/specified/list.rs

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

Copy link
Copy Markdown

warning Warning warning

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

}

#[cfg(not(feature = "gecko"))]
let value = input.try(|input| UrlOrNone::parse(context, input))?;

@fenak fenak Dec 15, 2017 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I could possibly use #[allow(unused_mut)] to avoid this #[cfg(not(feature = "gecko"))].
I'm not sure what would be the most correct way.

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

Looks great! Just minor nits, thanks a lot!


impl ListStyleImage {
/// Initial value for `list-style-image`.
///

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: let's remove this extra line.

/// Initial value for `list-style-image`.
///
#[inline]
pub fn get_initial_value() -> ListStyleImage {

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.

let's call this none.

use values::specified::UrlOrNone;

/// Specified and computed `list-style-image` property.
///

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.

Let's remove this extra newline.


impl ListStyleImage {
/// Initial specified value for `list-style-image`.
///

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.

ditto.

let mut value = input.try(|input| UrlOrNone::parse(context, input))?;
if let Either::First(ref mut url) = value {
url.build_image_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.

let's return Ok(ListStyleImage(value)) here so it's clearer that the code below doesn't really run, I think, or #[allow(unused_mut)]

/// Initial specified value for `list-style-image`.
///
#[inline]
pub fn get_initial_specified_value() -> ListStyleImage {

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.

Let's just define none here, and remove the impl block in the computed module, actually.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hey, thanks for reviewing. I'm not sure I understand the none definitions. Can you explain it further? (I'm beginning at Rust)

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.

Sure! I'm just saying that calling this method none (which is the value it returns) is slightly more idiomatic.

That way, you call it like ListStyleImage::none(), instead of get_initial_value, which is not very useful as a name to know what value is it.

initial_value="computed::ListStyleImage::get_initial_value()",
initial_specified_value="specified::ListStyleImage::get_initial_specified_value()",
animation_value_type="discrete",
boxed="True" if product == "gecko" else "False",

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 think this can be boxed=product == "gecko" now.

@fenak

fenak commented Dec 15, 2017 •

Copy link
Copy Markdown
Author

@emilio made a few changes regarding your comments

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

Looks great! Mind squashing your commits?

${helpers.predefined_type("list-style-image",
"ListStyleImage",
initial_value="specified::ListStyleImage::none()",
initial_specified_value="specified::ListStyleImage::none()",

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Should I work to remove this apparently duplication?

I see that the initial_specified_value is kind of necessary, or the code fails trying to unwrap_or_initial!, which tries to call get_specified_initial_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.

Yeah, we may be able to clean that up a bit. I fail to remember the details, but happy to page those back in if you want! Mind opening an issue? I'll happily comment on it when I do and assign it to you if you want :)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

cleaner way to set boxed param

redefine get_initial_value to none

make parse method clearer

remove some extra lines
@fenak
fenak force-pushed the list-style-image-mako branch from d0b72fd to eb88a29 Compare December 15, 2017 05:24
@fenak

fenak commented Dec 15, 2017

Copy link
Copy Markdown
Author

Commits squashed. 👍

@emilio

emilio commented Dec 15, 2017

Copy link
Copy Markdown
Member

@bors-servo r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit eb88a29 has been approved by emilio

@highfive highfive assigned emilio and unassigned pcwalton Dec 15, 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 Dec 15, 2017
@emilio

emilio commented Dec 15, 2017

Copy link
Copy Markdown
Member

Thanks a lot!

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit eb88a29 with merge da3dd05...

bors-servo pushed a commit that referenced this pull request Dec 15, 2017
style: move list-style-image out of mako

<!-- Please describe your changes on the following line: -->
Moving `list-style-image` out of mako.

---
<!-- 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 #19557  (part of #19015 ).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because refactoring

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

<!-- 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/19570)
<!-- Reviewable:end -->
@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 da3dd05 to master...

@bors-servo
bors-servo merged commit eb88a29 into servo:master Dec 15, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Dec 15, 2017
@fenak
fenak deleted the list-style-image-mako branch December 15, 2017 06:44
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.

Move list-style-image outside of mako.

5 participants