Commit graph

100 commits

Author SHA1 Message Date
Oriol Brufau
d8993eef7e Further changes required by Servo 2023-05-16 23:40:17 +02:00
Oriol Brufau
743f213c25 style: Move moz-control-character-visibility out of mako, and remove support 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
2023-05-16 23:17:16 +02:00
Oriol Brufau
b40f4b6fec style: Clean up text-justify, and make distribute a parse-time alias
Since it's simpler, as discussed in the CSSWG issue.

Differential Revision: https://phabricator.services.mozilla.com/D111346
2023-05-16 23:14:19 +02:00
Oriol Brufau
b38517757f style: Remove layout.css.ruby.position-alternate.enabled pref
Differential Revision: https://phabricator.services.mozilla.com/D114044
2023-05-16 12:59:19 +02:00
Oriol Brufau
17ae374c65 style: part 1 - Support parsing ruby-position: alternate
Differential Revision: https://phabricator.services.mozilla.com/D107382
2023-05-16 12:56:06 +02:00
Emilio Cobos Álvarez
685e749cfc
style: Switch all callsites of try() to try_parse() in the style crate.
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
2020-06-18 23:51:14 +02:00
Emilio Cobos Álvarez
e259c53c62 style: Derive parse for TextOverflowSide.
Depends on D76330

Differential Revision: https://phabricator.services.mozilla.com/D76331
2020-06-04 01:50:36 +02:00
Emilio Cobos Álvarez
f76acc84c6 style: Reformat recent changes. 2020-04-16 17:50:17 +02:00
Emilio Cobos Álvarez
7d438cd816 style: Ensure that derived types are right for optimized-away implementations.
We have this optimization where, for non-generic structs, we generate just a
clone / move as the ToComputedValue / ToResolvedValue implementation.

This moves the optimization a bit further down, and refines it so that we still
generate all the relevant where clauses that make it sound, that is, that all
the ToComputedValue implementations of the fields return the same type.

Otherwise this wouldn't be sound and the type would need to become generic.

We add an escape hatch (no_field_bound) for fields that need to be cloned but
which don't implement the trait. This is right now only for the RefPtr<> in the
shared font-family list, and a piece of code in PaintWorklet which looks kinda
fishy, and probably should be fixed (but we don't ship it in Firefox and there's
a pre-existing FIXME for servo, so I punted on it for now).

The other thing this patch does is adding a bunch of ToComputedValue /
ToResolvedValue implementations that are trivial and were missing.

Differential Revision: https://phabricator.services.mozilla.com/D67913
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
7af9a087aa style: Use enums for text-align / text-align-last.
This also fixes some backwards logic in nsBlockFrame::ReflowDirtyLines, and adds
some static assertions to nsGenericHTMLElement that almost cause a very subtle
bug.

Depends on D63792

Differential Revision: https://phabricator.services.mozilla.com/D63793
2020-04-16 16:35:07 +02:00
Jonathan Kew
471e491a89 style: Add support for the 'all' value of text-decoration-skip-ink.
Differential Revision: https://phabricator.services.mozilla.com/D61184
2020-04-16 16:35:07 +02:00
Fernando Jiménez Moreno
17948f3b39 Propagate text decoration where needed 2020-03-23 11:13:10 +01:00
Fernando Jiménez Moreno
83fc9943d3 Do not use buggy text_decorations_in_effect 2020-03-23 11:10:44 +01:00
Jonathan Kew
df01cec675
style: Move the from-font value from text-underline-offset to text-underline-position, as per recent spec changes, and fix interaction between position and offset.
Differential Revision: https://phabricator.services.mozilla.com/D59778
2020-02-12 02:43:19 +01:00
Jonathan Kew
2910ca6197
style: Support percentage values for the CSS text-decoration-thickness and text-underline-offset properties.
Differential Revision: https://phabricator.services.mozilla.com/D59777
2020-02-12 02:43:19 +01:00
Emilio Cobos Álvarez
16fd7cad0c
style: Add a style flag for the root element style.
This is needed to make the root element not a containing block in presence of
filters or what not.

Differential Revision: https://phabricator.services.mozilla.com/D61167
2020-02-12 02:43:18 +01:00
Emilio Cobos Álvarez
16e5331950
style: Simplify calc expressions earlier.
This simplifies a bit the code, and guarantees that all calc()s have percentages
and lengths.

