Commit graph

408 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
036056d2a9 style: Move image-rendering out of mako
It's easier to touch in the future that way, even though the derive list is
massive.

Differential Revision: https://phabricator.services.mozilla.com/D124377
2023-05-26 15:23:24 +02:00
Emilio Cobos Álvarez
028f2f95d2 style: Initial support for the color-scheme CSS property
Add initial support for the color-scheme CSS property, allowing pages to
choose between light and dark system colors per-element, and such.

Things that are left to do so that this can be enabled by default:

 * Dark system colors on Windows / Android / Standins.
 * Dark Canvas/CanvasText/Link visited colors (which right now are set
   via PreferenceSheet).
 * Dark form controls in nsNativeBasicTheme.
 * Processing the color-scheme meta tag to fill-in
   Document::mColorSchemeBits.

But this seems like enough progress to be landable on its own.

Differential Revision: https://phabricator.services.mozilla.com/D120843
2023-05-24 18:32:40 +02:00
Boris Chiou
fa6ab91acd style: Part 1: Add SVG d property in CSS
Add d property for style system. d property only supports path() for now
and it has the functional notation without fill rule.

https://github.com/w3c/svgwg/issues/320#issuecomment-414462645

Differential Revision: https://phabricator.services.mozilla.com/D81237
2023-05-24 18:32:33 +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
4d4fb4b414 style: Create a NonNegativePercentage type in values:specified
Differential Revision: https://phabricator.services.mozilla.com/D109285
2023-05-16 13:03:52 +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
80dae5bc59 Rustfmt. 2021-02-26 16:44:05 +01:00
Boris Chiou
52d39fc1bc style: Move Ratio into independent files.
Based on https://drafts.csswg.org/css-values/#ratios, <ratio> should be
a general types in css values, and now the media query and the position use
this type, so let's move it into the independent files.

Differential Revision: https://phabricator.services.mozilla.com/D106218
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
5fe702fa2b style: Move caption-side outside of mako.
Make it an enum class, etc.

Differential Revision: https://phabricator.services.mozilla.com/D103978
2021-02-26 16:44:05 +01:00
Emily McDonough
96c08d78cf style: Add page-size parsing to Servo
Differential Revision: https://phabricator.services.mozilla.com/D102360
2021-02-26 16:44:05 +01:00
Frederic Wang
4dfcf583cf style: Rename -moz-math-script-level to math-depth.
This renames the internal -moz-math-script-level property in order to
prepare for full math-depth support. Currently, the property is guarded
under a disabled-by-default flag, so there should be no observable
behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D91285
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
768db078ef style: Make appearance: button behave like auto.
As per https://github.com/w3c/csswg-drafts/issues/5174.

Differential Revision: https://phabricator.services.mozilla.com/D89119
2021-02-26 16:44:05 +01:00
Cameron McCormack
862b7d1249 style: Make appearance: button behave like auto on various elements.
Differential Revision: https://phabricator.services.mozilla.com/D83434
2021-02-26 16:44:05 +01: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
Philipp Zech
5af0d7ca7c
style: Remove StyleFontSize enum from nsStyleConsts.h.
Differential Revision: https://phabricator.services.mozilla.com/D77511
2020-06-18 23:51:14 +02:00
Emilio Cobos Álvarez
762abbaf9f
style: Rustfmt recent changes. 2020-06-04 02:02:50 +02:00
Boris Chiou
35546aea54 style: Use style::One for Integer to avoid implementing Mul.
Differential Revision: https://phabricator.services.mozilla.com/D76207
2020-06-04 01:50:36 +02:00
Boris Chiou
7022f451e1 style: Replace AspectRatio with computed::position::Ratio in media-queries.
Also, we drop the pref, layout.css.aspect-ratio-number.enabled, becacuse
the spec of css-sizing-4 uses Number now.

Differential Revision: https://phabricator.services.mozilla.com/D75233
2020-06-04 01:50:36 +02:00
Boris Chiou
fc9321bb23 style: Let aspect-ratio (css-sizing-4) support 'auto | <ratio>'.
In order to test its parsing and serialization, we expose it but protect
it behind a pref.

Besides, I would like to drop layout.css.aspect-ratio-number.enabled in
the next patch because the spec has been updated. It seems we don't have
to keep this pref and we should always use Number.

Differential Revision: https://phabricator.services.mozilla.com/D74955
2020-06-04 01:50:36 +02:00
Mats Palmgren
6f58c66589 style: Implement style system support for Masonry layout.
This implements support for this CSS Masonry layout proposal:
https://github.com/w3c/csswg-drafts/issues/4650

I've intentionally left out a shorthand (place-tracks?) for now until
we have a draft CSS spec for this.

Differential Revision: https://phabricator.services.mozilla.com/D67061
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
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
Tim Nguyen
25b265a10f style: Refactor GenericGradient for conic-gradient support.
Differential Revision: https://phabricator.services.mozilla.com/D62923
2020-04-16 16:35:07 +02:00
Tim Nguyen
0e3c122890 style: Make GradientItem and ColorStop support angular color stops.
Differential Revision: https://phabricator.services.mozilla.com/D62544
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
149cb5f5f1 style: Merge ImageLayer and Image.
ImageLayer is almost the only usage of Image, so keeping them in the same enum
makes the resulting C++ struct smaller, and makes it map more cleanly to
nsStyleImage.

