Commit graph

419 commits

Author SHA1 Message Date
Xidorn Quan
af8026a98c Don't try to share style on quirks mode whenever two elements have different id 2017-11-29 19:37:03 -06:00
Matt Brubeck
0009ccd330 Remove unused generic from push_applicable_declarations
This function is only ever used with one type.  This gets rid of the
only use of the `smallvec::VecLike` trait, which we may want to
deprecate.  (If we do need to make this function generic in the future,
we can do it using standard traits instead.)
2017-11-29 09:20:13 -08:00
Bastien Orivel
29b4eec141 Bump bitflags to 1.0 in every servo crate 2017-10-30 23:36:06 +01:00
Emilio Cobos Álvarez
7861ec1d5b
style: Make the SelectorMap API slightly nicer. 2017-10-30 12:33:44 +01:00
Emilio Cobos Álvarez
0df912be93
style: Make style sharing look at XBL / Shadow DOM rules.
Bug: 1412251
Reviewed-by: bz
MozReview-Commit-ID: II6lk6OmSZU
2017-10-28 12:43:43 +02:00
Gecko Backout
cda9d186c1 Backed out changeset fc813bf68348 for failing reftest layout/reftests/bugs/272646-1.xul on OS X. r=backout
Backs out https://github.com/servo/servo/pull/19045
2017-10-28 08:08:47 +00:00
Emilio Cobos Álvarez
4b43b7c7f8
style: Make style sharing look at XBL / Shadow DOM rules.
Bug: 1412251
Reviewed-by: bz
MozReview-Commit-ID: II6lk6OmSZU
2017-10-28 02:13:59 +02:00
Manish Goregaokar
b118ba72d0 Revert "Diagnostic map semantics."
This reverts commit f5c5be00a7.
2017-10-23 13:51:08 -07:00
bors-servo
eaba7ede23 Auto merge of #18988 - emilio:qs, r=heycam
stylo: querySelector / querySelectorAll machinery.

Bug: 1410624
Reviewed-by: heycam

<!-- 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/18988)
<!-- Reviewable:end -->
2017-10-23 08:14:35 -05: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
Emilio Cobos Álvarez
bd2a82334b
style: Don't look at user and author rules if the element can't be affected by them.
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-10-23 08:22:50 +02:00
Emilio Cobos Álvarez
1b32709d95
style: avoid selector refcount churn during invalidation.
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-10-23 08:22:49 +02:00
bors-servo
b1e6f05ae4 Auto merge of #18962 - upsuper:tree-pseudos, r=emilio
Support matching for ::-moz-tree-* pseudo-elements

This is the Servo side change of [bug 1397644](https://bugzilla.mozilla.org/show_bug.cgi?id=1397644).

<!-- 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/18962)
<!-- Reviewable:end -->
2017-10-20 04:18:53 -05:00
Cameron McCormack
d58c967efa style: Record DocumentState dependencies. 2017-10-20 13:13:13 +08:00
Cameron McCormack
2f21070701 style: Remove Stylist::might_have_state_dependency.
We always know for sure whether we have a dependency on particular
event state bits, so just use has_state_dependency.
2017-10-20 13:12:44 +08:00
Xidorn Quan
2dc714f0ac Implement XUL tree pseudo style resolution for stylo. 2017-10-20 14:08:56 +11:00
Xidorn Quan
cd527733c5 Make tree pseudos not precomputed since they are not really anonymous boxes. 2017-10-20 14:08:36 +11:00
Xidorn Quan
4ce3dc7729 Add slots in PerPseudoElementMap for tree pseudos. 2017-10-20 14:08:35 +11:00
Gecko Backout
11c64178d8 Backed out changeset e64e659c077d: servo PR #18809 and revendor for reftest failures, e.g. in layout/reftests/bugs/392435-1.html. r=backout on a CLOSED TREE
Backs out https://github.com/servo/servo/pull/18809
2017-10-19 21:26:51 +00:00
bors-servo
fe16c1d5c3 Auto merge of #18809 - Eijebong:bitflags, r=nox
Update bitflags to 1.0 in every servo crate

It still needs dependencies update to remove all the other bitflags
versions.

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes do not require tests because it's a dependency update

<!-- 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/18809)
<!-- Reviewable:end -->
2017-10-19 10:35:08 -05:00
Bastien Orivel
e8e2d0a4b2 Update bitflags to 1.0 in every servo crate
It still needs dependencies update to remove all the other bitflags
versions.
2017-10-19 15:01:17 +02:00
Emilio Cobos Álvarez
b0e54968ec
style: Make MatchingContext generic over SelectorImpl.
This will help Xidorn implement tree pseudos, and in general makes sense,
allowing to put specific matching data in a selectors implementation.
2017-10-19 11:33:13 +02:00
bors-servo
865b9aea35 Auto merge of #18921 - mrobinson:incremental-stacking-context-ids, r=emilio
Fix duplicate stacking context creation for anonymous Flows

Anonymous nodes were previously creating duplicate stacking contexts,
one for each node in the anonymous node chain. This change eliminates
that for tables.

Additionally the use of stacking context ids based on node addresses is
no longer necessary since stacking contexts no longer control scrolling.
This is the first step in eliminating the dependency between node
addresses and ClipScrollNodes which causes issues like #16425.

<!-- 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
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they are covered by existing tests.

<!-- 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/18921)
<!-- Reviewable:end -->
2017-10-18 21:34:23 -05: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
Martin Robinson
36fa7e4c44 Fix duplicate stacking context creation for anonymous Flows
Anonymous nodes were previously creating duplicate stacking contexts,
one for each node in the anonymous node chain. This change eliminates
that for tables.

