-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Conversation
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. |
} | ||
|
||
pub mod computed_value { | ||
use cssparser::ToCss; |
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Roger!
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
e8bf4e2
to
5c897de
Compare
#[cfg_attr(feature = "servo", derive(HeapSizeOf))] | ||
pub enum SpecifiedValue { | ||
None, | ||
Number(CSSFloat), |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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. :-)
5c897de
to
08c47c4
Compare
return Ok(SpecifiedValue::None); | ||
} | ||
|
||
Ok(SpecifiedValue::Number(try!(Number::parse_non_negative(input)))) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filed w3c/csswg-drafts#702
@bors-servo r+ |
📌 Commit 08c47c4 has been approved by |
@@ -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 |
There was a problem hiding this comment.
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.
⌛ Testing commit 08c47c4 with merge 2e2eab0... |
#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 -->
☀️ Test successful - arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-dev |
are you planning on working on the gecko stuff next? |
Yes, I'd like to do it. Should I file another issue? Or I could just send a PR and ask for help there? |
Just a PR is fine. Feel free to ask any questions here, in IRC (or in person to Shing if you can find him 😜 ) |
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 -->
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 -->
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 -->
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 -->
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 -->
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 -->
Implement parsing/serialization for font-size-adjust.
./mach build -d
does not report any errors./mach test-tidy
does not report any errorsThis change is