Commit graph

105 commits

Author SHA1 Message Date
Simon Sapin
a15d33a10e cargo fix --edition 2018-11-10 17:47:28 +01:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
Pyfisch
cb07debcb6 Format remaining files 2018-11-06 22:30:31 +01:00
Emilio Cobos Álvarez
d035d02517
style: Don't keep a separate list of ignored-when-colors-disabled longhands.
Most of the change is moving sets around to be static functions on
LonghandIdSet. I think I like that pattern, but I can also make the new set a
global static and add mako code to be `pub` or something.

Though I think the LonghandIdSet::foo().contains(..) pattern is nice to read :)

Differential Revision: https://phabricator.services.mozilla.com/D10653
2018-11-05 12:32:15 +01:00
Sean Voisen
62aaf865aa
style: Ignore border-image-source when overriding document colors.
Differential Revision: https://phabricator.services.mozilla.com/D10017
2018-11-05 12:29:20 +01:00
Emilio Cobos Álvarez
5ab81c4254
style: Make Servo build.
StrongRuleNode is really Sync.
2018-09-18 11:46:23 +02:00
Manish Goregaokar
84ca681a78
servo_arc cleanups for publishing.
Differential Revision: https://phabricator.services.mozilla.com/D6034
2018-09-18 11:39:54 +02:00
Cameron McCormack
1f45fc0339
style: Update comments to no longer point to nsRuleNode.
There are a few mentions of nsRuleNode left but they are mostly
historical references so it makes sense to keep them.

Differential Revision: https://phabricator.services.mozilla.com/D5505
2018-09-15 17:57:12 +02:00
chansuke
8dab4d659a
Format style component. 2018-09-09 16:24:45 +02:00
Nicholas Nethercote
fc9df0bcf3
style: Convert FnvHash{Set,Map} instances to FxHash{Set,Map}.
Bug: 1477628
Reviewed-by: heycam
2018-08-08 01:34:35 +02:00
Bobby Holley
48558e313a
style: Update StyleSource to use ArcUnion.
Bug: 1455784
Reviewed-by: Manishearth
MozReview-Commit-ID: AT4sud9goGV
2018-04-29 03:28:32 +02:00
Emilio Cobos Álvarez
b5c18c24fe
style: Pack the shadow cascade order in ApplicableDeclarationBlock.
I didn't bother not shifting there. We need to load the whole thing and shift
for at least one of cascade level / shadow cascade order.

Callers of level() other than for_rule_tree are non-existent in release builds,
so we'd be doing the shift anyway. I can implement the same thing for
shadow_cascade_order too, but I don't think that optimization is measurable in
any way, either, the compiler should make the decision.

And just in case, the simpler version actually generated less instructions in:

  https://play.rust-lang.org/?gist=ceadb0d3cbce4eeca76e4d9ab9a1c744&version=nightly

with the simple thing.

Bug: 1455032
Reviewed-by: heycam
MozReview-Commit-ID: 8xPBJmlcyKh
2018-04-28 10:26:07 +02:00
Emilio Cobos Álvarez
84d6c13871
style: Fix cascade order of !important in Shadow DOM.
No cleaner ideas right now that carrying that counter around... Maybe a custom
type may be cleaner?

This makes ApplicableDeclarationBlock a bit bigger. I could probably try to make
the counter a 4 / 5-bit number or something and pack the counter there in the
SourceOrderAndCascadeLevel somehow...

But doesn't seem really worth the churn, and can be done as a followup in any
case. Let me know if you want to block on that.

Bug: 1454162
Reviewed-by: heycam
MozReview-Commit-ID: 1LdW9S4xA6f
2018-04-28 10:26:01 +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
13f61a6e5f
style: Indent properly a couple more functions. 2018-02-24 23:23:16 +01:00
Emilio Cobos Álvarez
69c018c70d
style: Cascade pres hints after normal user rules.
Per https://drafts.csswg.org/css-cascade/#preshint and
https://html.spec.whatwg.org/multipage/#presentational-hints.

This was causing failures in the link color reftests with the preferences sheet
as a User sheet.

