Commit graph

7331 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
ff41f82720 style: Fix Gecko and Servo builds, and appease tidy. 2019-03-27 14:29:28 +01:00
Emilio Cobos Álvarez
f9ce3a9da2 style: Honor browser.display.use_document_fonts again.
Differential Revision: https://phabricator.services.mozilla.com/D24218
2019-03-27 14:29:27 +01:00
Emilio Cobos Álvarez
f637d93fc1 style: Remove bindings.rs.
I kept it building the most straight-forward way possible (pub use) because it
seems to me that bindings is not a bad name, and we should probably move
structs.rs to be bindings.rs rather than the other way around.

But that's a different bug in any case, need to think more about it.

Differential Revision: https://phabricator.services.mozilla.com/D24713
2019-03-27 14:29:27 +01:00
Emilio Cobos Álvarez
ecda72a5fd style: Cleanup refcounted types.
And make the handling of ComputedStyle more similar to these.

Differential Revision: https://phabricator.services.mozilla.com/D24703
2019-03-27 14:29:26 +01:00
Emilio Cobos Álvarez
02bc29a11b style: Simplify Owned FFI types.
And make them actually sound. We're defining functions on Rust-land that get
structs as arguments, but declaring them in C++ as getting pointers.

This is another step in order to be able to autogenerate ServoBindings.h and
remove bindings.rs altogether.

We remove FooOwned in favor of Owned<Foo>, which is generated via cbindgen.

It'd be good to actually mark Owned and such as MOZ_MUST_USE_TYPE, so I sent
https://github.com/eqrion/cbindgen/pull/307 for that.

Differential Revision: https://phabricator.services.mozilla.com/D24681
2019-03-27 14:29:25 +01:00
Mats Palmgren
64f19ae34d style: Add support for the 'content' CSS property on ::marker pseudo elements.
Bug: 205202
Reviewed-by: emilio
2019-03-27 14:29:25 +01:00
Mats Palmgren
ab8c00e41a style: Add support for the ::marker pseudo element on list items. Alias :-moz-list-bullet/number to that in the parser.
Bug: 205202
Reviewed-by: emilio
2019-03-27 14:29:24 +01:00
Mats Palmgren
ed74e8acbb style: Implement display:list-item counters using a built-in 'list-item' CSS counter.
Bug: 288704
Reviewed-by: emilio
2019-03-27 14:29:23 +01: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
14b176019c style: Simplify a bit our generated bindings by getting rid of FooBorrowed and FooBorrowedMut.
This reduces a lot the boilerplate that's needed in order to add simple binding
functions.

This starts using &Foo and Option<&Foo> instead, and as a result we need to
remove the servo_function_signatures test, which is a bit unfortunate.

