layout: Structure reflow code to make it more modular (#36597)

This reworks the structure of reflow in `layout_thread_2020` in order to
make it more modular. The goal here is to allow possibly adding a new
fragment tree traversal and to, in general, make the code a bit more
organized.

Testing: This should not change any behavior so is covered by existing
WPT tests.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Martin Robinson 2025-04-23 09:34:35 +02:00 committed by GitHub
parent 73b778e67f
commit 554fa26da2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 273 additions and 242 deletions

View file

@ -12,19 +12,15 @@ use crate::context::LayoutContext;
use crate::dom::DOMLayoutData;
pub struct RecalcStyle<'a> {
context: LayoutContext<'a>,
context: &'a LayoutContext<'a>,
}
impl<'a> RecalcStyle<'a> {
pub fn new(context: LayoutContext<'a>) -> Self {
pub fn new(context: &'a LayoutContext<'a>) -> Self {
RecalcStyle { context }
}
pub fn context(&self) -> &LayoutContext<'a> {
&self.context
}
pub fn destroy(self) -> LayoutContext<'a> {
self.context
}
}