Commit graph

8109 commits

Author SHA1 Message Date
Simon Sapin
17ec774a49 Stylo: replace uses of mem::uninitialized with MaybeUninit
MozReview-Commit-ID: KGhYL6DJRaR
2019-07-16 08:03:54 +02:00
Bastien Orivel
28fa0f8009 Update rayon to dedupe crossbeam-epoch
As a bonus this also removes one version of crossbeam-utils
2019-07-12 21:01:33 +02:00
Emilio Cobos Álvarez
fbf6b926e5
style: Servo doesn't support backdrop-filter yet. 2019-07-08 14:59:16 +02:00
Emilio Cobos Álvarez
03a8e57b9c
style: Appease tidy. 2019-07-08 12:58:20 +02:00
Emilio Cobos Álvarez
55966412af
style: Rustfmt recent changes. 2019-07-08 12:56:47 +02:00
Emilio Cobos Álvarez
c913941669
style: Trivially simplify some recently-added code. 2019-07-08 12:56:37 +02:00
Emilio Cobos Álvarez
c5a90e1baf
style: Remove a map(From::from) statement that does literally nothing. 2019-07-08 12:47:04 +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
f0b5d02901
style: Use more compact and ffi-friendly types for some svg props.
No functional change yet.

Differential Revision: https://phabricator.services.mozilla.com/D36805
2019-07-08 12:46:29 +02:00
Emilio Cobos Álvarez
a0df9f76de
style: Apply text-only zoom to system fonts.
Differential Revision: https://phabricator.services.mozilla.com/D36893
2019-07-08 12:46:22 +02:00
Calixte Denizet
1c452e6c45
style: Fix python3 lint issues on servo.
Differential Revision: https://phabricator.services.mozilla.com/D35247
2019-07-08 12:46:12 +02:00
Emilio Cobos Álvarez
4abfa1a2d8
style: Don't optimize out recascading of children when becoming or stopping being display: contents.
Since they can change whether descendants get blockified.

Differential Revision: https://phabricator.services.mozilla.com/D35818
2019-07-08 12:46:03 +02:00
Emilio Cobos Álvarez
1af30fa0c9
style: rustfmt recent changes. 2019-07-08 12:45:56 +02:00
Hugh Gallagher
069c0b06de
style: In CounterStyleOrNone check if SymbolsType is symbolic and skip if it is.
Differential Revision: https://phabricator.services.mozilla.com/D36235
2019-07-08 12:45:48 +02:00
Emilio Cobos Álvarez
31b166fb1b
style: Remove nsStyleCoord.
And move the useful bits of it somewhere else (ServoStyleConstInlines.h for the
inline function definitions, and nsFrame.cpp for the static assertions).

Differential Revision: https://phabricator.services.mozilla.com/D36120
2019-07-08 12:45:36 +02:00
Emilio Cobos Álvarez
8d127014c3
style: Stop using nsStyleSides for -moz-image-rect.
Differential Revision: https://phabricator.services.mozilla.com/D36119
2019-07-08 12:45:28 +02:00
Emilio Cobos Álvarez
cc15afa348
style: Use cbindgen for grid track sizing.
Differential Revision: https://phabricator.services.mozilla.com/D36118
2019-07-08 12:45:21 +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
3530ea9862
style: Restrict properties that apply to ::marker for now.
Differential Revision: https://phabricator.services.mozilla.com/D31680
2019-07-08 12:45:06 +02:00
Cameron McCormack
b8873f44aa
style: Cache computed styles of scrollbar part anonymous content.
Differential Revision: https://phabricator.services.mozilla.com/D33123
2019-07-08 12:44:25 +02:00
Connor Brewster
1aef82f806
style: Parse backdrop-filter CSS property.
Differential Revision: https://phabricator.services.mozilla.com/D35816
2019-07-08 12:44:15 +02:00
Emilio Cobos Álvarez
960be2fd01
style: Add an internal aspect-ratio CSS property.
Differential Revision: https://phabricator.services.mozilla.com/D29037
2019-07-08 12:43:58 +02:00
Emilio Cobos Álvarez
87e3dadf22
style: Use the cbindgen representation for grid line properties.
We clamp earlier (parse time rather than computed value time), but that's the
only behavior change, which I think doesn't really matter.

Differential Revision: https://phabricator.services.mozilla.com/D35198
2019-07-08 12:43:39 +02:00
Emilio Cobos Álvarez
248b2ac829
style: Generate top-level function and constant declarations for the style crate.
This needs https://github.com/eqrion/cbindgen/pull/362, but I expect it to be
uncontroversial. I'll add a patch to this bug when it's merged to update it.

