-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style: Generate top-level function and constant declarations for the …
…style crate. This needs mozilla/cbindgen#362, but I expect it to be uncontroversial. I'll add a patch to this bug when it's merged to update it. cbindgen historically didn't include these, but it turns out to be pretty useful to generate constants for the style crate (since the binding crate is `servo/ports/geckolib`). An alternative is to get a completely different cbindgen-generated header for these, but that seems a bit wasteful. This generates the constants with the Style prefix (so we'll get `StyleMAX_GRID_LINE` for example), which is very ugly. But we probably want to eventually stop using the Style prefix and use a namespace instead, plus it's trivial to do `auto kMaxLine = StyleMAX_GRID_LINE`, for example, so it's probably not a huge deal. Another alternative would be to use associated consts, which _are_ generated by cbindgen. Something like: ``` struct GridConstants([u8; 0]); impl GridConstants { const MAX_GRID_LINE: i32 = 10000; } ``` Which would yield something like: ``` static const int32 StyleGridConstants_MAX_GRID_LINE = 10000; ``` I'm not sure if you find it preferrable, but I'm also happy to change it in a follow-up to use this. We need to fix a few manual C++ function signature definitions to match the C++ declaration. Differential Revision: https://phabricator.services.mozilla.com/D35197
- Loading branch information
Showing
2 changed files
with
9 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters