Commit graph

8109 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
b268ef6aed style: Remove some redundant use statements. 2019-04-12 12:19:57 +02:00
Emilio Cobos Álvarez
c106fb1231 style: Remove comment that is outdated since I fixed it in bug 1483808. 2019-04-12 12:19:56 +02:00
Emilio Cobos Álvarez
0406be7b68 style: Make the fixed generic family a parse-time alias to monospace.
As discussed on IRC, fixed is only used for prefs right now, and:

 * We already copy the fixed size to the monospace font.
 * We already serialize the fixed family as "monospace" in the style system.

So it already works somewhat inconsistently. Making it an alias makes it
work consistently.

Differential Revision: https://phabricator.services.mozilla.com/D24288
2019-04-12 12:19:56 +02:00
Emilio Cobos Álvarez
2184e3f2e5 style: Cleanup generic font-family handling.
To be more similar between Rust and C++. This introduces GenericFontFamily and
exposes that plus FontFamilyNameSyntax to C++, using that where appropriate
instead of plain uint8_t as we were doing.

As a follow-up, as discussed on IRC with Jonathan, we can remove the -moz-fixed
family, and turn it just into an alias of Monospace.

The only non-trivial change is the MatchType changes, but they're ok I think.
The code already assumed at most one CSS generic, and the struct still takes 8
bits. I've verified that the relevant tests are passing (though try is closed).

Differential Revision: https://phabricator.services.mozilla.com/D24272
2019-04-12 12:19:55 +02:00
Emilio Cobos Álvarez
c49a88ec84 style: Trivially cleanup and remove some dead font code.
Differential Revision: https://phabricator.services.mozilla.com/D24271
2019-04-12 12:19:54 +02:00
Emilio Cobos Álvarez
2f8e05e9e0 style: Autogenerate Servo_ binding functions with cbindgen.
This depends on https://github.com/eqrion/cbindgen/pull/308. Other than that,
this should be ready to go.

There's still a bit more magic than what I'd like to eventually. I should be
able to make cbindgen not rename types if it doesn't know about them, or
something.

But this removes most of the manual binding function implementations (all but
the ones that are declared via macros, which cbindgen doesn't see across).

I need to give up on the _Drop functions taking an Owned<T> because of
instantiation order fiasco. In order to define DefaultDelete I need Owned to be
complete, but I cannot do it after including the generated file since some
declarations already instantiate the specialization. Oh well.

Differential Revision: https://phabricator.services.mozilla.com/D24798
2019-04-12 12:19:54 +02:00
Cameron McCormack
debd837bf0 style: Add FFI API to create a StyleSheet backed by shared data.
Differential Revision: https://phabricator.services.mozilla.com/D17199
2019-04-12 12:19:53 +02:00
Cameron McCormack
7aac260c5d style: Add FFI API to use SharedMemoryBuilder.
Differential Revision: https://phabricator.services.mozilla.com/D17198
2019-04-12 12:19:52 +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
Cameron McCormack
128c6ae94a style: Add ToShmem impl for FontFamilyList.
Differential Revision: https://phabricator.services.mozilla.com/D17196
2019-04-12 12:19:51 +02:00
Cameron McCormack
1f966535ac style: Add ToShmem impl for UrlExtraData.
Differential Revision: https://phabricator.services.mozilla.com/D17195
2019-04-12 12:19:50 +02:00
Cameron McCormack
41f6e67893 style: Add ToShmem impl for URLValueSource.
Differential Revision: https://phabricator.services.mozilla.com/D17194
2019-04-12 12:19:49 +02:00
Cameron McCormack
b8506e4a55 style: Add ToShmem impl for shared_lock::Locked.
Depends on D17192

Differential Revision: https://phabricator.services.mozilla.com/D17193
2019-04-12 12:19:48 +02:00
Cameron McCormack
8c007ad999 style: Add ToShmem impl for Atom.
Differential Revision: https://phabricator.services.mozilla.com/D17192
2019-04-12 12:19:48 +02:00
Cameron McCormack
7fa7c103d6 style: Add simple ToShmem implementations.
Differential Revision: https://phabricator.services.mozilla.com/D17190
2019-04-12 12:19:46 +02:00
Cameron McCormack
f6ef35c5d3 style: Add support for deriving ToShmem.
Differential Revision: https://phabricator.services.mozilla.com/D17189
2019-04-12 12:19:45 +02:00
Cameron McCormack
f581d2afb2 style: Add SharedMemoryBuilder type and ToShmem trait.
Differential Revision: https://phabricator.services.mozilla.com/D17187
2019-04-12 12:19:44 +02:00
Cameron McCormack
f889b303da style: Add support for static references to servo_arc::Arc. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D17186
2019-04-12 12:19:43 +02:00
Cameron McCormack
b71a601a36 style: Add support for read only SharedRwLocks, which don't need any locking.
Differential Revision: https://phabricator.services.mozilla.com/D17185
2019-04-12 12:19:42 +02:00
Cameron McCormack
7e7a9e2ec5 style: Allow C++ URLValue objects to be lazily created from Rust SpecifiedUrls.
This avoids having to support storing refcounted URLValue objects in shared memory,
which would be tricky.

Depends on D17183

Differential Revision: https://phabricator.services.mozilla.com/D17184
2019-04-12 12:19:42 +02:00
Cameron McCormack
b6b5ddda71 style: Allow references to static, single-generic C++ SharedFontList objects from Rust FontFamilyList.
UA style sheets only ever specify a single generic font family in font-family
properties, so we pre-create a unique, static SharedFontList for each generic
and change the representation of FontFamilyList to be able to refer to them
by their generic ID.  This avoids having to share refcounted SharedFontList
objects across processes.

Differential Revision: https://phabricator.services.mozilla.com/D17183
2019-04-12 12:19:41 +02:00
Cameron McCormack
91586eea0e style: Allow references to static C++ URLExtraData objects from Rust UrlExtraData.
Each user agent style sheet has a unique URLExtraData object containing
its URL, but since they are refcounted objects, we can't share them
easily across processes.  Rather than adding support for copying them
into a shared memory buffer like we will do with the Rust objects, here
we just set up a static array of URLExtraData objects per UA style
sheet.  The array will be filled in in a later patch.

Rust UrlExtraData objects, once they are transformed into their
sharable form and copied into the shared memory buffer, will reference
them by an index.

Differential Revision: https://phabricator.services.mozilla.com/D17182
2019-04-12 12:19:40 +02:00
Masayuki Nakano
5ebc3f8dfa Rename Document::GetShell() to Document::GetPresShell() and make it return PresShell* rather than nsIPresShell*
This makes `Document::GetShell()` return `PresShell*` instead of `nsIPresShell`.

Additonally, "shell" is unclear ("docshell" vs. "presshell").  Therefore, this
also renames `Document::GetShell()` to `Document::GetPresShell()`.

Similarly, some other method names of `Document` are also renamed from
`*Shell*` to `*PresShell*`.

Differential Revision: https://phabricator.services.mozilla.com/D25338
2019-04-12 12:19:39 +02:00
Emilio Cobos Álvarez
7b14499665 style: Unship line-height: -moz-block-height.
They're only used in forms.css, and only for some anonymous content, which are
not content-accessible in the first place.

The only place where this could be exposed is calling
getComputedStyle(input, "::placeholder"), so I think this should be pretty safe,
but I've added a pref just in case.

While at it, also derive the Parse implementation. Less code is better.

Differential Revision: https://phabricator.services.mozilla.com/D25118
2019-04-12 12:19:39 +02:00
Emilio Cobos Álvarez
bd77cd64b9 style: Refactor some enabledness checks.
There are some common checks that could get some easy-to-use aliases.

Differential Revision: https://phabricator.services.mozilla.com/D25117
2019-04-12 12:19:38 +02:00
Emilio Cobos Álvarez
76c0ae565e style: Fix ::marker invalidation when we need to potentially insert a marker as a result of a style change.
Differential Revision: https://phabricator.services.mozilla.com/D24888
2019-04-12 12:19:37 +02:00
Emilio Cobos Álvarez
1f73c524bd style: Follow the list-item definition from the spec a bit more closely.
The HTML restriction doesn't match any browser.

This matches Edge, though I filed
https://github.com/w3c/csswg-drafts/issues/3766 about the pseudo-element
condition.

Differential Revision: https://phabricator.services.mozilla.com/D24936
2019-04-12 12:19:36 +02:00
Julian Descottes
5a55978478 style: Augment CSS errors with the CSS selector.
Differential Revision: https://phabricator.services.mozilla.com/D24894
2019-04-12 12:19:35 +02:00
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