Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upstylo: Implement gecko glue for font-language-override. #16155
Conversation
highfive
commented
Mar 27, 2017
|
Heads up! This PR modifies the following files:
|
highfive
commented
Mar 27, 2017
|
r? @emilio |
|
Looks good! r=me with those final nits addressed. |
| match *self { | ||
| SpecifiedValue::Normal => computed_value::T(0), | ||
| SpecifiedValue::Override(ref lang) => { | ||
| if lang.len() == 0 || lang.len() > 4 || !lang.is_ascii() { |
This comment has been minimized.
This comment has been minimized.
| let slice = if cfg!(debug_assertions) { | ||
| str::from_utf8(&buf).unwrap() | ||
| } else { | ||
| unsafe { str::from_utf8_unchecked(&buf) } |
This comment has been minimized.
This comment has been minimized.
emilio
Mar 27, 2017
Member
Let's add a comment here with something like "Safe because we ensure it's ASCII during parsing", or something like that.
This comment has been minimized.
This comment has been minimized.
chenpighead
Mar 28, 2017
Author
Contributor
Okay, I'm adding a comment as follows: "Safe because we ensure it's ASCII during computing"
| } | ||
| let mut buf = [0; 4]; | ||
| BigEndian::write_u32(&mut buf, computed.0); | ||
| SpecifiedValue::Override(String::from_utf8(buf.to_vec()).unwrap()) |
This comment has been minimized.
This comment has been minimized.
emilio
Mar 27, 2017
Member
This can also use if cfg!(debug_assertions) { String::from_utf8(..) } else { String::from_utf8_unchecked } if you want, but no big deal.
This comment has been minimized.
This comment has been minimized.
383abf7
to
6c4b15f
|
|
|
|
|
|
|
@bors-servo r=emilio |
|
@chenpighead: |
|
@bors-servo r=emilio |
|
|
|
|
|
@chenpighead: |
6c4b15f
to
520131e
57f52fb
to
4304d2e
To be aligned with the implementation from Gecko side, we parse font-language-override as Normal keyword or String. Then, we compute and store it as a u32. So, as to the stylo glue, we can just pass the u32 to Gecko. The extra crate, byteorder, is used to simplify the computing and serialization. Since we now implement font-language-override for Gecko, we can remove the additional branches for font-language-override in font shorthand. ref: Gecko Bug 1347821
4304d2e
to
a9e4b9c
|
@bors-servo r=emilio |
|
|
…ide, r=emilio stylo: Implement gecko glue for font-language-override. To be aligned with the implementation from Gecko side, we parse font-language-override as Normal keyword or String. Then, we compute and store it as a u32. So, as to the stylo glue, we can just pass the u32 to Gecko. The extra crate, byteorder, is used to simplify the computing and serialization. Since we now implement font-language-override for Gecko, we can remove the additional branches for font-language-override in font shorthand. ref: Gecko [Bug 1347821](https://bugzilla.mozilla.org/show_bug.cgi?id=1347821) <!-- 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 - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- 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/16155) <!-- Reviewable:end -->
|
|
chenpighead commentedMar 27, 2017
•
edited by larsbergstrom
To be aligned with the implementation from Gecko side, we parse
font-language-override as Normal keyword or String. Then, we compute
and store it as a u32. So, as to the stylo glue, we can just pass the
u32 to Gecko.
The extra crate, byteorder, is used to simplify the computing and
serialization.
Since we now implement font-language-override for Gecko, we can remove
the additional branches for font-language-override in font shorthand.
ref: Gecko Bug 1347821
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is