I think it's worth though, this causes problems on some platforms (see bug
1534844), and messing up the functions signature is not something that I've ever
seen (other than bug 1308234, which already had all the FooBorrowed mess which
I'm removing).

Also, cbindgen understands references and Option<&Foo>, so it will be the way to
go in the future.

After this patch we can also remove HasSimpleFFI, but I've kept it for now since
I still use it in a few places, and this patch is quite big on its own.

Differential Revision: https://phabricator.services.mozilla.com/D24092
2019-03-27 14:29:19 +01:00
Cameron McCormack
d4635f1d12 style: Use horizontal metrics for ch in vertical mixed/sideways writing modes and for ex always.
Differential Revision: https://phabricator.services.mozilla.com/D23426
2019-03-27 14:29:18 +01:00
Cameron McCormack
d5f208e18c style: Allow FontMetricsProvider to produce ex height and zero width independently.
We are always able to produce an x height, but depending on whether the
glyph exists, we sometimes can't produce a zero glyph width.

Differential Revision: https://phabricator.services.mozilla.com/D23424
2019-03-27 14:29:17 +01:00
Emilio Cobos Álvarez
39df092bce style: fix some rust-nightly warnings about unused doc comments.
Differential Revision: https://phabricator.services.mozilla.com/D24287
2019-03-27 14:29:16 +01:00
Emilio Cobos Álvarez
cf5a2acdf1 style: Remove ComputedStyle::mBits.
Use the Servo flags instead.

Differential Revision: https://phabricator.services.mozilla.com/D20729
2019-03-27 14:29:16 +01:00
Emilio Cobos Álvarez
ed4a23eccf style: Keep track of whether a style is affected by font metrics.
Differential Revision: https://phabricator.services.mozilla.com/D20728
2019-03-27 14:29:15 +01:00
Boris Chiou
fe7b3a6b11 style: Part 6: Add individual transform properties into compositor animation list.
Now, its time to let individual transform run on the compositor thread.

Differential Revision: https://phabricator.services.mozilla.com/D22566
2019-03-27 14:29:14 +01:00
Emilio Cobos Álvarez
01e0f37861 style: Make the will-change bitfield use cbindgen.
Differential Revision: https://phabricator.services.mozilla.com/D23414
2019-03-27 14:29:12 +01:00
Emilio Cobos Álvarez
6e2643c636 style: Use cbindgen for touch-action.
And rename the constants to not be prefixed by TOUCH_ACTION_, since that's part
of the type name anyway.

Differential Revision: https://phabricator.services.mozilla.com/D23413
2019-03-27 14:29:11 +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
d3f254d2e4 style: Make all font-metrics-affecting properties cascade early.
And make font-size computation work on the whole font of the parent, not just
accounting for the parent's font-size.

Differential Revision: https://phabricator.services.mozilla.com/D20656
2019-03-27 14:29:08 +01:00
Emilio Cobos Álvarez
aa5ea337da style: Try to bring some more sanity into our font code.
It's not very easy to understand on its current state, and it causes subtle bugs
like bug 1533654.

It could be simpler if we centralized where the interactions between properties
are handled. This patch does this.

This patch also changes how MathML script sizes are tracked when scriptlevel
changes and they have relative fonts in between.

With this patch, any explicitly specified font-size is treated the same (being a
scriptlevel boundary), regardless of whether it's either an absolute size, a
relative size, or a wide keyword.

Relative lengths always resolve relative to the constrained size, which allows
us to avoid the double font-size computation, and not give up on sanity with
keyword font-sizes.

I think given no other browser supports scriptlevel it seems like the right
trade-off.

Differential Revision: https://phabricator.services.mozilla.com/D23070
2019-03-27 14:29:07 +01:00
Emilio Cobos Álvarez
77a75596bb style: Don't call PrefillDefaultForGeneric when inheriting font-family.
This is the low-risk fix for this issue, that we should get into 67.

What's going on here is that font-family is tracked via the font list, from the
POV of the style system the font list is generally just the
RefPtr<SharedFontList>, but in Gecko there's also mDefaultGenericId.

The way we end up with the right mDefaultGenericId is fishy at best, bogus at
worst. I left various fixmes over time related to a bunch of this code.

After my patch, we end up with a mDefaultGenericId of serif, rather than the
right one (none).

The parent font always has none because nsLayoutUtils::ComputeSystemFont always
sets it to none if the font is known.

Before my patch, PrefillDefaultForGeneric with aGenericId of none (from the
parent), which makes it the default generic id for the current language, serif
in this case.

Before my optimization, apply_declaration_ignoring_phase called
copy_font_family_from, which resets both the font list _and_ the default
generic.

This patch achieves the same effect by not having the first mutation in the
first place.

This code is still terribly fishy in any case, all the _skip_font_family stuff
is just ridiculous. I'll try to clean up a bit after this, but for 68.

Differential Revision: https://phabricator.services.mozilla.com/D23026
2019-03-27 14:29:07 +01:00
Emilio Cobos Álvarez
9f4643ac24 style: Avoid crashing when calling insertRule("@import ...") on a detached sheet.
This should unblock the fuzzers for now, though it's not the ideal solution.

It's the only reasonably easy solution to unblock them though, I think.

We should probably always keep track of the document a stylesheet was associated
with. We'll need that for constructible stylesheets anyway.

That requires some though on how to get the cycle-collection and such right,
though, and I wouldn't be able to write or land that ASAP.

Differential Revision: https://phabricator.services.mozilla.com/D23584
2019-03-27 14:29:06 +01:00
Emilio Cobos Álvarez
95ee1a5adf style: Use a single RestyleHint representation.
Differential Revision: https://phabricator.services.mozilla.com/D22828
2019-03-27 14:29:05 +01:00
Emilio Cobos Álvarez
8dbf9b1da9 Bug 1535084 - Cleanup contain property. r=dholbert
Now that cbindgen supports bitflags, this is trivial.

Differential Revision: https://phabricator.services.mozilla.com/D23371
2019-03-27 14:29:05 +01:00
Simon Sapin
389e69bafe Upgrade to rustc 1.35.0-nightly (4c27fb19b 2019-03-25) 2019-03-26 15:12:55 +01:00
Peter Hall
8bfd4dc1e2 #8539 Config preferences backend restructure 2019-03-20 15:01:26 +00:00
Emilio Cobos Álvarez
a65925cb85 style: Fix servo build. 2019-03-13 15:08:39 +01:00
Emilio Cobos Álvarez
5aeab7adb1 style: Reformat recent changes. 2019-03-13 15:08:38 +01:00
violet
9a8cee2800 style: Change stroke-miterlimit restriction from GreaterThanOrEqualToOneNumber to NonNegativeNumber. 2019-03-13 15:08:37 +01:00
Emilio Cobos Álvarez
4a1f390788 style: Optimize cascading of other wide keywords if possible.
The way the copy-on-write stuff works, and the way that we have to apply
properties from most specific to less specific guarantees that always that we're
going to inherit an inherited property, or reset a reset property, we have
already the right value on the style.

Revert relies on that, so there doesn't seem to be a reason to not use that fact
more often and skip useless work earlier.

Font-size is still special of course... I think I have a way to move the
specialness outside of the style, but piece by piece.

Differential Revision: https://phabricator.services.mozilla.com/D21882
2019-03-13 15:08:36 +01:00
Emilio Cobos Álvarez
6fd17ccb35 style: Implement CSS revert keyword.
The only fishy bit is the animation stuff. In particular, there are two places
where we just mint the revert behavior:

 * When serializing web-animations keyframes (the custom properties stuff in
   declaration_block.rs). That codepath is already not sound and I wanted to
   get rid of it in bug 1501530, but what do I know.

 * When getting an animation value from a property declaration. At that point
   we no longer have the CSS rules that apply to the element to compute the
   right revert value handy. It'd also use the wrong style anyway, I think,
   given the way StyleBuilder::for_animation works.

   We _could_ probably get them out of somewhere, but it seems like a whole lot
   of code reinventing the wheel which is probably not useful, and that Blink
   and WebKit just cannot implement either since they don't have a rule tree,
   so it just doesn't seem worth the churn.

The custom properties code looks a bit different in order to minimize hash
lookups in the common case. FWIW, `revert` for custom properties doesn't seem
very useful either, but oh well.

Differential Revision: https://phabricator.services.mozilla.com/D21877
2019-03-13 15:08:35 +01:00
Emilio Cobos Álvarez
80ed070639 style: fix a typo. 2019-03-13 15:08:35 +01:00
Emilio Cobos Álvarez
18a0c9b033 style: followup: Add a comment as requested on Phabricator. 2019-03-13 15:08:34 +01:00
Emilio Cobos Álvarez
14e6875ef9 style: Use more cbindgen features.
We can get back the fancy flag syntax as soon as we get C++17 inline variables,
which I sent an email to dev-platform@ about, with no reply.

Differential Revision: https://phabricator.services.mozilla.com/D22382
2019-03-13 15:08:33 +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
e723a5b7d6 style: Make the pres context optional in the style system.
Differential Revision: https://phabricator.services.mozilla.com/D21239
2019-03-13 15:08:32 +01:00
Emilio Cobos Álvarez
4e3e4c106a style: Refactor preference stylesheet prefs to not require a pres context.
We really only have two sets of prefs, one for chrome-like documents
(stuff in chrome docshells + chrome-origin images), and one for the rest.

Differential Revision: https://phabricator.services.mozilla.com/D20946
2019-03-13 15:08:31 +01:00
Daniel Holbert
33814a9afe style: Drop css parser support for 'contain:style'.
We're not sure we're going to ship support for this value, and it's been marked
as 'at-risk' in the spec, so let's stop pretending we support it in the parser.

Spec issue:
https://github.com/w3c/csswg-drafts/issues/3280

Differential Revision: https://phabricator.services.mozilla.com/D22203
2019-03-13 15:08:29 +01:00
Emilio Cobos Álvarez
b96981f88e style: Make word-spacing, letter-spacing, and line-height use Rust lengths.
This also adopts the resolution from [1] while at it, making letter-spacing
compute to a length, serializing 0 to normal rather than keeping normal in the
computed value, which matches every other engine.

This removes the SMIL tests for percentages from letter-spacing since
letter-spacing does in fact not support percentages, so they were passing just
by chance.

[1]: https://github.com/w3c/csswg-drafts/issues/1484

Differential Revision: https://phabricator.services.mozilla.com/D21850
2019-03-13 15:08:28 +01:00
Emilio Cobos Álvarez
c16e88d229 style: Remove Options from TransformOperation.
This may or may not be part of the plan to get rid of nsCSSValue ;)