Differential Revision: https://phabricator.services.mozilla.com/D62161
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
071ce6f345
style: Rustfmt recent changes. 2020-02-12 02:43:23 +01:00
Tim Nguyen
5ed8fe8ee2
style: Add AngleOrPercentage to style system.
Differential Revision: https://phabricator.services.mozilla.com/D62158
2020-02-12 02:43:21 +01:00
Emilio Cobos Álvarez
d74f90e3a7
style: Centralize calc function parsing.
So that extending it to support other math functions like min / max / etc is
simpler.

There should be no behavior change with this patch, though I added a comment to
some places where we don't do calc() clamping correctly (though other browsers
don't either so...).

Differential Revision: https://phabricator.services.mozilla.com/D59939
2020-02-12 02:43:12 +01:00
Emilio Cobos Álvarez
219c0f6328
style: Use cbindgen for content property.
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
2020-02-12 02:43:08 +01:00
Emilio Cobos Álvarez
ef16c5844f Rustfmt recent changes. 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
Emilio Cobos Álvarez
d9aa0571e3
style: Simplify some code now that lifetimes are non-lexical.
Differential Revision: https://phabricator.services.mozilla.com/D54529
2019-11-30 20:45:05 +01:00
Emilio Cobos Álvarez
a44515c314 style: Rustfmt recent changes. 2019-11-04 13:36:32 +01:00
Emilio Cobos Álvarez
854c480177 style: Experiment with implementing zoom as a transform + transform-origin shorthand.
This is a gross hack, of course, but has the advantage of not breaking sites
that use both zoom and -moz-transform / -moz-transform-origin.

There should be no behavior change when the pref is off, of course, and the
webcompat team wanted to experiment with this.

Differential Revision: https://phabricator.services.mozilla.com/D49792
2019-11-04 13:36:32 +01:00
Emilio Cobos Álvarez
33d39d37a2 style: Rustfmt recent changes. 2019-10-09 13:21:35 +02:00
Emilio Cobos Álvarez
d43632c9f8 style: Don't allow negative radii in radial gradients.
Mostly renaming for clarity, as the gradient parsing code is a bit hairy.

This also changes -webkit- gradients, which is, I think, the right thing to do
(otherwise I need to give up on the type system and sprinkle parse_non_negatives
around, which would be unfortunate).

I filed https://bugs.chromium.org/p/chromium/issues/detail?id=1008112 on
Chromium still accepting negative radii for those, so will wait to submit the
patch for review until they reply there with their intentions.

Differential Revision: https://phabricator.services.mozilla.com/D47141
2019-10-09 13:21:35 +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
b238698691 style: Use cbindgen for clip / -moz-image-region.
This also fixes some of the issues with -moz-image-region, where we just minted
an auto out of the blue.

Differential Revision: https://phabricator.services.mozilla.com/D43474
2019-09-12 22:34:16 +02:00
Emilio Cobos Álvarez
ee106992e1 style: Simplify -x-span property.
Differential Revision: https://phabricator.services.mozilla.com/D42914
2019-09-12 22:34:16 +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
Boris Chiou
29f6db4d16
style: Support multiple track sizes for grid-auto-{columns|rows}.
Support `<track-size>+` on the implicit track sizing properties,
grid-auto-columns and grid-auto-rows.

Differential Revision: https://phabricator.services.mozilla.com/D38408
2019-08-15 17:00:25 +02:00
Boris Chiou
33690b9eaf
style: Support offset-anchor.
Differential Revision: https://phabricator.services.mozilla.com/D39432
2019-08-15 16:58:02 +02:00
Boris Chiou
4813390e60
style: Accept percentage for shape-image-threshold.
Differential Revision: https://phabricator.services.mozilla.com/D39241
2019-07-30 12:06:19 +02:00
Emilio Cobos Álvarez
3d57c22e9c Update euclid.
There are a few canvas2d-related dependencies that haven't updated, but they
only use euclid internally so that's not blocking landing the rest of the
changes.

Given the size of this patch, I think it's useful to get this landed as-is.
2019-07-23 23:09:55 +02:00
Boris Chiou
87231e676d
style: Add percentage for opacity (i.e. <alpha-value>).
The following properties accept <alpha-value> [1], which is
"<number> | <percentage>", so we update the parser, spec links, and
their web-platform-tests.
1. opacity
2. flood-opacity
3. fill-opacity
4. stroke-opacity
5. stop-opacity
6. -moz-window-opacity

Besides, shape-image-threshold [2] still only accepts <number>, so we need
to support a different version of `Opacity::parse()`.

[1] https://drafts.csswg.org/css-color/#typedef-alpha-value
[2] https://drafts.csswg.org/css-shapes/#shape-image-threshold-property

Differential Revision: https://phabricator.services.mozilla.com/D37493
2019-07-23 22:54:04 +02:00
Jonathan Kew
6cf87d23f8
style: Add an 'auto' value for the CSS 'quotes' property, and make it use language-dependent quote marks.
Differential Revision: https://phabricator.services.mozilla.com/D36429
2019-07-23 22:53:59 +02:00
Emilio Cobos Álvarez
341023690c
style: Use cbindgen for fill and stroke.
Differential Revision: https://phabricator.services.mozilla.com/D36807
2019-07-08 12:46:46 +02:00
Emilio Cobos Álvarez
83da7c1535
style: Simplify parsing and storage of SVG paint server fallback. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D36806
2019-07-08 12:46:39 +02:00
Emilio Cobos Álvarez
1af30fa0c9
style: rustfmt recent changes. 2019-07-08 12:45:56 +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