aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/properties/helpers.mako.rs
Commit message (Collapse)AuthorAgeFilesLines
* Make the choice of layout runtime settingMartin Robinson2023-07-061-6/+3
| | | | Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com>
* style: Add support for the revert-layer keywordEmilio Cobos Álvarez2023-06-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch looks bigger than it is, but it's mostly because of plumbing. To implement revert-layer we need not only the cascade origin of the declaration, but the whole cascade level, plus also the layer order. In order to do this, encapsulate these two things inside a 32-bit `CascadePriority` struct and plumb it through the rule tree and so on. This allows us to remove the packing and unpacking of CascadeLevel, though I kept the ShadowCascadeOrder limit for now in case we need to reintroduce it. Fix `!important` behavior of layers while at it (implementing it in `CascadeLevel::cmp`, spec quote included since it was tricky to find) since some revert-layer tests were depending on it. The style attribute test is failing now, but follow-up commit fixes it, see spec issue. In terms of the actual keyword implementation, it's sort of straight-forward: We implement revert and revert-layer in a shared way, by storing the cascade priority that reverted it. Differential Revision: https://phabricator.services.mozilla.com/D133372
* style: Reduce code size of shorthand serializationEmilio Cobos Álvarez2023-05-241-6/+11
| | | | Differential Revision: https://phabricator.services.mozilla.com/D118835
* style: Move moz-control-character-visibility out of mako, and remove support ↵Oriol Brufau2023-05-161-25/+9
| | | | | | | | | | | for gecko_pref_controlled_initial_value No behavior change, just cleanup. Actually seem this technically _adds_ some code even though it's a cleanup, but that's mostly because of the wrapping of the derive list. The resulting code is simpler (more in-line with our usual things, so I think it's an improvement). Differential Revision: https://phabricator.services.mozilla.com/D111551
* style: Clean up text-justify, and make distribute a parse-time aliasOriol Brufau2023-05-161-36/+9
| | | | | | Since it's simpler, as discussed in the CSSWG issue. Differential Revision: https://phabricator.services.mozilla.com/D111346
* style: Use a single system font definition rather than twoOriol Brufau2023-05-161-1/+1
| | | | | | Follow the pattern we use for system colors. Differential Revision: https://phabricator.services.mozilla.com/D108822
* Miscellaneous build / tidy fixes.Emilio Cobos Álvarez2021-02-261-3/+10
|
* style: Reduce the amount of code generated by ↵Emilio Cobos Álvarez2021-02-261-3/+3
| | | | | | | | | | | | | | | | | | | UnparsedValues::substitute_variables. This reduces the amount of assembly instructions generated by this function from 18k+ to ~800. This should make reasoning about its stack space usage sane, and should fix the ASAN stack overflows, but also we should take this regardless, because it's saner and makes reading it simpler. I also think that the writing_mode shenanigans is fixing a bug (I think before this, we'd pick the first physical value which mapped to any of the properties, which is wrong), but I haven't bothered looking for a test-case that fails before my patch. The relevant WPTs (css/css-logical/animation*) still pass. Differential Revision: https://phabricator.services.mozilla.com/D105342
* style: Remove the need for needs_context in the mako glue.Emilio Cobos Álvarez2021-02-261-18/+14
| | | | | | | | It's only used to disambiguate between the one-argument and the trait version of Keyword::parse. Instead, just explicitly use the trait version, so that we don't need to specify it. Differential Revision: https://phabricator.services.mozilla.com/D104328
* Fix warnings introduced in newer Rust NightlySimon Sapin2021-02-251-7/+7
| | | | | | | | | | | | This does not (yet) upgrade ./rust-toolchain The warnings: * dead_code "field is never read" * redundant_semicolons "unnecessary trailing semicolon" * non_fmt_panic "panic message is not a string literal, this is no longer accepted in Rust 2021" * unstable_name_collisions "a method with this name may be added to the standard library in the future" * legacy_derive_helpers "derive helper attribute is used before it is introduced" https://github.com/rust-lang/rust/issues/79202
* style: Switch all callsites of try() to try_parse() in the style crate.Emilio Cobos Álvarez2020-06-181-2/+2
| | | | | | | | | Fully automated via: $ rg -l '\.try\(' | xargs sed -i 's/\.try(/.try_parse(/g' $ cd servo/components/style && cargo +nightly fmt Differential Revision: https://phabricator.services.mozilla.com/D80099
* style: Build mako-generated stylo rust sources deterministically.Mike Hommey2020-04-161-1/+1
| | | | Differential Revision: https://phabricator.services.mozilla.com/D70633
* style: Convert GenerateServoCSSPropList.py to py3.Mike Hommey2020-04-161-3/+3
| | | | Differential Revision: https://phabricator.services.mozilla.com/D70308
* style: Add support for pref-controlled initial values.Cameron McCormack2020-04-161-3/+16
| | | | Differential Revision: https://phabricator.services.mozilla.com/D67931
* style: Make direction use an enum class.Emilio Cobos Álvarez2020-02-121-1/+2
| | | | Differential Revision: https://phabricator.services.mozilla.com/D60857
* 2020: paint bordersSimon Sapin2019-10-241-1/+2
|
* Stylo: replace product={gecko,servo} with engine={gecko,servo-2013,servo-2020}Simon Sapin2019-07-291-29/+42
| | | | Renaming the variable helped make sure I looked at every use.
* style: Implement overflow-block and overflow-inline propertiesviolet2019-06-251-3/+21
| | | | Differential Revision: https://phabricator.services.mozilla.com/D34738
* style: Fix servo build.Emilio Cobos Álvarez2019-05-291-2/+2
|
* style: Appease tidy.Emilio Cobos Álvarez2019-05-291-1/+4
|
* style: Support AllowQuirks::Always option in helpers.mako.rsviolet2019-05-291-8/+8
| | | | Differential Revision: https://phabricator.services.mozilla.com/D29936
* style: Add bindings for box shadows, and remove nsCSSShadowArray and friends.Emilio Cobos Álvarez2019-05-291-2/+22
| | | | Differential Revision: https://phabricator.services.mozilla.com/D30547
* style: Use an ArcSlice as the computed value representation of inherited ↵Emilio Cobos Álvarez2019-05-291-13/+122
| | | | | | | | | list properties. This adds a bit of complexity, which I think will pay off in the end. Removals incoming. Differential Revision: https://phabricator.services.mozilla.com/D30544
* style: Use OwnedSlice in the specified and computed values of most vector ↵Emilio Cobos Álvarez2019-05-291-30/+19
| | | | | | | | | | | | | | | | properties. This is just a refactor in the right direction. Eventual goal is: * All inherited properties use ArcSlice<>. * All reset properties use OwnedSlice<> (or ThinVec<>). No conversion happens at all, so we can remove all that glue, and also compute_iter and co. Of course there's work to do, but this is a step towards that. Differential Revision: https://phabricator.services.mozilla.com/D30127
* style: Use rust lengths for row-gap / column-gap.Emilio Cobos Álvarez2019-04-121-2/+2
| | | | Differential Revision: https://phabricator.services.mozilla.com/D26915
* style: Derive ToResolvedValue.Emilio Cobos Álvarez2019-04-121-7/+36
| | | | Differential Revision: https://phabricator.services.mozilla.com/D26783
* style: Add derived ToShmem implementations.Cameron McCormack2019-04-121-5/+5
| | | | Differential Revision: https://phabricator.services.mozilla.com/D17197
* style: Try to bring some more sanity into our font code.Emilio Cobos Álvarez2019-03-271-13/+1
| | | | | | | | | | | | | | | | | | | | | | | | It's not very easy to understand on its current state, and it causes subtle bugs like bug 1533654. It could be simpler if we centralized where the interactions between properties are handled. This patch does this. This patch also changes how MathML script sizes are tracked when scriptlevel changes and they have relative fonts in between. With this patch, any explicitly specified font-size is treated the same (being a scriptlevel boundary), regardless of whether it's either an absolute size, a relative size, or a wide keyword. Relative lengths always resolve relative to the constrained size, which allows us to avoid the double font-size computation, and not give up on sanity with keyword font-sizes. I think given no other browser supports scriptlevel it seems like the right trade-off. Differential Revision: https://phabricator.services.mozilla.com/D23070
* style: Optimize cascading of other wide keywords if possible.Emilio Cobos Álvarez2019-03-131-9/+11
| | | | | | | | | | | | | | | The way the copy-on-write stuff works, and the way that we have to apply properties from most specific to less specific guarantees that always that we're going to inherit an inherited property, or reset a reset property, we have already the right value on the style. Revert relies on that, so there doesn't seem to be a reason to not use that fact more often and skip useless work earlier. Font-size is still special of course... I think I have a way to move the specialness outside of the style, but piece by piece. Differential Revision: https://phabricator.services.mozilla.com/D21882
* style: Implement CSS revert keyword.Emilio Cobos Álvarez2019-03-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The only fishy bit is the animation stuff. In particular, there are two places where we just mint the revert behavior: * When serializing web-animations keyframes (the custom properties stuff in declaration_block.rs). That codepath is already not sound and I wanted to get rid of it in bug 1501530, but what do I know. * When getting an animation value from a property declaration. At that point we no longer have the CSS rules that apply to the element to compute the right revert value handy. It'd also use the wrong style anyway, I think, given the way StyleBuilder::for_animation works. We _could_ probably get them out of somewhere, but it seems like a whole lot of code reinventing the wheel which is probably not useful, and that Blink and WebKit just cannot implement either since they don't have a rule tree, so it just doesn't seem worth the churn. The custom properties code looks a bit different in order to minimize hash lookups in the common case. FWIW, `revert` for custom properties doesn't seem very useful either, but oh well. Differential Revision: https://phabricator.services.mozilla.com/D21877
* style: Add a Zero trait that doesn't require Add, and use it in place of ↵Emilio Cobos Álvarez2019-03-131-0/+2
| | | | | | | | | 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: Cleanup a few shorthand properties.Emilio Cobos Álvarez2019-01-291-0/+52
| | | | Differential Revision: https://phabricator.services.mozilla.com/D17082
* style: Make tidy happy.Emilio Cobos Álvarez2019-01-201-2/+2
|
* style: Add plumbing for handling physical/logical corner values.Mats Palmgren2019-01-201-1/+14
| | | | | Bug: 1520684 Reviewed-by: emilio
* Update MPL license to https (part 4)Jan Andre Ikenmeyer2018-11-191-1/+1
|
* Use 2018-style paths in code generated by MakoSimon Sapin2018-11-101-35/+35
|
* style: Remove DeclaredValue.Emilio Cobos Álvarez2018-09-181-1/+1
| | | | | | | | I think it used to be the case that all PropertyDeclaration variants had a DeclaredValueOwned<T> inside. But that's no longer the case, so this abstraction seems less useful now. Differential Revision: https://phabricator.services.mozilla.com/D5978
* style: Deindent the non-css-wide-keyword-related code from cascade_property.Emilio Cobos Álvarez2018-09-181-82/+76
| | | | | | There's no good reason we construct a DeclaredValue as an intermediate step. Differential Revision: https://phabricator.services.mozilla.com/D5977
* style: Remove DeclaredValue::WithVariables.Emilio Cobos Álvarez2018-09-181-1/+0
| | | | | | We never construct it. Differential Revision: https://phabricator.services.mozilla.com/D5976
* style: Rename offset-* logical properties to inset-*.Emilio Cobos Álvarez2018-07-011-1/+1
| | | | | | Bug: 1464782 Reviewed-by: xidorn MozReview-Commit-ID: BW44sru99RF
* style: Move some parsing-only attributes to use #[parse(..)] instead of ↵Emilio Cobos Álvarez2018-06-121-1/+1
| | | | | | | | | | #[css(..)]. I need to admit I'm ambivalent about this one :). Bug: 1466609 Reviewed-by: xidorn MozReview-Commit-ID: F1jlfnQKXwo
* style: Minor indentation cleanup.Emilio Cobos Álvarez2018-06-121-2/+4
| | | | MozReview-Commit-ID: JmilaCX3rNy
* followup: Add a comment regarding why a type is generic.Emilio Cobos Álvarez2018-05-281-0/+4
| | | | | | Bug: 1462829 Rubber-stamped-by: xidorn MozReview-Commit-ID: 5DE8W2n1NP
* style: Refactor vector types.Emilio Cobos Álvarez2018-05-281-24/+63
| | | | | | | | This fixes clamping of mask-size and moves it out of mako while at it. Bug: 1462829 Reviewed-by: hiro,xidorn MozReview-Commit-ID: 9hiTe63odna
* style: Consistently use top-right-bottom-left order for physical sides.Xidorn Quan2018-05-191-1/+1
| | | | | | Bug: 1454591 Reviewed-by: heycam MozReview-Commit-ID: 6pLRSO8YNDI
* style: Allow shorthands to specify their own impl of SpecifiedValueInfo and ↵Xidorn Quan2018-04-291-22/+10
| | | | | | | | manual impl it for font and border. Bug: 1434130 Reviewed-by: emilio MozReview-Commit-ID: 3B9OfkWU0Eq
* style: Skip system font variant for ToCss in font subproperties.Xidorn Quan2018-04-291-0/+1
| | | | | | | | | | | System font keywords are not a valid value for those properties. The newly-added #[css(skip)] would be reused by deriving algorithm of SpecifiedValueInfo to skip them as well. Bug: 1434130 Reviewed-by: emilio MozReview-Commit-ID: EmnhkaA9RR5
* style: Add a ValueInfo trait for exposing types needed by devtools.Xidorn Quan2018-04-291-7/+28
| | | | | | | | | | | | Most of types just derive it using proc_macro directly. Some of value types need manual impl. In my current plan, this new trait will be used in bug 1434130 to expose values as well. Bug: 1455576 Reviewed-by: emilio MozReview-Commit-ID: LI7fy45VkRw
* Make nscssproperty a method of longhand/shorthand/alias class.Xidorn Quan2018-04-111-14/+0
|
* Introduce #[css(if_empty = "…", iterable)]Anthony Ramine2018-03-071-59/+11
|