Commit graph

237 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
384fd59ad0 style: Use Option::as_deref() in style code.
And drive-by simplify another function that was only doing
Option::clone().

Differential Revision: https://phabricator.services.mozilla.com/D92839
2021-02-26 16:44:05 +01:00
Martin Robinson
364235ac0c Include animations and transitions in the cascade
Instead of applying animations and transitions to styled elements,
include them in the cascade. This allows them to interact properly with
things like font-size and !important rules.
2020-06-09 11:41:07 +02:00
Emilio Cobos Álvarez
f76acc84c6 style: Reformat recent changes. 2020-04-16 17:50:17 +02:00
Emilio Cobos Álvarez
149cb5f5f1 style: Merge ImageLayer and Image.
ImageLayer is almost the only usage of Image, so keeping them in the same enum
makes the resulting C++ struct smaller, and makes it map more cleanly to
nsStyleImage.

Differential Revision: https://phabricator.services.mozilla.com/D62161
2020-04-16 16:35:07 +02:00
Anthony Ramine
516e8e0aa6 Don't expose any AtomicRefCell directly from style traits
This lets us experiment with how we store this data on the DOM side.
2020-04-04 13:08:51 +02:00
Emilio Cobos Álvarez
16fd7cad0c
style: Add a style flag for the root element style.
This is needed to make the root element not a containing block in presence of
filters or what not.

Differential Revision: https://phabricator.services.mozilla.com/D61167
2020-02-12 02:43:18 +01:00
Simon Sapin
062c1872f0 Parse -moz-image-rect() and -moz-element() only in Gecko 2020-01-07 14:44:28 +01:00
Emilio Cobos Álvarez
a44515c314 style: Rustfmt recent changes. 2019-11-04 13:36:32 +01:00
Emilio Cobos Álvarez
fc1233f3d2 style: Remove -moz-binding, nsStyleDisplay::mBinding and similar.
Differential Revision: https://phabricator.services.mozilla.com/D50556
2019-11-04 13:36:32 +01:00
Kitlith
0a07a88904 Remove usage of opts::get() from style.
Part of #22854.
2019-10-21 13:44:31 -07:00
Emilio Cobos Álvarez
add08518cd
Fix style system build with recent changes. 2019-06-25 13:11:32 +02:00
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
b268ef6aed style: Remove some redundant use statements. 2019-04-12 12:19:57 +02:00
Emilio Cobos Álvarez
80ed070639 style: fix a typo. 2019-03-13 15:08:35 +01:00
Simon Sapin
be69f9c3e6 Rustfmt has changed its default style :/ 2018-12-28 13:17:47 +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
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
chansuke
8dab4d659a
Format style component. 2018-09-09 16:24:45 +02:00
Emilio Cobos Álvarez
5507d53611
style: Make element-backed pseudos inherit from NAC subtree roots and other NAC inherit from their parents.
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.

Bug: 1460382
Reviewed-by: heycam
MozReview-Commit-ID: IDKYt3EJtSH
2018-06-02 12:07:07 +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
Bobby Holley
f7ae1a37e3 Manual fixups so that the rustfmt output won't trigger tidy. 2018-04-10 17:33:25 -07:00
Emilio Cobos Álvarez
94b687306f
style: Cleanup always-false argument to Servo_ResolveStyleLazily.
I changed this setup in https://bugzilla.mozilla.org/show_bug.cgi?id=1414999,
because it was totally unsound.
2018-02-20 12:59:21 +01:00
Emilio Cobos Álvarez
02ad6d3d90
style: Require an nth-index cache for invalidation. 2017-11-29 21:22:29 +01:00
Emilio Cobos Álvarez
d61c9a8d31
style: Bring back the optimization to avoid traversing XBL subtrees that will likely change.
We need to get rid of BindingHolder to handle properly the case of an invalid
binding URL.

Bug: 1420496
Reviewed-by: heycam
MozReview-Commit-ID: 3sIGtcVOt0r
2017-11-26 16:36:13 +01:00
Emilio Cobos Álvarez
09c11d49d5
style: Make a Servo-only assertion apply to Gecko too.
MozReview-Commit-ID: CWhSfDQ8naE
2017-11-24 20:50:18 +01:00
Emilio Cobos Álvarez
b1fecea0aa
style: Get rid of unstyled children only traversals.
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
2017-11-20 08:24:08 +01:00
Emilio Cobos Álvarez
7ea98a577b
style: Remove unused argument in element_needs_traversal. 2017-11-17 16:56:26 +01:00
Emilio Cobos Álvarez
3a5d70f106
style: Stop inspecting children to recascade them just because we reframed.
We only need to do this when display changes from none to non-none, so handle it
explicitly when computing the cascade requirement.

