So that we don't waste a bunch of memory with stuff like <svg:use>. I
plan to shrink AuthorStyles further, but this should help regardless, and isn't
very complex.
Differential Revision: https://phabricator.services.mozilla.com/D4618
--HG--
extra : moz-landing-system : lando
Currently, NAC always inherits from the closest non-NAC ancestor element,
regardless of whether it is for an element-backed pseudo or not.
This patch changes the inheritance so that for element-backed pseudos, we
inherit from the closest native anonymous root's parent, and for other NAC we
inherit from the parent.
This prevents the following two issues and allows us to remove the
NODE_IS_NATIVE_ANONYMOUS flag:
* Avoiding inheriting from the non-NAC ancestor in XBL bindings bound to NAC.
- This is no longer a problem since we apply the rule only if we're a
pseudo-element, and all pseudo-elements are in native anonymous subtrees.
- This also allows to remove the hack that propagates the
NODE_IS_NATIVE_ANONYMOUS flag from the ::cue pseudo-element from
BindToTree.
* Inheriting from the wrong thing if we're a nested NAC subtree.
- We no longer look past our NAC subtree, with the exception of
::-moz-number-text's pseudo-elements, for which we do want to propagate
::placeholder to.
A few rules from forms.css have been modified because they're useless or needed
to propagate stuff to the anonymous form control in input[type="number"] which
previously inherited from the input itself.
MozReview-Commit-ID: IDKYt3EJtSH
Pretty much the same setup we have for document.
We have the awkwardness of having to check containing shadow manually for
ShadowRoot because it's not available in TNode (and making it available added a
bit more complexity that wasn't worth it IMO).
MozReview-Commit-ID: CqOh0sLHf6o
Pretty much the same setup we have for document.
We have the awkwardness of having to check containing shadow manually for
ShadowRoot because it's not available in TNode (and making it available added a
bit more complexity that wasn't worth it IMO).
MozReview-Commit-ID: CqOh0sLHf6o
This also adopts the resolution of [1] while at it, and switches XUL to not
support display: contents until a use case appears.
This makes our behavior consistent both with the spec and also in terms of
handling dynamic changes to stuff that would otherwise get suppressed.
Also makes us consistent with both Blink and WebKit in terms of computed style.
We were the only ones respecting "behaves as display: none" without actually
computing to display: none. Will file a spec issue to get that changed.
It also makes us match Blink and WebKit in terms of respecting display: contents
before other suppressions, see the reftest which I didn't write as a WPT
(because there's no spec supporting neither that or the opposite of what we do),
where a <g> element respects display: contents even though if it had any other
kind of display value we'd suppress the frame for it and all the descendants
since it's an SVG element in a non-SVG subtree.
Also, this removes the page-break bit from the display: contents loop, which I
think is harmless.
As long as the tests under style are based in namespace id / node name /
traversal parent, this should not make style sharing go wrong in any way, since
that's the first style sharing check we do at [2].
The general idea under this change is making all nodes with computed style of
display: contents actually honor it. Otherwise there's no way of making the
setup sound except re-introducing something similar to all the state tracking
removed in bug 1303605.
[1]: https://github.com/w3c/csswg-drafts/issues/2167
[2]: https://searchfox.org/mozilla-central/rev/fca4426325624fecbd493c31389721513fc49fef/servo/components/style/sharing/mod.rs#700
MozReview-Commit-ID: JoCKnGYEleD
Now that rustfmt is getting close to stable, and work on the style system has died down a bit, it seemed like an opportune time to auto-format the style crates.
The first commit disables import reordering, since tidy and rustfmt don't currently agree on the correct ordering. The second commit does a bunch of manual fixups such that the output of rustfmt passes tidy. The third commit runs rustfmt on the three aforementioned crate.
There are a few dozen warnings in the style crate about lines longer than 100 characters. It would be good to fix these, but I don't have time for that now.
Source-Repo: https://github.com/servo/servo
Source-Revision: 9a900ef019cd643bff961d7b20db6da69f3edb29
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 2b228d52a084bc832444ac686290840c4369f98d
We could invalidate in a slightly more fine-grained way, but I don't think it's
worth the churn vs. keeping the special-cases minimal.
Bug: 1452640
Reviewed-by: xidorn
MozReview-Commit-ID: 5DkQrgwg9GW
Source-Repo: https://github.com/servo/servo
Source-Revision: e11c2d97552d192b761b0684c8c6852b9dea0921
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 00941db97d18fcbea845f225d318eae4d47aab22
Kinda tricky because :host only matches rules on the shadow root where the rules
come from. So we need to be careful during invalidation and style sharing.
I didn't use the non_ts_pseudo_class_list bits because as soon as we implement
the :host(..) bits we're going to need to special-case it anyway.
The general schema is the following:
* Rightmost featureless :host selectors are handled inserting them in the
host_rules hashmap. Note that we only insert featureless stuff there. We
could insert all of them and just filter during matching, but that's slightly
annoying.
* The other selectors, like non-featureless :host or what not, are added to the
normal cascade data. This is harmless, since the shadow host rules are never
matched against the host, so we know they'll just never match, and avoids
adding more special-cases.
* Featureless :host selectors to the left of a combinator are handled during
matching, in the special-case of next_element_for_combinator in selectors.
This prevents this from being more invasive, and keeps the usual fast path
slim, but it's a bit hard to match the spec and the implementation.
We could keep a copy of the SelectorIter instead in the matching context to
make the handling of featureless-ness explicit in match_non_ts_pseudo_class,
but we'd still need the special-case anyway, so I'm not fond of it.
* We take advantage of one thing that makes this sound. As you may have
noticed, if you had `root` element which is a ShadowRoot, and you matched
something like `div:host` against it, using a MatchingContext with
current_host == root, we'd incorrectly report a match. But this is impossible
due to the following constraints:
* Shadow root rules aren't matched against the host during styling (except
these featureless selectors).
* DOM APIs' current_host needs to be the _containing_ host, not the element
itself if you're a Shadow host.
Bug: 992245
Reviewed-by: xidorn
MozReview-Commit-ID: KayYNfTXb5h
Source-Repo: https://github.com/servo/servo
Source-Revision: cb754b262747e7cab794411df55588f0f0b30b5e
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 2ebbb2578ff9dbadfe905ae501cd52bd61a9fe9a
Also move the checks so that the tag name checks (presumably cheaper) come earlier.
Source-Repo: https://github.com/servo/servo
Source-Revision: 087cf21d79cb090c2a8b55b441e6004921b540aa
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 4dd2eb2330026ccf2c498898b75a1f7648f378ec
This adds TShadowRoot to the `dom` module.
Right now it barely adds uses of it, but this is a prerequisite to fix a bunch
of Shadow DOM bugs and separate it from the XBL mess.
Source-Repo: https://github.com/servo/servo
Source-Revision: ce562a2cc6c508a423cad07be30638e89ff13def
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 17c6150f89621b67a6d92d20d62617d605f94417
Introduce AuthorStyles, which is 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
Source-Repo: https://github.com/servo/servo
Source-Revision: 504b901cc82db5c5e02e157cec9753f7c297ac2c
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 79252144a91938156e03e4bf1be76988a14beeed
Just some more use-cases that can be converted right away.
I'm trying to make XBL not use a whole Stylist, slowly...
Source-Repo: https://github.com/servo/servo
Source-Revision: 63691f01d79874aae4bb84badf86667c863cec9b
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : da4fa29f65cb29a337b99877f44fe18db26ee4b9
This fixes the test from https://github.com/w3c/web-platform-tests/pull/9212 in
Gecko.
Source-Repo: https://github.com/servo/servo
Source-Revision: 82922c97dc0313736fedb8021b205d4f84088a15
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : ec1b0b5dcf36a50fe9b1cd5b087efb5f665cc79e
This makes an element available in StyleAdjuster, and uses it to replace some of our CascadeFlags (the ones that don't represent restrictions on what's actually cascaded, actually).
That fixes handwaviness in the handling of those flags from style reparenting,
and code duplication to handle tricky stuff like :visited.
There are a number of other changes that are worth noticing:
* skip_root_and_item_based_display_fixup is renamed to skip_item_display_fixup:
TElement::is_root() already implies being the document element, which by
definition is not native anonymous and not a pseudo-element.
Thus, you never get fixed-up if your NAC or a pseudo, which is what the code
tried to avoid, so the only fixup with a point is the item one, which is
necessary.
* The pseudo-element probing code was refactored to return early a
Option::<CascadeInputs>::None, which is nicer than what it was doing.
* The visited_links_enabled check has moved to selector-matching time. The rest
of the checks aren't based on whether the element is a link, or are properly
guarded by parent_style.visited_style().is_some() or visited_rules.is_some().
Thus you can transitively infer that no element will end up with a :visited
style, not even from style reparenting.
Anyway, the underlying reason why I want the element in StyleAdjuster is because
we're going to implement an adjustment in there depending on the tag of the
element (converting display: contents to display: none depending on the tag), so
computing that information eagerly, including a hash lookup, wouldn't be nice.
See each commit for details.
Source-Repo: https://github.com/servo/servo
Source-Revision: 02331617b9bd7a379b05f7daa7ad09a44c27504c
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : dceeca4961762c9f7414007c83ceed03e00c720b
See https://bugzilla.mozilla.org/show_bug.cgi?id=1351737#c29
This patch saves more than 80k of code size.
Source-Repo: https://github.com/servo/servo
Source-Revision: 08fc9f190d7e1eaa11560b5924e243ba686c3d79
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 5c71e5e84415f8934a4e72b75e357d1962f82def
This allows to selector-match ::slotted, though we still don't parse it.
Bug: 1425834, 1424607, 1425755
Reviewed-by: heycam
MozReview-Commit-ID: ItELHkf2PMl
Source-Repo: https://github.com/servo/servo
Source-Revision: bb34b7f54aa85cde600c6d675360d03714cf1f8b
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : c92bde66c55c112ea537384d89a698ccb5eba798
Replace them instead by a computed value flag, the same way as the
IS_IN_DISPLAY_NONE_SUBTREE flag works.
Source-Repo: https://github.com/servo/servo
Source-Revision: 83a8891bd4d04ccb3f2f7b292d53f2847380b94c
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : e866663b660580644a022356b6226f5ec3e336d4
This is stable in Rust 1.22 (#19532).
---
- [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 is refactoring only
Source-Repo: https://github.com/servo/servo
Source-Revision: 5f4f355cea4a24992ac9efa97f4a6e1837008e0b
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 3a61f3b466e9f3c80f94b7ecb30f70f85efa55b3
They're useless now, provided we remove the hack to not traverse XBL-bound
elements on initial styling.
Bug: 1418456
Reviewed-by: heycam
MozReview-Commit-ID: AvBVdyF1wb6
Source-Repo: https://github.com/servo/servo
Source-Revision: e4cfff8364cebd0ae2236cc8c39ba93072b35148
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : b9ae9d359687ae32609a11d9ad5e8457c548e941
Called Option::unwrap() on a None value is not a helpful crash message.
This will hopefully help figure out what is causing bug 1418856.
Source-Repo: https://github.com/servo/servo
Source-Revision: af6c2f93b9ff91f4c3e5758d9b27173e49928bed
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 79fcf95fafaa207f4ce7bdfa08b256d388e1aa47
Just waiting for a try run.
Source-Repo: https://github.com/servo/servo
Source-Revision: a376382ed06dce1aa4a63138270b3131375ed5ed
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 224e9fc02fd9a67f98ea7edd97d47535e765c3a1
See #18809
Still haven't had time to test it but it should fix the tests failures that appeared in m-c
Source-Repo: https://github.com/servo/servo
Source-Revision: fe4139b779b3af749ec1426ddf4e1393c7b85442
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 9a0549d7dd8a99315ba3f8eec5d0f9fdf9eb4c0f
Reland of #19045, because it was backed out for an unexpected pass.
Bug: 1412251
Reviewed-by: bz
MozReview-Commit-ID: II6lk6OmSZU
Source-Repo: https://github.com/servo/servo
Source-Revision: 52f962c387456308b68f062bff1ad72947da79b9
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 18264487d62c7d32d3d1c69e90e8021797303bc9
The secret plan is introducing a `get_elements_with_id` for use by `querySelector` / `querySelectorAll`.
But this allows also to make some code look a bit nicer.
Source-Repo: https://github.com/servo/servo
Source-Revision: ee4e371c73b265946146947bb16042360cb2fa41
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 2e34bb4dd31ca9cdafc0756d5366f4ad196f73bd
This is not really an useful abstraction, and I never knew how to spell it.
Source-Repo: https://github.com/servo/servo
Source-Revision: b2867c0afa8bc728c13ddfd56678170dfba98967
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 0cc73981a77aa96cd0ce3486fc82e1f106f37496
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
Source-Repo: https://github.com/servo/servo
Source-Revision: fe16c1d5c3c9084da0ccb85af599d6ec0f8ab20b
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : bb9d52a22bee6d1fe773718f649c977b07840719
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`.
<!-- 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 https://bugzilla.mozilla.org/show_bug.cgi?id=1409255
<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because testing is on the Gecko side.
<!-- 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. -->
Source-Repo: https://github.com/servo/servo
Source-Revision: 4c538b642e4bdfbf42c522c5a59c258a6d14546e
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : f9a6feed1088d0b0be2b55d7f0c2ec9c594ac33b
style: Stop threading the ElementData around the invalidator.
Source-Repo: https://github.com/servo/servo
Source-Revision: c1e0889971582488ed7a4d3a3af21a49bf497abc
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : e7648a93a0b2ee03a02355cff9d6a4d7af9169b8
It is likely it's the most useless trait ever existing.
Source-Repo: https://github.com/servo/servo
Source-Revision: 7d05c76d1828bc80e578c9b77f0c57b0e1afafc2
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 7a3ba2d317d5a408030414318627442a31e66a89
This fixes bug https://bugzilla.mozilla.org/show_bug.cgi?id=1406111
This fixes the fishy TransitionProperty mapping which I complained about in my
previous refactor.
Turns out that those properties could only be longhands, and thus the expansion
we did before that (and which I removed) was correct.
This fixes the bug by moving back to the previous correct behavior but using the
correct types.
The optimization to avoid creating a HashSet if we're transitioning all
properties or had no existing transition is removed since now we're creating a
LonghandIdSet, which is cheap, and that was only a performance optimization.
Source-Repo: https://github.com/servo/servo
Source-Revision: 04f787dbf9b235bf3af58dc7f3160689cdb2311c
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 72e10febd57baaffd77eea420c905de7dc5f9a9d
We have three different enums to represent slightly different things. Reuse them
properly, and kill some code in the animated_properties module while at it.
Source-Repo: https://github.com/servo/servo
Source-Revision: 9ffd2b8c9e2b897f12daa5eac48a76a0c10c60c9
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : dd97b322e75cdcdf26f991e11da85056aad56cc6
See the commit details.
Source-Repo: https://github.com/servo/servo
Source-Revision: bad77b6a20ee9bdba27d0af9edd1dd638c73d64b
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : e53fb304044c534e968c6d073277dd5958e73afd
No longer needed since a while ago.
Source-Repo: https://github.com/servo/servo
Source-Revision: 4628db14951667b7ffddb47bdcc0c5ed886cb3b1
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : bceb703e28667654cb67f7bdd04135503f9c8967
This relands #18519 as-is.
It was backed-out because some Gecko changes hadn't landed yet, but I just pushed them in a way they wouldn't break the build.
Source-Repo: https://github.com/servo/servo
Source-Revision: 3d2dccf1f3e7bf99cb750ee9fd245c24255ad9e2
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 268b2a1d2a6de5657384558b5a08570b879ac4de
This avoids grabbing the body when values that inherit from the body,
whatever that means, aren't under the body.
In that case we'll get a semi-random value, but that's also mishandled by Gecko
anyways (and probably Blink, though haven't tested), and doesn't really make
much sense.
Source-Repo: https://github.com/servo/servo
Source-Revision: 89d5780570894a54774542e79585b79ece3f2dce
--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : eaa1f8a2c14ca3afefa1aa28b11494c370063eed
extra : histedit_source : 54cc0a2ec83760562be8efa9794d079c582ae853