Commit graph

68 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
e5b5cd78a9 style: Remove support for XBL resources.
So much unsound code going away :-)

Differential Revision: https://phabricator.services.mozilla.com/D28380
2019-05-07 12:55:29 +02:00
Emilio Cobos Álvarez
c0b17cc844 style: Don't keep two list of stylesheets in ServoStyleSet.
Just one set of stylesheets is enough. While at it, unify SheetType and Origin.

Differential Revision: https://phabricator.services.mozilla.com/D27564
2019-05-07 12:55:26 +02:00
Fernando Jiménez Moreno
d0b2e826ef Move StylesheetSetRef to script 2019-04-26 12:00:26 +02:00
Fernando Jiménez Moreno
e4f34fde1b Rename StylesheetSet to StylesheetSetRef 2019-04-26 12:00:26 +02:00
Fernando Jiménez Moreno
9df1c2f2cc Revert unnecessary format changes 2019-04-26 12:00:26 +02:00
Fernando Jiménez Moreno
6bf1ca20a2 Make Node and Element rare_data an Option 2019-04-26 12:00:25 +02:00
Fernando Jiménez Moreno
0ca4792dc6 Revert changes in sheet_set_methods macro 2019-04-26 11:42:38 +02:00
Fernando Jiménez Moreno
8b353ee3ce Make StylesheetSet an enum instead of a trait object 2019-04-26 11:31:18 +02:00
Fernando Jiménez Moreno
23b92d54d4 Remove stylesheets ownership from DocumentOrShadowRoot 2019-04-26 10:17:47 +02:00
Emilio Cobos Álvarez
b268ef6aed style: Remove some redundant use statements. 2019-04-12 12:19:57 +02:00
Cameron McCormack
5bf0eea1f8 style: Remove ServoStyleSet::PrependStyleSheet.
Differential Revision: https://phabricator.services.mozilla.com/D16284
2019-01-13 21:59:07 +01:00
Jan Andre Ikenmeyer
1d6fe65401
Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
Simon Sapin
a15d33a10e cargo fix --edition 2018-11-10 17:47:28 +01:00
chansuke
8dab4d659a
Format style component. 2018-09-09 16:24:45 +02:00
Bobby Holley
afe484e46b
style: Allow placeholder import sheets.
This is necessary because we can't create GeckoStyleSheets off-main-thread,
so we need a placeholder until it can be filled in.

Bug: 1454030
Reviewed-by: emilio
MozReview-Commit-ID: ssRme4fLYg
2018-04-17 20:01:27 +02:00
Bobby Holley
c99bcdd4b8 Run rustfmt on selectors, servo_arc, and style.
This was generated with:

./mach cargo fmt --package selectors &&
./mach cargo fmt --package servo_arc &&
./mach cargo fmt --package style

Using rustfmt 0.4.1-nightly (a4462d1 2018-03-26)
2018-04-10 17:35:15 -07:00
Emilio Cobos Álvarez
9c77f0b977
style: Better Shadow DOM assertions.
Bug: 1445682
Reviewed-by: xidorn
Differential Revision: https://phabricator.services.mozilla.com/D748
2018-03-19 13:58:18 +01:00
Emilio Cobos Álvarez
ef4ea7cc49
style: Separate the XBL and shadow dom styling bits.
Bug: 1441022
Reviewed-by: xidorn
MozReview-Commit-ID: 2W0BmZ8wWXg
2018-03-07 15:42:28 +01:00
Xidorn Quan
f518e55c28 Add sizeof for AuthorStyles. 2018-02-19 15:12:13 +11:00
Emilio Cobos Álvarez
5e64cb3516
style: Make XBL / Shadow DOM use something more light-weight than a Stylist.
It's just a struct aggregating stylesheets + CascadeData, with a quirks_mode
parameter because XBL sucks so bad.

Bug: 1436059
Reviewed-by: xidorn
MozReview-Commit-ID: 7q99tSNXo0K
2018-02-16 13:42:36 +01:00
Emilio Cobos Álvarez
88cc2798c4
style: Move more stuff to the place it belongs to.
In particular, `rebuild` is now done entirely by CascadeData, which simplifies
more stuff.

