Commit graph

408 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
98091243a7
style: Use a more similar representation in Rust and C++ for grid lines.
Option<> is not FFI-safe, so if we want to use the same representation
everywhere we need to get rid of it. This also makes it take the same amount of
memory as the C++ representation, and it's not very complex, I'd think.

Differential Revision: https://phabricator.services.mozilla.com/D35195
2019-07-08 12:43:07 +02:00
Boris Chiou
73b0b7c477 style: Implement offset-rotate.
This includes style system and layout update. I add 3 extra reftests
because the original tests use ray() function as the offset-path, but we
don't support it. It'd be better to add tests using a different type of
offset-path.

The spec issue about the serialization:
https://github.com/w3c/fxtf-drafts/issues/340

Differential Revision: https://phabricator.services.mozilla.com/D32212
2019-05-29 16:14:27 +02:00
Emilio Cobos Álvarez
8bf0f82ddc style: Remove old CSS scroll snap implementation.
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
2019-05-29 16:14:24 +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
Cameron McCormack
ca756a8550 style: Implement -webkit-line-clamp.
Differential Revision: https://phabricator.services.mozilla.com/D20115
2019-05-10 12:43:00 +02:00
Emilio Cobos Álvarez
57874ae90a style: Rustfmt recent changes. 2019-05-07 12:56:02 +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
Hiroyuki Ikezoe
21481e315e style: Switch to the new scroll-snap-type syntax for the old scroll snap implementation and drop the scroll-snap-type-{x,y} longhands.
Now scroll-snap-type is a longhand property.

Differential Revision: https://phabricator.services.mozilla.com/D21622
2019-04-12 12:20:12 +02:00
Hiroyuki Ikezoe
2f457ed144 style: Rename ScrollSnapType to ScrollSnapStrictness.
The scroll snap strictness is defined in the new spec [1], and the structure
is the exactly same as the old scroll snap type structure.

[1] https://drafts.csswg.org/css-scroll-snap-1/#snap-strictness

Differential Revision: https://phabricator.services.mozilla.com/D21621
2019-04-12 12:20:12 +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
Emilio Cobos Álvarez
5d2724994c style: Remove the last usage of lossy currentcolor.
We don't have lossy currentcolor in the style system anymore, except for a
single property -moz-font-smoothing-background-color.

I could've converted it into a proper StyleColor and thread down all the
necessary information to the font metrics code.

But it doesn't really seem worth it given it's not exposed to the web, so I just
did the simplest thing, which is making currentcolor compute to transparent to
that specific property.

This patch also removes the stores_complex_colors_lossily code and related,
since now we always can cache computed colors.

Differential Revision: https://phabricator.services.mozilla.com/D26187
2019-04-12 12:20:02 +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
Mats Palmgren
4f44b1c6b1 style: Add an inherited internal UA sheet property (-moz-list-reversed:true|false) to propagate <ol reversed> to its relevant descendants.
Bug: 288704
Reviewed-by: emilio
2019-03-27 14:29:22 +01:00
Mats Palmgren
4b4b5b6a1d style: Implement the counter-set property.
Bug: 1518201
Reviewed-by: emilio
2019-03-27 14:29:21 +01:00
Emilio Cobos Álvarez
5aeab7adb1 style: Reformat recent changes. 2019-03-13 15:08:38 +01:00
Emilio Cobos Álvarez
e0b3e5f691 style: Derive more stuff for clip rects.
I feel a bit weird for using LenghtPercentageOrAuto to implement LengthOrAuto,
but I don't think much other code will use it so it seemed a bit better to me.

Differential Revision: https://phabricator.services.mozilla.com/D21863
2019-03-13 15:08:32 +01:00
Emilio Cobos Álvarez
f1b5d5c06a style: Cleanup and fix interpolation of SVG lengths.
Instead of storing them as LengthPercentage | Number, always store as
LengthPercentage, and use the unitless length quirk to parse numbers instead.

Further cleanups to use the rust representation can happen as a followup, which
will also get rid of the boolean argument (since we can poke at the rust length
itself). That's why I didn't bother to convert it to an enum class yet.

Differential Revision: https://phabricator.services.mozilla.com/D21804
2019-03-13 15:08:15 +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
74d7d5bc42 style: Use Rust types for perspective and z-index.
Differential Revision: https://phabricator.services.mozilla.com/D20381
2019-02-23 21:05:17 -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
Hiroyuki Ikezoe
22e12a0f52 style: Implement scroll-snap-align parser and serializer.
https://drafts.csswg.org/css-scroll-snap-1/#scroll-snap-align

