Commit graph

227 commits

Author SHA1 Message Date
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
Bobby Holley
74b4f95d71 Encapsulate the sharing cache backend better.
MozReview-Commit-ID: 2x9BIhmwH83
2017-09-11 22:39:34 -07:00
Bobby Holley
db67cd1759 Shorten the naming around the style sharing cache.
MozReview-Commit-ID: EcVQDLoxwFP
2017-09-11 22:39:31 -07:00
Emilio Cobos Álvarez
825f623b3c
style: Stop the cascade when only reset structs change.
Bug: 1395227
Reviewed-by: heycam
MozReview-Commit-ID: JCZJl2fmtJ9
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-06 12:56:29 +02:00
Emilio Cobos Álvarez
10ba4ead25
style: Remove the for reconstruction traversals.
One less hack, a few more to go.

Bug: 1374235
Reviewed-by: bholley
MozReview-Commit-ID: 6katL1EGn2U
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-09-01 13:13:50 +02:00
Bobby Holley
994074fca6 Clean up bit clearing. 2017-08-26 10:22:03 -07:00
Emilio Cobos Álvarez
8c3cc9ba1f Hook the recursive invalidation traversal up to the stack checker machinery.
MozReview-Commit-ID: 3tX3gHFTBT
2017-08-25 18:39:20 -07:00
Bobby Holley
707ab455bb Eliminate the sequential/traversal parallel distinction in favor of a unified adaptive driver.
MozReview-Commit-ID: ADVTNJntzmp
2017-08-25 10:00:27 -07:00
Emilio Cobos Álvarez
ff700aba75
style: Only store applicable ::before / ::after pseudo styles during the traversal. 2017-08-25 08:46:22 +02: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
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