Additionally the use of stacking context ids based on node addresses is
no longer necessary since stacking contexts no longer control scrolling.
This is the first step in eliminating the dependency between node
addresses and ClipScrollNodes which causes issues like #16425.
2017-10-18 09:31:40 +02:00
Emilio Cobos Álvarez
6a5576085c
style: Reformat Rule::new. 2017-10-14 17:03:32 +02:00
J. Ryan Stinnett
0eb7d65e73 Limit visited cascade for reparenting
The specialized cascade flow in `stylist::compute_style_with_inputs` (used with
reparenting) currently computes all properties for visited styles, but we only
need visited-dependent properties.

This adds the cascade flag to reduce the work to visited-dependent properties
only, like we do for the regular cascade flow.

MozReview-Commit-ID: FGCj6GPnQOB
2017-10-11 23:50:55 -05:00
Emilio Cobos Álvarez
100dd18307
style: use the XBL styleset quirks mode to match XBL rules.
This fixes bug 1405543.

MozReview-Commit-ID: Dv3mt3Fb8Yp
2017-10-09 11:30:37 +02:00
Bobby Holley
f5c5be00a7 Diagnostic map semantics.
MozReview-Commit-ID: C0a5g6xMPY0
2017-10-07 12:54:15 -07:00
Boris Zbarsky
b488b321ed Don't assume that inputs to compute_style_with_inputs have any rules.
It could be a text style, which never has any rules attached to it.

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1406222
2017-10-05 23:16:14 -04:00
Bobby Holley
15b866d8de Revert #18668 - Add mprotect diagnostics for HashMap crash 2017-10-03 12:44:26 -07:00
Emilio Cobos Álvarez
ab8dcf0a18
style: Rename get_visited_style to just visited_style. 2017-10-01 13:27:16 +02:00
Bobby Holley
abd408433f Add a testing API.
This will allow us to verify the entire detection pipeline in real nightly
builds, which will give us confidence that real heap corruption will be
detected and reported properly.

MozReview-Commit-ID: 43Fp2HT8RYy
2017-09-28 15:06:50 -07:00
Bobby Holley
98f370130d Semantics for ProtectedHashMap.
MozReview-Commit-ID: K0m65uZi7iw
2017-09-28 14:13:01 -07:00
Emilio Cobos Álvarez
19d34b96e5
style: Fix various issues with XBL rule matching.
We were using the wrong MatchingMode and flags setter just because we didn't
bother threading them down.

This patch fixes the issue seen with the video controls.

MozReview-Commit-ID: Il1WOzRDxI1
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-27 15:29:04 +02:00
Emilio Cobos Álvarez
d82e6926fc
style: Do not optimize out lazy pseudo rules if the main stylist doesn't have rules for it.
This could prevent an XBL binding to use some pseudo-elements fairly randomly.

MozReview-Commit-ID: b44DO8qcfD
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-27 13:29:36 +02:00
Nicholas Nethercote
7019d42523 Devirtualize nsIAtom. 2017-09-27 12:40:31 +10:00
bors-servo
4450bbdb0c Auto merge of #18640 - emilio:cleanup-as-you-go, r=nox
style: Really minor cleanups.

See commits for details.
2017-09-26 07:53:43 -05:00
Emilio Cobos Álvarez
2bf84ba468
style: There are no more ua_sheets. 2017-09-26 14:52:00 +02:00
Nicholas Nethercote
e030c0d96a Rename add_size_of_children() methods as add_size_of().
This makes them match `size_of` from `MallocSizeOf`.
2017-09-26 18:54:36 +10:00
Bobby Holley
438740b912 Implement an nth-index cache.
MozReview-Commit-ID: Ee0um3QXkxl
2017-09-21 15:25:38 -07:00
Bobby Holley
48466bf876 Introduce an NthIndexCache type and pipe it from ThreadLocalStyleContext to MatchingContext.
Some future refactoring here to pass fewer things as parameters would be nice.
2017-09-20 23:22:38 -07:00
Nicholas Nethercote
f7023a120e Measure the UA cache.
ServoStyleSetSizes now has two uses, one for the Stylist, and one for the UA
cache, and so the patch removes 'Stylist' from the field names.

Example output from about:memory:

> +----1,359,608 B (00.55%) -- layout
> |    +----756,488 B (00.31%) -- style-sheet-cache [2]
> |    +----393,968 B (00.16%) -- servo-ua-cache
> |    |    +--234,496 B (00.10%) -- element-and-pseudos-maps
> |    |    +---59,648 B (00.02%) -- revalidation-selectors
> |    |    +---58,320 B (00.02%) -- invalidation-map
> |    |    +---30,752 B (00.01%) -- other
> |    |    +---10,752 B (00.00%) -- precomputed-pseudos
2017-09-20 08:50:21 +10:00
Emilio Cobos Álvarez
efb2019f4c
style: Remove unused FnvHashMap re-export.
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-17 04:31:21 +02:00
Emilio Cobos Álvarez
5be81d04a7
style: Clear the UA cache on shutdown.
MozReview-Commit-ID: KAGdhFb67hq
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-15 09:26:25 +02: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
985c6193eb
style: Factor out whether a stylesheet matches all the existing medium-affected-values in CascadeData.
MozReview-Commit-ID: IE6RFiBXZ8s
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-15 01:47:12 +02:00
Emilio Cobos Álvarez
0a9309aa96
style: Unify how servo and Gecko handle UA sheets. 2017-09-14 20:33:43 +02:00
Emilio Cobos Álvarez
7454006d6c
style: Move DocumentCascadeData::add_stylesheet to CascadeData.
More plumbing in preparation for isolating the UA stuff.
2017-09-14 12:49:10 +02:00
Emilio Cobos Álvarez
c34c92e904 style: Add a TLS-based style struct caching mechanism. 2017-09-14 17:13:39 +08:00