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

Stylo: Implement font-variant-caps #13668

Closed
wafflespeanut opened this issue Oct 10, 2016 · 18 comments
Closed

Stylo: Implement font-variant-caps #13668

wafflespeanut opened this issue Oct 10, 2016 · 18 comments

Comments

@wafflespeanut
Copy link
Member

@wafflespeanut wafflespeanut commented Oct 10, 2016

Please go through the guide before working on this issue.

font-variant-caps is a keyword property which takes one of the following values: normal | small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps. The default value is normal. The linked MDN has more information about this.

The constant prefix you should be using is NS_FONT_VARIANT_CAPS

Code: servo/components/style/properties/longhand/font.mako.rs

  • Use the example from the MDN page.
  • Build stylo and screenshot how the example looks before your changes.
  • Make your changes, build stylo and screenshot how it looks after.
  • Open a PR with your changes and attach the screenshots
@highfive
Copy link

@highfive highfive commented Oct 10, 2016

Please make a comment here if you intend to work on this issue. Thank you!

@vgvenkat
Copy link

@vgvenkat vgvenkat commented Oct 11, 2016

Hello people! I would like to take this on.
I am guessing adding gecko_constant_prefix="NS_FONT_VARIANT_CAPS" at [line repo=stylo-flat](https://github.com/Manishearth/stylo-flat/blob/master/servo/components/style/properties/longhand/font.mako.rs#L128 should do the trick?) .
Is there anything else that needs done?

Also should i submit PR to the stylo-flat repo as I am starting out?

@Manishearth
Copy link
Member

@Manishearth Manishearth commented Oct 12, 2016

Actually, this one is trickier. It needs to be manually implemented.

So the change will be more like https://github.com/servo/servo/pull/13570/files

It is preferable if you submit the pull request to Servo. You can submit to stylo-flat if you think that's easier.

@Manishearth
Copy link
Member

@Manishearth Manishearth commented Oct 12, 2016

You'll also need to expand the list of possible values, right now it only takes two of the ones listed in the issue above. gecko_constant_prefix is only necessary if you're not manually implementing the gecko glue.

@wafflespeanut
Copy link
Member Author

@wafflespeanut wafflespeanut commented Oct 12, 2016

No, this is a little bit trickier than the others, but it can still be implemented using the single_keyword method.

@vgvenkat You're right about the gecko_constant_prefix. Along with that, we'll be needing the gecko_ffi_name (which, in this case would be "mFont.variantCaps").

Also, the constants used in gecko are a bit weird. So, we have to remove some hyphens and adjust some of the values. Using something like, "normal smallcaps allsmall petitecaps allpetite unicase titling", we'll be good to go!

Actually, I was wrong about this. As Manish says, this requires manual glue code for proper parsing and setting of values 😞

It can now be implemented using single_keyword

@Manishearth
Copy link
Member

@Manishearth Manishearth commented Oct 14, 2016

Any updates?

@vgvenkat
Copy link

@vgvenkat vgvenkat commented Oct 15, 2016

Yes, currently working on a PR with changes similar to https://github.com/servo/servo/pull/13570/files. I will need some more help to check after submission.

@vgvenkat
Copy link

@vgvenkat vgvenkat commented Oct 17, 2016

I will need to contact some one in the IRC, doing ./mach build --release or ./mach build --dev gives out Build failed, waiting for other jobs to finish....
If some one else is willing to work on this, I can delegate as well, else I will need some help with building the repo. Completed Mac OSx homebrew setup.

@Manishearth
Copy link
Member

@Manishearth Manishearth commented Oct 17, 2016

It's ./mach build-geckolib for this. Also, you're building the Servo repo, you should be building stylo-flat (see the guide). That's just ./mach build

@vgvenkat
Copy link

@vgvenkat vgvenkat commented Oct 26, 2016

I have added all values from the MDN for the existing font-variant in font.marko.rs. I am guessing no other changes in this file.

As pointed out, I guess the manual glue needs to be added in the gecko.marko.rs file. Also the pointed set_font_stretch in https://github.com/servo/servo/pull/13570/files is no longer in the gecko.mako.rs .

I tried creating a similar function in gecko.marko.rs modifying the set_font_stretch function to set_font_variant and its properties. I ran mach build faster then mach run --disable-e10s https://en.wikipedia.org. The browser opens with the site, if I inspect any element it crashes.

Any directions on how to make the gecko glue manually would be great!

@wafflespeanut
Copy link
Member Author

@wafflespeanut wafflespeanut commented Oct 26, 2016

@vgvenkat Let's wait until #13902 lands, and this will be much easier to implement :)

@wafflespeanut
Copy link
Member Author

@wafflespeanut wafflespeanut commented Nov 29, 2016

@vgvenkat Sorry, I forgot to ping you. That PR has landed. Are you planning to work on this?

@wafflespeanut
Copy link
Member Author

@wafflespeanut wafflespeanut commented Dec 6, 2016

This is open for anyone to jump in. All we have to do is build a constants map just like what we do for image-rendering and auto-generate the code using single_keyword helper.

@Impally
Copy link

@Impally Impally commented Dec 10, 2016

Reading the guide and taking a glance at this later today so I would like to claim it if that is alright. Thanks.

@wafflespeanut
Copy link
Member Author

@wafflespeanut wafflespeanut commented Dec 10, 2016

Yes please...

@Impally
Copy link

@Impally Impally commented Dec 12, 2016

Am I wrong in assuming I just need to insert the following code into servo/components/style/properties/longhand/font.mako.rs

${helpers.single_keyword("font-variant-caps",
                         "normal small-caps all-small-caps petite-caps unicase tilting-caps",
                         gecko_constant_prefix="NS_FONT_VARIANT_CAPS",
                         animatable=False)}

After adding that, my build fails because method Font_variant_caps is not a member of trait 'CSSStyleDeclarationMethods'

@Manishearth
Copy link
Member

@Manishearth Manishearth commented Dec 12, 2016

There needs to be a products="gecko" there and you need to run ./mach build-geckolib

Please see the guide. You have to test this using a clone of the Stylo repository. It is not enough to just add that code and submit it.

@wafflespeanut
Copy link
Member Author

@wafflespeanut wafflespeanut commented Dec 12, 2016

Also, note that the generated constants will have incorrect names. This should be done just like image-rendering i.e., a constants map should be passed as argument. For example, simply passing small-caps will generate NS_FONT_VARIANT_CAPS_SMALL_CAPS, which is wrong, because, in gecko, this doesn't have an underscore. So, we should have a dictionary that contains "small-caps": "SMALLCAPS" in order for it to be generated correctly.

@Impally Impally mentioned this issue Dec 13, 2016
3 of 5 tasks complete
bors-servo added a commit that referenced this issue Dec 13, 2016
font-variant-caps implemented in font.mako.rs

<!-- Please describe your changes on the following line: -->
Implemented font-variant-caps for gecko library

---
<!-- 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 #13668  (github issue number if applicable).

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

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Before Change:

<img width="261" alt="beforechange" src="https://cloud.githubusercontent.com/assets/9249887/21127332/03487fbc-c0c0-11e6-8667-bb1e60d5c754.PNG">

After Change:

<img width="174" alt="afterchange" src="https://cloud.githubusercontent.com/assets/9249887/21127345/0cc8860e-c0c0-11e6-96cf-16b77c14c5a7.png">

Pictures are rendering of example from [font-variant-caps](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-caps)

<!-- 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/14561)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Dec 13, 2016
font-variant-caps implemented in font.mako.rs