Bug: 1436782
Reviewed-by: bholley
MozReview-Commit-ID: 9iwEqPBw4CF
2018-02-10 13:12:30 +01:00
janczer
661d234c3c Change debug assertions to specific ones 2018-02-07 09:21:24 +01:00
Simon Sapin
4be3096040 Add some FIXME comments about using ptr::NonNull 2018-01-22 17:41:26 +01:00
Xidorn Quan
3593392788 Skip rule node which contains only inherited properties for rule cache. 2018-01-05 11:29:01 +11:00
Emilio Cobos Álvarez
f0d749a544
style: Stop allowing unused_unsafe. 2017-11-15 13:26:26 +01:00
Xidorn Quan
9c23594e74 Remove XBL as a separate cascading level in Stylo.
In Gecko, we handle XBL rules like author rules everywhere, except that
XBL rules are added and sorted in an independent step, behave as if it
has a separate level.

It is not clear to me why Stylo chose to add a separate level for XBL
rules, but it doesn't seem that there is anything special to do with
XBL rules.

This bug happens because we don't handle XBL important rules which are
handled as part of author rules in Gecko due to lack of the additional
level there. We should just follow what Gecko does here and handle them
all the same.
2017-10-23 17:34:34 +11:00
Boris Chiou
aa72970f0a Add Servo_StyleSet_GetComputedValuesByAddingAnimation FFI.
Add an FFI to create a temporary ServoStyleContext with the animation value.
We need this because we calculate the Cumulative change hints to check
if we can ignore this animation segment.
2017-10-19 11:05:07 +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
Xidorn Quan
96d0529be5 Remove text-shadow handling from HasAuthorSpecifiedRules 2017-10-12 15:20:47 +11:00
Xidorn Quan
0c40ae70ed Support pseudo-element properly in HasAuthorSpecifiedRules. 2017-10-11 10:29:32 +11:00
Manish Goregaokar
8bce37e6ba stylo: use FnvHashMap everywhere, remove default HashMap construction methods 2017-10-03 14:10:31 -07:00
Emilio Cobos Álvarez
c34c92e904 style: Add a TLS-based style struct caching mechanism. 2017-09-14 17:13:39 +08:00
Nicholas Nethercote
f83099f62a Make MallocSizeOf::malloc_{,enclosing_}size_of unsafe.
This fixes #18473.
2017-09-13 15:59:54 +10:00
Nicholas Nethercote
32548e5312 Overhaul MallocSizeOf and related things.
This patch makes the MallocSizeOf stuff in Stylo work more like the HeapSizeOf
stuff already in Servo, except better. In particular, it adds deriving support
for MallocSizeOf, which will make it easier to improve coverage.

The patch does the following.

- Combines servo/components/style/stylesheets/memory.rs and the heapsize crate
  into a new crate, malloc_size_of.

- Forks the heapsize_derive crate, calling it malloc_size_of, so that
  MallocSizeOf can be derived.

- Both the new crates have MIT/Apache licenses, like heapsize, in case they are
  incorporated into heapsize in the future.

- Renames the methods within MallocSizeOf and the related traits so they are
  more concise.

- Removes MallocSizeOfWithGuard.

- Adds `derive(MallocSizeOf)` to a lot of types, in some cases replacing an
  equivalent or almost-equivalent hand-written implementation.

- Adds stuff so that Rc/Arc can be handled properly.
2017-09-12 12:37:51 +10:00
Matt Brubeck
a5a0e9ffe8 Use SmallBitVec for important flags in PDB 2017-09-11 06:53:05 -07:00
Nicholas Nethercote
d880efcab3
Measure the stylist during memory reporting. 2017-09-05 19:43:50 +02:00
bors-servo
ac7cf53692 Auto merge of #18334 - Manishearth:hashglobe, r=emilio,Gankro
Add fallible hashmaps from HashGlobe for stylo

HashGlobe code is r=emilio,Gankro

integration code is r=emilio from https://bugzilla.mozilla.org/show_bug.cgi?id=1393656

