Commit graph

21216 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
fce58015d6 style: Cleanup unused style traversal flags.
Some of these were unused, some of them were only used in combination with
others, so I've unified them.

In particular, Forgetful and ClearAnimationOnlyDirtyDescendants were used only
together for a very specific task (the final animation traversal), so I merged
them into something that has that name.

ClearDirtyBits was unused, so I removed along with some code that would no
longer be called.

Differential Revision: https://phabricator.services.mozilla.com/D25454
2019-04-12 12:20:07 +02:00
Emilio Cobos Álvarez
a7636010ee style: Remove a redundant use statement. 2019-04-12 12:20:06 +02:00
Emilio Cobos Álvarez
fc0dad2074 style: Handle the non-generic path earlier in the derive code.
No need to build the match body if there are no generics. This should hopefully
save some work too.

Depends on D26289

Differential Revision: https://phabricator.services.mozilla.com/D26290
2019-04-12 12:20:05 +02:00
Emilio Cobos Álvarez
c3ab3f0963 style: Share more code between ToAnimatedValue and ToComputedValue derive.
I'm going to add a ToResolvedValue, and I don't want to add more copy-pasta.

This shouldn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D26289
2019-04-12 12:20:04 +02:00
Emilio Cobos Álvarez
ae32e4df40 style: Use an explicit stack to measure rule tree memory usage.
A patch of mine that makes us measure the rule tree more often triggers this.

Differential Revision: https://phabricator.services.mozilla.com/D26595
2019-04-12 12:20:04 +02:00
Emilio Cobos Álvarez
369acffea8 style: Make color and text-decoration-line not early properties.
The text-decoration-line is a drive-by thing, but I can put it in a separate
patch if you want. It was needed for Servo (to compute
-servo-text-decorations-in-effect), but I moved Servo away from that model a
while ago.

Differential Revision: https://phabricator.services.mozilla.com/D26254
2019-04-12 12:20:03 +02:00
Emilio Cobos Álvarez
5d2724994c style: Remove the last usage of lossy currentcolor.
We don't have lossy currentcolor in the style system anymore, except for a
single property -moz-font-smoothing-background-color.

I could've converted it into a proper StyleColor and thread down all the
necessary information to the font metrics code.

But it doesn't really seem worth it given it's not exposed to the web, so I just
did the simplest thing, which is making currentcolor compute to transparent to
that specific property.

This patch also removes the stores_complex_colors_lossily code and related,
since now we always can cache computed colors.

Differential Revision: https://phabricator.services.mozilla.com/D26187
2019-04-12 12:20:02 +02:00
Emilio Cobos Álvarez
681f861018 style: Use rust lengths for outline-offset.
Differential Revision: https://phabricator.services.mozilla.com/D26156
2019-04-12 12:20:02 +02:00
Emilio Cobos Álvarez
f8fce03e82 style: Use Servo lengths for column-width.
Differential Revision: https://phabricator.services.mozilla.com/D26155
2019-04-12 12:20:01 +02:00
Emilio Cobos Álvarez
ef0b6bb225 style: Trivially remove some dead code.
Differential Revision: https://phabricator.services.mozilla.com/D26154
2019-04-12 12:20:01 +02:00
Emilio Cobos Álvarez
79fc59c75f style: Use only the new name for StyleColor.
That is, change all uses of StyleComplexColor to just StyleColor.

Differential Revision: https://phabricator.services.mozilla.com/D25977
2019-04-12 12:20:00 +02:00
Emilio Cobos Álvarez
53ccbc5751 style: Use the rust color representation.
Differential Revision: https://phabricator.services.mozilla.com/D25976
2019-04-12 12:19:59 +02:00
Emilio Cobos Álvarez
691eb36ffe style: Expose colors via cbindgen.
Also s/Foreground/CurrentColor.

Differential Revision: https://phabricator.services.mozilla.com/D25975
2019-04-12 12:19:59 +02:00
Emilio Cobos Álvarez
a6f32bc762 style: Fix revalidation in <svg:use> subtree.
So as to avoid incorrectly sharing styles across elements.

Differential Revision: https://phabricator.services.mozilla.com/D25918
2019-04-12 12:19:58 +02:00
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
48718b876c style: Add ToShmem impls for collections and strings.
Differential Revision: https://phabricator.services.mozilla.com/D17191
2019-04-12 12:19:47 +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
d8a758272e style: Factor out some of style_derive.
Differential Revision: https://phabricator.services.mozilla.com/D17188
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
bors-servo
1e4b42a90b
Auto merge of #23191 - paulrouget:no_proxy_clone, r=ferjm
Remove useless embedder proxy clone

<!-- 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/23191)
<!-- Reviewable:end -->
2019-04-11 20:42:12 -04:00
bors-servo
db9300d3e6
Auto merge of #23183 - krk:fix-23144, r=asajeffrey
Replace panic with warn in DocumentLoader.finish_load.

Fix panic on broken script URL with an onerror handler that rewrites the document.

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #23144

<!-- 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/23183)
<!-- Reviewable:end -->
2019-04-11 14:33:44 -04:00
Paul Rouget
906a33ad0f Remove useless embedder proxy clone 2019-04-11 08:43:12 +02:00
Lucas Fantacuci
6b2be9b31d Implementing the builder pattern for RequestInit 2019-04-10 14:01:30 -03:00
krk
211fb00574 Replace panic with warn in DocumentLoader.finish_load.
Fix panic on broken script URL with an onerror handler that rewrites the
document.
2019-04-09 21:05:38 +02:00
bors-servo
4a4d878f18
Auto merge of #23166 - paulrouget:less-gl-clone, r=jdm
call window.gl() once

<!-- 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/23166)
<!-- Reviewable:end -->
2019-04-07 23:06:34 -04:00