Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CounterBound::Integer made to store an Integer #20304

Merged
merged 1 commit into from Mar 19, 2018

Conversation

@nupurbaghel
Copy link
Contributor

nupurbaghel commented Mar 15, 2018


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #20197
  • These changes do not require tests because they involve datatype change of already existing enum CounterBound

This change is Reviewable

@highfive
Copy link

highfive commented Mar 15, 2018

Heads up! This PR modifies the following files:

  • @bholley: components/style/counter_style/mod.rs, components/style/gecko/rules.rs
  • @canaltinova: components/style/counter_style/mod.rs, components/style/gecko/rules.rs
  • @emilio: components/style/counter_style/mod.rs, components/style/gecko/rules.rs
@highfive
Copy link

highfive commented Mar 15, 2018

warning Warning warning

  • These commits modify style code, but no tests are modified. Please consider adding a test!
@@ -482,7 +481,7 @@ fn parse_bound<'i, 't>(
let location = input.current_source_location();
match *input.next()? {
Token::Number { int_value: Some(v), .. } => {

This comment has been minimized.

@emilio

emilio Mar 15, 2018

Member

This should stop matching on Token, and use Integer::parse instead.

This comment has been minimized.

@nupurbaghel

nupurbaghel Mar 15, 2018

Author Contributor

To use Integer::parse we need to have the context, which is not available in this scope?

This comment has been minimized.

@emilio

emilio Mar 15, 2018

Member

The caller of this function has it though, so we should be able to start passing it to this function.

This comment has been minimized.

@emilio

emilio Mar 15, 2018

Member

Regarding infinite, we should do something like:

if let Ok(integer) = input.try(|input| Integer::parse(context, input)) {
    return Ok(CounterBound::Integer(integer));
}
input.expect_ident_matching("infinite")?;
Ok(CounterBound::Infinite)

After this change we need to add a test for calc() being allowed in counter-style, with something like: range: infinite calc(1) or something like that.

Thanks!

@nupurbaghel
Copy link
Contributor Author

nupurbaghel commented Mar 15, 2018

This should stop matching on Token, and use Integer::parse instead.

Also how can we change the test for CounterBound::Infinite here? Do we have to use parse for just CounterBound::Integer?

@nupurbaghel nupurbaghel force-pushed the nupurbaghel:counterbound branch from 1884d23 to 31842a4 Mar 18, 2018
@emilio
emilio approved these changes Mar 18, 2018
Copy link
Member

emilio left a comment

Looks great with that nit addressed. I'll write the test for Firefox as soon as it lands :)

@@ -463,8 +462,8 @@ impl Parse for Ranges {
Ok(Ranges(Vec::new()))
} else {
input.parse_comma_separated(|input| {
let opt_start = parse_bound(input)?;
let opt_end = parse_bound(input)?;
let opt_start = parse_bound(_context, input)?;

This comment has been minimized.

@emilio

emilio Mar 18, 2018

Member

Let's name the variable context now it's not unused.

@emilio
Copy link
Member

emilio commented Mar 18, 2018

Also, there's #20332 on the other missing places in the same file. Thanks for fixing this!

@nupurbaghel nupurbaghel force-pushed the nupurbaghel:counterbound branch from 31842a4 to 307858b Mar 19, 2018
@nupurbaghel
Copy link
Contributor Author

nupurbaghel commented Mar 19, 2018

Looks great with that nit addressed. I'll write the test for Firefox as soon as it lands :)

I have updated the suggested changes. Thank you so much for helping out :)
Will be happy to work on any other issue regarding this as well 🎉

@emilio
emilio approved these changes Mar 19, 2018
@emilio
Copy link
Member

emilio commented Mar 19, 2018

Thanks for fixing this!

@bors-servo r+

@bors-servo
Copy link
Contributor

bors-servo commented Mar 19, 2018

📌 Commit 307858b has been approved by emilio

@bors-servo
Copy link
Contributor

bors-servo commented Mar 19, 2018

Testing commit 307858b with merge 6d06d1b...

bors-servo added a commit that referenced this pull request Mar 19, 2018
CounterBound::Integer made to store an Integer

<!-- Please describe your changes on the following line: -->

---
<!-- 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 #20197

<!-- Either: -->
- [x] These changes do not require tests because they involve datatype change of already existing enum CounterBound

<!-- 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/20304)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Mar 19, 2018

@bors-servo bors-servo merged commit 307858b into servo:master Mar 19, 2018
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

6 participants
You can’t perform that action at this time.