This patch also removes a few conditions that are redundant because they're
handled also by the cascade requirement check, like the initial styling.
2017-11-10 20:47:37 +01:00
Emilio Cobos Álvarez
6704122927
style: Get rid of CurrentElementInfo.
It's out-of-band data I never liked, and the code has changed enough from when
it was introduced, that now all of the information it stores can be local.
2017-11-10 17:03:01 +01:00
Emilio Cobos Álvarez
49fe3d1c9f
style: Remove "reconstructed ancestor" checks.
This is only useful to avoid restyling NAC subtrees, but _not_ for ::before or
::after, in most cases. These subrees are small, and reframing is also not too
common, so I don't think it warrants the complexity.
2017-11-10 17:03:01 +01:00
Bastien Orivel
29b4eec141 Bump bitflags to 1.0 in every servo crate 2017-10-30 23:36:06 +01: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
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
a11d268468
style: Refactor children handling.
Moving traversal_children away from TNode I can make TNode trivial enough, in
order to share a QuerySelector implementation between Servo and Gecko.
2017-10-17 08:57:35 +02:00
Emilio Cobos Álvarez
aba1cf8cd5
style: Allow passing an nth-index-cache to the invalidation code. 2017-10-02 21:02:28 +02:00
Emilio Cobos Álvarez
5954e0a4ba
style: Remove conditional imports in traversal.rs 2017-10-01 22:55:50 +02:00
Emilio Cobos Álvarez
07d55a4bf8
style: Lazily tweak the traversal root to account for sibling invalidations.
Bug: 1403078
Reviewed-by: heycam
MozReview-Commit-ID: Ij3nMOKu5FO
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-26 13:09:03 +02:00
Emilio Cobos Álvarez
fed5960f2c
style: Make sure to not run any style invalidation in an unstyled children only traversal.
Bug: 1402472
Reviewed-by: bholley
MozReview-Commit-ID: IFPA7LJpvsZ
2017-09-23 04:15:01 +02:00
Emilio Cobos Álvarez
891bc7d174
style: Massage the resolver code so it's cleaner and prevents the problem.
This way all the borrows stay in the sharing code, and prevents an extra borrow
on a cache hit, which is not a big deal but nice.
2017-09-18 04:57:50 +02:00
Bobby Holley
703a5c93d0 Undo #18497 in the MatchAndCascade case.
It's easy to construct examples where not inserting in those cases causes performance
to get worse (for example, any long list of siblings that match the same selectors
while having some non-effectual differences in LocalName/Class/Id/etc). And the LRU
nature of the cache already does the right thing of pruning non-useful entries.

Fixing this causes several hundred more sharing hits on wikipedia.

MozReview-Commit-ID: L7W8vcMnHaq
2017-09-15 23:21:00 -07:00
Emilio Cobos Álvarez
158aa0ffdf
style: Move the check into insert_if_possible. 2017-09-14 11:56:45 +02:00
Emilio Cobos Álvarez
2908c6a266
style: Don't cache styles that got a cache hit.
This avoids doing wasted work, at least in the recascade case, and pretty likely
in the other as well.
2017-09-14 10:00:00 +02:00
Bobby Holley
8e5c1c771e Share styles during recascades.
MozReview-Commit-ID: AFTwtzi4P93
2017-09-13 22:06:46 -07:00
Bobby Holley
7a7070e075 Add some wrapper types to propagate styles out of style resolver.
We'll use these next to propagate information about style reuse to the ElementDataFlags.

MozReview-Commit-ID: Dya6vgzydpL
2017-09-13 22:06:33 -07:00
Bobby Holley
9092e6b4c2 Return the element rather than styles from the style sharing cache.
This gives us more flexibility, and doesn't cost us anything.

MozReview-Commit-ID: CuvOEcLA3My
2017-09-13 22:06:24 -07:00
Bobby Holley
50cee3e133 Eliminate RestyleData entirely.
Without this change, the previous commit increases the size of ElementData.

MozReview-Commit-ID: 87BZuXINiT9
2017-09-12 10:33:51 -07:00
Bobby Holley
61cad869d9 Hoist flags out of RestyleData.
MozReview-Commit-ID: 8emE83lykh3
2017-09-12 10:22:50 -07:00
Bobby Holley
8268217767 Avoid memmoving ValidationData more than necessary.
MozReview-Commit-ID: 70w3bZ2FU0W
2017-09-11 22:39:35 -07:00