<!-- Please describe your changes on the following line: -->
Implemented font-variant-caps for gecko library

---
<!-- 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 #13668  (github issue number if applicable).

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

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Before Change:

<img width="261" alt="beforechange" src="https://cloud.githubusercontent.com/assets/9249887/21127332/03487fbc-c0c0-11e6-8667-bb1e60d5c754.PNG">

After Change:

<img width="174" alt="afterchange" src="https://cloud.githubusercontent.com/assets/9249887/21127345/0cc8860e-c0c0-11e6-96cf-16b77c14c5a7.png">

Pictures are rendering of example from [font-variant-caps](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-caps)

<!-- 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/14561)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Dec 13, 2016
font-variant-caps implemented in font.mako.rs

<!-- Please describe your changes on the following line: -->
Implemented font-variant-caps for gecko library

---
<!-- 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 #13668  (github issue number if applicable).

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

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Before Change:

<img width="261" alt="beforechange" src="https://cloud.githubusercontent.com/assets/9249887/21127332/03487fbc-c0c0-11e6-8667-bb1e60d5c754.PNG">

After Change:

<img width="174" alt="afterchange" src="https://cloud.githubusercontent.com/assets/9249887/21127345/0cc8860e-c0c0-11e6-96cf-16b77c14c5a7.png">

