aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/gecko/values.rs
Commit message (Collapse)AuthorAgeFilesLines
* Move Stylo to its own repo (#31350)Delan Azabani2024-02-271-72/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove packages that were moved to external repo * Add workspace dependencies pointing to 2023-06-14 branch * Fix servo-tidy.toml errors * Update commit to include #31346 * Update commit to include servo/stylo#2 * Move css-properties.json lookup to target/doc/stylo * Remove dependency on vendored mako in favour of pypi dependency This also removes etc/ci/generate_workflow.py, which has been unused since at least 9e71bd6a7010d6e5723831696ae0ebe26b47682f. * Add temporary code to debug Windows test failures * Fix failures on Windows due to custom target dir * Update commit to include servo/stylo#3 * Fix license in tests/unit/style/build.rs * Document how to build with local Stylo in Cargo.toml
* style: Simplify border snappingEmilio Cobos Álvarez2023-11-241-17/+0
| | | | | | | | Make the computed value of border-like properties app units (which is effectively what happens in Gecko already), and clamp at computed value time. Differential Revision: https://phabricator.services.mozilla.com/D179481
* style: Convert RGBA to AbsoluteColor for computed/animated/resolved CSS colorsTiaan Louw2023-11-211-10/+16
| | | | | | | | | | | | | | Computed color values will not be in the correct format, closer to the one specified by the author. This also means that colors accross the code are stored now as AbsoluteColor or StyleAbsoluteColor. This allows color space/gamut information to be available for use. Some animation related test failures had to be changed, because colors now has greater precision. Animated a color now causes a lot more animation updates, which was not initially expected. See the bug for discussion. Differential Revision: https://phabricator.services.mozilla.com/D171021
* style: Add lab(), lch(), oklab(), oklch() to specified colorsTiaan Louw2023-11-061-10/+8
| | | | | | | | | | | Use new changes from cssparser and use the new lab/lch/oklab/oklch color formats. Introduced a new color type AbsoluteColor. It represents any kind of color that has absolute numerical values. It is also tied to a color space and therefore can be trivially converted to another color space. Differential Revision: https://phabricator.services.mozilla.com/D163579
* style: Use cbindgen for content property.Emilio Cobos Álvarez2020-02-121-35/+5
| | | | | | | | | | | This cleans up and also allows us to keep the distinction between content: none and content: normal, which allows us to fix the computed style we return from getComputedStyle(). Do this last bit from the resolved value instead of StyleAdjuster, because otherwise we need to tweak every initial struct for ::before / ::after. Differential Revision: https://phabricator.services.mozilla.com/D58276
* style: [css-lists-3] Make 'none' invalid as a <counter-style> in ↵Mats Palmgren2019-09-121-14/+9
| | | | | | | | | | | | counter()/counters(). CSSWG resolution: https://github.com/w3c/csswg-drafts/issues/4163#issuecomment-521331100 Spec: https://drafts.csswg.org/css-lists-3/#counter-functions Differential Revision: https://phabricator.services.mozilla.com/D43893
* style: Remove nsStyleCoord.Emilio Cobos Álvarez2019-07-081-153/+3
| | | | | | | And move the useful bits of it somewhere else (ServoStyleConstInlines.h for the inline function definitions, and nsFrame.cpp for the static assertions). Differential Revision: https://phabricator.services.mozilla.com/D36120
* style: Use cbindgen for grid track sizing.Emilio Cobos Álvarez2019-07-081-51/+1
| | | | Differential Revision: https://phabricator.services.mozilla.com/D36118
* style: Remove old CSS scroll snap implementation.Emilio Cobos Álvarez2019-05-291-22/+0
| | | | | | | | | | | | This will save us some time from figuring out what's the best thing to do in bug 1552587, so that other patches I have in flight (mainly bug 1552708) can land, since we cannot add a single byte to nsStyleDisplay right now otherwise. The code removed here is well isolated and not that complicated, so it seems to me that should be easy to bring back should we have an emergency (and I commit to doing that while preserving the nsStyleDisplay size limit if we need to :)). Differential Revision: https://phabricator.services.mozilla.com/D32026
* style: Cleanup a bit the counter style code.Emilio Cobos Álvarez2019-05-291-2/+2
| | | | | | | Use more compact types, and remove some manual implementations that can be derived. Differential Revision: https://phabricator.services.mozilla.com/D31315
* style: Rustfmt + build fix.Emilio Cobos Álvarez2019-05-101-1/+1
|
* style: Use the owned slice type for basic shape polygon coordinates.Emilio Cobos Álvarez2019-05-101-32/+1
| | | | | | | | | | | | | | | | | | | This enables destructors for tagged unions in cbindgen, implemented in: * https://github.com/eqrion/cbindgen/pull/333 Which allow us to properly generate a destructor for the cbindgen-generated StyleBasicShape (which now contains an OwnedSlice). For now, we still use the glue code to go from Box<BasicShape> to UniquePtr<BasicShape>. But that will change in the future when we generate even more stuff and remove all the glue. I could add support for copy-constructor generation to cbindgen for tagged enums, but I'm not sure if it'll end up being needed, and copy-constructing unions in C++ is always very tricky. Differential Revision: https://phabricator.services.mozilla.com/D29769
* style: Use rust lengths for row-gap / column-gap.Emilio Cobos Álvarez2019-04-121-60/+1
| | | | Differential Revision: https://phabricator.services.mozilla.com/D26915
* style: Remove some redundant use statements.Emilio Cobos Álvarez2019-04-121-1/+0
|
* style: Add a Zero trait that doesn't require Add, and use it in place of ↵Emilio Cobos Álvarez2019-03-131-1/+1
| | | | | | | | | num_traits and IsZeroLength. Use it to be consistent in InsetRect serialization and storage between Servo and Gecko. Differential Revision: https://phabricator.services.mozilla.com/D21493
* style: Use Rust types for perspective and z-index.Emilio Cobos Álvarez2019-02-231-22/+0
| | | | Differential Revision: https://phabricator.services.mozilla.com/D20381
* style: Remove a couple trivial dependencies on nsPresContext.Emilio Cobos Álvarez2019-02-231-5/+3
| | | | Differential Revision: https://phabricator.services.mozilla.com/D20141
* style: Use Rust sizes for flex-basis, width, height, and their min/max ↵Emilio Cobos Álvarez2019-02-231-85/+4
| | | | | | | | | | | | properties. Really sorry for the size of the patch :( Only intentional behavior change is in the uses of HasLengthAndPercentage(), where it's easier to do the right thing. The checks that used to check for (IsCalcUnit() && CalcHasPercentage()) are wrong since bug 957915. Differential Revision: https://phabricator.services.mozilla.com/D19553
* style: Rename MozLength to Size, and MaxLength to MaxSize.Emilio Cobos Álvarez2019-02-121-17/+17
| | | | | | | | | | | | | MozLength is not a very descriptive name. If we're going to use it in both Gecko and Servo we may as well name it something more accurate. I would've chosen `ContentSize` per CSS2[1][2] if it wasn't a lie in presence of box-sizing. I don't have better ideas than `Size`, given that. [1]: https://drafts.csswg.org/css2/visudet.html#propdef-width [2]: https://drafts.csswg.org/css2/box.html#content-width Differential Revision: https://phabricator.services.mozilla.com/D19280
* style: Derive more length stuff, and shrink MaxLength / MozLength's repr(C) ↵Emilio Cobos Álvarez2019-02-101-33/+25
| | | | | | | | | | | | | | | | | | | | | | | | representation. This patch: * Makes LengthPercentageOrAuto generic, and removes a bunch of code fo LengthPercentageOrNone, which was used only for servo and now can use the normal MaxLength (with a cfg() guard for the ExtremumLength variant). * Shrinks MaxLength / MozLength's repr(C) reperesentation by reducing enum nesting. The shrinking is in preparation for using them from C++ too, though that'd be a different bug. * Moves NonNegative usage to the proper places so that stuff for them can be derived. I did this on top of bug 1523071 to prove both that it could be possible and that stuff wasn't too messy. It got a bit messy, but just because of a bug I had fixed in bindgen long time ago already, so this updates bindgen's patch version to grab a fix instead of ugly workarounds :) Differential Revision: https://phabricator.services.mozilla.com/D17762
* style: Represent the percentage in LengthPercentage with something other ↵Emilio Cobos Álvarez2019-01-201-3/+3
| | | | | | | | | | | | | | | | | than an option. Not the prettiest, but it will work, and LengthPercentage will be 12 bytes which is pretty good (we could do better if wanted I guess): * Au(i32) length; * f32 percentage; * AllowedNumericType(u8) clamping_mode; * bool has_percentage; * bool was_calc; This will allow me to start moving C++ stuff to use this representation. Differential Revision: https://phabricator.services.mozilla.com/D16929
* Rustfmt recent changes.Emilio Cobos Álvarez2019-01-081-4/+8
|
* style: Manually rename some variables.Emilio Cobos Álvarez2019-01-081-6/+6
| | | | | | lop is not an acceptable variable name for LengthPercentage. Differential Revision: https://phabricator.services.mozilla.com/D15813
* style: Rename LengthOrPercentage to LengthPercentage.Emilio Cobos Álvarez2019-01-081-25/+25
| | | | | | | | | | | | It does not represent `<length> | <percentage>`, but `<length-percentage>`, so `LengthOrPercentage` is not the right name. This patch is totally autogenerated using: rg 'LengthOrPercentage' servo | cut -d : -f 1 | sort | uniq > files for file in $(cat files); do sed -i "s#LengthOrPercentage#LengthPercentage#g" $file; done Differential Revision: https://phabricator.services.mozilla.com/D15812
* style: Simplify computed::LengthOrPercentage and friends.Emilio Cobos Álvarez2019-01-071-35/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a first step to share LengthOrPercentage representation between Rust and Gecko. We need to preserve whether the value came from a calc() expression, for now at least, since we do different things depending on whether we're calc or not right now. See https://github.com/w3c/csswg-drafts/issues/3482 and dependent bugs for example. That means that the gecko conversion code needs to handle calc() in a bit of an awkward way until I change it to not be needed (patches for that incoming in the next few weeks I hope). I need to add a hack to exclude other things from the PartialEq implementation because the new conversion code is less lossy than the old one, and we relied on the lousiness in AnimationValue comparison (in order to start transitions and such, in [1] for example). I expect to remove that manual PartialEq implementation as soon as I'm done with the conversion. The less lossy conversion does fix a few serialization bugs for animation values though, like not loosing 0% values in calc() when interpolating lengths and percentages, see the two modified tests: * property-types.js * test_animation_properties.html Differential Revision: https://phabricator.services.mozilla.com/D15793
* style: Rustfmt recent changes.Emilio Cobos Álvarez2019-01-071-3/+1
|
* style: Clamp to non-negative value after doing interpolation for circle(), ↵Boris Chiou2019-01-071-1/+3
| | | | | | | | | | | | | | | ellipse(), and inset(). Replace LengthOrPercentage with NonNegativeLengthOrPercentage on ShapeRadius, Circle, Ellipse. And derive ToAnimatedValue for ShapeSource and its related types, so we clamp its interpolated results into non-negative values. (i.e. The radius of circle()/ellipse() and the border-radius of inset().) Note: We may get negative values when using a negative easing function, so the clamp is necessary to avoid the incorrect result or any undefined behavior. Differential Revision: https://phabricator.services.mozilla.com/D14654
* style: Use cbindgen for ExtremumLength.Boris Chiou2019-01-071-30/+3
| | | | | | | | | | | | | 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. Differential Revision: https://phabricator.services.mozilla.com/D7535
* style: Cleanup some conversion code dealing with NonNegative.Emilio Cobos Álvarez2019-01-071-32/+16
| | | | | | | I'm about to introduce another use of it and I don't want to repeat the same copy-pasta again. Differential Revision: https://phabricator.services.mozilla.com/D14672
* Rustfmt has changed its default style :/Simon Sapin2018-12-281-1/+1
|
* Update MPL license to https (part 4)Jan Andre Ikenmeyer2018-11-191-1/+1
|
* style: Manually extinguish multi-line use statements.Emilio Cobos Álvarez2018-11-101-3/+2
|
* `cargo fix --edition --features gecko`Simon Sapin2018-11-101-33/+43
|
* style: Some minor formatting nits.Emilio Cobos Álvarez2018-11-081-6/+3
|
* Reorder importsPyfisch2018-11-061-9/+13
|
* Format remaining filesPyfisch2018-11-061-1/+2
|
* Fix various tidy issues.Emilio Cobos Álvarez2018-10-191-1/+1
|
* style: Move MozLength and MaxLength into generics.Boris Chiou2018-10-191-4/+5
| | | | | | | Move MozLength and MaxLength into generics, and drop the manual implementation of ToComputedValue. Differential Revision: https://phabricator.services.mozilla.com/D8291
* style: Always compute angle values to degrees.Emilio Cobos Álvarez2018-10-191-4/+1
| | | | | | | | | | | | | | | | | | This matches the spec, https://drafts.csswg.org/css-values/#angles, which says: > All <angle> units are compatible, and deg is their canonical unit. And https://drafts.csswg.org/css-values/#compat, which says: >When serializing computed values [...], compatible units [...] are converted into a single canonical unit. And also other implementations (Blink always serializes angles as degrees in computed style for example). Also allows us to get rid of quite a bit of code, and makes computed angle value representation just a number, which is nice. Differential Revision: https://phabricator.services.mozilla.com/D8619
* Format style component.chansuke2018-09-091-3/+4
|
* Run rustfmt on selectors, servo_arc, and style.Bobby Holley2018-04-101-78/+107
| | | | | | | | | | This was generated with: ./mach cargo fmt --package selectors && ./mach cargo fmt --package servo_arc && ./mach cargo fmt --package style Using rustfmt 0.4.1-nightly (a4462d1 2018-03-26)
* style: Add support for 'flex-basis:content' in the style system.Emilio Cobos Álvarez2018-04-021-1/+28
| | | | | | Bug: 1105111 Reviewed-by: xidorn MozReview-Commit-ID: 5WhgHJJ0mDB
* style: Remove unsound Atom From implementations.Emilio Cobos Álvarez2018-03-191-1/+1
| | | | Fixes #20158
* Replace LengthOrNone by a specific type for the perspective propertyAnthony Ramine2018-02-261-0/+22
| | | | | This was its only use, and it was bugged: AFAIK this didn't properly clamp animated values below 0.
* style: Get rid of gecko_size_type.Emilio Cobos Álvarez2018-02-071-2/+2
| | | | This also fixes a style sharing issue with MaxLength, anecdotally.
* Fix naming of ExtremumLength variantsAnthony Ramine2018-02-011-8/+8
|
* style: Make css(dimension) apply to the variant.Emilio Cobos Álvarez2017-11-121-2/+2
|
* style: Implement css(dimension) and derive ToCss for a bunch of stuff.Emilio Cobos Álvarez2017-11-121-3/+3
| | | | For css(dimension), it'd be nice to derive(Parse) too, I think...
* Update ns[C]String::from -> ns[C]Str::from where possibleMichael Layzell2017-09-261-2/+2
|
* Use CSSPixelLength in LengthOrPercentage{*}.Boris Chiou2017-09-131-6/+6
| | | | | Replace Au with CSSPixelLength in LengthOrPercentage, LengthOrPercentageOrAuto, and LengthOrPercentageOrNone.