Option is not usable via FFI, and they should not be needed (we should be
following the shortest serialization principle instead). These patches also do
that, which matches the other transform properties. I think that slight change
is fine, if we can make it work, and consistent with other properties.

Alternative is adding more TransformOperation variants or such, which I rather
not do.

Differential Revision: https://phabricator.services.mozilla.com/D21862
2019-03-13 15:08:26 +01:00
Emilio Cobos Álvarez
1418ddc685 style: Use contextual_skip_if for background-size.
Also drive-by cleanup.

Differential Revision: https://phabricator.services.mozilla.com/D21861
2019-03-13 15:08:24 +01:00
Emilio Cobos Álvarez
93d3004c17 style: Use skip_if for translate serialization.
Trivial drive-by cleanup.

Differential Revision: https://phabricator.services.mozilla.com/D21860
2019-03-13 15:08:22 +01:00
Emilio Cobos Álvarez
94686df11b style: Use rust lengths for the SVG lengths.
As it turns out we need this to avoid losing precision both during painting and
during serialization.

This patch also changes to serialize `context-value` if it's the computed value.

I could keep the previous behavior, but it makes no sense to serialize the
initial value. We're the only ones to support this value anyway, and I couldn't
find a definition or spec for this.

Also update tests and expectations for:

 * New unexpected passes.
 * Always serializing the unit in getComputedStyle.
 * Calc and interpolation support.

Chrome also always serializes the unit in getComputedStyle, so I'm pretty sure
this is compatible with them. Chrome is inconsistent and keeps numbers in
specified style, but that's inconsistent with itself and with other quirky
lengths, so I updated the tests instead.

Differential Revision: https://phabricator.services.mozilla.com/D21819
2019-03-13 15:08:17 +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
7d01114cbf style: Add a Zero trait that doesn't require Add, and use it in place of num_traits and IsZeroLength.
Use it to be consistent in InsetRect serialization and storage between Servo and
Gecko.

Differential Revision: https://phabricator.services.mozilla.com/D21493
2019-03-13 15:08:14 +01:00
Emilio Cobos Álvarez
4496411edc style: Fix computed value clamping.
Differential Revision: https://phabricator.services.mozilla.com/D21268
2019-03-13 15:08:13 +01:00
Hiroyuki Ikezoe
52db71c0bf style: Explicitly specify animation_value_type for scroll-padding.
Otherwise the Trait for clamping negative animation value isn't generated thus
negative animating results are exposed in computed values.

Differential Revision: https://phabricator.services.mozilla.com/D21153
2019-03-13 15:08:12 +01:00