Pictures are rendering of example from [font-variant-caps](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-caps)

<!-- 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/14561)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Dec 14, 2016
font-variant-caps implemented in font.mako.rs

<!-- Please describe your changes on the following line: -->
Implemented font-variant-caps for gecko library

---
<!-- 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 #13668  (github issue number if applicable).

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

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Before Change:

<img width="261" alt="beforechange" src="https://cloud.githubusercontent.com/assets/9249887/21127332/03487fbc-c0c0-11e6-8667-bb1e60d5c754.PNG">

After Change:

<img width="174" alt="afterchange" src="https://cloud.githubusercontent.com/assets/9249887/21127345/0cc8860e-c0c0-11e6-96cf-16b77c14c5a7.png">

Pictures are rendering of example from [font-variant-caps](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-caps)

<!-- 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/14561)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Dec 14, 2016
font-variant-caps implemented in font.mako.rs

<!-- Please describe your changes on the following line: -->
Implemented font-variant-caps for gecko library

---
<!-- 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 #13668  (github issue number if applicable).

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

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Before Change:

<img width="261" alt="beforechange" src="https://cloud.githubusercontent.com/assets/9249887/21127332/03487fbc-c0c0-11e6-8667-bb1e60d5c754.PNG">

After Change:

<img width="174" alt="afterchange" src="https://cloud.githubusercontent.com/assets/9249887/21127345/0cc8860e-c0c0-11e6-96cf-16b77c14c5a7.png">

Pictures are rendering of example from [font-variant-caps](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-caps)

<!-- 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/14561)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Dec 14, 2016
font-variant-caps implemented in font.mako.rs

<!-- Please describe your changes on the following line: -->
Implemented font-variant-caps for gecko library

---
<!-- 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 #13668  (github issue number if applicable).

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

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Before Change:

<img width="261" alt="beforechange" src="https://cloud.githubusercontent.com/assets/9249887/21127332/03487fbc-c0c0-11e6-8667-bb1e60d5c754.PNG">

After Change:

<img width="174" alt="afterchange" src="https://cloud.githubusercontent.com/assets/9249887/21127345/0cc8860e-c0c0-11e6-96cf-16b77c14c5a7.png">

Pictures are rendering of example from [font-variant-caps](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-caps)

<!-- 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/14561)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue Dec 14, 2016
font-variant-caps implemented in font.mako.rs

<!-- Please describe your changes on the following line: -->
Implemented font-variant-caps for gecko library

---
<!-- 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 #13668  (github issue number if applicable).

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

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Before Change:

<img width="261" alt="beforechange" src="https://cloud.githubusercontent.com/assets/9249887/21127332/03487fbc-c0c0-11e6-8667-bb1e60d5c754.PNG">

After Change:

<img width="174" alt="afterchange" src="https://cloud.githubusercontent.com/assets/9249887/21127345/0cc8860e-c0c0-11e6-96cf-16b77c14c5a7.png">

Pictures are rendering of example from [font-variant-caps](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-caps)

<!-- 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/14561)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

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