Skip to content

Commit de3cd26

Browse files
committed
servo: Merge #14436 - Make restyle tracking more granular (from bholley:granular_restyle); r=emilio
The primary idea of this patch is to ditch the rigid enum of Previous/Current styles, and replace it with a series of indicators for the various types of work that needs to be performed (expanding snapshots, rematching, recascading, and damage processing). This loses us a little bit of sanity checking (since the up-to-date-ness of our style is no longer baked into the type system), but gives us a lot more flexibility that we'll need going forward (especially when we separate matching from cascading). We also eliminate get_styling_mode in favor of a method on the traversal. This patch does a few other things as ridealongs: * Temporarily eliminates the handling for transfering ownership of styles to the frame. We'll need this again at some point, but for now it's causing too much complexity for a half-implemented feature. * Ditches TRestyleDamage, which is no longer necessary post-crate-merge, and is a constant source of compilation failures from either needing to be imported or being unnecessarily imported (which varies between gecko and servo). * Expands Snapshots for the traversal root, which was missing before. * Fixes up the skip_root stuff to avoid visiting the skipped root. * Unifies parallel traversal and avoids spawning for a single work item. * Adds an explicit pre_traverse step do any pre-processing and determine whether we need to traverse at all. Source-Repo: https://github.com/servo/servo Source-Revision: b9a8ccd775c3192e3810a1730b1d0bc2b5c9dfb6 UltraBlame original commit: b5b63ec333ddcb40ac2c321e7e9dda9c79a81bc0
1 parent 5e75f09 commit de3cd26

27 files changed

+3561
-3600
lines changed

servo/components/layout/animation.rs

-9
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,6 @@ use
155155
style
156156
:
157157
:
158-
dom
159-
:
160-
:
161-
TRestyleDamage
162-
;
163-
use
164-
style
165-
:
166-
:
167158
selector_parser
168159
:
169160
:

servo/components/layout/context.rs

+34
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,15 @@ use
177177
std
178178
:
179179
:
180+
borrow
181+
:
182+
:
183+
Borrow
184+
;
185+
use
186+
std
187+
:
188+
:
180189
cell
181190
:
182191
:
@@ -643,6 +652,31 @@ FnvHasher
643652
>
644653
>
645654
}
655+
impl
656+
Borrow
657+
<
658+
SharedStyleContext
659+
>
660+
for
661+
SharedLayoutContext
662+
{
663+
fn
664+
borrow
665+
(
666+
&
667+
self
668+
)
669+
-
670+
>
671+
&
672+
SharedStyleContext
673+
{
674+
&
675+
self
676+
.
677+
style_context
678+
}
679+
}
646680
pub
647681
struct
648682
LayoutContext

servo/components/layout/flow.rs

-9
Original file line numberDiff line numberDiff line change
@@ -581,15 +581,6 @@ use
581581
style
582582
:
583583
:
584-
dom
585-
:
586-
:
587-
TRestyleDamage
588-
;
589-
use
590-
style
591-
:
592-
:
593584
logical_geometry
594585
:
595586
:

servo/components/layout/fragment.rs

-9
Original file line numberDiff line numberDiff line change
@@ -438,15 +438,6 @@ use
438438
style
439439
:
440440
:
441-
dom
442-
:
443-
:
444-
TRestyleDamage
445-
;
446-
use
447-
style
448-
:
449-
:
450441
logical_geometry
451442
:
452443
:

servo/components/layout/generated_content.rs

-9
Original file line numberDiff line numberDiff line change
@@ -228,15 +228,6 @@ use
228228
style
229229
:
230230
:
231-
dom
232-
:
233-
:
234-
TRestyleDamage
235-
;
236-
use
237-
style
238-
:
239-
:
240231
properties
241232
:
242233
:

servo/components/layout/incremental.rs

-9
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,6 @@ use
8181
style
8282
:
8383
:
84-
dom
85-
:
86-
:
87-
TRestyleDamage
88-
;
89-
use
90-
style
91-
:
92-
:
9384
selector_parser
9485
:
9586
:

servo/components/layout/traversal.rs

+23-72
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ dom
178178
:
179179
:
180180
{
181-
StylingMode
182181
TElement
183182
TNode
184183
}
@@ -814,7 +813,7 @@ self
814813
node
815814
:
816815
N
817-
data
816+
traversal_data
818817
:
819818
&
820819
mut
@@ -872,6 +871,20 @@ unwrap
872871
(
873872
)
874873
;
874+
let
875+
mut
876+
data
877+
=
878+
el
879+
.
880+
mutate_data
881+
(
882+
)
883+
.
884+
unwrap
885+
(
886+
)
887+
;
875888
recalc_style_at
876889
:
877890
:
@@ -885,8 +898,11 @@ Self
885898
self
886899
.
887900
context
888-
data
901+
traversal_data
889902
el
903+
&
904+
mut
905+
data
890906
)
891907
;
892908
}
@@ -915,77 +931,16 @@ node
915931
;
916932
}
917933
fn
918-
should_traverse_child
934+
text_node_needs_traversal
919935
(
920-
child
936+
node
921937
:
922938
N
923939
)
924940
-
925941
>
926942
bool
927943
{
928-
match
929-
child
930-
.
931-
as_element
932-
(
933-
)
934-
{
935-
/
936-
/
937-
Elements
938-
should
939-
be
940-
traversed
941-
if
942-
they
943-
need
944-
styling
945-
or
946-
flow
947-
construction
948-
.
949-
Some
950-
(
951-
el
952-
)
953-
=
954-
>
955-
el
956-
.
957-
styling_mode
958-
(
959-
)
960-
!
961-
=
962-
StylingMode
963-
:
964-
:
965-
Stop
966-
|
967-
|
968-
el
969-
.
970-
as_node
971-
(
972-
)
973-
.
974-
to_threadsafe
975-
(
976-
)
977-
.
978-
restyle_damage
979-
(
980-
)
981-
!
982-
=
983-
RestyleDamage
984-
:
985-
:
986-
empty
987-
(
988-
)
989944
/
990945
/
991946
Text
@@ -1049,10 +1004,7 @@ needs
10491004
fixup
10501005
)
10511006
.
1052-
None
1053-
=
1054-
>
1055-
child
1007+
node
10561008
.
10571009
get_raw_data
10581010
(
@@ -1063,7 +1015,7 @@ is_none
10631015
)
10641016
|
10651017
|
1066-
child
1018+
node
10671019
.
10681020
parent_node
10691021
(
@@ -1089,7 +1041,6 @@ empty
10891041
(
10901042
)
10911043
}
1092-
}
10931044
unsafe
10941045
fn
10951046
ensure_element_data

0 commit comments

Comments
 (0)