Commit graph

84 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
bd70c405b4
style: Rename StyleContext to ComputedStyle.
Bug: 1447483
Reviewed-by: jwatt
MozReview-Commit-ID: KATZ6DkmpVY
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2018-03-22 18:04:29 +01:00
Emilio Cobos Álvarez
9364cd21b8
style: Don't share style with an element that has a different proto binding than us.
See the lengthy comment about why... XBL sucks.

MozReview-Commit-ID: 8UgeJAVkj6a
2018-03-12 21:47:47 +01:00
Emilio Cobos Álvarez
c338745b17
style: Allow to share style across elements with similar XBL bindings. 2018-03-12 21:47:46 +01:00
Emilio Cobos Álvarez
a37bb8e6aa
style: Reorder style sharing checks so that cheaper and broader ones are earlier. 2018-03-08 22:50:34 +01:00
Emilio Cobos Álvarez
f2efd04a5d
style: Make Element::id not clone the attribute. 2018-02-24 22:45:43 +01:00
Emilio Cobos Álvarez
98c9292ecb
style: Remove get_ prefix from get_state and get_id. 2018-02-24 22:45:42 +01:00
Emilio Cobos Álvarez
8d34aacb3b
style: Remove some useless explicit dereferencing. 2018-02-24 22:45:39 +01:00
Emilio Cobos Álvarez
7ab4b21bc3
selectors: Remove the get_ prefix from get_local_name and get_namespace. 2018-02-24 22:45:38 +01:00
Emilio Cobos Álvarez
3595c98411
style: Use Option::get_or_insert_with.
Less unwraps is better.
2018-01-10 03:39:29 +01:00
Emilio Cobos Álvarez
76257ae4df
style: Add a necessary check for style sharing between ::slotted() nodes.
If two elements are assigned to different slots, even within the same shadow
root, they could match different rules, due to the slot being assigned to yet
another slot in another shadow root.

MozReview-Commit-ID: CfZJCVxIQzM
2018-01-09 14:26:03 +01:00
Matt Brubeck
99c2db0549 Update to uluru 0.2 and arrayvec 0.4 2017-12-07 10:05:38 -08:00
Emilio Cobos Álvarez
bd890cc9bc
style: Sharing formatting nits.
MozReview-Commit-ID: 3tSiyBquR1v
2017-12-05 11:21:32 +01:00
Emilio Cobos Álvarez
0bcd36838d
style: Remove redundant style sharing check.
We check that a few lines before calling test_candidate.
2017-11-30 17:26:45 +01:00
Emilio Cobos Álvarez
47b02658ec
style: Move lru_cache to its own crate.
One less crate pointlessly in components/.
2017-11-15 16:18:11 +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
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
Bobby Holley
05c03d5104 Hoist lookup() into lru_cache.
MozReview-Commit-ID: F5FbKFqpXEh
2017-09-20 23:22:33 -07:00
Bobby Holley
13a3cf27a8 LRUCache::new -> LRUCache::default.
MozReview-Commit-ID: KouOaYTluRx
2017-09-20 23:22:27 -07:00
Bobby Holley
8b6c5988b5 Hoist the LRU cache into its own crate to share it with selectors. 2017-09-20 23:22:20 -07:00
Bobby Holley
4abe8002e9 Bug 1401317 - Make second pass sharing sensitive to DISABLE_STYLE_SHARING_CACHE. r=emilio
MozReview-Commit-ID: 8U0xekMHGg8
2017-09-19 23:09:12 -07:00
Emilio Cobos Álvarez
a5842165d9
style: Assert we don't try to share against ourselves. 2017-09-18 04:57:53 +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
Emilio Cobos Álvarez
36fed07b1c
style: avoid testing against ourselves in lookup_for_rules.
There's a path in finish_restyle, where we can recascade a style for a given
element, in get_after_change_style.

I haven't been able to construct a test-case for this, but this is the only
coherent story I have for crashes like:

  https://crash-stats.mozilla.com/report/index/bcdfe629-ca1f-4e4d-aa17-27f890170917#tab-details