The eventual final state for this is that the data structure we use to store the
XBL / Shadow DOM stuff will be something like:

  struct AuthorStyles { CascadeData, AuthorSheetCollection }

MozReview-Commit-ID: 8TExtP58L4X
2018-02-09 19:45:04 +01:00
Emilio Cobos Álvarez
7edd25890d
style: Introduce AuthorStyleSheetSet.
MozReview-Commit-ID: K3ciocPJuz3
2018-02-09 19:45:03 +01:00
Emilio Cobos Álvarez
5e8dd8a2d4
style: Move the stylesheet set methods under a macro to reuse it soon.
MozReview-Commit-ID: 50Srw4Mjw18
2018-02-09 19:45:02 +01:00
Emilio Cobos Álvarez
a254dc12a4
style: Move author-style-disabled handling to push_applicable_declarations.
This will make it easier to handle it properly for Shadow DOM, though this patch
doesn't do that.

This also makes some method inline and infallible for convenience, since nobody
checks the errors anyway.

Bug: 1436798
Reviewed-by: bholley
MozReview-Commit-ID: Hq3erAUs5tf
2018-02-09 19:44:53 +01:00
Emilio Cobos Álvarez
438251cbfc
style: Make AuthorStylesEnabled an enum.
Chances are we need to pass it around in a bit.

Also invert the boolean because I don't want to reason about double negations,
even if they're simple.

MozReview-Commit-ID: KhX4lDKwDoj
2018-02-09 13:27:35 +01:00
Emilio Cobos Álvarez
bbc6857c06
style: Rename OriginValidity to DataValidity.
MozReview-Commit-ID: FpsYUlWLWTt
2018-02-09 13:27:33 +01:00
Emilio Cobos Álvarez
01915d84db
style: Assert we don't try to do dumb stuff.
MozReview-Commit-ID: 6DpkiwUdccD
2018-02-09 13:27:33 +01:00
Emilio Cobos Álvarez
c88d339db2
style: Move the dirty bit to SheetCollection.
MozReview-Commit-ID: DO9vv9vmSzF
2018-02-09 13:27:31 +01:00
Emilio Cobos Álvarez
f1516d228f
style: Rename StylesheetSet to DocumentStylesheetSet.
MozReview-Commit-ID: 5Xl1eRLu1VF
2018-02-09 13:27:30 +01:00
Bobby Holley
1d6841b9fd Avoid stylist flushes when sheets are appended and then removed again before flushing layout.
MozReview-Commit-ID: CHgbqfHnjwI
2018-02-01 09:14:07 -08:00
Emilio Cobos Álvarez
657d8b8e31
style: Look at the snapshots when invalidating due to stylesheet changes.
Otherwise removal of stylesheets may get out of sync with other DOM changes, and
we may fail to invalidate the style of the affected elements.

Bug: 1432850
Reviewed-by: bz
MozReview-Commit-ID: DrMTgLzQcnk
2018-01-27 02:34:27 +01:00
Emilio Cobos Álvarez
ce1d8cd232
style: Make invalidation state also be with the ::slotted rules.
MozReview-Commit-ID: GYmsXYvL9vj
2018-01-09 14:26:03 +01:00
Matt Brubeck
3005a26daf style: Use the ? operator for Option 2017-12-09 08:29:53 -08:00
Nicholas Nethercote
4506f0d30c Replace all uses of the heapsize crate with malloc_size_of.
Servo currently uses `heapsize`, but Stylo/Gecko use `malloc_size_of`.
`malloc_size_of` is better -- it handles various cases that `heapsize` does not
-- so this patch changes Servo to use `malloc_size_of`.

This patch makes the following changes to the `malloc_size_of` crate.

- Adds `MallocSizeOf` trait implementations for numerous types, some built-in
  (e.g. `VecDeque`), some external and Servo-only (e.g. `string_cache`).

- Makes `enclosing_size_of_op` optional, because vanilla jemalloc doesn't
  support that operation.

