Page MenuHomePhabricator

Bug 1322780 - Part 1: Use cbindgen for ExtremumLength.
ClosedPublic

Authored by boris on Oct 2 2018, 8:12 PM.

Details

Summary

ExtremumLength is the keyword type for css sizing properties, so we
could use cbindgen.

In Gecko, we use nsStyleCoord to store the sizing properties, and use
integer values to check the enum values, so I keep the macros in nsStyleConsts.
Even though we need to convert the enum type into integer, we still have
benefits to reduce the complexity of converting Rust into C++, and leave
the simplified mappings in C++ for better readability.

Diff Detail

Repository
rMOZILLACENTRAL mozilla-central
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

boris created this revision.Oct 2 2018, 8:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 2 2018, 8:12 PM
phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".Oct 2 2018, 8:12 PM
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed a project: Restricted Project.
boris requested review of this revision.Oct 2 2018, 8:12 PM
boris added a reviewer: emilio.Oct 2 2018, 8:13 PM
emilio accepted this revision.Oct 2 2018, 10:47 PM

Nice, thanks!

layout/style/nsStyleConsts.h
520

Let's put the parenthesis around the whole expression, like:

((uint8_t)StyleExtremumLength::MozMaxContent)
534

I think it should be able to assert != instead of >, but not a big deal either way.

This revision is now accepted and ready to land.Oct 2 2018, 10:47 PM
emilio added inline comments.Oct 2 2018, 10:47 PM
layout/style/nsStyleConsts.h
534

s/able/enough/ I mean

boris updated this revision to Diff 20860.Oct 3 2018, 12:49 AM
boris marked 3 inline comments as done.Oct 3 2018, 12:50 AM
boris updated this revision to Diff 39813.Nov 28 2018, 12:41 AM
boris retitled this revision from Bug 1322780 - Part 1: Use cbindgen for ExtremumLength to Bug 1322780 - Part 1: Use cbindgen for ExtremumLength..
boris updated this revision to Diff 40809.Nov 29 2018, 11:27 PM
boris updated this revision to Diff 41246.Nov 30 2018, 9:05 PM
boris added a comment.Nov 30 2018, 9:08 PM

Only rebase because we have some updates on the cbindgen.toml and ServoBindings.toml.

Code analysis found 1 defect in this patch:

  • 1 defect found by clang-format

You can run this analysis locally with:

  • ./mach clang-format -p path/to/file.cpp (C/C++)

For your convenience, here is a patch that fixes all the clang-format defects: https://queue.taskcluster.net/v1/task/NLdQKpD6RYmUQmjgS0tmBg/runs/0/artifacts/public/results/clang-format-PHID-DIFF-7mdchbwrkwo4i4f6sfi6.diff (use it in your repository with hg import or git apply)

If you see a problem in this automated review, please report it here: https://bit.ly/2IyNRy2

layout/style/nsStyleConsts.h
535–537

Warning: Incorrect coding style [clang-format]

boris updated this revision to Diff 41254.Nov 30 2018, 9:33 PM
boris marked an inline comment as done.Nov 30 2018, 9:33 PM
boris updated this revision to Diff 41258.Nov 30 2018, 9:45 PM
boris updated this revision to Diff 43751.Dec 12 2018, 8:42 PM
boris updated this revision to Diff 45597.Dec 18 2018, 6:47 PM
This revision was automatically updated to reflect the committed changes.