Commit graph

8109 commits

Author SHA1 Message Date
Charlie Marlow
9e826e380a
style: updating text-decoration-skip-ink to support ::first-line/first-letter/placeholder.
Differential Revision: https://phabricator.services.mozilla.com/D41228
2019-08-15 17:00:58 +02:00
Nicholas Nethercote
bb032c1ddc
style: Use static_prefs::pref!.
It's much nicer.

One nice thing about this is that the new code is subject to the existing
threadedness checking, which identified that several of these should be atomic
because they're accessed off the main thread.

Differential Revision: https://phabricator.services.mozilla.com/D40792
2019-08-15 17:00:37 +02:00
Charlie Marlow
ad1d028e40
style: added text-decoration-thickness to the text-decoration shorthands.
Differential Revision: https://phabricator.services.mozilla.com/D40335
2019-08-15 17:00:31 +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
Emilio Cobos Álvarez
69191d8b8c
style: Don't write manual glue code for the order property.
The default code works just as well.

Differential Revision: https://phabricator.services.mozilla.com/D40698
2019-08-15 17:00:18 +02:00
Emilio Cobos Álvarez
3c346c35d2
style: Fix Rust unit tests. 2019-08-15 17:00:03 +02:00
Emilio Cobos Álvarez
708ce04896
Bug 1519958 - Improve stack size of grid templates and re-enable style struct size assertions disabled in the previous patch. r=boris
This re-enables the assertion which was disabled on the previous patch by doing
a bit of boxing around.

Differential Revision: https://phabricator.services.mozilla.com/D36599
2019-08-15 16:58:52 +02:00
Emilio Cobos Álvarez
3e39998068
style: Refactor grid types to preserve repeat() at computed value time and use cbindgen.
I'm _really_ sorry for the size of the patch. I tried to do this in two steps
but it was a lot of work and pretty ugly.