I also wanted to remove unclamped_length() / specified_percentage() (for the
same reason as the above patch), but they're needed for animations for now. When
I implement min() / max() for <length-percentage> they'll be fixed.

Differential Revision: https://phabricator.services.mozilla.com/D60194
2020-02-12 02:43:15 +01:00
Emilio Cobos Álvarez
a541046147 style: Use less Au in font code.
Font code is the only thing that was using Au in the style system without
interfacing with Gecko, and there was no real reason for it to do so.

This slightly simplifies the code.

Differential Revision: https://phabricator.services.mozilla.com/D57248
2019-12-16 14:23:56 +01:00
Jonathan Kew
51c1dfee2d
style: Add support for parsing of the CSS text-underline-position property.
Differential Revision: https://phabricator.services.mozilla.com/D54722
2019-12-15 21:03:31 +01:00
Simon Sapin
9f4b1a0f14 Implement text-align (except justify) 2019-12-07 14:31:45 +01:00
Anthony Ramine
785a344e32 Update rand to 0.7 (fixes #24448) 2019-10-23 15:34:48 +02:00
Emilio Cobos Álvarez
cd3b0c23fa
style: Fix Servo build, and rustfmt recent changes. 2019-09-12 23:04:56 +02:00
Emilio Cobos Álvarez
54ce45f3ee style: Update cbindgen.
This cleans up the pattern of "Use a private dtor so that the helper functions
do the right thing" by enabling it everywhere using:

  https://github.com/eqrion/cbindgen/pull/377

It also caught some uninitialized value issues.

I think they're mostly harmless since we zero-initialize our structs:

https://searchfox.org/mozilla-central/rev/325c1a707819602feff736f129cb36055ba6d94f/servo/components/style/properties/gecko.mako.rs#632

And since we override the clip rect, which is the other bit of code that was
failing to build with this change.

Differential Revision: https://phabricator.services.mozilla.com/D43491
2019-09-12 22:34:16 +02:00
Emilio Cobos Álvarez
9404ac89b7 style: Don't clamp font-size calc() factors too early.
These two bugs (bug 1572738 and bug 1572451) are stylo regressions.

When font-family changes, we try to recompute the font-size with a length /
percentage combinations in case the generic family changes, so the user
preferences are kept.

When calc() is involved, we clamp to non-negative too early, via
NonNegativeLength::scale_by.

I think we should generally dump this "try to track font-size across calc()"
thingie, as as various comments note it is not quite perfect, and it's not clear
how it should work in presence of min()/max().

This patch fixes the issue and simplifies code a bit, I may consider removing
this altogether in a follow-up.

Differential Revision: https://phabricator.services.mozilla.com/D41776
2019-09-12 22:07:45 +02:00
Emilio Cobos Álvarez
4d8fc4b8f7
style: Fix formatting of recent changes. 2019-08-15 17:02:37 +02:00
Charlie Marlow
cf7b0e13b6
style: adding from-font support to text-underline-offset and text-decoration-thickness.
Differential Revision: https://phabricator.services.mozilla.com/D41476
2019-08-15 17:02:01 +02:00
Emilio Cobos Álvarez
0844439bb2
style: Adjust comment grammar as suggested by xidorn. 2019-08-15 17:01:47 +02:00
Emilio Cobos Álvarez
7f02662770
style: Use cbindgen for text-emphasis-style.
I sent https://github.com/eqrion/cbindgen/pull/377 since I got sick of
copy-pasting the private default constructor stuff :)

Differential Revision: https://phabricator.services.mozilla.com/D41419
2019-08-15 17:01:14 +02:00
Emilio Cobos Álvarez
fa06241ab6
style: Simplify text-emphasis-style.
Differential Revision: https://phabricator.services.mozilla.com/D41418
2019-08-15 17:01:06 +02:00
Charlie Marlow
034557a717
style: Adding parsing support for text-decoration-skip-ink
Differential Revision: https://phabricator.services.mozilla.com/D35831
2019-07-08 12:45:14 +02:00
Emilio Cobos Álvarez
81f40a57e4 style: Reformat recent style system changes. 2019-05-29 16:14:30 +02:00
violet
e66e612452 style: Use cbindgen for text-overflow.
Differential Revision: https://phabricator.services.mozilla.com/D32285
2019-05-29 16:14:28 +02:00
Jonathan Kew
8ee516b681 style: Add parsing of the loose|normal|strict values of the CSS line-break property.
Differential Revision: https://phabricator.services.mozilla.com/D30785
2019-05-29 16:14:18 +02:00
Jonathan Kew
0dc70cf7f2 style: Implement the CSS line-break property, with values "auto | anywhere".
Note that the "loose | normal | strict" values are not yet parsed/implemented.