- For `HashSet`/`HashMap`, falls back to a computed estimate when
  `enclosing_size_of_op` isn't available.

- Adds an extern "C" `malloc_size_of` function that does the actual heap
  measurement; this is based on the same functions from the `heapsize` crate.

This patch makes the following changes elsewhere.

- Converts all the uses of `heapsize` to instead use `malloc_size_of`.

- Disables the "heapsize"/"heap_size" feature for the external crates that
  provide it.

- Removes the `HeapSizeOf` implementation from `hashglobe`.

- Adds `ignore` annotations to a few `Rc`/`Arc`, because `malloc_size_of`
  doesn't derive those types, unlike `heapsize`.
2017-10-18 22:20:37 +11:00
Emilio Cobos Álvarez
cb31e782aa
style: Share user agent cascade data across documents.
MozReview-Commit-ID: KcyuTHD0bt9
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-15 09:26:23 +02:00
Emilio Cobos Álvarez
0a9309aa96
style: Unify how servo and Gecko handle UA sheets. 2017-09-14 20:33:43 +02:00
bors-servo
bb2030a493 Auto merge of #18494 - frewsxcv:frewsxcv-size-hint, r=jdm
Implement `size_hint` for more iterators.

```
implement size hint for
more iterators because why
not we like fast things
```

<!-- 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/18494)
<!-- Reviewable:end -->
2017-09-13 19:38:32 -05:00
Corey Farwell
9cd4535364 Implement size_hint for more iterators.
```
implement size hint for
more iterators because why
not we like fast things
```
2017-09-13 20:29:27 -04:00
Emilio Cobos Álvarez
d7a3bec6d7
style: Add a comment about why the raw pointer is ok. 2017-09-13 19:52:49 +02:00
Emilio Cobos Álvarez
31079e2e3d
style: Disable "removed" assertion in Gecko. 2017-09-13 19:12:49 +02:00
Emilio Cobos Álvarez
02d1264047
style: Store stylesheets per origin.
This will allow us to cache UA sheets across documents.

MozReview-Commit-ID: 5rYIKTmC6iw
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-13 16:01:35 +02:00
Emilio Cobos Álvarez
fca2f48f86
style: Remove outdated comment.
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-08-23 14:10:45 +02:00
Emilio Cobos Álvarez
3fd8a534d7
style: Rename SheetRebuildKind::rebuild_invalidation to should_rebuild_invalidation.
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-08-23 14:10:45 +02:00
Emilio Cobos Álvarez
bf45a20760
style: Implement finer-grained stylist rebuilds.
MozReview-Commit-ID: ALsH9kSqHb0
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-08-23 11:06:42 +02:00
Emilio Cobos Álvarez
1c67a7dc14
style: Ensure the flusher is completely consumed before getting dropped.
This will be necessary for future patches.

MozReview-Commit-ID: FgWaoRCMdw2
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-08-23 09:30:47 +02:00
Emilio Cobos Álvarez
15594dda10
style: Add a StylesheetFlusher abstraction to enable more incremental rebuilds.
MozReview-Commit-ID: 8RBUUErm4bm
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-08-23 09:30:46 +02:00
Emilio Cobos Álvarez
029ab24671
style: Add a no-op constructor of StyleSheetEntry, in preparation for more changes.
MozReview-Commit-ID: 6Kz0S7YYmFC
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-08-23 09:26:22 +02:00
Emilio Cobos Álvarez
e1517d62af
style: Simplify and improve the per origin stylesheet invalidation setup.
MozReview-Commit-ID: adDDRhNnOw
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-08-23 09:26:21 +02:00
Emilio Cobos Álvarez
a98fd5e2b6
style: Make the StyleSheetSet::flush API slightly nicer.
MozReview-Commit-ID: LfJxZA9zhaE
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-08-23 09:24:50 +02:00
Bobby Holley
d4aa8e3cef Track the restyle root and use it to do less work during the traversal.
MozReview-Commit-ID: A8O3JOpsv4E
2017-08-22 19:34:46 -07:00