cbindgen historically didn't include these, but it turns out to be pretty useful
to generate constants for the style crate (since the binding crate is
`servo/ports/geckolib`).

An alternative is to get a completely different cbindgen-generated header for
these, but that seems a bit wasteful. This generates the constants with the
Style prefix (so we'll get `StyleMAX_GRID_LINE` for example), which is very
ugly. But we probably want to eventually stop using the Style prefix and use a
namespace instead, plus it's trivial to do `auto kMaxLine = StyleMAX_GRID_LINE`,
for example, so it's probably not a huge deal.

Another alternative would be to use associated consts, which _are_ generated by
cbindgen. Something like:

```
struct GridConstants([u8; 0]);
impl GridConstants {
    const MAX_GRID_LINE: i32 = 10000;
}
```

Which would yield something like:

```
static const int32 StyleGridConstants_MAX_GRID_LINE = 10000;
```

I'm not sure if you find it preferrable, but I'm also happy to change it in a
follow-up to use this.

We need to fix a few manual C++ function signature definitions to match the C++
declaration.

Differential Revision: https://phabricator.services.mozilla.com/D35197
2019-07-08 12:43:19 +02:00
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
Nicholas Nethercote
323221051f
style: Change StaticPrefs from a class to a namespace.
This doesn't change the way C++ code uses static prefs. But it does slightly
change how Rust code uses static prefs, specifically the name generated by
bindgen is slightly different.

The commit also improves some comments.

Differential Revision: https://phabricator.services.mozilla.com/D35764
2019-07-08 12:42:58 +02:00
Alastor Wu
84a5ab2ba8
style: restrict CSS properties for '::cue'.
According to the spec [1], only those CSS properties listed on the spec can be applied on the `::cue`.

[1] https://www.w3.org/TR/webvtt1/#the-cue-pseudo-element

Differential Revision: https://phabricator.services.mozilla.com/D34262
2019-07-08 12:42:46 +02:00
violet
5db88db8fc
style: paint-order parsing has off-by-one error.
A couple of firefox only WPT failure caused by this off-by-one bug.

Differential Revision: https://phabricator.services.mozilla.com/D35630
2019-07-08 12:42:36 +02:00
violet
2fba62aba9
style: Add computed value ZeroToOneNumber.
Correctly handle clamping to 1 behavior of grayscale(),
invert(), opacity() and sepia().

Differential Revision: https://phabricator.services.mozilla.com/D35509
2019-07-08 12:42:25 +02:00
Simon Sapin
2b01c26aa5 Add ./mach build --with-layout-2020
… with corresponding `layout` and `layout_thread` crates,
which for now do nothing.
2019-07-04 18:16:44 +02:00
Kagami Sascha Rosylight
7a1db0e8ea Support DOMMatrix string constructor 2019-06-30 18:45:56 +09:00
Emilio Cobos Álvarez
a7e441fc15
style: Servo doesn't implement white-space: break-spaces. 2019-06-25 13:11:32 +02:00
Emilio Cobos Álvarez
add08518cd
Fix style system build with recent changes. 2019-06-25 13:11:32 +02:00
Emilio Cobos Álvarez
ed2e9ce482
Rustfmt and fix tidy on recent changes. 2019-06-25 13:11:31 +02:00
violet
6eedebe2c8
style: Invalidate style for ::selection.
This patch invalidates the style for `::selection`, which will restore the
behavior before the regression.

However, it's still not quite correct, because repaint is not triggered. Given
that `::selection` requires some major change to implement
https://github.com/w3c/csswg-drafts/issues/2474, we can address this problem
later.

Differential Revision: https://phabricator.services.mozilla.com/D35305
2019-06-25 13:11:31 +02:00
Boris Chiou
815d189228
style: Fix the serialization of the computed value of background-size.
This patch produces the following serialization:
```
    input      |  computed value
  ------------------------------
1. "auto"            "auto"
2. "auto auto"       "auto"
3. "15px auto"       "15px"
4. "15px"            "15px"
```
i.e. If the second value is 'auto', then it's omitted from our serialization,
because it's implied.

Besides, we update the wpt to address this spec issue:
https://github.com/w3c/csswg-drafts/issues/2574

Differential Revision: https://phabricator.services.mozilla.com/D35510
2019-06-25 13:11:31 +02:00
Emilio Cobos Álvarez
c87da27bca
style: Use atoms for grid line names.
The style system already atomizes all CustomIdent values, which means that we're
just wasting memory and CPU by doing string copies all over the place.

This patch fixes it. This also simplifies further changes to use as much of the
rust data structures as possible.

I had to switch from nsTHashtable to mozilla::HashTable because the former
doesn't handle well non-default-constructible structs (like NamedLine, which
now has a StyleAtom, which is not default-constructible).