This patch makes us use cbindgen for grid-template-{rows,columns}, in order to:

 * Make us preserve repeat() at computed-value time. This is per spec since
   interpolation needs to know about repeat(). Except for subgrid, which did the
   repeat expansion at parse-time and was a bit more annoying (plus it doesn't
   really animate yet so we don't need it to comply with the spec).

 * Tweaks the WPT tests for interpolation to adopt the resolution at:
   https://github.com/w3c/csswg-drafts/issues/3503.

Trade-off here, as this patch stands, is that this change makes us use less
long-living memory, since we expand repeat() during layout, but at the cost of a
bit of CPU time during layout (conditional on the property applying though,
which wasn't the case before). It should be very easy to store a cached version
of the template, should this be too hot (I expect it isn't), or to change the
representation in other ways to optimize grid layout code if it's worth it.

Another trade-off: I've used SmallPointerArray to handle line-name merging,
pointing to the individual arrays in the style data, rather than actually
heap-allocating the merged lists. This would also be pretty easy to change
should we measure and see that it's not worth it.

This patch also opens the gate to potentially improving memory usage in some
other ways, by reference-counting line-name lists for example, though I don't
have data that suggests it is worth it.

In general, this patch makes much easier to tweak the internal representation of
the grid style data structures. Overall, I think it's a win, the amount of magic
going on in that mako code was a bit huge; it took a bit to wrap my head around
it.

This patch comments out the style struct size assertions. They will be
uncommented in a follow-up patch which contains some improvements for this type,
which are worth getting reviewed separately.

Also, this patch doesn't remove as much code as I would've hoped for because of
I tried not to change most of the dom/grid code for inspector, but I think a
fair bit of the nsGridContainerFrame.cpp code that collects information for it
can be simplified / de-copy-pasted to some extent. But that was a pre-existing
problem and this patch is already quite massive.

Differential Revision: https://phabricator.services.mozilla.com/D36598
2019-08-15 16:58:44 +02:00
Emilio Cobos Álvarez
0e8b1853a7
style: Expand and simplify a macro that's not very useful.
Skip whitespace upfront rather than on each individual branch. The only
difference in behavior is that we would've consumed some extra whitespace in the
error case, but I don't think that matters at all.

We were consuming some extra whitespace as well after the close path command for
example, which wasn't parsing anything.

Differential Revision: https://phabricator.services.mozilla.com/D40539
2019-08-15 16:58:37 +02:00
Emilio Cobos Álvarez
2c17050819
style: Deindent a bit SVG path parsing code.
None cannot be returned, since we just called peek() and it returned something.

Differential Revision: https://phabricator.services.mozilla.com/D40538
2019-08-15 16:58:31 +02:00
Emilio Cobos Álvarez
3ec38e252f
style: Remove the GetCSNeedsLayoutFlush flag, as it is unneeded now.
Differential Revision: https://phabricator.services.mozilla.com/D40300
2019-08-15 16:58:14 +02:00
Boris Chiou
c6cdaaf1cf
style: Make offset-anchor animatable.
Per the spec issue, https://github.com/w3c/csswg-drafts/issues/3482,
we update the wpt to keep the percentage in `calc()` for `offset-anchor`.

Differential Revision: https://phabricator.services.mozilla.com/D39552
2019-08-15 16:58:08 +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
Emilio Cobos Álvarez
e04273a4d9
style: Move the overrides to a separate struct in nsPresContext.
Just so that we can keep track of these together.

Differential Revision: https://phabricator.services.mozilla.com/D40247
2019-08-15 16:57:56 +02:00
Emilio Cobos Álvarez
07b8666029
style: Simplify emulated medium setup in nsPresContext.
Differential Revision: https://phabricator.services.mozilla.com/D40246
2019-08-15 16:57:50 +02:00
Emilio Cobos Álvarez
032347f4ff
style: Fix cursor prefixed aliases to do the right thing.
This was an oversight in bug 1520154. We kept the -moz- version in the specified
value but not the computed value.

That's a very peculiar way of making aliases work. This makes them work
consistently as many other aliases instead.

Also, add an assert that would've caught this much much earlier.

Differential Revision: https://phabricator.services.mozilla.com/D40063
2019-08-15 16:57:41 +02:00
Bastien Orivel
f7411db717 Update toml to 0.5 and cbindgen to 0.9 2019-08-13 13:26:13 +02:00
Bastien Orivel
62e46cf87c Force the std feature for log
While trying to build this crate with the gecko feature rust complained
about us using `log::set_boxed_logger` because it requires the std feature
which was not explicitly set in that crate.
2019-08-13 13:24:35 +02:00
Anthony Ramine
8e6591b81b Fix a panic when using layout 2020 2019-08-06 18:07:31 +02:00
bors-servo
196c511d5e
Auto merge of #23896 - nox:layout-2020, r=SimonSapin
Remove most of the things in layout 2020

We keep mostly the query system. There is probably more to delete but
that's a good start I think.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23896)
<!-- Reviewable:end -->
2019-08-01 08:08:19 -04:00
Anthony Ramine
f8341daf95 Fix compilation errors due to the rebase
It's too complicated to make all the commits in that branch compile properly.
2019-08-01 13:50:52 +02:00
Simon Sapin
c38c964f1b Upgrade to rustc 1.38.0-nightly (dddb7fca0 2019-07-30) 2019-07-31 13:34:01 +02:00
Emilio Cobos Álvarez
46236d015b
style: Fix some issues with #23856 in Gecko. 2019-07-30 12:06:26 +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
Simon Sapin
0215d09ccb Generate apis.html and css-properties.json for docs as part of crates’ build scripts
… rather than as an extra step after `cargo doc`.
This helps always using the correct set of CSS properties
(for layout 2013 v.s. 2020).
2019-07-30 08:37:33 +02:00
Simon Sapin
ddb4e369dd Stylo: replace product={gecko,servo} with engine={gecko,servo-2013,servo-2020}
Renaming the variable helped make sure I looked at every use.
2019-07-29 17:37:03 +02:00
Simon Sapin
f1300bb98b Auto-generate CSSStyleDeclaration.webidl for CSS properties based on the style crate 2019-07-29 17:37:03 +02:00
bors-servo
8f7440f368
Auto merge of #23827 - emilio:gecko-sync, r=emilio,manishearth
style: Sync changes from mozilla-central, and update euclid

See individual commits for details.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23827)
<!-- Reviewable:end -->
2019-07-23 18:42:00 -04: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
Emilio Cobos Álvarez
2ff7cb5a37
style: Appease tidy. 2019-07-23 22:54:12 +02:00
Emilio Cobos Álvarez
3da8f85914
style: Fix a warning in Servo builds by moving a macro to where it's used. 2019-07-23 22:54:11 +02:00
Emilio Cobos Álvarez
8665d9dc12
Fix Servo build. 2019-07-23 22:54:10 +02:00
longsonr
243520fb27
style: Change dominant-baseline from reset to inherit.
Bug: 1353164
Reviewed-by: heycam
2019-07-23 22:54:09 +02:00
Charlie Marlow
6bc1b97a6c
style: renamed text-decoration-width to text-decoration-thickness.
Differential Revision: https://phabricator.services.mozilla.com/D38586
2019-07-23 22:54:09 +02:00
Nicolas Silva
239f2da9d9
style: Update to euclid 0.20.
Differential Revision: https://phabricator.services.mozilla.com/D38530
2019-07-23 22:54:08 +02:00
Emilio Cobos Álvarez
66eae2fc81
style: Remove the ability to build Gecko without the bindgen feature.
This is not used for anything, as far as I can tell.

Differential Revision: https://phabricator.services.mozilla.com/D38584
2019-07-23 22:54:07 +02:00
Emilio Cobos Álvarez
137044a3db
style: Update animations when a pseudo-element had animations but no longer has, and has been re-framed in the meantime.
This is the easy fix.

The hard fix (outlined in the comment) would be nice, but I don't think this bug
alone justifies it.

Differential Revision: https://phabricator.services.mozilla.com/D38184
2019-07-23 22:54:06 +02:00
Thomas Nguyen
59cf10d1b0
style: Modify URLExtraData rust debug to include referrerInfo.
Differential Revision: https://phabricator.services.mozilla.com/D36475
2019-07-23 22:54:06 +02:00
longsonr
2ab9156401
style: Remove dominant-baseline values that no longer exist.
Bug: 1353164
Reviewed-by: heycam
2019-07-23 22:54:05 +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
Emilio Cobos Álvarez
65bf72f131
style: Set the property restrictions flags from the centralized list.
Differential Revision: https://phabricator.services.mozilla.com/D37721
2019-07-23 22:54:04 +02:00
Emilio Cobos Álvarez
e33a799775
style: Centralize property restrictions.
The assertion in properties.mako.rs ensures I got this right.

Differential Revision: https://phabricator.services.mozilla.com/D37720
2019-07-23 22:54:03 +02:00
Emilio Cobos Álvarez
2a500eadd3
style: scroll-margin properties shouldn't apply to first-line / first-letter.
From https://drafts.csswg.org/css-scroll-snap-1/#placement:

> None of the properties in this module apply to the ::first-line and
> ::first-letter pseudo-elements.

Differential Revision: https://phabricator.services.mozilla.com/D37719
2019-07-23 22:54:02 +02:00
Emilio Cobos Álvarez
b8e3247b32
style: Update spec link for font-variation-settings.
It had got outdated.

Differential Revision: https://phabricator.services.mozilla.com/D37718
2019-07-23 22:54:01 +02:00
Emilio Cobos Álvarez
10cb9c07aa
style: Don't apply property restrictions to pseudo-elements in UA stylesheets.
And remove some of the ::placeholder and ::cue hacks where we need to use
!important to make the property not apply for content but apply on UA sheets.

The comment about the white-space property was wrong, we don't enforce it with
!important in the UA stylesheets for <input> (we do for <textarea> though), so
I've kept the flag since it really applies.

Differential Revision: https://phabricator.services.mozilla.com/D37717
2019-07-23 22:54:01 +02:00
Cameron McCormack
e3b57efc7e
style: Ignore pref-controlled properties in cached scrollbar style assertions.
Now if you add a new inherited, pref-controlled property, you must
declare whether it can have an effect on scrollbar styles.  If no,
then the property will be skipped in the assertions that check
whether our cached styles are equal to those we would compute.

Differential Revision: https://phabricator.services.mozilla.com/D37507
2019-07-23 22:54:00 +02:00
Boris Chiou
145acbf876
style: Part 2: Retire the support for 3-valued syntax for position.
According to this resolved spec issue:
https://github.com/w3c/csswg-drafts/issues/2140,
we retire the 3-valued <position> on
1. `object-position`
2. `perspective-origin`,
3. `mask-position`
4. `circle()` and `ellipse()`
, but still keep the support for `background-position`.

Besides, I simply run this python script to generate the .ini file:
```
s = sys.argv[1] + ".ini"
with open(s, "w") as f:
    f.write('[{}]\n'.format(sys.argv[1]))
    f.write('  expected: FAIL\n')
    f.write('  bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276\n')
```

Differential Revision: https://phabricator.services.mozilla.com/D37126
2019-07-23 22:53:59 +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
alwu
c00045b0c9
style: set CSS properties directly on '::cue'.
According to the spec [1], we have to set those CSS properties on the root node,
and then this root node would have a child node, background box [2], which would
contain all other child nodes.

In our case, the background box is `cueDiv` [3].

In theory, all those properties set on the root node should be inherited by the
background box. However, when the background box is a pseudo element `::cue`,
they won't be directly inherit from the the background box's parent, inherited
styles would acutally come from video instead.

Therefore, we have to directly set these properties on the pseudo element and
mark them as `!important` to avoid being overrided by user style script.

[1] https://www.w3.org/TR/webvtt1/#ref-for-list-of-webvtt-node-objects-9
[2] https://www.w3.org/TR/webvtt1/#webvtt-cue-background-box
[3] https://searchfox.org/mozilla-central/rev/11712bd3ce7454923e5931fa92eaf9c01ef35a0a/dom/media/webvtt/vtt.jsm#533-534

Differential Revision: https://phabricator.services.mozilla.com/D35694
2019-07-23 22:53:58 +02:00
bors-servo
e948c7dcc6
Auto merge of #23824 - servo:stylo-uninit, r=emilio
Stylo: replace uses of mem::uninitialized with MaybeUninit

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23824)
<!-- Reviewable:end -->
2019-07-23 16:28:42 -04:00