<!-- 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/18334)
<!-- Reviewable:end -->
2017-09-01 16:09:53 -05:00
bors-servo
af52f5394a Auto merge of #18337 - kuoe0:make-the-order-of-rules-in-DevTools-be-the-specificity-order, r=emilio
Make the order of rules in DevTools be the specificity order.

We insert rules with any important declaration into rule tree twice,
one for the normal level and another for the important level. And
when we fetch them from rule tree, we skip the important one to
make the order be the specificity order.

<!-- 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 [Bug 1391198](https://bugzilla.mozilla.org/show_bug.cgi?id=1391198)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because test cases already in gecko

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- 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/18337)
<!-- Reviewable:end -->
2017-09-01 04:15:21 -05:00
KuoE0
1bacd01a78 Bug 1391198 - Make the order of rules in DevTools be the specificity order.
We insert rules with any important declaration into rule tree twice,
one for normal level and another for important level. And when we fetch
them from rule tree, we skip the important one to make the order be

MozReview-Commit-ID: HewZG6jYVvv
2017-09-01 10:59:57 +08:00
Manish Goregaokar
5cd296a264
stylo: Replace all hashtable collections with ones from style::hash 2017-08-31 16:28:30 -07:00
Nicholas Nethercote
e08829703a Measure memory usage of Stylo's Rule Tree. 2017-08-30 21:46:15 +10:00
Clément DAVID
c5fe235112 order derivable traits lists
Ignoring :
 - **generated**.rs
 - python/tidy/servo_tidy_tests/rust_tidy.rs
2017-08-23 21:38:44 +02:00
KuoE0
a6ceafe3da Make emtpy rule can be inserted into rule tree 2017-08-16 11:08:49 +08:00
Manish Goregaokar
6dac81c34c Include logical properties in has_author_specified_rules 2017-08-09 22:00:11 -07:00
Manish Goregaokar
2ebce54d75 Remove testing feature from style crate 2017-08-07 14:30:31 -07:00
Hiroyuki Ikezoe
07421a8e9c Make replace_rules_internal return true only if important rules changed. 2017-08-03 07:18:32 +09:00
Michael Partheil
b07ebbae6b Replace all uses of the style::stylearc alias with servo_arc.
The alias is left there temporarilly and will be removed completely in a later commit where
also components/style/gecko/generated/structs_{debug|release}.rs are re-generated (they still
use the old alias).
2017-07-19 09:29:05 +02:00
Manish Goregaokar
74519cc1a7 stylo: Make Servo Arc types use ptr to T instead of ptr to ArcInner<T> 2017-07-17 18:03:09 -07:00
Emilio Cobos Álvarez
fcf85e4658
style: Make RuleTree::root return a reference instead of a strong pointer.
There's no reason it wasn't done before.

MozReview-Commit-ID: G0lMLWmfHbS
2017-07-12 08:39:41 +02:00
Emilio Cobos Álvarez
cc94a8b7cb
style: Undo the optimization for grabbing animation rules from the style data.
This is unfortunate, but for now it complicates things, I would like not needing
a ElementData to get the style of an Element in order to fix all the
getDefaultComputedStyle bugs.

MozReview-Commit-ID: LZvsdFEqrDE
2017-07-12 08:39:35 +02:00
Bobby Holley
c742ed31da Use GC machinery rather than recursion for post-rule-tree-teardown node dropping.
MozReview-Commit-ID: BPC6u4sBNPR
2017-07-04 13:43:41 -07:00
Bobby Holley
6ade9c11ec Allow StrongRuleNode drops after RuleTree destruction. 2017-06-30 23:35:40 -07:00
Bobby Holley
67cd974636 Use a different sentinel value to lock the free list.
We're going to use null to indicate that the final GC has already
occurred.
2017-06-30 23:35:32 -07:00
Bobby Holley
654661df36 Hook into the Gecko leak checking machinery.
Since we're going to stop asserting that all RuleNodes have been
destroyed by the time the RuleTree is destroyed, we want reliable leak
checking.
2017-06-30 23:35:22 -07:00
Bobby Holley
31b1233a73 Stop GCing before dropping the root rule node.
We already gc before dropping the RuleTree.
2017-06-30 23:35:14 -07:00