Differential Revision: https://phabricator.services.mozilla.com/D35119
2019-06-25 13:11:31 +02:00
Emilio Cobos Álvarez
6cb588d2b5
style: Use Servo for the representation of grid template areas.
Right now we do a lot of useless string copying. In order to avoid transcoding
to utf-16 during layout, make sure to use nsCString at a few related places.

I may revisit this since we're storing other line names as atoms in some places.
So it may be better to just use atoms everywhere.

But that'd be a different patch either way.

Differential Revision: https://phabricator.services.mozilla.com/D35117
2019-06-25 13:11:30 +02:00
Emilio Cobos Álvarez
e8271ee926
style: Use more ffi-friendly types in grid template areas.
Differential Revision: https://phabricator.services.mozilla.com/D35116
2019-06-25 13:11:30 +02:00
violet
e1e82dbe5f
style: Should not serialize default radius of circle.
Should not serialize default shape-outside circle() function radius.

The ToCss impl of Circle and Ellipse turn out to be identical in specified and computed value, thus move them to generics.

Differential Revision: https://phabricator.services.mozilla.com/D35183
2019-06-25 13:11:30 +02:00
violet
c7c1fed95c
style: Implement overflow-block and overflow-inline properties
Differential Revision: https://phabricator.services.mozilla.com/D34738
2019-06-25 13:11:30 +02:00
violet
05633886ab
style: Implement the break-spaces value of the white-space property.
Differential Revision: https://phabricator.services.mozilla.com/D34499
2019-06-25 13:11:29 +02:00
Emilio Cobos Álvarez
8b0d2b1e38
style: Add a pref and enable Shadow Parts in Nightly and for chrome stylesheets.
I want to enable in Nightly to evaluate (in the medium term) shipping it without
the part forwarding, once the cascade order and importance issues are fixed, and
that we pass all the tests that don't involve forwarding.

That is, I want to monitor whether having ::part() causes compat issues or not.

Differential Revision: https://phabricator.services.mozilla.com/D32649
2019-06-25 13:11:29 +02:00
Emilio Cobos Álvarez
e272bfed70
style: Implement GeckoElement::each_part.
This should make all the pieces come together.

Note that we don't need to look at the snapshot for ::part() for now (other than
when selector-matching normally) because I decided to just restyle the element
for now when the part attribute changes.

::part() can't affect descendants anyway (as long as we don't do the forwarding
stuff), and eager pseudo-elements are handled during the normal element restyle,
so it seems to me that adding all the complexity that we have for classes to
part may not be worth it at least yet.

Differential Revision: https://phabricator.services.mozilla.com/D32648
2019-06-25 13:11:29 +02:00
Emilio Cobos Álvarez
7139a4185a
style: Add code to make part rules affect the style of the elements.
I still haven't implemented each_part(), so this will do nothing yet.

The cascade order stuff is fishy, I know, and I'll fix in a followup if it's
fine with you. I moved the sorting of the rules to rule_collector, since it
seemed to me it was better that way that duplicating the code, and those
SelectorMap functions only have a single caller anyway.

Differential Revision: https://phabricator.services.mozilla.com/D32647
2019-06-25 13:11:29 +02:00
Emilio Cobos Álvarez
39de0a068e
style: Collect ::part() rules during CascadeData rebuilds.
Unlike for :host() or ::slotted(), or regular rules, we don't need a whole
SelectorMap<>, so gotta make the code a bit more generic.

Differential Revision: https://phabricator.services.mozilla.com/D32646
2019-06-25 13:11:28 +02:00
Emilio Cobos Álvarez
96594be65d
style: Don't go through all the part names if not there.
This uses the bit added for tracking part attributes in order to avoid doing
wasted work.

Differential Revision: https://phabricator.services.mozilla.com/D32644
2019-06-25 13:11:28 +02:00
Emilio Cobos Álvarez
f0bf7d6481
style: Add plumbing code to invalidate shadow parts.
Still does nothing, since we still do not collect part rules, but this is all
the plumbing that should allow us to invalidate parts when attributes or state
change on their ancestors.

Differential Revision: https://phabricator.services.mozilla.com/D32642
2019-06-25 13:11:27 +02:00
Emilio Cobos Álvarez
a4690ce158
style: Use cbindgen for gradients.
Differential Revision: https://phabricator.services.mozilla.com/D33901
2019-06-25 13:11:27 +02:00