Differential Revision: https://phabricator.services.mozilla.com/D29817
2019-05-29 16:14:18 +02:00
Emilio Cobos Álvarez
57874ae90a style: Rustfmt recent changes. 2019-05-07 12:56:02 +02:00
Emilio Cobos Álvarez
c990c9623d style: Use rust types for vertical-align.
The previous commit removed the dependence on the discriminant value, so we
don't need to keep discriminants different from text-align anymore.

Differential Revision: https://phabricator.services.mozilla.com/D29361
2019-05-07 12:55:41 +02:00
Jonathan Kew
a9e473c6e8 style: Allow full-width and/or full-size-kana values of text-transform to be combined with a case transformation.
Differential Revision: https://phabricator.services.mozilla.com/D27402
2019-05-07 12:55:21 +02:00
Emilio Cobos Álvarez
8c004c0858 style: Reformat recent changes. 2019-04-12 12:20:14 +02:00
Emilio Cobos Álvarez
a47dcb5707 style: Derive ToResolvedValue.
Differential Revision: https://phabricator.services.mozilla.com/D26783
2019-04-12 12:20:09 +02:00
Cameron McCormack
40248ae5fd style: Add derived ToShmem implementations.
Differential Revision: https://phabricator.services.mozilla.com/D17197
2019-04-12 12:19:52 +02:00
Emilio Cobos Álvarez
7b14499665 style: Unship line-height: -moz-block-height.
They're only used in forms.css, and only for some anonymous content, which are
not content-accessible in the first place.

The only place where this could be exposed is calling
getComputedStyle(input, "::placeholder"), so I think this should be pretty safe,
but I've added a pref just in case.

While at it, also derive the Parse implementation. Less code is better.

Differential Revision: https://phabricator.services.mozilla.com/D25118
2019-04-12 12:19:39 +02:00
Emilio Cobos Álvarez
ff41f82720 style: Fix Gecko and Servo builds, and appease tidy. 2019-03-27 14:29:28 +01:00
Emilio Cobos Álvarez
b0af565656 style: Use cbindgen for text-decoration-line.
Differential Revision: https://phabricator.services.mozilla.com/D23412
2019-03-27 14:29:10 +01:00
Emilio Cobos Álvarez
a65925cb85 style: Fix servo build. 2019-03-13 15:08:39 +01:00
Emilio Cobos Álvarez
9e0d38a64f style: Make word-break: break-word behave like word-break: normal; overflow-wrap: anywhere.
Differential Revision: https://phabricator.services.mozilla.com/D21398
2019-03-13 15:08:14 +01:00
Emilio Cobos Álvarez
be616c31e8 style: Rustfmt recent changes. 2019-02-23 21:05:32 -08:00
Emilio Cobos Álvarez
73d5b82f9f style: Improve #[derive(Parse)].
I want to do this so that I can get rid of Either<>. The reasons for getting rid
of either are multiple:

 * It doesn't generate as nice C++ code using cbindgen.
 * It isn't that nice to use either from Rust.
 * cbindgen has bugs with zero-sized types.

I started using this for ColorOrAuto and a few others, for now.

Differential Revision: https://phabricator.services.mozilla.com/D19844
2019-02-23 21:04:44 -08:00
Emilio Cobos Álvarez
6118e4d993 style: Use Rust types for some misc properties.
-moz-tab-size, border-image-outset and border-image-slice.

This is not a particularly interesting patch, just removes some code. We can
remove way more code when a few related properties are also ported.

Differential Revision: https://phabricator.services.mozilla.com/D19825
2019-02-23 21:04:33 -08:00
Emilio Cobos Álvarez
80651fde47 style: Manually rename some variables.
lop is not an acceptable variable name for LengthPercentage.

Differential Revision: https://phabricator.services.mozilla.com/D15813
2019-01-08 12:00:48 +01:00
Emilio Cobos Álvarez
daf1f02feb style: Rename LengthOrPercentage to LengthPercentage.
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
2019-01-08 12:00:48 +01:00