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

#13875 - Implement parsing/serialization for font-size-adjust. #14125

Merged
merged 1 commit into from Nov 8, 2016

Conversation

chenpighead
Copy link
Contributor

@chenpighead chenpighead commented Nov 8, 2016

Implement parsing/serialization for font-size-adjust.


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

This change is Reviewable

@highfive
Copy link

highfive commented Nov 8, 2016

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

@highfive
Copy link

highfive commented Nov 8, 2016

Heads up! This PR modifies the following files:

  • @bholley: components/style/properties/longhand/font.mako.rs
  • @emilio: components/style/properties/longhand/font.mako.rs

@highfive
Copy link

highfive commented Nov 8, 2016

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 Nov 8, 2016
}

pub mod computed_value {
use cssparser::ToCss;
Copy link
Contributor

Choose a reason for hiding this comment

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

As of #14089, we make use of style_traits::ToCss. This was a recent change, and the guide should be updated :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Roger!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Filed #14128 for this.


match try!(input) {
Token::Ident(ref value) if value.eq_ignore_ascii_case("none") =>
Ok(SpecifiedValue::None),
Copy link
Contributor

Choose a reason for hiding this comment

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

Indent here (and below) please... (to distinguish the match pattern from the expression)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops. You're right. Should have done this. Thanks.

#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum SpecifiedValue {
None,
Number(CSSFloat),
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use Number struct here (which stores number as CSSFloat but it has useful implementations). And in parsing function, you can try to parse number directly with:
SpecifiedValue::Number(try!(Number::parse_non_negative(input)))

use cssparser::Token;
use std::ascii::AsciiExt;

match try!(input) {
Copy link
Contributor

Choose a reason for hiding this comment

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

After converting to Number struct, you can return early like this:

if input.try(|input| input.expect_ident_matching("none")).is_ok() {
    return Ok(SpecifiedValue::None);
}

And you can try to parse number after that. This is a good example for what I say I think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for these hints. Code looks much better now. :-)

return Ok(SpecifiedValue::None);
}

Ok(SpecifiedValue::Number(try!(Number::parse_non_negative(input))))
Copy link
Member

Choose a reason for hiding this comment

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

We probably should file a spec bug for making this explicit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Manishearth
Copy link
Member

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit 08c47c4 has been approved by Manishearth

@highfive highfive assigned Manishearth and unassigned Ms2ger Nov 8, 2016
@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 Nov 8, 2016
@@ -349,6 +349,55 @@ ${helpers.single_keyword("font-variant",
}
</%helpers:longhand>

// https://www.w3.org/TR/css-fonts-3/#font-size-adjust-prop
// FIXME: This prop should be animatable
Copy link
Member

Choose a reason for hiding this comment

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

If you're going to work on the gecko glue this is easy to fix.

@bors-servo
Copy link
Contributor

⌛ Testing commit 08c47c4 with merge 2e2eab0...

bors-servo pushed a commit that referenced this pull request Nov 8, 2016
 #13875 - Implement parsing/serialization for font-size-adjust.

<!-- Please describe your changes on the following line: -->
 Implement parsing/serialization for font-size-adjust.
---
<!-- 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 #13875 (github issue number if applicable).

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

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

@bors-servo bors-servo merged commit 08c47c4 into servo:master Nov 8, 2016
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Nov 8, 2016
@Manishearth
Copy link
Member

are you planning on working on the gecko stuff next?

@chenpighead
Copy link
Contributor Author

Yes, I'd like to do it. Should I file another issue? Or I could just send a PR and ask for help there?

@Manishearth
Copy link
Member

Just a PR is fine. Feel free to ask any questions here, in IRC (or in person to Shing if you can find him 😜 )

bors-servo pushed a commit that referenced this pull request Nov 17, 2016
Stylo - gecko glue code for font-size-adjust.

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

Implement the gecko-side glue code for font-size-adjust.
This is a followup for #14125, which is originally filed in #13875.

---
<!-- 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
- [ ] These changes fix #__ (github issue number if applicable).

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

<!-- 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/14227)
<!-- Reviewable:end -->
bors-servo pushed a commit that referenced this pull request Nov 17, 2016
Stylo - gecko glue code for font-size-adjust.

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

Implement the gecko-side glue code for font-size-adjust.
This is a followup for #14125, which is originally filed in #13875.

---
<!-- 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
- [ ] These changes fix #__ (github issue number if applicable).

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

<!-- 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/14227)
<!-- Reviewable:end -->
bors-servo pushed a commit that referenced this pull request Nov 18, 2016
Stylo - gecko glue code for font-size-adjust.

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

Implement the gecko-side glue code for font-size-adjust.
This is a followup for #14125, which is originally filed in #13875.

---
<!-- 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
- [ ] These changes fix #__ (github issue number if applicable).

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

<!-- 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/14227)
<!-- Reviewable:end -->
bors-servo pushed a commit that referenced this pull request Nov 18, 2016
Stylo - gecko glue code for font-size-adjust.

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

Implement the gecko-side glue code for font-size-adjust.
This is a followup for #14125, which is originally filed in #13875.

---
<!-- 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
- [ ] These changes fix #__ (github issue number if applicable).

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

<!-- 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/14227)
<!-- Reviewable:end -->
bors-servo pushed a commit that referenced this pull request Nov 18, 2016
Stylo - gecko glue code for font-size-adjust.

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

Implement the gecko-side glue code for font-size-adjust.
This is a followup for #14125, which is originally filed in #13875.

---
<!-- 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
- [ ] These changes fix #__ (github issue number if applicable).

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

<!-- 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/14227)
<!-- Reviewable:end -->
bors-servo pushed a commit that referenced this pull request Nov 19, 2016
Stylo - gecko glue code for font-size-adjust.

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

Implement the gecko-side glue code for font-size-adjust.
This is a followup for #14125, which is originally filed in #13875.

---
<!-- 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
- [ ] These changes fix #__ (github issue number if applicable).

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

<!-- 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/14227)
<!-- Reviewable:end -->
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.

Implement parsing/serialization for font-size-adjust
7 participants