Skip to content

Commit ccec4b2

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 688c648 commit ccec4b2

27 files changed

+2376
-2295
lines changed

servo/components/layout/animation.rs

-9
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,6 @@ use
8989
style
9090
:
9191
:
92-
dom
93-
:
94-
:
95-
TRestyleDamage
96-
;
97-
use
98-
style
99-
:
100-
:
10192
selector_parser
10293
:
10394
:

servo/components/layout/context.rs

+34
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,15 @@ use
105105
std
106106
:
107107
:
108+
borrow
109+
:
110+
:
111+
Borrow
112+
;
113+
use
114+
std
115+
:
116+
:
108117
cell
109118
:
110119
:
@@ -468,6 +477,31 @@ FnvHasher
468477
>
469478
>
470479
}
480+
impl
481+
Borrow
482+
<
483+
SharedStyleContext
484+
>
485+
for
486+
SharedLayoutContext
487+
{
488+
fn
489+
borrow
490+
(
491+
&
492+
self
493+
)
494+
-
495+
>
496+
&
497+
SharedStyleContext
498+
{
499+
&
500+
self
501+
.
502+
style_context
503+
}
504+
}
471505
pub
472506
struct
473507
LayoutContext

servo/components/layout/flow.rs

-9
Original file line numberDiff line numberDiff line change
@@ -224,15 +224,6 @@ use
224224
style
225225
:
226226
:
227-
dom
228-
:
229-
:
230-
TRestyleDamage
231-
;
232-
use
233-
style
234-
:
235-
:
236227
logical_geometry
237228
:
238229
:

servo/components/layout/fragment.rs

-9
Original file line numberDiff line numberDiff line change
@@ -365,15 +365,6 @@ use
365365
style
366366
:
367367
:
368-
dom
369-
:
370-
:
371-
TRestyleDamage
372-
;
373-
use
374-
style
375-
:
376-
:
377368
logical_geometry
378369
:
379370
:

servo/components/layout/generated_content.rs

-9
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,6 @@ use
106106
style
107107
:
108108
:
109-
dom
110-
:
111-
:
112-
TRestyleDamage
113-
;
114-
use
115-
style
116-
:
117-
:
118109
properties
119110
:
120111
:

servo/components/layout/incremental.rs

-9
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,6 @@ use
2323
style
2424
:
2525
:
26-
dom
27-
:
28-
:
29-
TRestyleDamage
30-
;
31-
use
32-
style
33-
:
34-
:
3526
selector_parser
3627
:
3728
:

servo/components/layout/traversal.rs

+23-58
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ dom
105105
:
106106
:
107107
{
108-
StylingMode
109108
TElement
110109
TNode
111110
}
@@ -308,7 +307,7 @@ self
308307
node
309308
:
310309
N
311-
data
310+
traversal_data
312311
:
313312
&
314313
mut
@@ -342,6 +341,20 @@ unwrap
342341
(
343342
)
344343
;
344+
let
345+
mut
346+
data
347+
=
348+
el
349+
.
350+
mutate_data
351+
(
352+
)
353+
.
354+
unwrap
355+
(
356+
)
357+
;
345358
recalc_style_at
346359
:
347360
:
@@ -355,8 +368,11 @@ Self
355368
self
356369
.
357370
context
358-
data
371+
traversal_data
359372
el
373+
&
374+
mut
375+
data
360376
)
361377
;
362378
}
@@ -385,67 +401,17 @@ node
385401
;
386402
}
387403
fn
388-
should_traverse_child
404+
text_node_needs_traversal
389405
(
390-
child
406+
node
391407
:
392408
N
393409
)
394410
-
395411
>
396412
bool
397413
{
398-
match
399-
child
400-
.
401-
as_element
402-
(
403-
)
404-
{
405-
Some
406-
(
407-
el
408-
)
409-
=
410-
>
411-
el
412-
.
413-
styling_mode
414-
(
415-
)
416-
!
417-
=
418-
StylingMode
419-
:
420-
:
421-
Stop
422-
|
423-
|
424-
el
425-
.
426-
as_node
427-
(
428-
)
429-
.
430-
to_threadsafe
431-
(
432-
)
433-
.
434-
restyle_damage
435-
(
436-
)
437-
!
438-
=
439-
RestyleDamage
440-
:
441-
:
442-
empty
443-
(
444-
)
445-
None
446-
=
447-
>
448-
child
414+
node
449415
.
450416
get_raw_data
451417
(
@@ -456,7 +422,7 @@ is_none
456422
)
457423
|
458424
|
459-
child
425+
node
460426
.
461427
parent_node
462428
(
@@ -482,7 +448,6 @@ empty
482448
(
483449
)
484450
}
485-
}
486451
unsafe
487452
fn
488453
ensure_element_data

0 commit comments

Comments
 (0)