Differential Revision: https://phabricator.services.mozilla.com/D20205
2019-02-23 21:03:55 -08:00
Emilio Cobos Álvarez
c2819365f0 style: Rename MozLength to Size, and MaxLength to MaxSize.
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
2019-02-12 02:28:00 +01:00
Emilio Cobos Álvarez
a68bc29b96 style: Derive more length stuff, and shrink MaxLength / MozLength's repr(C) 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
2019-02-10 07:11:46 +01:00
Emilio Cobos Álvarez
2e6d34cad9 style: Rustfmt recent changes. 2019-01-13 21:59:35 +01:00
Ryan Hunt
c04a4140a7 style: Add 'overflow-anchor' CSS property.
https://drafts.csswg.org/css-scroll-anchoring/#exclusion-api

Differential Revision: https://phabricator.services.mozilla.com/D13265
2019-01-13 21:58:18 +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
Emilio Cobos Álvarez
5f173c463e style: Rustfmt recent changes. 2019-01-07 00:32:54 +01:00
Emilio Cobos Álvarez
ca1ad003bd style: Use NonNegative more in the border code.
This ended up not being so small of a patch as I'd have thought, since it
propagated a bit. But most of it is mechanical. Interesting part is
NonNegativeNumberOrPercentage and the actual uses of the NonNegative stuff and
during parsing.

This looks like it'd fix a few correctness issues during interpolation for all
the types except for BorderRadius and co (which handled it manually).

I should write tests for those in a different patch.

Differential Revision: https://phabricator.services.mozilla.com/D14673
2019-01-07 00:03:41 +01:00
Simon Sapin
be69f9c3e6 Rustfmt has changed its default style :/ 2018-12-28 13:17:47 +01:00
Emilio Cobos Álvarez
901c055519 style: Move overflow to use cbindgen.
It's one of the most annoying / hacky mako bits we have.

Differential Revision: https://phabricator.services.mozilla.com/D14084
2018-12-16 13:35:05 +01:00
Emilio Cobos Álvarez
fd73f1665a style: Move BorderStyle to border.rs.
Differential Revision: https://phabricator.services.mozilla.com/D12858
2018-12-02 14:17:26 -05:00
Jan Andre Ikenmeyer
1d6fe65401
Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
Emilio Cobos Álvarez
06fe0a1fc0
style: Fix formatting. 2018-11-17 09:56:05 +01:00
Emilio Cobos Álvarez
a5f0eb9205
style: Also move page-break-inside outside of mako.
Differential Revision: https://phabricator.services.mozilla.com/D11876
2018-11-17 09:56:04 +01:00
Emilio Cobos Álvarez
d9de68ad6a
style: Move the page-break-{before,after} properties to not use mako.
And respect the computed value of `left` / `right` / etc.

Differential Revision: https://phabricator.services.mozilla.com/D11872
2018-11-17 09:56:03 +01:00
Boris Chiou
41d2f7f3a2
style: Support keywords [x|y|z] on rotate.
Update the parser and the serialization to support the keywords, [x|y|z].

Differential Revision: https://phabricator.services.mozilla.com/D11531
2018-11-17 09:56:01 +01:00
Emilio Cobos Álvarez
1aa6725f9a
style: Move user-select outside of mako.
This is the first step to unprefix user-select.

This has no behavior change, it's just a nicer way to do the same thing which
allows us to unship individual values more easily using parse(condition).

Differential Revision: https://phabricator.services.mozilla.com/D11580
2018-11-17 09:55:47 +01:00
Emilio Cobos Álvarez
212b3e1311
style: Revert try -> r#try change.
Since we're in an inconsistent state because mako files weren't updated, and
it's really really ugly.
2018-11-10 21:42:17 +01:00
Emilio Cobos Álvarez
155caba595
style: Cargo fix + ./mach fmt. 2018-11-10 21:11:47 +01:00
Emilio Cobos Álvarez
fa764fc8e9
style: Implement overflow-wrap: anywhere.
Per https://github.com/w3c/csswg-drafts/issues/2682

Differential Revision: https://phabricator.services.mozilla.com/D11328
2018-11-10 21:10:19 +01:00
Simon Sapin
a15d33a10e cargo fix --edition 2018-11-10 17:47:28 +01:00
Emilio Cobos Álvarez
8cb5b149eb
style: Some minor formatting nits. 2018-11-08 15:22:31 +01:00
Cameron McCormack
acf7b65f36
style: Make quotes property representation allocate less.
Differential Revision: https://phabricator.services.mozilla.com/D10650
2018-11-08 15:22:26 +01:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
Boris Chiou
c7027e2676
style: Use alias for StyleFillRule.
This needs to update the "fill-rule" and "clip-rule" to use
predefined_type to avoid some compilation errors.

Differential Revision: https://phabricator.services.mozilla.com/D10142
2018-11-05 12:30:46 +01:00
Boris Chiou
a20b6a5166
style: Split TimingFunction into a separate file to match spec.
TimingFunction is defined in a separate spec (i.e. css-easing), instead
of transform, so we move it into a different file.

Depends on D9310

Differential Revision: https://phabricator.services.mozilla.com/D9311
2018-10-28 23:44:26 +01:00
chansuke
8dab4d659a
Format style component. 2018-09-09 16:24:45 +02:00