2017-09-18 03:23:32 +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
Matt Brubeck
286888009f Make LRUCache use a linked list to reduce memmoves.
https://bugzilla.mozilla.org/show_bug.cgi?id=1398957
2017-09-14 11:33:02 -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
9d671058df
style: Reformat the signature of insert_if_possible. 2017-09-14 09:59:48 +02:00
Bobby Holley
8e5c1c771e Share styles during recascades.
MozReview-Commit-ID: AFTwtzi4P93
2017-09-13 22:06:46 -07:00
Bobby Holley
1c9b39a8e8 Do a second pass on the sharing cache to reuse style by rule node identity.
MozReview-Commit-ID: H67j3Sbt3gr
2017-09-13 22:06:39 -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
729db5ccec Cache the parent CV identity on ValidationData.
This will make the linear probing faster. If we end up implementing the two-tier
cache setup, this code will be unnecessary and can go away.

MozReview-Commit-ID: BRfV5ump34n
2017-09-13 22:06:17 -07:00
Bobby Holley
7b019f807b Use inheritance_parent to control style_sharing.
Using traversal_parent here is wrong.

MozReview-Commit-ID: GHCIjkgx4VE
2017-09-13 22:06:09 -07:00
Bobby Holley
61cad869d9 Hoist flags out of RestyleData.
MozReview-Commit-ID: 8emE83lykh3
2017-09-12 10:22:50 -07:00
bors-servo
af077a7222 Auto merge of #18420 - servo:toml, r=nox,emilio
Get rustc commit hash from channel manifest

… added in https://github.com/rust-lang/rust/pull/44218, instead of using the GitHub API.

Also upgrade to rustc 1.22.0-nightly (d93036a04 2017-09-07).

<!-- 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/18420)
<!-- Reviewable:end -->
2017-09-12 05:01:24 -05:00
Simon Sapin
0d4168034f Un-inline some methods initializing thread_local! …
… in order to limit stack frame sizes after extra inlining from
https://github.com/rust-lang/rust/pull/43931

See https://github.com/servo/servo/pull/18420#issuecomment-328769322
2017-09-12 11:42:04 +02: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
Matt Brubeck
21006fb752 Use SmallBitVec to replace BitVec 2017-09-11 06:33:43 -07:00
Hiroyuki Ikezoe
6ed7c69281 Don't cache style data if the element has running animations. 2017-08-23 09:51:27 +09:00
Bobby Holley
54c52910e4 Introduce a new flag and use it to be more permissive about cousin sharing.
MozReview-Commit-ID: BCJg0Ycsy6M
2017-08-05 01:07:02 -07:00
Emilio Cobos Álvarez
2940270a50
style: Prevent cousin sharing if we haven't restyled the parents.
This "fixes" bug 1381821 by disabling the optimization in the cases we can't
prove this is correct. Bug 1387116 tracks fixing the optimization to apply more
broadly.

Bug: 1381821
Reviewed-by: bz
MozReview-Commit-ID: COKdmHHokGx
2017-08-03 18:34:22 +02: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
8d7a368377 stylo: Don't ignore visited state when deciding to share style contexts 2017-07-18 12:40:01 -07:00
Hiroyuki Ikezoe
f91126ba86 Add has_current_styles_for_traversal().
In animation-only restyle, we just need to check the element
has animation restyle hints or has recascade self which is a result
of animation-only restyle for ancestors.
has_current_styles() in Servo_ResolveStyle() is intentionally left there,
it will be changed in a subsequent patch.
2017-07-18 19:13:50 +09: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
bors-servo
6597178b91
Auto merge of #17701 - bholley:reuse_allocations, r=emilio
reuse the bloom filter and style sharing cache across traversals

https://bugzilla.mozilla.org/show_bug.cgi?id=1380198

<!-- 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/17701)
<!-- Reviewable:end -->
2017-07-14 11:01:07 +02:00